@wick-charts/vue 0.6.2 → 0.6.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.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/dist/BandSeries.vue.js +50 -0
  3. package/dist/BandSeries.vue2.js +4 -0
  4. package/dist/ChartContainer.vue.js +45 -39
  5. package/dist/composables.js +39 -26
  6. package/dist/core/dist/animation/config.js +92 -75
  7. package/dist/core/dist/axis/dom-labels.js +56 -43
  8. package/dist/core/dist/chart/badge-animator.js +30 -22
  9. package/dist/core/dist/chart/edge-indicators.js +22 -21
  10. package/dist/core/dist/chart/last-value.js +33 -26
  11. package/dist/core/dist/chart/options.js +5 -5
  12. package/dist/core/dist/chart/scale-guards.js +26 -0
  13. package/dist/core/dist/chart/y-target.js +46 -19
  14. package/dist/core/dist/chart.js +670 -518
  15. package/dist/core/dist/components/crosshair.js +8 -8
  16. package/dist/core/dist/components/grid.js +26 -17
  17. package/dist/core/dist/components/marker.js +28 -28
  18. package/dist/core/dist/components/reference-line.js +16 -16
  19. package/dist/core/dist/data/decimation.js +58 -39
  20. package/dist/core/dist/interactions/handler.js +3 -2
  21. package/dist/core/dist/interactions/zoom.js +6 -5
  22. package/dist/core/dist/navigator/controller.js +47 -44
  23. package/dist/core/dist/perf/perf-hud.js +3 -3
  24. package/dist/core/dist/scales/log-scale.js +76 -0
  25. package/dist/core/dist/scales/y-scale.js +134 -35
  26. package/dist/core/dist/series/band.js +670 -0
  27. package/dist/core/dist/series/bar-intro.js +11 -11
  28. package/dist/core/dist/series/bar.js +301 -251
  29. package/dist/core/dist/series/base-multi-layer.js +100 -76
  30. package/dist/core/dist/series/candlestick.js +238 -235
  31. package/dist/core/dist/series/heatmap.js +5 -5
  32. package/dist/core/dist/series/line-intro.js +50 -40
  33. package/dist/core/dist/series/line.js +561 -483
  34. package/dist/core/dist/series/painters/builtins.js +4 -4
  35. package/dist/core/dist/series/painters/canvas-path.js +64 -52
  36. package/dist/core/dist/series/register-builtins.js +9 -8
  37. package/dist/core/dist/series/scale-stack.js +25 -0
  38. package/dist/core/dist/snapshots.js +36 -35
  39. package/dist/core/dist/tooltip-position.js +5 -5
  40. package/dist/core/dist/utils/point.js +10 -0
  41. package/dist/index.d.ts +501 -128
  42. package/dist/index.js +195 -189
  43. package/dist/ui/Crosshair.vue.js +14 -14
  44. package/dist/ui/HeatmapTooltip.vue.js +6 -6
  45. package/dist/ui/InfoBar.vue.js +100 -81
  46. package/dist/ui/PieTooltip.vue.js +4 -4
  47. package/dist/ui/TimeAxis.vue.js +23 -22
  48. package/dist/ui/Tooltip.vue.js +140 -111
  49. package/dist/ui/YAxis.vue.js +25 -24
  50. package/dist/ui/YLabel.vue.js +63 -70
  51. package/package.json +2 -2
  52. package/src/BandSeries.vue +87 -0
  53. package/src/ChartContainer.vue +20 -8
  54. package/src/composables.ts +35 -1
  55. package/src/index.ts +13 -0
  56. package/src/ui/Crosshair.vue +2 -2
  57. package/src/ui/InfoBar.vue +20 -1
  58. package/src/ui/TimeAxis.vue +7 -4
  59. package/src/ui/Tooltip.vue +40 -3
  60. package/src/ui/YAxis.vue +5 -3
  61. package/src/ui/YLabel.vue +5 -16
