vvplot 0.4.2 → 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.
@@ -1,4 +1,4 @@
1
- import { computed, isRef, reactive, unref, getCurrentScope, onScopeDispose, toValue, watch, shallowRef, getCurrentInstance, onMounted, useTemplateRef, nextTick, openBlock, createElementBlock, mergeProps, renderSlot, toDisplayString, createCommentVNode, createTextVNode, Fragment, renderList, inject, normalizeStyle, createElementVNode, createBlock, toHandlers, normalizeProps, resolveDynamicComponent, guardReactiveProps, createVNode, useModel, createPropsRestProxy, mergeModels, ref, useId, Teleport, useSlots, useAttrs, provide } from "vue";
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;
@@ -1660,7 +1796,44 @@ function baseParse(input, options) {
1660
1796
  new RegExp(
1661
1797
  "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
1662
1798
  );
1663
- class GEnumElement {
1799
+ class AsisString extends String {
1800
+ static #cache = /* @__PURE__ */ new Map();
1801
+ constructor(str) {
1802
+ const s = String(str);
1803
+ if (AsisString.#cache.has(s)) {
1804
+ return AsisString.#cache.get(s);
1805
+ }
1806
+ super(s);
1807
+ AsisString.#cache.set(s, this);
1808
+ }
1809
+ }
1810
+ class AsisNumber extends Number {
1811
+ static #cache = /* @__PURE__ */ new Map();
1812
+ constructor(num2) {
1813
+ const n = Number(num2);
1814
+ if (AsisNumber.#cache.has(n)) {
1815
+ return AsisNumber.#cache.get(n);
1816
+ }
1817
+ super(n);
1818
+ AsisNumber.#cache.set(n, this);
1819
+ }
1820
+ }
1821
+ class Asis extends String {
1822
+ static #cache = /* @__PURE__ */ new Map();
1823
+ constructor(value) {
1824
+ if (typeof value === "string" || value instanceof String) {
1825
+ return new AsisString(value);
1826
+ }
1827
+ if (typeof value === "number" || value instanceof Number) {
1828
+ return new AsisNumber(value);
1829
+ }
1830
+ throw new Error("Unsupported type");
1831
+ }
1832
+ static [Symbol.hasInstance](obj) {
1833
+ return obj instanceof AsisString || obj instanceof AsisNumber;
1834
+ }
1835
+ }
1836
+ class EnumElement {
1664
1837
  constructor(label, value, level) {
1665
1838
  this.label = label;
1666
1839
  this.value = value;
@@ -1676,20 +1849,20 @@ class GEnumElement {
1676
1849
  return this.label;
1677
1850
  }
1678
1851
  }
1679
- class GEnumLevel extends Array {
1852
+ class EnumLevel extends Array {
1680
1853
  /**
1681
1854
  * return:
1682
- * x if x is a GEnumLevel
1683
- * new GEnumLevel from distinct values of x, ordered by natural order, if x is iterable
1684
- * new GEnumLevel from keys of x, orderd by coresponing values, if x is an object
1855
+ * x if x is a EnumLevel
1856
+ * new EnumLevel from distinct values of x, ordered by natural order, if x is iterable
1857
+ * new EnumLevel from keys of x, orderd by coresponing values, if x is an object
1685
1858
  * @param {*} x
1686
1859
  * @param {function} [sortkey]
1687
- * @returns {GEnumLevel}
1860
+ * @returns {EnumLevel}
1688
1861
  */
1689
1862
  static from(x2) {
1690
1863
  if (x2 instanceof this) return x2;
1691
1864
  if (x2[Symbol.iterator]) {
1692
- let lvl = unique(Array.from(x2).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
1865
+ let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis)).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
1693
1866
  return new this(...lvl);
1694
1867
  } else if (typeof x2 === "object") {
1695
1868
  let lvl = Object.keys(x2).map((x3) => String(x3)).sort((a, b) => compare(x2[a], x2[b]));
@@ -1698,7 +1871,7 @@ class GEnumLevel extends Array {
1698
1871
  throw new Error(`Invalid level values: ${x2}`);
1699
1872
  }
1700
1873
  /**
1701
- * Check if two GEnumLevel are equal, i.e. they have the same labels in the same order
1874
+ * Check if two EnumLevel are equal, i.e. they have the same labels in the same order
1702
1875
  * @param {string[]} level
1703
1876
  */
1704
1877
  static isEqual(a, b) {
@@ -1707,20 +1880,20 @@ class GEnumLevel extends Array {
1707
1880
  }
1708
1881
  }
1709
1882
  /**
1710
- * build a GEnumLevel
1883
+ * build a EnumLevel
1711
1884
  * @param {string[]} level
1712
1885
  */
1713
1886
  constructor(...level) {
1714
- level = level.map((x2, i) => new GEnumElement(String(x2), i));
1887
+ level = level.map((x2, i) => new EnumElement(String(x2), i));
1715
1888
  level.forEach((l) => l.level = level);
1716
1889
  level.mapping = Object.fromEntries(level.map((fct) => [fct, fct]));
1717
- Object.setPrototypeOf(level, GEnumLevel.prototype);
1890
+ Object.setPrototypeOf(level, EnumLevel.prototype);
1718
1891
  return level;
1719
1892
  }
1720
1893
  /**
1721
1894
  * get the level instance by index or key
1722
1895
  * @param {(number|string)} idx
1723
- * @returns {GEnumElement}
1896
+ * @returns {EnumElement}
1724
1897
  */
1725
1898
  getItem(idx) {
1726
1899
  if (typeof idx === "number" || idx instanceof Number) {
@@ -1732,15 +1905,15 @@ class GEnumLevel extends Array {
1732
1905
  /**
1733
1906
  * convert an array to a GEnum array
1734
1907
  * @param {string[]} arr array to be converted, preferably a string array (items of other types will be converted to string)
1735
- * @returns {GEnumElement[]}
1908
+ * @returns {EnumElement[]}
1736
1909
  */
1737
1910
  apply(arr) {
1738
- let result = arr.map((x2) => this.mapping[x2]);
1911
+ let result = arr.map((x2) => x2 instanceof Asis ? x2 : this.mapping[x2]);
1739
1912
  result.level = this;
1740
1913
  return result;
1741
1914
  }
1742
1915
  }
1743
- function isContinuous(x2) {
1916
+ function is_continuous(x2) {
1744
1917
  return typeof x2 === "number" || x2 instanceof Number || x2 instanceof Date;
1745
1918
  }
1746
1919
  function plus$1(a, b = 0) {
@@ -1750,30 +1923,30 @@ function plus$1(a, b = 0) {
1750
1923
  }
1751
1924
  const numutils = {
1752
1925
  min(arr, { na_rm = true, infinity_rm = true } = {}) {
1753
- if (na_rm) arr = arr.filter(isContinuous);
1926
+ if (na_rm) arr = arr.filter(is_continuous);
1754
1927
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1755
1928
  return Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity);
1756
1929
  },
1757
1930
  max(arr, { na_rm = true, infinity_rm = true } = {}) {
1758
- if (na_rm) arr = arr.filter(isContinuous);
1931
+ if (na_rm) arr = arr.filter(is_continuous);
1759
1932
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1760
1933
  return Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
1761
1934
  },
1762
1935
  mean(arr, { na_rm = true, infinity_rm = true } = {}) {
1763
- if (na_rm) arr = arr.filter(isContinuous);
1936
+ if (na_rm) arr = arr.filter(is_continuous);
1764
1937
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1765
1938
  if (arr.length == 0) return NaN;
1766
1939
  return Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
1767
1940
  },
1768
1941
  sd(arr, { na_rm = true, infinity_rm = true } = {}) {
1769
- if (na_rm) arr = arr.filter(isContinuous);
1942
+ if (na_rm) arr = arr.filter(is_continuous);
1770
1943
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1771
1944
  if (arr.length <= 1) return NaN;
1772
1945
  let mean = Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
1773
1946
  return Math.sqrt(Array.from(arr).reduce((a, v) => a + (v - mean) ** 2, 0) / (arr.length - 1));
1774
1947
  },
1775
1948
  quantile(arr, p, { na_rm = true, infinity_rm = true } = {}) {
1776
- if (na_rm) arr = arr.filter(isContinuous);
1949
+ if (na_rm) arr = arr.filter(is_continuous);
1777
1950
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1778
1951
  if (arr.length == 0) return NaN;
1779
1952
  arr = Array.from(arr).sort((a, b) => a - b);
@@ -1782,7 +1955,7 @@ const numutils = {
1782
1955
  return arr[lo] * (hi - idx) + arr[hi] * (idx - lo);
1783
1956
  },
1784
1957
  extent(arr, { na_rm = true, infinity_rm = true } = {}) {
1785
- if (na_rm) arr = arr.filter(isContinuous);
1958
+ if (na_rm) arr = arr.filter(is_continuous);
1786
1959
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1787
1960
  if (arr.length == 0) return new Array(2);
1788
1961
  let min = Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity), max = Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
@@ -1993,7 +2166,16 @@ function parseLinetype(linetype) {
1993
2166
  if (linetype.includes(" ")) return linetype.split(" ").map((v) => +v);
1994
2167
  return linetype.split("").map((v) => +("0x" + v));
1995
2168
  }
1996
- function serializeSVG(svgElement) {
2169
+ const unitInPx = {
2170
+ "": 1,
2171
+ "px": 1,
2172
+ "in": 96,
2173
+ "cm": 96 / 2.54,
2174
+ "mm": 96 / 25.4,
2175
+ "pt": 96 / 72,
2176
+ "pc": 16
2177
+ };
2178
+ function serializeSVG(svgElement, { unit: unit2 = "mm" } = {}) {
1997
2179
  if (!(svgElement instanceof SVGElement)) return null;
1998
2180
  function removeComments(node) {
1999
2181
  let i = node.childNodes.length;
@@ -2027,8 +2209,9 @@ function serializeSVG(svgElement) {
2027
2209
  svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
2028
2210
  svgClone.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
2029
2211
  svgClone.setAttribute("version", "1.1");
2030
- svgClone.setAttribute("width", svgElement.scrollWidth);
2031
- svgClone.setAttribute("height", svgElement.scrollHeight);
2212
+ if (!unitInPx[unit2]) unit2 = "";
2213
+ svgClone.setAttribute("width", svgElement.scrollWidth / unitInPx[unit2] + unit2);
2214
+ svgClone.setAttribute("height", svgElement.scrollHeight / unitInPx[unit2] + unit2);
2032
2215
  svgClone.setAttribute("viewBox", `0 0 ${svgElement.scrollWidth} ${svgElement.scrollHeight}`);
2033
2216
  const serializer = new XMLSerializer();
2034
2217
  return serializer.serializeToString(svgClone);
@@ -6590,7 +6773,7 @@ function format_datetime({
6590
6773
  function format_auto(opts) {
6591
6774
  let formatter_number = format_number(opts), formatter_datetime = format_datetime(opts);
6592
6775
  return function(x2, i, arr = [x2]) {
6593
- if (x2 instanceof GEnumElement) return String(x2);
6776
+ if (x2 instanceof EnumElement) return String(x2);
6594
6777
  if (x2 instanceof Date) return formatter_datetime(x2, i, arr);
6595
6778
  return formatter_number(x2, i, arr);
6596
6779
  };
@@ -6671,7 +6854,7 @@ class GLayer {
6671
6854
  this.$fnames = {};
6672
6855
  for (const aes in $$aes) {
6673
6856
  this.$fnames[aes] = String($$aes[aes]);
6674
- data[aes] = $$data.map($$aes[aes]);
6857
+ data[aes] = $$data.map($$aes[aes]).map((x2) => x2 instanceof String || x2 instanceof Number ? new Asis(x2) : x2);
6675
6858
  }
6676
6859
  data.$raw = $$data;
6677
6860
  let core_aes = stat?.core_attrs ?? ["x", "y", "xnudge", "ynudge"];
@@ -6722,9 +6905,9 @@ class GLayer {
6722
6905
  if ($$levels?.[aes] != null) {
6723
6906
  scale.level = $$levels[aes];
6724
6907
  } else if (values.some(is_categorical)) {
6725
- scale.level = GEnumLevel.from(values);
6908
+ scale.level = EnumLevel.from(values);
6726
6909
  } else {
6727
- scale.extent = numutils.extent(values);
6910
+ scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
6728
6911
  }
6729
6912
  }
6730
6913
  this.applyScale(aes, scale);
@@ -6754,7 +6937,8 @@ class GLayer {
6754
6937
  if (scale.level) values = scale.level.apply(values);
6755
6938
  if (scale.limits) values.extent = scale.limits;
6756
6939
  scale.aes = aes;
6757
- this.data[aes] = scale(values);
6940
+ let scaled = scale(values);
6941
+ this.data[aes] = values.map((v, i) => v instanceof Asis ? v.valueOf() : scaled[i]);
6758
6942
  this.scales[aes] = scale;
6759
6943
  }
6760
6944
  applyCoordScale(coord_levels) {
@@ -6789,9 +6973,9 @@ class GPlot {
6789
6973
  if (levels?.[aes] != null) {
6790
6974
  scale.level = levels[aes];
6791
6975
  } else if (values.some(is_categorical)) {
6792
- scale.level = GEnumLevel.from(values);
6976
+ scale.level = EnumLevel.from(values);
6793
6977
  } else {
6794
- scale.extent = numutils.extent(values);
6978
+ scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
6795
6979
  }
6796
6980
  }
6797
6981
  scale._title = this.layers.reduce((v, layer) => v ?? layer.$fnames?.[aes], null);
@@ -6823,17 +7007,17 @@ class GPlot {
6823
7007
  useCoordLevels(levels = {}) {
6824
7008
  for (const aes of ["x", "y"]) {
6825
7009
  if (levels[aes]) {
6826
- this.levels[aes] = new GEnumLevel(...levels[aes]);
7010
+ this.levels[aes] = new EnumLevel(...levels[aes]);
6827
7011
  } else {
6828
7012
  let values = this.layers.flatMap((layer) => {
6829
7013
  let fn = vvgeom[layer.geom].get_values ?? vvgeom[layer.geom].get_range;
6830
7014
  return fn?.(layer.$data, aes);
6831
7015
  });
6832
7016
  if (values.some(is_categorical)) {
6833
- this.levels[aes] = GEnumLevel.from(values);
7017
+ this.levels[aes] = EnumLevel.from(values);
6834
7018
  } else {
6835
7019
  values = this.layers.flatMap((layer) => vvgeom[layer.geom].get_range?.(layer.$data, aes)).filter((v) => !isNaN(v));
6836
- this.extents[aes] = numutils.extent(values);
7020
+ this.extents[aes] = numutils.extent(values.filter((v) => !(v instanceof Asis)));
6837
7021
  }
6838
7022
  }
6839
7023
  }
@@ -15463,7 +15647,8 @@ const _sfc_main$Y = {
15463
15647
  data: Object,
15464
15648
  coord2pos: Function,
15465
15649
  getCoord: Function,
15466
- layout: Object
15650
+ layout: Object,
15651
+ dpi: { type: Number, default: 96 }
15467
15652
  },
15468
15653
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
15469
15654
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -15479,10 +15664,13 @@ const _sfc_main$Y = {
15479
15664
  const layerCanvas = computed(() => {
15480
15665
  if (containerRef.value == null) return;
15481
15666
  const canvas2 = document.createElement("canvas");
15482
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
15483
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
15667
+ canvas2.style.width = vBind.value.width + "px";
15668
+ canvas2.style.height = vBind.value.height + "px";
15669
+ canvas2.width = vBind.value.width * __props.dpi / 96;
15670
+ canvas2.height = vBind.value.height * __props.dpi / 96;
15484
15671
  const ctx = canvas2.getContext("2d");
15485
15672
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
15673
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
15486
15674
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
15487
15675
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
15488
15676
  for (const group of __props.data) {
@@ -15606,7 +15794,8 @@ const _sfc_main$X = {
15606
15794
  data: Object,
15607
15795
  coord2pos: Function,
15608
15796
  getCoord: Function,
15609
- layout: Object
15797
+ layout: Object,
15798
+ dpi: { type: Number, default: 96 }
15610
15799
  },
15611
15800
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
15612
15801
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -15622,10 +15811,13 @@ const _sfc_main$X = {
15622
15811
  const layerCanvas = computed(() => {
15623
15812
  if (containerRef.value == null) return;
15624
15813
  const canvas2 = document.createElement("canvas");
15625
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
15626
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
15814
+ canvas2.style.width = vBind.value.width + "px";
15815
+ canvas2.style.height = vBind.value.height + "px";
15816
+ canvas2.width = vBind.value.width * __props.dpi / 96;
15817
+ canvas2.height = vBind.value.height * __props.dpi / 96;
15627
15818
  const ctx = canvas2.getContext("2d");
15628
15819
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
15820
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
15629
15821
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
15630
15822
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
15631
15823
  for (const group of __props.data) {
@@ -15708,7 +15900,8 @@ const _sfc_main$W = {
15708
15900
  data: Object,
15709
15901
  coord2pos: Function,
15710
15902
  getCoord: Function,
15711
- layout: Object
15903
+ layout: Object,
15904
+ dpi: { type: Number, default: 96 }
15712
15905
  },
15713
15906
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
15714
15907
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -15724,10 +15917,13 @@ const _sfc_main$W = {
15724
15917
  const layerCanvas = computed(() => {
15725
15918
  if (containerRef.value == null) return;
15726
15919
  const canvas2 = document.createElement("canvas");
15727
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
15728
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
15920
+ canvas2.style.width = vBind.value.width + "px";
15921
+ canvas2.style.height = vBind.value.height + "px";
15922
+ canvas2.width = vBind.value.width * __props.dpi / 96;
15923
+ canvas2.height = vBind.value.height * __props.dpi / 96;
15729
15924
  const ctx = canvas2.getContext("2d");
15730
15925
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
15926
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
15731
15927
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
15732
15928
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
15733
15929
  for (const group of __props.data) {
@@ -15809,7 +16005,8 @@ const _sfc_main$V = {
15809
16005
  data: Object,
15810
16006
  coord2pos: Function,
15811
16007
  getCoord: Function,
15812
- layout: Object
16008
+ layout: Object,
16009
+ dpi: { type: Number, default: 96 }
15813
16010
  },
15814
16011
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
15815
16012
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -15825,10 +16022,13 @@ const _sfc_main$V = {
15825
16022
  const layerCanvas = computed(() => {
15826
16023
  if (containerRef.value == null) return;
15827
16024
  const canvas2 = document.createElement("canvas");
15828
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
15829
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16025
+ canvas2.style.width = vBind.value.width + "px";
16026
+ canvas2.style.height = vBind.value.height + "px";
16027
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16028
+ canvas2.height = vBind.value.height * __props.dpi / 96;
15830
16029
  const ctx = canvas2.getContext("2d");
15831
16030
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16031
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
15832
16032
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
15833
16033
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
15834
16034
  for (const group of __props.data) {
@@ -15898,7 +16098,8 @@ const _sfc_main$U = {
15898
16098
  data: Object,
15899
16099
  coord2pos: Function,
15900
16100
  getCoord: Function,
15901
- layout: Object
16101
+ layout: Object,
16102
+ dpi: { type: Number, default: 96 }
15902
16103
  },
15903
16104
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
15904
16105
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -15921,10 +16122,13 @@ const _sfc_main$U = {
15921
16122
  const layerCanvas = computed(() => {
15922
16123
  if (containerRef.value == null) return;
15923
16124
  const canvas2 = document.createElement("canvas");
15924
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
15925
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16125
+ canvas2.style.width = vBind.value.width + "px";
16126
+ canvas2.style.height = vBind.value.height + "px";
16127
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16128
+ canvas2.height = vBind.value.height * __props.dpi / 96;
15926
16129
  const ctx = canvas2.getContext("2d");
15927
16130
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16131
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
15928
16132
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
15929
16133
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
15930
16134
  for (const group of __props.data) {
@@ -16009,7 +16213,8 @@ const _sfc_main$T = {
16009
16213
  data: Object,
16010
16214
  coord2pos: Function,
16011
16215
  getCoord: Function,
16012
- layout: Object
16216
+ layout: Object,
16217
+ dpi: { type: Number, default: 96 }
16013
16218
  },
16014
16219
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
16015
16220
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -16025,10 +16230,13 @@ const _sfc_main$T = {
16025
16230
  const layerCanvas = computed(() => {
16026
16231
  if (containerRef.value == null) return;
16027
16232
  const canvas2 = document.createElement("canvas");
16028
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
16029
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16233
+ canvas2.style.width = vBind.value.width + "px";
16234
+ canvas2.style.height = vBind.value.height + "px";
16235
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16236
+ canvas2.height = vBind.value.height * __props.dpi / 96;
16030
16237
  const ctx = canvas2.getContext("2d");
16031
16238
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16239
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
16032
16240
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16033
16241
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16034
16242
  for (const group of __props.data) {
@@ -16102,7 +16310,8 @@ const _sfc_main$S = {
16102
16310
  data: Object,
16103
16311
  coord2pos: Function,
16104
16312
  getCoord: Function,
16105
- layout: Object
16313
+ layout: Object,
16314
+ dpi: { type: Number, default: 96 }
16106
16315
  },
16107
16316
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
16108
16317
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -16118,10 +16327,13 @@ const _sfc_main$S = {
16118
16327
  const layerCanvas = computed(() => {
16119
16328
  if (containerRef.value == null) return;
16120
16329
  const canvas2 = document.createElement("canvas");
16121
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
16122
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16330
+ canvas2.style.width = vBind.value.width + "px";
16331
+ canvas2.style.height = vBind.value.height + "px";
16332
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16333
+ canvas2.height = vBind.value.height * __props.dpi / 96;
16123
16334
  const ctx = canvas2.getContext("2d");
16124
16335
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16336
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
16125
16337
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16126
16338
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16127
16339
  for (const group of __props.data) {
@@ -16193,7 +16405,8 @@ const _sfc_main$R = {
16193
16405
  data: Object,
16194
16406
  coord2pos: Function,
16195
16407
  getCoord: Function,
16196
- layout: Object
16408
+ layout: Object,
16409
+ dpi: { type: Number, default: 96 }
16197
16410
  },
16198
16411
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
16199
16412
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -16209,10 +16422,13 @@ const _sfc_main$R = {
16209
16422
  const layerCanvas = computed(() => {
16210
16423
  if (containerRef.value == null) return;
16211
16424
  const canvas2 = document.createElement("canvas");
16212
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
16213
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16425
+ canvas2.style.width = vBind.value.width + "px";
16426
+ canvas2.style.height = vBind.value.height + "px";
16427
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16428
+ canvas2.height = vBind.value.height * __props.dpi / 96;
16214
16429
  const ctx = canvas2.getContext("2d");
16215
16430
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16431
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
16216
16432
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16217
16433
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16218
16434
  for (const group of __props.data) {
@@ -16319,7 +16535,8 @@ const _sfc_main$Q = {
16319
16535
  data: Object,
16320
16536
  coord2pos: Function,
16321
16537
  getCoord: Function,
16322
- layout: Object
16538
+ layout: Object,
16539
+ dpi: { type: Number, default: 96 }
16323
16540
  },
16324
16541
  emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
16325
16542
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -16335,10 +16552,13 @@ const _sfc_main$Q = {
16335
16552
  const layerCanvas = computed(() => {
16336
16553
  if (containerRef.value == null) return;
16337
16554
  const canvas2 = document.createElement("canvas");
16338
- canvas2.width = __props.layout.fullWidth * (1 + __props.extendX * 2);
16339
- canvas2.height = __props.layout.fullHeight * (1 + __props.extendY * 2);
16555
+ canvas2.style.width = vBind.value.width + "px";
16556
+ canvas2.style.height = vBind.value.height + "px";
16557
+ canvas2.width = vBind.value.width * __props.dpi / 96;
16558
+ canvas2.height = vBind.value.height * __props.dpi / 96;
16340
16559
  const ctx = canvas2.getContext("2d");
16341
16560
  ctx.clearRect(0, 0, canvas2.width, canvas2.height);
16561
+ ctx.scale(__props.dpi / 96, __props.dpi / 96);
16342
16562
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16343
16563
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16344
16564
  for (const group of __props.data) {
@@ -16501,7 +16721,9 @@ const _sfc_main$P = {
16501
16721
  data: Object,
16502
16722
  coord2pos: Function,
16503
16723
  getCoord: Function,
16504
- layout: Object
16724
+ layout: Object,
16725
+ groupClass: null,
16726
+ groupStyle: null
16505
16727
  },
16506
16728
  emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
16507
16729
  setup(__props, { emit: __emit }) {
@@ -17967,7 +18189,9 @@ const _sfc_main$x = {
17967
18189
  data: Object,
17968
18190
  geom: String,
17969
18191
  render: String,
17970
- defaultRender: { type: String, default: "auto" }
18192
+ defaultRender: { type: String, default: "auto" },
18193
+ dpi: Number,
18194
+ defaultDpi: Number
17971
18195
  },
17972
18196
  setup(__props, { expose: __expose }) {
17973
18197
  const geoms = { svg, canvas };
@@ -17986,13 +18210,15 @@ const _sfc_main$x = {
17986
18210
  render: rend,
17987
18211
  dispatchEvent: (e) => layer.value?.dispatchEvent?.(e)
17988
18212
  });
18213
+ const dpi = computed(() => rend.value === "canvas" ? __props.dpi ?? __props.defaultDpi : void 0);
17989
18214
  return (_ctx, _cache) => {
17990
18215
  return openBlock(), createBlock(resolveDynamicComponent(geoms[rend.value][__props.geom]), {
17991
18216
  ref_key: "layer",
17992
18217
  ref: layer,
17993
18218
  style: normalizeStyle(style.value),
17994
- data: __props.data
17995
- }, null, 8, ["style", "data"]);
18219
+ data: __props.data,
18220
+ dpi: dpi.value
18221
+ }, null, 8, ["style", "data", "dpi"]);
17996
18222
  };
17997
18223
  }
17998
18224
  };
@@ -18032,12 +18258,22 @@ const _sfc_main$w = {
18032
18258
  setup(__props, { emit: __emit }) {
18033
18259
  const model = useModel(__props, "modelValue");
18034
18260
  const config = createPropsRestProxy(__props, ["coord2pos", "pos2coord", "layout", "theme", "flip", "activeTransform", "transition"]);
18261
+ function normalize2({ xmin, xmax, ymin, ymax, xreverse = false, yreverse = false } = {}) {
18262
+ if ([xmin, xmax, ymin, ymax].every((v) => v == null)) return null;
18263
+ if (xmin != null && xmax != null && xmin > xmax) [xmin, xmax, xreverse] = [xmax, xmin, !xreverse];
18264
+ if (ymin != null && ymax != null && ymin > ymax) [ymin, ymax, yreverse] = [ymax, ymin, !yreverse];
18265
+ let coord = { xreverse, yreverse };
18266
+ if (xmin != null && isFinite(xmin)) coord.xmin = xmin;
18267
+ if (xmax != null && isFinite(xmax)) coord.xmax = xmax;
18268
+ if (ymin != null && isFinite(ymin)) coord.ymin = ymin;
18269
+ if (ymax != null && isFinite(ymax)) coord.ymax = ymax;
18270
+ return coord;
18271
+ }
18035
18272
  const position = computed(() => {
18036
18273
  if (model.value == null || model.value.hidden) return null;
18037
- if (["xmin", "xmax", "ymin", "ymax"].every((k) => model.value?.[k] == null)) return null;
18038
- let { hmin, hmax, vmin, vmax } = __props.coord2pos(model.value, { limited: true }), pos = __props.coord2pos(model.value);
18039
- if (hmin != null && hmax != null) [hmin, hmax] = [hmin, hmax].sort((a, b) => a - b);
18040
- if (vmin != null && vmax != null) [vmin, vmax] = [vmin, vmax].sort((a, b) => a - b);
18274
+ let coord = normalize2(model.value);
18275
+ if (coord == null) return null;
18276
+ let { hmin, hmax, vmin, vmax } = __props.coord2pos(coord, { limited: true }), pos = __props.coord2pos(coord);
18041
18277
  return { hmin, hmax, vmin, vmax, pos };
18042
18278
  });
18043
18279
  const transform = computed(() => {
@@ -18150,7 +18386,8 @@ const _sfc_main$w = {
18150
18386
  e.stopPropagation();
18151
18387
  e.preventDefault();
18152
18388
  e.target.setPointerCapture(e.pointerId);
18153
- let pos0 = __props.coord2pos(model.value);
18389
+ let { xreverse: $xreverse, yreverse: $yreverse, ...coord0 } = normalize2(model.value);
18390
+ let pos0 = __props.coord2pos(coord0);
18154
18391
  let { h: coordL, v: coordT } = __props.pos2coord({ h: pos0.hmin, v: pos0.vmin }), { h: coordR, v: coordB } = __props.pos2coord({ h: pos0.hmax, v: pos0.vmax });
18155
18392
  let { hmin: hmin0, hmax: hmax0, vmin: vmin0, vmax: vmax0 } = pos0;
18156
18393
  let pointerMoved = false;
@@ -18217,10 +18454,10 @@ const _sfc_main$w = {
18217
18454
  let res = {
18218
18455
  xmin,
18219
18456
  xmax,
18220
- xreverse: Boolean(xreverse ^ model.value.xreverse),
18457
+ xreverse: Boolean(xreverse ^ $xreverse),
18221
18458
  ymin,
18222
18459
  ymax,
18223
- yreverse: Boolean(yreverse ^ model.value.yreverse)
18460
+ yreverse: Boolean(yreverse ^ $yreverse)
18224
18461
  }, event = new PointerEvent("select", e);
18225
18462
  model.value = dropNull(res);
18226
18463
  emit("selectend");
@@ -18459,13 +18696,13 @@ const _sfc_main$s = {
18459
18696
  },
18460
18697
  setup(__props) {
18461
18698
  const guides = computed(() => {
18462
- let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false));
18699
+ let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false && fn.limits?.min != fn.limits?.max));
18463
18700
  let scale_fns = Array.from(guide_scales.keys());
18464
18701
  let keys = scale_fns.map((s) => s.key);
18465
18702
  let n = 1;
18466
18703
  for (let i = 0; i < keys.length; i++) {
18467
18704
  while (keys.includes("_guide_" + n)) n++;
18468
- keys[i] ??= keys.find((_, j) => keys[j] != null && GEnumLevel.isEqual(scale_fns[j].level, scale_fns[i].level)) ?? "_guide_" + n;
18705
+ keys[i] ??= keys.find((_, j) => keys[j] != null && EnumLevel.isEqual(scale_fns[j].level, scale_fns[i].level)) ?? "_guide_" + n;
18469
18706
  }
18470
18707
  let types = scale_fns.map((s) => getGuideType(s));
18471
18708
  let groups = interaction(keys, types);
@@ -18521,6 +18758,7 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18521
18758
  theme: Object,
18522
18759
  render: String,
18523
18760
  clip: Boolean,
18761
+ dpi: Number,
18524
18762
  action: { type: Array, default: () => [] },
18525
18763
  selections: { type: Array, default: () => [] },
18526
18764
  legendTeleport: null
@@ -19234,8 +19472,9 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19234
19472
  geom: layer.geom,
19235
19473
  coord2pos,
19236
19474
  getCoord,
19237
- "default-render": props.render
19238
- }), null, 16, ["data", "layout", "geom", "default-render"]);
19475
+ "default-render": props.render,
19476
+ "default-dpi": props.dpi
19477
+ }), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
19239
19478
  }), 256))
19240
19479
  ], 16),
19241
19480
  _cache[3] || (_cache[3] = createTextVNode()),
@@ -19522,7 +19761,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19522
19761
  flip: Boolean,
19523
19762
  clip: { type: Boolean, default: true },
19524
19763
  resize: null,
19525
- legendTeleport: null
19764
+ legendTeleport: null,
19765
+ dpi: Number
19526
19766
  }, {
19527
19767
  "selectionPreview": { default: () => ({}) },
19528
19768
  "selectionPreviewModifiers": {},
@@ -19630,6 +19870,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19630
19870
  let arr = Array.isArray($attrs[key]) ? $attrs[key] : [$attrs[key]];
19631
19871
  plot[key] = arr.filter((f) => typeof f === "function");
19632
19872
  wrapper[key] = arr.filter((f) => typeof f !== "function");
19873
+ } else if (key.startsWith("svg-")) {
19874
+ plot[key.slice(4)] = $attrs[key];
19633
19875
  } else {
19634
19876
  wrapper[key] = $attrs[key];
19635
19877
  }
@@ -19710,7 +19952,7 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19710
19952
  aes[key] = etc[key];
19711
19953
  }
19712
19954
  } else {
19713
- if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
19955
+ if (["class", "style", "group-class", "group-style", "dpi", "render"].includes(key)) {
19714
19956
  vBind2[key] = etc[key];
19715
19957
  } else if (["item-class", "item-style"].includes(key)) {
19716
19958
  attrs2[key.slice(5)] = etc[key];
@@ -20009,6 +20251,7 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20009
20251
  };
20010
20252
  });
20011
20253
  });
20254
+ const { pixelRatio } = /* @__PURE__ */ useDevicePixelRatio();
20012
20255
  const wrapperRef = useTemplateRef("wrapper");
20013
20256
  const plotRef = useTemplateRef("plot");
20014
20257
  const width = useModel(__props, "width");
@@ -20055,8 +20298,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20055
20298
  get svg() {
20056
20299
  return plotRef.value.svg;
20057
20300
  },
20058
- serialize() {
20059
- return serializeSVG(plotRef.value.svg);
20301
+ serialize(options) {
20302
+ return serializeSVG(plotRef.value.svg, options);
20060
20303
  }
20061
20304
  });
20062
20305
  return (_ctx, _cache) => {
@@ -20091,9 +20334,10 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20091
20334
  action: action.value,
20092
20335
  clip: __props.clip,
20093
20336
  render: __props.render,
20337
+ dpi: __props.dpi ?? 96 * unref(pixelRatio),
20094
20338
  legendTeleport: __props.legendTeleport,
20095
20339
  onSelect: _cache[3] || (_cache[3] = (d, e) => emit("select", d, e))
20096
- }), 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"]),
20340
+ }), 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"]),
20097
20341
  _cache[4] || (_cache[4] = createTextVNode()),
20098
20342
  createElementVNode("div", {
20099
20343
  class: "vvplot-panel-container",