@wick-charts/vue 0.6.1 → 0.6.3

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 (52) hide show
  1. package/dist/ChartContainer.vue.js +43 -37
  2. package/dist/LineSeries.vue.js +2 -2
  3. package/dist/composables.js +39 -26
  4. package/dist/core/dist/animation/config.js +66 -64
  5. package/dist/core/dist/animation/intro-wave.js +19 -21
  6. package/dist/core/dist/animation/reduced-motion.js +6 -0
  7. package/dist/core/dist/axis/dom-labels.js +58 -45
  8. package/dist/core/dist/chart/badge-animator.js +15 -19
  9. package/dist/core/dist/chart/options.js +5 -5
  10. package/dist/core/dist/chart/scale-guards.js +26 -0
  11. package/dist/core/dist/chart/y-target.js +46 -19
  12. package/dist/core/dist/chart.js +752 -570
  13. package/dist/core/dist/components/crosshair.js +8 -8
  14. package/dist/core/dist/components/grid.js +28 -15
  15. package/dist/core/dist/components/marker.js +28 -28
  16. package/dist/core/dist/components/reference-line.js +16 -16
  17. package/dist/core/dist/interactions/handler.js +3 -2
  18. package/dist/core/dist/interactions/zoom.js +6 -5
  19. package/dist/core/dist/navigator/controller.js +43 -40
  20. package/dist/core/dist/perf/perf-hud.js +3 -3
  21. package/dist/core/dist/scales/log-scale.js +76 -0
  22. package/dist/core/dist/scales/tick-tracker.js +2 -2
  23. package/dist/core/dist/scales/x-scale.js +47 -32
  24. package/dist/core/dist/scales/y-scale.js +155 -38
  25. package/dist/core/dist/series/bar-intro.js +11 -11
  26. package/dist/core/dist/series/bar.js +299 -249
  27. package/dist/core/dist/series/base-multi-layer.js +100 -76
  28. package/dist/core/dist/series/candlestick.js +252 -249
  29. package/dist/core/dist/series/heatmap.js +16 -16
  30. package/dist/core/dist/series/line-intro.js +18 -18
  31. package/dist/core/dist/series/line.js +522 -424
  32. package/dist/core/dist/series/scale-stack.js +25 -0
  33. package/dist/core/dist/tooltip-position.js +5 -5
  34. package/dist/core/dist/utils/pixel-grid.js +10 -0
  35. package/dist/index.d.ts +279 -32
  36. package/dist/index.js +59 -57
  37. package/dist/ui/Crosshair.vue.js +14 -14
  38. package/dist/ui/HeatmapTooltip.vue.js +6 -6
  39. package/dist/ui/PieTooltip.vue.js +4 -4
  40. package/dist/ui/TimeAxis.vue.js +23 -22
  41. package/dist/ui/Tooltip.vue.js +71 -69
  42. package/dist/ui/YAxis.vue.js +25 -24
  43. package/dist/ui/YLabel.vue.js +50 -49
  44. package/package.json +2 -2
  45. package/src/ChartContainer.vue +20 -8
  46. package/src/composables.ts +35 -1
  47. package/src/index.ts +5 -0
  48. package/src/ui/Crosshair.vue +2 -2
  49. package/src/ui/TimeAxis.vue +7 -4
  50. package/src/ui/Tooltip.vue +4 -1
  51. package/src/ui/YAxis.vue +5 -3
  52. package/src/ui/YLabel.vue +3 -3
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { default as m } from "./ChartContainer.vue.js";
4
4
  import { useCrosshairPosition as i, useLastYValue as s, usePreviousClose as x, useVisibleRange as n, useYRange as l } from "./composables.js";
5
5
  import { useChartInstance as u, useTheme as c } from "./context.js";
6
6
  import { default as h } from "./HeatmapSeries.vue.js";
7
- import { default as I } from "./LineSeries.vue.js";
7
+ import { default as S } from "./LineSeries.vue.js";
8
8
  import { default as P } from "./PieSeries.vue.js";
9
9
  import { default as T } from "./ui/Crosshair.vue.js";
10
10
  import { default as k } from "./ui/HeatmapTooltip.vue.js";
@@ -31,7 +31,7 @@ import { NavigatorController as le } from "./core/dist/navigator/controller.js";
31
31
  import { PerfMonitor as ue } from "./core/dist/perf/perf-monitor.js";
32
32
  import { PieSeriesDef as ge } from "./core/dist/series/pie.js";
33
33
  import { XScale as Ce } from "./core/dist/scales/x-scale.js";
34
- import { YScale as Se } from "./core/dist/scales/y-scale.js";
34
+ import { YScale as Ie } from "./core/dist/scales/y-scale.js";
35
35
  import { andromeda as ve } from "./core/dist/theme/themes/andromeda.js";
36
36
  import { autoGradient as Le, createTheme as ke, isDarkBg as De } from "./core/dist/theme/create.js";
37
37
  import { ayuMirage as Be } from "./core/dist/theme/themes/ayu-mirage.js";
@@ -49,34 +49,35 @@ import { formatCompact as xr, formatPriceAdaptive as nr } from "./core/dist/util
49
49
  import { githubLight as dr } from "./core/dist/theme/themes/github-light.js";