@@ -1,59 +1,72 @@
1
- import { resolveAxisTextColor as w, resolveAxisFontSize as A } from "../theme/resolve.js";
2
- const F = 0.01;
3
- function $(g) {
4
- const { chart: e, container: h, axis: r } = g, s = /* @__PURE__ */ new Map();
5
- let y = null;
6
- const p = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
7
- function k() {
8
- return r === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
9
- }
10
- function m(t, o) {
11
- return r === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
12
- }
13
- function C(t, o) {
14
- if (r === "x") {
1
+ import { resolveAxisTextColor as I, resolveAxisFontSize as C } from "../theme/resolve.js";
2
+ import { clamp as P } from "../utils/math.js";
3
+ const V = 0.01;
4
+ function E(T) {
5
+ const { chart: e, container: w, axis: a } = T, r = /* @__PURE__ */ new Map();
6
+ let p = null, m = null;
7
+ const x = a === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
8
+ function A() {
9
+ return a === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
10
+ }
11
+ function S(t, o) {
12
+ return a === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
13
+ }
14
+ function $(t, o) {
15
+ if (a === "x") {
15
16
  t.style.left = `${e.timeScale.timeToSnappedX(o)}px`;
16
17
  return;
17
18
  }
18
19
  t.style.top = `${e.yScale.valueToSnappedY(o)}px`;
19
20
  }
20
- function x(t, o) {
21
- t.style.color = w(o, r), t.style.fontSize = `${A(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
21
+ function h(t, o) {
22
+ t.style.color = I(o, a), t.style.fontSize = `${C(o, a)}px`, t.style.fontFamily = o.typography.fontFamily;
23
+ }
24
+ function v(t, o) {
25
+ const i = o === "left" ? "left" : "right", n = o === "left" ? "right" : "left";
26
+ t.style[i] = "8px", t.style[n] = "";
27
+ }
28
+ function F(t, o) {
29
+ const i = e.headerHeight;
30
+ if (a !== "y" || i <= 0 || e.yAxisPosition !== "left") return 1;
31
+ const n = C(o, a), y = e.yScale.valueToSnappedY(t) - n / 2;
32
+ return P((y - i + n) / n, 0, 1);
22
33
  }
23
- function d(t, o, u) {
34
+ function Y(t, o, i) {
24
35
  const n = document.createElement("span");
25
- return n.textContent = m(t, o), n.style.position = "absolute", n.style.userSelect = "none", x(n, u), n.style.willChange = "opacity", r === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (n.style.right = "8px", n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), h.appendChild(n), n;
26
- }
27
- function l() {
28
- const t = e.getTheme(), o = t !== y;
29
- y = t;
30
- const { ticks: u, tickInterval: n } = k();
31
- p.setCurrentTicks(u);
32
- const { entries: T } = p.snapshot(), S = /* @__PURE__ */ new Set();
33
- for (const { value: a, opacity: f } of T) {
34
- if (f <= F) continue;
35
- S.add(a);
36
- let i = s.get(a);
37
- if (i === void 0)
38
- i = d(a, n, t), s.set(a, i);
36
+ return n.textContent = S(t, o), n.style.position = "absolute", n.style.userSelect = "none", h(n, i), n.style.willChange = "opacity", a === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (v(n, e.yAxisPosition), n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), w.appendChild(n), n;
37
+ }
38
+ function c() {
39
+ const t = e.getTheme(), o = t !== p;
40
+ p = t;
41
+ const i = e.yAxisPosition, n = a === "y" && i !== m;
42
+ m = i;
43
+ const { ticks: y, tickInterval: g } = A();
44
+ x.setCurrentTicks(y);
45
+ const { entries: b } = x.snapshot(), k = /* @__PURE__ */ new Set();
46
+ for (const { value: s, opacity: u } of b) {
47
+ if (u <= V) continue;
48
+ k.add(s);
49
+ let l = r.get(s);
50
+ if (l === void 0)
51
+ l = Y(s, g, t), r.set(s, l);
39
52
  else {
40
- const v = m(a, n);
41
- i.textContent !== v && (i.textContent = v), o && x(i, t);
53
+ const d = S(s, g);
54
+ l.textContent !== d && (l.textContent = d), o && h(l, t), n && v(l, i);
42
55
  }
43
- C(i, a), i.style.opacity = String(f);
56
+ $(l, s), l.style.opacity = String(u * F(s, t));
44
57
  }
45
- for (const [a, f] of s)
46
- S.has(a) || (f.remove(), s.delete(a));
58
+ for (const [s, u] of r)
59
+ k.has(s) || (u.remove(), r.delete(s));
47
60
  }
48
- function c() {
49
- e.getAnimationState().animating || l();
61
+ function f() {
62
+ e.getAnimationState().animating || c();
50
63
  }
51
- return l(), e.on("tickFrame", l), e.on("viewportChange", c), e.on("overlayChange", c), () => {
52
- e.off("tickFrame", l), e.off("viewportChange", c), e.off("overlayChange", c);
53
- for (const t of s.values()) t.remove();
54
- s.clear();
64
+ return c(), e.on("tickFrame", c), e.on("viewportChange", f), e.on("overlayChange", f), () => {
65
+ e.off("tickFrame", c), e.off("viewportChange", f), e.off("overlayChange", f);
66
+ for (const t of r.values()) t.remove();
67
+ r.clear();
55
68
  };
56
69
  }
57
70
  export {
58
- $ as mountAxisLabels
71
+ E as mountAxisLabels
59
72
  };
@@ -1,6 +1,6 @@
1
1
  import { ScalarSpring as g } from "../animation/scalar-spring.js";
2
- const r = 320, V = 0.15;
3
- class x {
2
+ const l = 320, V = 0.15;
3
+ class b {
4
4
  #t;
5
5
  #e;
6
6
  #i = !1;
@@ -8,45 +8,53 @@ class x {
8
8
  this.#t = new g(i), this.#e = i;
9
9
  }
10
10
  frame(i) {
11
- const { target: t, firstVisible: n, introFront: o, now: s, glide: u = !0, countUp: l = !0, reducedMotion: p = !1 } = i;
12
- if (p || !u && !l)
11
+ const { target: t, firstVisible: n, introFront: r, now: s, glide: a = !0, countUp: u = !0, reducedMotion: p = !1 } = i;
12
+ if (p || !a && !u)
13
13
  return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
14
- if (o < 1) {
15
- const f = n + (t - n) * o, a = l ? f : t;
16
- return this.#t.snap(a, { now: s }), this.#e = a, this.#i = !0, { positionValue: a, textValue: a, opacity: this.#s(o), animating: !0 };
14
+ if (r < 1) {
15
+ const h = n + (t - n) * r, o = u ? h : t;
16
+ return this.#t.snap(o, { now: s }), this.#e = o, this.#i = !0, { positionValue: o, textValue: o, opacity: this.#s(r), animating: !0 };
17
17
  }
18
18
  if (!this.#i)
19
19
  return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
20
- if (!u)
20
+ if (!a)
21
21
  return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
22
- const c = i.settleMs ?? r;
22
+ const c = i.settleMs ?? l;
23
23
  if (c <= 0)
24
24
  return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
25
- Math.abs(t - this.#e) > m && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
26
- const h = this.#t.tick(s);
27
- return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: h };
25
+ Math.abs(t - this.#e) > d && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
26
+ const f = this.#t.tick(s);
27
+ return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: f };
28
28
  }
29
29
  #s(i) {
30
- return i >= 1 ? 1 : d(i / V);
30
+ return i >= 1 ? 1 : y(i / V);
31
31
  }
32
32
  }
33
- const m = 1e-9;
34
- function d(e) {
33
+ const d = 1e-9;
34
+ function y(e) {
35
35
  return e <= 0 ? 0 : e >= 1 ? 1 : e;
36
36
  }
37
- function M(e) {
38
- return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
37
+ function w(e) {
38
+ return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: l } : {
39
39
  glide: e.glide ?? !0,
40
40
  countUp: e.countUp ?? !0,
41
- settleMs: e.settleMs ?? r
41
+ settleMs: e.settleMs ?? l
42
42
  };
43
43
  }
44
- function y(e, i, t) {
44
+ function M(e, i, t) {
45
45
  const { from: n } = e.getVisibleRange();
46
46
  return e.getStackedValueAtTime(i, n) ?? t;
47
47
  }
48
+ function S(e, i) {
49
+ if (i !== void 0) return i;
50
+ const t = new Set(e.getSeriesIdsByType("band")), n = (a) => !t.has(a), r = e.getSeriesIdsByType("time", { visibleOnly: !0, singleLayerOnly: !0 }).filter(n);
51
+ if (r.length > 0) return r[0];
52
+ const s = e.getSeriesIdsByType("time", { visibleOnly: !0 }).filter(n);
53
+ return s.length > 0 ? s[0] : null;
54
+ }
48
55
  export {
49
- x as BadgeAnimator,
50
- y as firstVisibleValue,
51
- M as resolveAnimate
56
+ b as BadgeAnimator,
57
+ M as firstVisibleValue,
58
+ w as resolveAnimate,
59
+ S as resolveYLabelSeriesId
52
60
  };
@@ -1,41 +1,42 @@
1
1
  import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
2
- function d(e) {
3
- const o = performance.now();
4
- for (const t of ["left", "right"]) {
5
- let r = e.edgeStates[t], n = 1;
2
+ import { pointValue as c } from "../utils/point.js";
3
+ function h(e) {
4
+ const t = performance.now();
5
+ for (const o of ["left", "right"]) {
6
+ let r = e.edgeStates[o], n = 1;
6
7
  if (r === "idle" || r === "has-more") {
7
- const a = e.edgeExitFades[t];
8
+ const a = e.edgeExitFades[o];
8
9
  if (a === null) continue;
9
10
  r = "loading", n = a;
10
11
  }
11
- const l = e.resolveBoundary(t);
12
+ const l = e.resolveBoundary(o);
12
13
  if (l === null) continue;
13
- const { context: c } = e.scope;
14
- n < 1 && (c.save(), c.globalAlpha *= n), s({
14
+ const { context: i } = e.scope;
15
+ n < 1 && (i.save(), i.globalAlpha *= n), s({
15
16
  scope: e.scope,
16
17
  timeScale: e.timeScale,
17
18
  theme: e.theme,
18
19
  chartMediaWidth: e.chartMediaWidth,
19
20
  chartMediaHeight: e.chartMediaHeight,
20
21
  boundaryTime: l,
21
- side: t,
22
+ side: o,
22
23
  state: r,
23
- now: o,
24
- customIndicator: e.edgeIndicatorFns[t],
25
- resolveEdgeAnchor: () => e.resolveEdgeAnchor(t, l),
24
+ now: t,
25
+ customIndicator: e.edgeIndicatorFns[o],
26
+ resolveEdgeAnchor: () => e.resolveEdgeAnchor(o, l),
26
27
  resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
27
- reportPlaceholders: (a) => e.reportPlaceholders(t, a)
28
- }), n < 1 && c.restore();
28
+ reportPlaceholders: (a) => e.reportPlaceholders(o, a)
29
+ }), n < 1 && i.restore();
29
30
  }
30
31
  }
31
- function g(e, o, t) {
32
- return o !== null ? o : e === "left" ? t.first ?? null : t.last ?? null;
32
+ function u(e, t, o) {
33
+ return t !== null ? t : e === "left" ? o.first ?? null : o.last ?? null;
33
34
  }
34
- function u(e, o) {
35
- return "close" in o ? e === "left" ? o.open : o.close : o.value;
35
+ function f(e, t) {
36
+ return "close" in t ? e === "left" ? t.open : t.close : c(t);
36
37
  }
37
38
  export {
38
- d as drawEdgeIndicators,
39
- u as resolveEdgeAnchorValue,
40
- g as resolveEdgeBoundary
39
+ h as drawEdgeIndicators,
40
+ f as resolveEdgeAnchorValue,
41
+ u as resolveEdgeBoundary
41
42
  };
@@ -1,32 +1,39 @@
1
- import { isTimeSeriesRenderer as c } from "../series/types.js";
2
- const a = (e) => "close" in e ? e.close : e.value;
3
- function d(e, s, i) {
4
- const t = s.find((f) => f.id === e);
1
+ import { isTimeSeriesRenderer as d } from "../series/types.js";
2
+ import { isBandPoint as g, pointValue as m } from "../utils/point.js";
3
+ function o(n) {
4
+ return g(n) ? null : m(n);
5
+ }
6
+ function L(n, i, u) {
7
+ const t = i.find((l) => l.id === n);
5
8
  if (!t) return null;
6
- const n = t.renderer;
7
- if (!c(n)) return null;
8
- const r = n.getLastDataPoint();
9
- if (!r) return null;
10
- const { from: u, to: o } = i;
11
- if (r.time >= u && r.time <= o)
12
- return { value: a(r), isLive: !0 };
13
- const l = n.getVisibleDataPoints(u, o);
14
- return l.length === 0 ? null : { value: a(l[l.length - 1]), isLive: !1 };
9
+ const r = t.renderer;
10
+ if (!d(r)) return null;
11
+ const e = r.getLastDataPoint();
12
+ if (!e) return null;
13
+ const { from: a, to: c } = u;
14
+ if (e.time >= a && e.time <= c) {
15
+ const l = o(e);
16
+ return l === null ? null : { value: l, isLive: !0 };
17
+ }
18
+ const s = r.getVisibleDataPoints(a, c);
19
+ if (s.length === 0) return null;
20
+ const f = o(s[s.length - 1]);
21
+ return f === null ? null : { value: f, isLive: !1 };
15
22
  }
16
- function v(e, s, i) {
17
- const t = s.find((r) => r.id === e);
18
- return t ? t.renderer.getStackedLastValue?.() || d(e, s, i) : null;
23
+ function p(n, i, u) {
24
+ const t = i.find((e) => e.id === n);
25
+ return t ? t.renderer.getStackedLastValue?.() || L(n, i, u) : null;
19
26
  }
20
- function L(e, s) {
21
- const i = s.find((r) => r.id === e);
22
- if (!i) return null;
23
- const t = i.renderer;
24
- if (!c(t)) return null;
25
- const n = t.getSecondLastDataPoint();
26
- return n ? "close" in n ? n.close : n.value : null;
27
+ function V(n, i) {
28
+ const u = i.find((e) => e.id === n);
29
+ if (!u) return null;
30
+ const t = u.renderer;
31
+ if (!d(t)) return null;
32
+ const r = t.getSecondLastDataPoint();
33
+ return r ? o(r) : null;
27
34
  }
28
35
  export {
29
- d as getLastValue,
30
- L as getPreviousClose,
31
- v as getStackedLastValue
36
+ L as getLastValue,
37
+ V as getPreviousClose,
38
+ p as getStackedLastValue
32
39
  };
@@ -2,14 +2,14 @@ import { DEFAULT_MAX_VISIBLE_BARS as i, MIN_VISIBLE_BARS as r } from "./pan-zoom
2
2
  function n(t) {
3
3
  return t === void 0 || !Number.isFinite(t) || t <= 0 ? 0 : t;
4
4
  }
5
- function a(t) {
5
+ function l(t) {
6
6
  return {
7
7
  top: n(t?.top),
8
8
  right: t?.right === void 0 ? null : n(t.right),
9
- left: n(t?.left)
9
+ left: t?.left === void 0 ? null : n(t.left)
10
10
  };
11
11
  }
12
- function l(t) {
12
+ function a(t) {
13
13
  if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
14
14
  if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
15
15
  throw new Error(
@@ -39,8 +39,8 @@ function m(t) {
39
39
  }
40
40
  export {
41
41
  u as isSameHorizontalPadding,
42
- a as resolveFade,
42
+ l as resolveFade,
43
43
  m as resolveMaxVisibleBars,
44
44
  f as resolvePadding,
45
- l as resolvePerfOptions
45
+ a as resolvePerfOptions
46
46
  };
@@ -0,0 +1,26 @@
1
+ function o(a) {
2
+ if (!(a.stacking !== "percent" || a.isPlottable(0)))
3
+ throw new Error(
4
+ `[wick-charts] Series '${a.seriesId}' uses stacking: 'percent', which this Y scale can't show — a 0–100% axis starts at 0, and the scale has no position for 0. Use a linear axis, or stacking: 'normal' / 'off'.`
5
+ );
6
+ }
7
+ function i(a) {
8
+ if (process.env.NODE_ENV === "production") return;
9
+ const { y: n, isPlottable: t } = a;
10
+ for (const e of ["min", "max"]) {
11
+ const s = n?.[e];
12
+ typeof s != "number" || t(s) || console.warn(
13
+ `[wick-charts] axis.y.${e} is ${s}, which the Y scale can't place — falling back to 'auto'. Use a bound inside the scale's domain.`
14
+ );
15
+ }
16
+ }
17
+ function r(a) {
18
+ process.env.NODE_ENV !== "production" && console.warn(
19
+ `[wick-charts] Series '${a.seriesId}' has values in view the Y scale can't place (e.g. ${a.value}; a log axis has no position for values ≤ 0). They are skipped — gaps in a line, no bar or candle. Filter or offset the data, or use a linear axis.`
20
+ );
21
+ }
22
+ export {
23
+ o as assertStackingFitsScale,
24
+ i as warnUnplottableBounds,
25
+ r as warnUnplottableValues
26
+ };
@@ -1,25 +1,52 @@
1
- import { isTimeSeriesRenderer as m } from "../series/types.js";
2
- function c(e, t, i) {
3
- let o = 1 / 0, a = -1 / 0;
4
- for (const n of t) {
5
- if (!n.visible || !m(n.renderer)) continue;
6
- const r = n.renderer.getValueRange(e.from, e.to);
7
- r && (r.max > a && (a = r.max), r.min < o && (o = r.min), i?.push(r.min, r.max));
1
+ import { isPlottableOn as c } from "../scales/y-scale.js";
2
+ import { isTimeSeriesRenderer as d } from "../series/types.js";
3
+ function b(n) {
4
+ const { targetVisible: a, series: t, allValues: o, plottable: r } = n, e = r ? { plottable: r } : void 0;
5
+ let s = 1 / 0, i = -1 / 0;
6
+ for (const l of t) {
7
+ if (!l.visible || !d(l.renderer)) continue;
8
+ const m = l.renderer.getValueRange(a.from, a.to, e);
9
+ m && (r && !r(m.max) || (m.max > i && (i = m.max), m.min < s && (!r || r(m.min)) && (s = m.min), o?.push(m.min, m.max)));
8
10
  }
9
- return o === 1 / 0 || a === -1 / 0 ? null : { min: o, max: a };
11
+ return i === -1 / 0 ? null : (s === 1 / 0 && (s = i), { min: s, max: i });
10
12
  }
11
- function p(e, t, i, o, a) {
12
- if (e === void 0 || e === "auto") return t;
13
- if (typeof e == "number") return e;
14
- if (typeof e == "function") return e(o);
15
- const n = String(e).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
16
- if (n) {
17
- const r = n[1] === "-" ? -1 : 1, s = parseFloat(n[2]) / 100, u = Math.abs(i - t) || Math.abs(t) || 1;
18
- return t + r * s * u * (a === "max" ? 1 : -1);
13
+ function w(n) {
14
+ const { raw: a, bounds: t, allValues: o, transform: r } = n;
15
+ if (r === null)
16
+ return {
17
+ min: u(t.min, a.min, a.max, o, "min"),
18
+ max: u(t.max, a.max, a.min, o, "max")
19
+ };
20
+ const e = { min: r.forward(a.min), max: r.forward(a.max) };
21
+ return {
22
+ min: f({ bound: t.min, raw: a, scaledRaw: e, allValues: o, side: "min", transform: r }),
23
+ max: f({ bound: t.max, raw: a, scaledRaw: e, allValues: o, side: "max", transform: r })
24
+ };
25
+ }
26
+ function f(n) {
27
+ const { bound: a, raw: t, scaledRaw: o, allValues: r, side: e, transform: s } = n, i = e === "min" ? "max" : "min";
28
+ if (typeof a == "string" && a !== "auto")
29
+ return u(a, o[e], o[i], [], e);
30
+ const l = u(a, t[e], t[i], r, e), m = c(s, l);
31
+ return s.forward(m ? l : t[e]);
32
+ }
33
+ function g(n, a) {
34
+ return a === null ? n : { min: a.inverse(n.min), max: a.inverse(n.max) };
35
+ }
36
+ function u(n, a, t, o, r) {
37
+ if (n === void 0 || n === "auto") return a;
38
+ if (typeof n == "number") return n;
39
+ if (typeof n == "function") return n(o);
40
+ const e = String(n).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
41
+ if (e) {
42
+ const s = e[1] === "-" ? -1 : 1, i = parseFloat(e[2]) / 100, l = Math.abs(t - a) || Math.abs(a) || 1;
43
+ return a + s * i * l * (r === "max" ? 1 : -1);
19
44
  }
20
- return t;
45
+ return a;
21
46
  }
22
47
  export {
23
- c as computeTargetYRange,
24
- p as resolveBound
48
+ b as computeTargetYRange,
49
+ g as fromScaleSpace,
50
+ u as resolveBound,
51
+ w as resolveYTarget
25
52
  };