50
50
  import { growIntro as cr, springIntro as gr } from "./core/dist/series/bar-intro.js";
51
51
  import { gruvbox as Cr } from "./core/dist/theme/themes/gruvbox.js";
52
- import { handwritten as Sr } from "./core/dist/theme/themes/handwritten.js";
52
+ import { handwritten as Ir } from "./core/dist/theme/themes/handwritten.js";
53
53
  import { hermite as vr } from "./core/dist/animation/y-range-hermite.js";
54
54
  import { highContrast as Lr } from "./core/dist/theme/themes/high-contrast.js";
55
55
  import { isTimeSeriesRenderer as Dr } from "./core/dist/series/types.js";
56
56
  import { lavenderMist as Br } from "./core/dist/theme/themes/lavender-mist.js";
57
57
  import { lightPink as Rr } from "./core/dist/theme/themes/light-pink.js";
58
- import { materialPalenight as Hr } from "./core/dist/theme/themes/material-palenight.js";
59
- import { minimalLight as Yr } from "./core/dist/theme/themes/minimal-light.js";
60
- import { mintBreeze as Fr } from "./core/dist/theme/themes/mint-breeze.js";
61
- import { mixColors as Nr, sampleRamp as qr } from "./core/dist/utils/color.js";
62
- import { monokaiPro as Vr } from "./core/dist/theme/themes/monokai-pro.js";
63
- import { nightOwl as Er } from "./core/dist/theme/themes/night-owl.js";
64
- import { oneDarkPro as Ur } from "./core/dist/theme/themes/one-dark-pro.js";
65
- import { panda as Jr } from "./core/dist/theme/themes/panda.js";
66
- import { parseAnimationTime as Qr } from "./core/dist/animation/time.js";
67
- import { peachCream as Zr } from "./core/dist/theme/themes/peach-cream.js";
68
- import { perfHud as $r } from "./core/dist/perf/perf-hud.js";
69
- import { quietLight as ro } from "./core/dist/theme/themes/quiet-light.js";
70
- import { registerBuiltinSeries as to } from "./core/dist/series/register-builtins.js";
71
- import { registerSeriesDefinition as fo } from "./core/dist/series/definition.js";
72
- import { resolveAxisFontSize as po, resolveAxisTextColor as io, resolveCandlestickBodyColor as so } from "./core/dist/theme/resolve.js";
73
- import { rosePineDawn as no } from "./core/dist/theme/themes/rose-pine-dawn.js";
74
- import { roundedBarFill as uo, roundedCandleFill as co, smoothCurve as go, steppedCurve as ho, straightCurve as Co } from "./core/dist/series/painters/builtins.js";
75
- import { sandDune as So } from "./core/dist/theme/themes/sand-dune.js";
76
- import { skeletonLoadingIndicator as vo } from "./core/dist/components/loading-indicator.js";
77
- import { snap as Lo } from "./core/dist/animation/y-range-snap.js";
78
- import { solarizedLight as Do } from "./core/dist/theme/themes/solarized-light.js";
79
- import { spring as Bo } from "./core/dist/animation/spring.js";
58
+ import { logScale as Hr } from "./core/dist/scales/log-scale.js";
59
+ import { materialPalenight as Yr } from "./core/dist/theme/themes/material-palenight.js";
60
+ import { minimalLight as Fr } from "./core/dist/theme/themes/minimal-light.js";
61
+ import { mintBreeze as Nr } from "./core/dist/theme/themes/mint-breeze.js";
62
+ import { mixColors as Or, sampleRamp as Vr } from "./core/dist/utils/color.js";
63
+ import { monokaiPro as Er } from "./core/dist/theme/themes/monokai-pro.js";
64
+ import { nightOwl as Ur } from "./core/dist/theme/themes/night-owl.js";
65
+ import { oneDarkPro as Jr } from "./core/dist/theme/themes/one-dark-pro.js";
66
+ import { panda as Qr } from "./core/dist/theme/themes/panda.js";
67
+ import { parseAnimationTime as Zr } from "./core/dist/animation/time.js";
68
+ import { peachCream as $r } from "./core/dist/theme/themes/peach-cream.js";
69
+ import { perfHud as ro } from "./core/dist/perf/perf-hud.js";
70
+ import { quietLight as to } from "./core/dist/theme/themes/quiet-light.js";
71
+ import { registerBuiltinSeries as fo } from "./core/dist/series/register-builtins.js";
72
+ import { registerSeriesDefinition as po } from "./core/dist/series/definition.js";
73
+ import { resolveAxisFontSize as so, resolveAxisTextColor as xo, resolveCandlestickBodyColor as no } from "./core/dist/theme/resolve.js";
74
+ import { rosePineDawn as uo } from "./core/dist/theme/themes/rose-pine-dawn.js";
75
+ import { roundedBarFill as go, roundedCandleFill as ho, smoothCurve as Co, steppedCurve as So, straightCurve as Io } from "./core/dist/series/painters/builtins.js";
76
+ import { sandDune as vo } from "./core/dist/theme/themes/sand-dune.js";
77
+ import { skeletonLoadingIndicator as Lo } from "./core/dist/components/loading-indicator.js";
78
+ import { snap as Do } from "./core/dist/animation/y-range-snap.js";
79
+ import { solarizedLight as Bo } from "./core/dist/theme/themes/solarized-light.js";
80
+ import { spring as Ro } from "./core/dist/animation/spring.js";
80
81
  export {
81
82
  o as BarSeries,
82
83
  oe as BarSeriesDef,
@@ -90,7 +91,7 @@ export {
90
91
  k as HeatmapTooltip,
91
92
  w as InfoBar,
92
93
  b as Legend,
93
- I as LineSeries,
94
+ S as LineSeries,
94
95
  xe as LineSeriesDef,
95
96
  A as Marker,
96
97
  M as Navigator,
@@ -110,7 +111,7 @@ export {
110
111
  Ce as XScale,
111
112
  _ as YAxis,
112
113
  ee as YLabel,
113
- Se as YScale,
114
+ Ie as YScale,
114
115
  ve as andromeda,
115
116
  Le as autoGradient,
116
117
  Be as ayuMirage,
@@ -134,47 +135,48 @@ export {
134
135
  dr as githubLight,
135
136
  cr as growIntro,
136
137
  Cr as gruvbox,
137
- Sr as handwritten,
138
+ Ir as handwritten,
138
139
  vr as hermite,
139
140
  Lr as highContrast,
140
141
  De as isDarkBg,
141
142
  Dr as isTimeSeriesRenderer,
142
143
  Br as lavenderMist,
143
144
  Rr as lightPink,
144
- Hr as materialPalenight,
145
- Yr as minimalLight,
146
- Fr as mintBreeze,
147
- Nr as mixColors,
148
- Vr as monokaiPro,
149
- Er as nightOwl,
145
+ Hr as logScale,
146
+ Yr as materialPalenight,
147
+ Fr as minimalLight,
148
+ Nr as mintBreeze,
149
+ Or as mixColors,
150
+ Er as monokaiPro,
151
+ Ur as nightOwl,
150
152
  $e as normalizeTime,
151
- Ur as oneDarkPro,
152
- Jr as panda,
153
- Qr as parseAnimationTime,
154
- Zr as peachCream,
155
- $r as perfHud,
153
+ Jr as oneDarkPro,
154
+ Qr as panda,
155
+ Zr as parseAnimationTime,
156
+ $r as peachCream,
157
+ ro as perfHud,
156
158
  He as plotterIntro,
157
- ro as quietLight,
158
- to as registerBuiltinSeries,
159
- fo as registerSeriesDefinition,
160
- po as resolveAxisFontSize,
161
- io as resolveAxisTextColor,
162
- so as resolveCandlestickBodyColor,
159
+ to as quietLight,
160
+ fo as registerBuiltinSeries,
161
+ po as registerSeriesDefinition,
162
+ so as resolveAxisFontSize,
163
+ xo as resolveAxisTextColor,
164
+ no as resolveCandlestickBodyColor,
163
165
  ar as riseIntro,
164
- no as rosePineDawn,
165
- uo as roundedBarFill,
166
- co as roundedCandleFill,
167
- qr as sampleRamp,
168
- So as sandDune,
169
- vo as skeletonLoadingIndicator,
166
+ uo as rosePineDawn,
167
+ go as roundedBarFill,
168
+ ho as roundedCandleFill,
169
+ Vr as sampleRamp,
170
+ vo as sandDune,
171
+ Lo as skeletonLoadingIndicator,
170
172
  Ve as skeletonMorphIntro,
171
- go as smoothCurve,
172
- Lo as snap,
173
- Do as solarizedLight,
174
- Bo as spring,
173
+ Co as smoothCurve,
174
+ Do as snap,
175
+ Bo as solarizedLight,
176
+ Ro as spring,
175
177
  gr as springIntro,
176
- ho as steppedCurve,
177
- Co as straightCurve,
178
+ So as steppedCurve,
179
+ Io as straightCurve,
178
180
  Me as sweepIntro,
179
181
  Ye as traceIntro,
180
182
  ir as tracePath,
@@ -1,21 +1,21 @@
1
- import { defineComponent as v, ref as d, onMounted as f, onUnmounted as h, computed as n, unref as t, openBlock as y, createElementBlock as g, Fragment as x, createElementVNode as c, normalizeStyle as m, toDisplayString as u, createCommentVNode as b } from "vue";
1
+ import { defineComponent as v, ref as d, onMounted as f, onUnmounted as y, computed as n, unref as t, openBlock as h, createElementBlock as x, Fragment as g, createElementVNode as c, normalizeStyle as m, toDisplayString as u, createCommentVNode as b } from "vue";
2
2
  import { useCrosshairPosition as C } from "../composables.js";
3
3
  import { useChartInstance as S } from "../context.js";
4
4
  const E = /* @__PURE__ */ v({
5
5
  __name: "Crosshair",
6
6
  setup(k) {
7
- const e = S(), a = C(e), r = d(0), l = () => {
7
+ const e = S(), o = C(e), r = d(0), l = () => {
8
8
  r.value++;
9
9
  };
10
- f(() => e.on("overlayChange", l)), h(() => e.off("overlayChange", l));
11
- const o = n(() => (r.value, e.getTheme())), i = n(() => e.getDataInterval()), p = n(() => (a.value, e.timeScale.niceTickValues(i.value).tickInterval || i.value)), s = n(() => ({
10
+ f(() => e.on("overlayChange", l)), y(() => e.off("overlayChange", l));
11
+ const a = n(() => (r.value, e.getTheme())), i = n(() => e.getDataInterval()), p = n(() => (o.value, e.timeScale.niceTickValues(i.value).tickInterval || i.value)), s = n(() => ({
12
12
  // Blend the theme's labelBackground at 80% opacity so the axis grid
13
13
  // shows through — keeps the badge from looking like an opaque block
14
14
  // while still masking whatever tick sits underneath.
15
- background: `color-mix(in srgb, ${o.value.crosshair.labelBackground} 80%, transparent)`,
16
- color: o.value.crosshair.labelTextColor,
17
- fontSize: o.value.axis.fontSize + "px",
18
- fontFamily: o.value.typography.fontFamily,
15
+ background: `color-mix(in srgb, ${a.value.crosshair.labelBackground} 80%, transparent)`,
16
+ color: a.value.crosshair.labelTextColor,
17
+ fontSize: a.value.axis.fontSize + "px",
18
+ fontFamily: a.value.typography.fontFamily,
19
19
  fontVariantNumeric: "tabular-nums",
20
20
  padding: "2px 6px",
21
21
  borderRadius: "2px",
@@ -25,25 +25,25 @@ const E = /* @__PURE__ */ v({
25
25
  // live last-value stays visible when the crosshair crosses its row.
26
26
  zIndex: 2
27
27
  }));
28
- return (_, I) => t(a) ? (y(), g(x, { key: 0 }, [
28
+ return (_, I) => t(o) ? (h(), x(g, { key: 0 }, [
29
29
  c("div", {
30
30
  style: m({
31
31
  position: "absolute",
32
- right: "0",
33
- top: t(a).mediaY + "px",
32
+ [t(e).yAxisPosition]: "0",
33
+ top: t(o).mediaY + "px",
34
34
  transform: "translateY(-50%)",
35
35
  ...s.value
36
36
  })
37
- }, u(t(e).yScale.formatY(t(a).y)), 5),
37
+ }, u(t(e).yScale.formatY(t(o).y)), 5),
38
38
  c("div", {
39
39
  style: m({
40
40
  position: "absolute",
41
41
  bottom: "0",
42
- left: t(a).mediaX + "px",
42
+ left: t(o).mediaX + "px",
43
43
  transform: "translateX(-50%)",
44
44
  ...s.value
45
45
  })
46
- }, u(t(e).timeScale.formatX(t(a).time, p.value)), 5)
46
+ }, u(t(e).timeScale.formatX(t(o).time, p.value)), 5)
47
47
  ], 64)) : b("", !0);
48
48
  }
49
49
  });
@@ -1,16 +1,16 @@
1
1
  import { defineComponent as x, computed as a, ref as g, onMounted as b, onUnmounted as y, unref as _, openBlock as k, createElementBlock as I, normalizeStyle as n, createElementVNode as r, toDisplayString as v, createCommentVNode as H } from "vue";
2
2
  import { defaultHeatmapFormat as T, resolveHeatmapSeriesId as C, HEATMAP_TOOLTIP_WIDTH as S, HEATMAP_TOOLTIP_HEIGHT as W } from "../core/dist/heatmap-tooltip.js";
3
3
  import { computeTooltipPosition as F } from "../core/dist/tooltip-position.js";
4
- import { useCrosshairPosition as P } from "../composables.js";
5
- import { useChartInstance as z } from "../context.js";
6
- const E = { style: { display: "flex", alignItems: "center", gap: "8px" } }, M = { style: { fontWeight: 600 } }, w = { style: { marginLeft: "auto", fontWeight: 600 } }, N = /* @__PURE__ */ x({
4
+ import { useCrosshairPosition as M } from "../composables.js";
5
+ import { useChartInstance as P } from "../context.js";
6
+ const z = { style: { display: "flex", alignItems: "center", gap: "8px" } }, E = { style: { fontWeight: 600 } }, w = { style: { marginLeft: "auto", fontWeight: 600 } }, N = /* @__PURE__ */ x({
7
7
  __name: "HeatmapTooltip",
8
8
  props: {
9
9
  seriesId: {},
10
10
  format: { type: Function }
11
11
  },
12
12
  setup(m) {
13
- const u = m, f = a(() => u.format ?? T), t = z(), l = P(t), i = g(0), d = () => {
13
+ const u = m, f = a(() => u.format ?? T), t = P(), l = M(t), i = g(0), d = () => {
14
14
  i.value++;
15
15
  };
16
16
  b(() => {
@@ -56,7 +56,7 @@ const E = { style: { display: "flex", alignItems: "center", gap: "8px" } }, M =
56
56
  minWidth: "120px"
57
57
  })
58
58
  }, [
59
- r("div", E, [
59
+ r("div", z, [
60
60
  r("span", {
61
61
  style: n({
62
62
  width: "10px",
@@ -66,7 +66,7 @@ const E = { style: { display: "flex", alignItems: "center", gap: "8px" } }, M =
66
66
  flexShrink: 0
67
67
  })
68
68
  }, null, 4),
69
- r("span", M, v(e.value.label), 1),
69
+ r("span", E, v(e.value.label), 1),
70
70
  r("span", w, v(f.value(e.value.value)), 1)
71
71
  ]),
72
72
  r("div", {
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as H, computed as a, useSlots as R, ref as x, onMounted as O, onUnmounted as P, watchEffect as B, openBlock as m, createElementBlock as g, Fragment as D, unref as b, normalizeStyle as y, createElementVNode as s, toDisplayString as _, createCommentVNode as I, renderSlot as L } from "vue";
2
2
  import { computeTooltipPosition as C } from "../core/dist/tooltip-position.js";
3
- import { formatCompact as X } from "../core/dist/utils/format.js";
4
- import { useCrosshairPosition as Y } from "../composables.js";
5
- import { useChartInstance as M } from "../context.js";
3
+ import { formatCompact as M } from "../core/dist/utils/format.js";
4
+ import { useCrosshairPosition as X } from "../composables.js";
5
+ import { useChartInstance as Y } from "../context.js";
6
6
  const U = { style: { display: "flex", alignItems: "center", gap: "8px" } }, A = { style: { fontWeight: 600 } }, N = { style: { display: "flex", justifyContent: "space-between", gap: "16px" } }, V = { style: { opacity: 0.6 } }, j = { style: { fontWeight: 600 } }, G = ["data-measured"], $ = 160, q = 70, te = /* @__PURE__ */ H({
7
7
  __name: "PieTooltip",
8
8
  props: {
@@ -10,7 +10,7 @@ const U = { style: { display: "flex", alignItems: "center", gap: "8px" } }, A =
10
10
  format: { type: Function }
11
11
  },
12
12
  setup(T) {
13
- const S = T, k = a(() => S.format ?? X), i = M(), l = Y(i), W = R(), d = a(() => typeof W.default == "function"), c = x(0), w = () => {
13
+ const S = T, k = a(() => S.format ?? M), i = Y(), l = X(i), W = R(), d = a(() => typeof W.default == "function"), c = x(0), w = () => {
14
14
  c.value++;
15
15
  };
16
16
  O(() => {
@@ -1,36 +1,37 @@
1
- import { defineComponent as r, ref as u, watch as c, onUnmounted as a, onMounted as p, openBlock as m, createElementBlock as b, normalizeStyle as f, unref as o } from "vue";
2
- import { mountAxisLabels as x } from "../core/dist/axis/dom-labels.js";
1
+ import { defineComponent as c, computed as p, ref as m, watch as f, onUnmounted as u, onMounted as x, openBlock as b, createElementBlock as y, normalizeStyle as h, unref as o } from "vue";
2
+ import { mountAxisLabels as L } from "../core/dist/axis/dom-labels.js";
3
+ import { useAxisLayout as d } from "../composables.js";
3
4
  import { useChartInstance as g } from "../context.js";
4
- const _ = /* @__PURE__ */ r({
5
+ const D = /* @__PURE__ */ c({
5
6
  __name: "TimeAxis",
6
7
  props: {
7
8
  labelCount: {},
8
9
  minLabelSpacing: {}
9
10
  },
10
- setup(s) {
11
- const n = s, e = g(), t = u(null), i = () => {
12
- e.setTimeAxisLabelDensity({
13
- labelCount: n.labelCount ?? null,
14
- minLabelSpacing: n.minLabelSpacing ?? null
11
+ setup(r) {
12
+ const e = r, n = g(), t = d(n), a = p(() => t.value.yAxisPosition === "left"), l = m(null), s = () => {
13
+ n.setTimeAxisLabelDensity({
14
+ labelCount: e.labelCount ?? null,
15
+ minLabelSpacing: e.minLabelSpacing ?? null
15
16
  });
16
17
  };
17
- i(), c(() => [n.labelCount, n.minLabelSpacing], i), a(() => {
18
- e.setTimeAxisLabelDensity({ labelCount: null, minLabelSpacing: null });
18
+ s(), f(() => [e.labelCount, e.minLabelSpacing], s), u(() => {
19
+ n.setTimeAxisLabelDensity({ labelCount: null, minLabelSpacing: null });
19
20
  });
20
- let l = null;
21
- return p(() => {
22
- t.value !== null && (l = x({ chart: e, container: t.value, axis: "x" }));
23
- }), a(() => {
24
- l?.(), l = null;
25
- }), (h, y) => (m(), b("div", {
21
+ let i = null;
22
+ return x(() => {
23
+ l.value !== null && (i = L({ chart: n, container: l.value, axis: "x" }));
24
+ }), u(() => {
25
+ i?.(), i = null;
26
+ }), (A, v) => (b(), y("div", {
26
27
  ref_key: "containerRef",
27
- ref: t,
28
- style: f({
28
+ ref: l,
29
+ style: h({
29
30
  position: "absolute",
30
- left: "0",
31
+ left: (a.value ? o(t).yAxisWidth : 0) + "px",
31
32
  bottom: "0",
32
- right: o(e).yAxisWidth + "px",
33
- height: o(e).xAxisHeight + "px",
33
+ right: (a.value ? 0 : o(t).yAxisWidth) + "px",
34
+ height: o(t).xAxisHeight + "px",
34
35
  pointerEvents: "none",
35
36
  display: "flex",
36
37
  alignItems: "center"
@@ -39,5 +40,5 @@ const _ = /* @__PURE__ */ r({
39
40
  }
40
41
  });
41
42
  export {
42
- _ as default
43
+ D as default
43
44
  };
@@ -1,98 +1,100 @@
1
- import { defineComponent as P, computed as s, ref as w, onMounted as D, onUnmounted as M, useSlots as X, watchEffect as Y, openBlock as r, createElementBlock as u, Fragment as x, unref as p, normalizeStyle as m, createElementVNode as d, toDisplayString as f, renderList as H, createCommentVNode as _, renderSlot as Z } from "vue";
2
- import { buildHoverSnapshots as $ } from "../core/dist/snapshots.js";
3
- import { resolveCandlestickBodyColor as K } from "../core/dist/theme/resolve.js";
1
+ import { defineComponent as P, computed as s, ref as w, onMounted as D, onUnmounted as X, useSlots as Y, watchEffect as Z, openBlock as r, createElementBlock as u, Fragment as x, unref as p, normalizeStyle as m, createElementVNode as d, toDisplayString as f, renderList as H, createCommentVNode as _, renderSlot as $ } from "vue";
2
+ import { buildHoverSnapshots as K } from "../core/dist/snapshots.js";
3
+ import { resolveCandlestickBodyColor as U } from "../core/dist/theme/resolve.js";
4
4
  import { computeTooltipPosition as R } from "../core/dist/tooltip-position.js";
5
- import { formatCompact as U, formatPriceAdaptive as j } from "../core/dist/utils/format.js";
6
- import { formatDate as q } from "../core/dist/utils/time.js";
7
- import { useCrosshairPosition as G } from "../composables.js";
8
- import { useChartInstance as J } from "../context.js";
9
- const Q = {
5
+ import { formatCompact as j, formatPriceAdaptive as q } from "../core/dist/utils/format.js";
6
+ import { formatDate as G } from "../core/dist/utils/time.js";
7
+ import { useCrosshairPosition as J } from "../composables.js";
8
+ import { useChartInstance as Q } from "../context.js";
9
+ const ee = {
10
10
  key: 0,
11
11
  style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "4px 12px" }
12
- }, ee = { style: { opacity: 0.5 } }, te = {
12
+ }, te = { style: { opacity: 0.5 } }, oe = {
13
13
  key: 1,
14
14
  style: { display: "flex", alignItems: "center", gap: "8px", padding: "2px 0" }
15
- }, oe = { style: { opacity: 0.6, flex: "1" } }, le = ["data-measured"], ce = /* @__PURE__ */ P({
15
+ }, le = { style: { opacity: 0.6, flex: "1" } }, ae = ["data-measured"], ve = /* @__PURE__ */ P({
16
16
  __name: "Tooltip",
17
17
  props: {
18
18
  sort: {},
19
19
  format: { type: Function }
20
20
  },
21
21
  setup(I) {
22
- const F = I, A = s(() => F.sort ?? "none"), k = s(
23
- () => F.format ?? ((a, n) => n === "volume" ? U(a) : j(a))
24
- ), o = J(), i = G(o), C = w(0), W = () => {
22
+ const F = I, L = s(() => F.sort ?? "none"), k = s(
23
+ () => F.format ?? ((a, i) => i === "volume" ? j(a) : q(a))
24
+ ), t = Q(), n = J(t), C = w(0), W = () => {
25
25
  C.value++;
26
26
  };
27
27
  D(() => {
28
- o.on("overlayChange", W), o.getSeriesIds().length > 0 && C.value++;
29
- }), M(() => {
30
- o.off("overlayChange", W);
28
+ t.on("overlayChange", W), t.getSeriesIds().length > 0 && C.value++;
29
+ }), X(() => {
30
+ t.off("overlayChange", W);
31
31
  });
32
- const t = s(() => o.getTheme()), O = s(() => o.getDataInterval()), c = s(() => (C.value, i.value ? $(o, {
33
- time: i.value.time,
34
- sort: A.value,
32
+ const o = s(() => t.getTheme()), A = s(() => t.getDataInterval()), c = s(() => (C.value, n.value ? K(t, {
33
+ time: n.value.time,
34
+ sort: L.value,
35
35
  cacheKey: "tooltip"
36
- }) : [])), z = s(() => i.value?.time ?? 0), T = X(), g = s(() => typeof T.default == "function"), B = w(null), b = w(null);
36
+ }) : [])), z = s(() => n.value?.time ?? 0), O = Y(), g = s(() => typeof O.default == "function"), B = w(null), b = w(null);
37
37
  let S = null;
38
- Y((a) => {
38
+ Z((a) => {
39
39
  if (!g.value) return;
40
- const n = B.value;
41
- !n || typeof ResizeObserver > "u" || (S = new ResizeObserver((e) => {
40
+ const i = B.value;
41
+ !i || typeof ResizeObserver > "u" || (S = new ResizeObserver((e) => {
42
42
  const l = e[0]?.contentRect;
43
43
  if (!l) return;
44
44
  const y = b.value;
45
45
  (!y || y.width !== l.width || y.height !== l.height) && (b.value = { width: l.width, height: l.height });
46
- }), S.observe(n), a(() => {
46
+ }), S.observe(i), a(() => {
47
47
  S?.disconnect(), S = null;
48
48
  }));
49
49
  });
50
50
  const h = s(() => {
51
- if (!i.value || c.value.length === 0) return null;
52
- const a = o.getMediaSize(), n = a.width - o.yAxisWidth, e = a.height - o.xAxisHeight;
51
+ if (!n.value || c.value.length === 0) return null;
52
+ const a = t.getMediaSize(), i = t.plotLeft, e = a.width - t.yAxisWidth, l = a.height - t.xAxisHeight;
53
53
  if (g.value) {
54
54
  const v = b.value;
55
55
  return v ? R({
56
- x: i.value.mediaX,
57
- y: i.value.mediaY,
58
- chartWidth: n,
59
- chartHeight: e,
56
+ x: n.value.mediaX,
57
+ y: n.value.mediaY,
58
+ chartLeft: i,
59
+ chartWidth: e,
60
+ chartHeight: l,
60
61
  tooltipWidth: v.width,
61
62
  tooltipHeight: v.height
62
- }) : { left: 0, top: 0 };
63
+ }) : { left: i, top: 0 };
63
64
  }
64
- const l = c.value.some((v) => "open" in v.data), y = c.value.filter((v) => !("open" in v.data)).length, L = 160, N = l ? 140 : 40 + y * 22;
65
+ const y = c.value.some((v) => "open" in v.data), E = c.value.filter((v) => !("open" in v.data)).length, M = 160, N = y ? 140 : 40 + E * 22;
65
66
  return R({
66
- x: i.value.mediaX,
67
- y: i.value.mediaY,
68
- chartWidth: n,
69
- chartHeight: e,
70
- tooltipWidth: L,
67
+ x: n.value.mediaX,
68
+ y: n.value.mediaY,
69
+ chartLeft: i,
70
+ chartWidth: e,
71
+ chartHeight: l,
72
+ tooltipWidth: M,
71
73
  tooltipHeight: N
72
74
  });
73
- }), V = s(() => !g.value || b.value !== null);
74
- function E(a) {
75
+ }), T = s(() => !g.value || b.value !== null);
76
+ function V(a) {
75
77
  return "open" in a;
76
78
  }
77
- return (a, n) => (r(), u(x, null, [
78
- p(i) && c.value.length > 0 && h.value && !g.value ? (r(), u("div", {
79
+ return (a, i) => (r(), u(x, null, [
80
+ p(n) && c.value.length > 0 && h.value && !g.value ? (r(), u("div", {
79
81
  key: 0,
80
82
  style: m({
81
83
  position: "absolute",
82
84
  left: h.value.left + "px",
83
85
  top: h.value.top + "px",
84
86
  pointerEvents: "none",
85
- background: t.value.tooltip.background,
87
+ background: o.value.tooltip.background,
86
88
  backdropFilter: "blur(12px)",
87
89
  WebkitBackdropFilter: "blur(12px)",
88
- border: "1px solid " + t.value.tooltip.borderColor,
90
+ border: "1px solid " + o.value.tooltip.borderColor,
89
91
  borderRadius: "8px",
90
92
  padding: "10px 14px",
91
93
  boxShadow: "0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)",
92
- fontSize: t.value.tooltip.fontSize + "px",
93
- fontFamily: t.value.typography.fontFamily,
94
+ fontSize: o.value.tooltip.fontSize + "px",
95
+ fontFamily: o.value.typography.fontFamily,
94
96
  fontVariantNumeric: "tabular-nums",
95
- color: t.value.tooltip.textColor,
97
+ color: o.value.tooltip.textColor,
96
98
  minWidth: "140px",
97
99
  zIndex: 10,
98
100
  transition: "opacity 0.15s ease"
@@ -100,18 +102,18 @@ const Q = {
100
102
  }, [
101
103
  d("div", {
102
104
  style: m({
103
- fontSize: t.value.axis.fontSize + "px",
104
- color: t.value.axis.textColor,
105
+ fontSize: o.value.axis.fontSize + "px",
106
+ color: o.value.axis.textColor,
105
107
  marginBottom: "8px",
106
108
  paddingBottom: "6px",
107
- borderBottom: "1px solid " + t.value.tooltip.borderColor,
109
+ borderBottom: "1px solid " + o.value.tooltip.borderColor,
108
110
  letterSpacing: "0.02em"
109
111
  })
110
- }, f(p(q)(z.value, { locale: p(o).timeScale.getLocale(), timeZone: p(o).timeScale.getTimeZone() })) + " " + f(p(o).timeScale.formatX(z.value, O.value)), 5),
112
+ }, f(p(G)(z.value, { locale: p(t).timeScale.getLocale(), timeZone: p(t).timeScale.getTimeZone() })) + " " + f(p(t).timeScale.formatX(z.value, A.value)), 5),
111
113
  (r(!0), u(x, null, H(c.value, (e) => (r(), u(x, {
112
114
  key: e.id
113
115
  }, [
114
- E(e.data) ? (r(), u("div", Q, [
116
+ V(e.data) ? (r(), u("div", ee, [
115
117
  (r(!0), u(x, null, H([
116
118
  { label: "Open", val: e.data.open, field: "open" },
117
119
  { label: "High", val: e.data.high, field: "high" },
@@ -120,24 +122,24 @@ const Q = {
120
122
  ], (l) => (r(), u(x, {
121
123
  key: l.label
122
124
  }, [
123
- d("span", ee, f(l.label), 1),
125
+ d("span", te, f(l.label), 1),
124
126
  d("span", {
125
127
  style: m({
126
128
  fontWeight: 600,
127
- color: p(K)(
128
- e.data.close >= e.data.open ? t.value.candlestick.up.body : t.value.candlestick.down.body
129
+ color: p(U)(
130
+ e.data.close >= e.data.open ? o.value.candlestick.up.body : o.value.candlestick.down.body
129
131
  ),
130
132
  textAlign: "right"
131
133
  })
132
134
  }, f(k.value(l.val, l.field)), 5)
133
135
  ], 64))), 128)),
134
136
  e.data.volume != null ? (r(), u(x, { key: 0 }, [
135
- n[0] || (n[0] = d("span", { style: { opacity: 0.5 } }, "Volume", -1)),
137
+ i[0] || (i[0] = d("span", { style: { opacity: 0.5 } }, "Volume", -1)),
136
138
  d("span", {
137
- style: m({ fontWeight: 600, color: t.value.tooltip.textColor, textAlign: "right" })
139
+ style: m({ fontWeight: 600, color: o.value.tooltip.textColor, textAlign: "right" })
138
140
  }, f(k.value(e.data.volume, "volume")), 5)
139
141
  ], 64)) : _("", !0)
140
- ])) : (r(), u("div", te, [
142
+ ])) : (r(), u("div", oe, [
141
143
  d("span", {
142
144
  style: m({
143
145
  width: "8px",
@@ -147,49 +149,49 @@ const Q = {
147
149
  flexShrink: 0
148
150
  })
149
151
  }, null, 4),
150
- d("span", oe, f(e.label ?? "Value"), 1),
152
+ d("span", le, f(e.label ?? "Value"), 1),
151
153
  d("span", {
152
154
  style: m({ fontWeight: 600, color: e.color })
153
155
  }, f(k.value(e.data.value, "value")), 5)
154
156
  ]))
155
157
  ], 64))), 128))
156
158
  ], 4)) : _("", !0),
157
- p(i) && c.value.length > 0 && h.value && g.value ? (r(), u("div", {
159
+ p(n) && c.value.length > 0 && h.value && g.value ? (r(), u("div", {
158
160
  key: 1,
159
161
  ref_key: "containerRef",
160
162
  ref: B,
161
- "data-measured": V.value ? "true" : "false",
163
+ "data-measured": T.value ? "true" : "false",
162
164
  style: m({
163
165
  position: "absolute",
164
166
  left: h.value.left + "px",
165
167
  top: h.value.top + "px",
166
168
  pointerEvents: "none",
167
- background: t.value.tooltip.background,
169
+ background: o.value.tooltip.background,
168
170
  backdropFilter: "blur(12px)",
169
171
  WebkitBackdropFilter: "blur(12px)",
170
- border: "1px solid " + t.value.tooltip.borderColor,
172
+ border: "1px solid " + o.value.tooltip.borderColor,
171
173
  borderRadius: "8px",
172
174
  padding: "10px 14px",
173
175
  boxShadow: "0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)",
174
- fontFamily: t.value.typography.fontFamily,
175
- fontSize: t.value.tooltip.fontSize + "px",
176
+ fontFamily: o.value.typography.fontFamily,
177
+ fontSize: o.value.tooltip.fontSize + "px",
176
178
  fontVariantNumeric: "tabular-nums",
177
- color: t.value.tooltip.textColor,
179
+ color: o.value.tooltip.textColor,
178
180
  width: "max-content",
179
- maxWidth: p(o).getMediaSize().width - p(o).yAxisWidth + "px",
181
+ maxWidth: p(t).getMediaSize().width - p(t).yAxisWidth + "px",
180
182
  boxSizing: "border-box",
181
183
  zIndex: 10,
182
184
  visibility: b.value !== null ? "visible" : "hidden"
183
185
  })
184
186
  }, [
185
- Z(a.$slots, "default", {
187
+ $(a.$slots, "default", {
186
188
  snapshots: c.value,
187
189
  time: z.value
188
190
  })
189
- ], 12, le)) : _("", !0)
191
+ ], 12, ae)) : _("", !0)
190
192
  ], 64));
191
193
  }
192
194
  });
193
195
  export {
194
- ce as default
196
+ ve as default
195
197
  };