p1-charts 0.2.0 → 0.3.0

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 (150) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +100 -2
  3. package/dist/CategoryBarChart-1Kn3Vozc.js +580 -0
  4. package/dist/CategoryBarChart-1Kn3Vozc.js.map +1 -0
  5. package/dist/ChartFrame-B1bVFM2E.js +403 -0
  6. package/dist/ChartFrame-B1bVFM2E.js.map +1 -0
  7. package/dist/{Heatmap-C1XcTUg1.js → Heatmap-CFC753mV.js} +278 -272
  8. package/dist/Heatmap-CFC753mV.js.map +1 -0
  9. package/dist/{PieLegend-BZsv9IbF.js → PieLegend-CbpjaOJH.js} +94 -111
  10. package/dist/PieLegend-CbpjaOJH.js.map +1 -0
  11. package/dist/PolarChart-hcNTWKfJ.js +450 -0
  12. package/dist/PolarChart-hcNTWKfJ.js.map +1 -0
  13. package/dist/Sparkline-BApLVWfg.js +110 -0
  14. package/dist/Sparkline-BApLVWfg.js.map +1 -0
  15. package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BzeHEtQl.js} +120 -119
  16. package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BzeHEtQl.js.map} +1 -1
  17. package/dist/category.d.ts +1 -1
  18. package/dist/category.d.ts.map +1 -1
  19. package/dist/category.js +1 -1
  20. package/dist/charts/CategoryBarChart/index.d.ts +1 -1
  21. package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
  22. package/dist/charts/Heatmap/index.d.ts.map +1 -1
  23. package/dist/charts/PolarChart/index.d.ts.map +1 -1
  24. package/dist/charts/ScatterChart/index.d.ts +1 -1
  25. package/dist/charts/ScatterChart/index.d.ts.map +1 -1
  26. package/dist/charts/Sparkline/index.d.ts +5 -2
  27. package/dist/charts/Sparkline/index.d.ts.map +1 -1
  28. package/dist/components/ChartFrame/index.d.ts +7 -0
  29. package/dist/components/ChartFrame/index.d.ts.map +1 -0
  30. package/dist/components/ChartStory/index.d.ts +7 -0
  31. package/dist/components/ChartStory/index.d.ts.map +1 -0
  32. package/dist/components/HeatmapCells/index.d.ts +1 -1
  33. package/dist/components/HeatmapCells/index.d.ts.map +1 -1
  34. package/dist/{css-C-rsk7-l.js → css-BtFQ2bM4.js} +2 -2
  35. package/dist/{css-C-rsk7-l.js.map → css-BtFQ2bM4.js.map} +1 -1
  36. package/dist/heatmap.js +1 -1
  37. package/dist/hooks/useMarkMemory.d.ts +9 -0
  38. package/dist/hooks/useMarkMemory.d.ts.map +1 -0
  39. package/dist/hooks/usePieTween.d.ts.map +1 -1
  40. package/dist/hooks/useSteps.d.ts +4 -0
  41. package/dist/hooks/useSteps.d.ts.map +1 -0
  42. package/dist/hooks/useTween.d.ts +12 -0
  43. package/dist/hooks/useTween.d.ts.map +1 -0
  44. package/dist/index.d.ts +11 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +122 -118
  47. package/dist/index.js.map +1 -1
  48. package/dist/motion.utils-DFoqptDi.js +55 -0
  49. package/dist/motion.utils-DFoqptDi.js.map +1 -0
  50. package/dist/pie.js +1 -1
  51. package/dist/scatter.js +1 -1
  52. package/dist/series.js +1 -1
  53. package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
  54. package/dist/shared-C1pGJV4T.js.map +1 -0
  55. package/dist/sparkline.d.ts +1 -1
  56. package/dist/sparkline.d.ts.map +1 -1
  57. package/dist/sparkline.js +2 -2
  58. package/dist/story.d.ts +11 -0
  59. package/dist/story.d.ts.map +1 -0
  60. package/dist/story.js +7 -0
  61. package/dist/theme.js +3 -3
  62. package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DgmWROoe.js} +40 -20
  63. package/dist/theme.utils-DgmWROoe.js.map +1 -0
  64. package/dist/tooltip.utils-CXD_NapA.js +9 -0
  65. package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
  66. package/dist/types/category.d.ts +10 -0
  67. package/dist/types/category.d.ts.map +1 -1
  68. package/dist/types/heatmap.d.ts +3 -0
  69. package/dist/types/heatmap.d.ts.map +1 -1
  70. package/dist/types/heatmapParts.d.ts +2 -0
  71. package/dist/types/heatmapParts.d.ts.map +1 -1
  72. package/dist/types/motion.d.ts +31 -0
  73. package/dist/types/motion.d.ts.map +1 -0
  74. package/dist/types/pie.d.ts +3 -4
  75. package/dist/types/pie.d.ts.map +1 -1
  76. package/dist/types/polar.d.ts +3 -0
  77. package/dist/types/polar.d.ts.map +1 -1
  78. package/dist/types/scatter.d.ts +3 -0
  79. package/dist/types/scatter.d.ts.map +1 -1
  80. package/dist/types/sparkline.d.ts +3 -0
  81. package/dist/types/sparkline.d.ts.map +1 -1
  82. package/dist/types/story.d.ts +73 -0
  83. package/dist/types/story.d.ts.map +1 -0
  84. package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-KKtc1C4K.js} +2 -2
  85. package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-KKtc1C4K.js.map} +1 -1
  86. package/dist/useControllable-Crsr0byh.js +11 -0
  87. package/dist/useControllable-Crsr0byh.js.map +1 -0
  88. package/dist/useMarkMemory-CLNY6TtT.js +15 -0
  89. package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
  90. package/dist/useTween-B0G0CcvM.js +46 -0
  91. package/dist/useTween-B0G0CcvM.js.map +1 -0
  92. package/dist/utils/category.utils.d.ts +2 -0
  93. package/dist/utils/category.utils.d.ts.map +1 -1
  94. package/dist/utils/color.utils.d.ts +9 -0
  95. package/dist/utils/color.utils.d.ts.map +1 -1
  96. package/dist/utils/csv.utils.d.ts +6 -0
  97. package/dist/utils/csv.utils.d.ts.map +1 -0
  98. package/dist/utils/motion.utils.d.ts +25 -0
  99. package/dist/utils/motion.utils.d.ts.map +1 -1
  100. package/dist/utils/pieTween.utils.d.ts +1 -1
  101. package/dist/utils/pieTween.utils.d.ts.map +1 -1
  102. package/dist/utils/sparkline.utils.d.ts +15 -0
  103. package/dist/utils/sparkline.utils.d.ts.map +1 -1
  104. package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
  105. package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
  106. package/package.json +10 -3
  107. package/src/category.ts +1 -0
  108. package/src/charts/CategoryBarChart/index.tsx +203 -44
  109. package/src/charts/Heatmap/index.tsx +4 -0
  110. package/src/charts/PolarChart/index.tsx +98 -5
  111. package/src/charts/ScatterChart/index.tsx +96 -13
  112. package/src/charts/Sparkline/index.tsx +54 -7
  113. package/src/components/ChartFrame/index.tsx +180 -0
  114. package/src/components/ChartStory/index.tsx +184 -0
  115. package/src/components/HeatmapCells/index.tsx +5 -2
  116. package/src/hooks/useMarkMemory.ts +29 -0
  117. package/src/hooks/usePieTween.ts +9 -44
  118. package/src/hooks/useSteps.ts +77 -0
  119. package/src/hooks/useTween.ts +112 -0
  120. package/src/index.ts +19 -0
  121. package/src/sparkline.ts +1 -1
  122. package/src/story.ts +19 -0
  123. package/src/types/category.ts +11 -0
  124. package/src/types/heatmap.ts +3 -0
  125. package/src/types/heatmapParts.ts +2 -0
  126. package/src/types/motion.ts +35 -0
  127. package/src/types/pie.ts +3 -3
  128. package/src/types/polar.ts +3 -0
  129. package/src/types/scatter.ts +3 -0
  130. package/src/types/sparkline.ts +3 -0
  131. package/src/types/story.ts +103 -0
  132. package/src/utils/category.utils.ts +22 -0
  133. package/src/utils/color.utils.ts +48 -0
  134. package/src/utils/csv.utils.ts +28 -0
  135. package/src/utils/motion.utils.ts +124 -0
  136. package/src/utils/pieTween.utils.ts +1 -2
  137. package/src/utils/sparkline.utils.ts +69 -0
  138. package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
  139. package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
  140. package/dist/Heatmap-C1XcTUg1.js.map +0 -1
  141. package/dist/PieLegend-BZsv9IbF.js.map +0 -1
  142. package/dist/PolarChart-BUEhn3CI.js +0 -334
  143. package/dist/PolarChart-BUEhn3CI.js.map +0 -1
  144. package/dist/Sparkline-DtNhxGVo.js +0 -67
  145. package/dist/Sparkline-DtNhxGVo.js.map +0 -1
  146. package/dist/motion.utils-C1eaZJdQ.js +0 -9
  147. package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
  148. package/dist/theme.utils-CP1XtGIe.js.map +0 -1
  149. package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
  150. package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
@@ -1,8 +1,9 @@
1
1
  "use client";
2
- import { a as e, c as t, f as n, g as r, i, n as a, o, p as s, s as c, t as l, u } from "./theme.utils-CP1XtGIe.js";
3
- import { r as d, t as f } from "./tooltip.utils-D7xaBSUK.js";
4
- import { t as p } from "./useChartTheme-B06p_jvu.js";
5
- import { t as m } from "./motion.utils-C1eaZJdQ.js";
2
+ import { a as e, c as t, h as n, i as r, m as i, n as a, o, s, t as c, u as l, v as u } from "./theme.utils-DgmWROoe.js";
3
+ import { n as d } from "./shared-C1pGJV4T.js";
4
+ import { o as f } from "./motion.utils-DFoqptDi.js";
5
+ import { t as p } from "./useChartTheme-KKtc1C4K.js";
6
+ import { t as m } from "./tooltip.utils-CXD_NapA.js";
6
7
  import { AreaSeries as h, BaselineSeries as g, CandlestickSeries as _, ColorType as v, CrosshairMode as y, HistogramSeries as b, LineSeries as x, LineStyle as S, createChart as C, createSeriesMarkers as w } from "lightweight-charts";
7
8
  import { forwardRef as T, useCallback as E, useEffect as D, useImperativeHandle as ee, useMemo as O, useRef as k, useState as A } from "react";
8
9
  import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
@@ -106,49 +107,49 @@ function U(e = {}) {
106
107
  layout: r
107
108
  };
108
109
  }
109
- function ae(e, t, n, i) {
110
- let a = e.current.owner === t ? e.current.options : {}, o = r(n, a, i);
111
- return o && (e.current = {
110
+ function ae(e, t, n, r) {
111
+ let i = e.current.owner === t ? e.current.options : {}, a = u(n, i, r);
112
+ return a && (e.current = {
112
113
  owner: t,
113
- options: i
114
- }), o;
114
+ options: r
115
+ }), a;
115
116
  }
116
- function oe(e, t, n, r) {
117
- let [i, a] = A(null), [o, c] = A(0), l = k(n), u = k({
117
+ function oe(e, t, r, i) {
118
+ let [a, o] = A(null), [s, c] = A(0), l = k(r), u = k({
118
119
  owner: null,
119
120
  options: {}
120
121
  }), d = k({
121
122
  owner: null,
122
123
  options: {}
123
124
  });
124
- return l.current = n, D(() => {
125
- let n = e.current;
126
- if (!n) return;
127
- let r = l.current?.layout, i = C(n, s({ autoSize: !0 }, { layout: {
128
- colorSpace: r?.colorSpace,
129
- colorParsers: r?.colorParsers
130
- } })), o = i.addSeries(t);
131
- return a({
132
- chart: i,
133
- series: o,
134
- chartDefaults: U(s(i.options())),
135
- seriesDefaults: s(o.options())
125
+ return l.current = r, D(() => {
126
+ let r = e.current;
127
+ if (!r) return;
128
+ let i = l.current?.layout, a = C(r, n({ autoSize: !0 }, { layout: {
129
+ colorSpace: i?.colorSpace,
130
+ colorParsers: i?.colorParsers
131
+ } })), s = a.addSeries(t);
132
+ return o({
133
+ chart: a,
134
+ series: s,
135
+ chartDefaults: U(n(a.options())),
136
+ seriesDefaults: n(s.options())
136
137
  }), () => {
137
- a(null), i.remove();
138
+ o(null), a.remove();
138
139
  };
139
140
  }, [
140
141
  e,
141
142
  t,
142
- o
143
+ s
143
144
  ]), D(() => {
144
- if (!i) return;
145
- let e = U(n), t = ae(u, i, i.chartDefaults, e);
146
- t ? i.chart.applyOptions(t) : c((e) => e + 1);
147
- }, [i, n]), D(() => {
148
- if (!i) return;
149
- let e = r ?? {}, t = ae(d, i, i.seriesDefaults, e);
150
- t ? i.series.applyOptions(t) : c((e) => e + 1);
151
- }, [i, r]), i;
145
+ if (!a) return;
146
+ let e = U(r), t = ae(u, a, a.chartDefaults, e);
147
+ t ? a.chart.applyOptions(t) : c((e) => e + 1);
148
+ }, [a, r]), D(() => {
149
+ if (!a) return;
150
+ let e = i ?? {}, t = ae(d, a, a.seriesDefaults, e);
151
+ t ? a.series.applyOptions(t) : c((e) => e + 1);
152
+ }, [a, i]), a;
152
153
  }
153
154
  //#endregion
154
155
  //#region src/utils/time.utils.ts
@@ -257,10 +258,10 @@ function pe(e) {
257
258
  return [...new Set(e.map((e) => e.key))];
258
259
  }
259
260
  function me(e, t, r = {}) {
260
- let i = t?.palette.categorical ?? [];
261
- return Object.fromEntries(e.map((e, a) => {
262
- let o = i[a % i.length], c = t && (n(o, t.bands.opacity) ?? o) || fe, l = r[e];
263
- return [e, s({
261
+ let a = t?.palette.categorical ?? [];
262
+ return Object.fromEntries(e.map((e, o) => {
263
+ let s = a[o % a.length], c = t && (i(s, t.bands.opacity) ?? s) || fe, l = r[e];
264
+ return [e, n({
264
265
  fill: c,
265
266
  label: e
266
267
  }, t?.bands.styles?.[e], typeof l == "string" ? { fill: l } : l)];
@@ -400,28 +401,28 @@ function _e(e, t, n, r, i) {
400
401
  //#endregion
401
402
  //#region src/hooks/useOverlays.ts
402
403
  function ve(e, t = []) {
403
- let n = k([]);
404
+ let r = k([]);
404
405
  return D(() => {
405
- n.current = [];
406
+ r.current = [];
406
407
  }, [e]), D(() => {
407
408
  if (!e) return;
408
- let { chart: i } = e, a = n.current, o = (e) => {
409
+ let { chart: i } = e, a = r.current, o = (e) => {
409
410
  let t = i.addSeries(x, e);
410
411
  return {
411
412
  series: t,
412
- defaults: s(t.options()),
413
+ defaults: n(t.options()),
413
414
  options: e
414
415
  };
415
416
  };
416
417
  t.forEach((e, t) => {
417
- let n = e.seriesOptions ?? {}, s = a[t];
418
- if (s && s.options !== n) {
419
- let e = r(s.defaults, s.options, n);
420
- e ? (s.series.applyOptions(e), s.options = n) : (i.removeSeries(s.series), s = void 0);
418
+ let n = e.seriesOptions ?? {}, r = a[t];
419
+ if (r && r.options !== n) {
420
+ let e = u(r.defaults, r.options, n);
421
+ e ? (r.series.applyOptions(e), r.options = n) : (i.removeSeries(r.series), r = void 0);
421
422
  }
422
- s || (a[t] = s = o(n)), s.series.setData(G(e.data).data);
423
+ r || (a[t] = r = o(n)), r.series.setData(G(e.data).data);
423
424
  }), a.splice(t.length).forEach((e) => i.removeSeries(e.series));
424
- }, [e, t]), n;
425
+ }, [e, t]), r;
425
426
  }
426
427
  //#endregion
427
428
  //#region src/utils/live.utils.ts
@@ -622,7 +623,7 @@ function Ve(e, t, n, r) {
622
623
  let a = i.current;
623
624
  i.current = t;
624
625
  let o = n.current, s = Se(a, t), c = t.rows[t.rows.length - 1];
625
- if (!e || !o || !r || !s || !c || typeof o.animate != "function" || m()) return;
626
+ if (!e || !o || !r || !s || !c || typeof o.animate != "function" || f()) return;
626
627
  let { chart: l, series: u } = e, d = requestAnimationFrame(() => {
627
628
  let e = u.priceToCoordinate(c.close), t = l.priceScale("right").width(), n = Ce(u.options());
628
629
  if (e === null || t === 0 || n === null) return;
@@ -652,26 +653,26 @@ function Ue(e, t = He) {
652
653
  }
653
654
  //#endregion
654
655
  //#region src/hooks/useSeriesTheme.ts
655
- function We(e, { magnet: t, magnetMode: n, ctrlWheelZoom: r, chartOptions: i, anchorLine: o, overlays: l }) {
656
+ function We(e, { magnet: t, magnetMode: r, ctrlWheelZoom: i, chartOptions: o, anchorLine: c, overlays: u }) {
656
657
  return {
657
- options: O(() => s(a(e), t && { crosshair: { mode: n } }, r && {
658
+ options: O(() => n(a(e), t && { crosshair: { mode: r } }, i && {
658
659
  handleScale: { mouseWheel: !1 },
659
660
  handleScroll: { mouseWheel: !1 }
660
- }, i), [
661
+ }, o), [
661
662
  e,
662
663
  t,
663
- n,
664
664
  r,
665
- i
665
+ i,
666
+ o
666
667
  ]),
667
- themedAnchorLine: O(() => u(c(e, e?.anchor, void 0), o), [e, o]),
668
+ themedAnchorLine: O(() => l(s(e, e?.anchor, void 0), c), [e, c]),
668
669
  themedOverlays: O(() => {
669
670
  let t = e?.line.overlays;
670
- return t?.length && l ? l.map((e, n) => ({
671
+ return t?.length && u ? u.map((e, r) => ({
671
672
  ...e,
672
- seriesOptions: s({ color: t[n % t.length] }, e.seriesOptions)
673
- })) : l;
674
- }, [e, l])
673
+ seriesOptions: n({ color: t[r % t.length] }, e.seriesOptions)
674
+ })) : u;
675
+ }, [e, u])
675
676
  };
676
677
  }
677
678
  //#endregion
@@ -1115,7 +1116,7 @@ function mt({ interactions: { legend: e, tooltip: t }, renderLegend: n, renderTo
1115
1116
  }
1116
1117
  //#endregion
1117
1118
  //#region src/charts/SeriesChart/index.tsx
1118
- function ht({ data: e, definition: t, normalize: r, aggregate: i, magnetMode: a = y.MagnetOHLC, chartOptions: o, seriesOptions: s, className: c, ariaLabel: l = "Chart", liveButtonClassName: u, liveButtonLabel: d = "Jump to live", magnet: f = !0, flashLastPrice: m = !0, followLive: h = !0, ctrlWheelZoom: g = !0, renderLegend: _, renderTooltip: v, pinOnClick: b = !1, keyboard: x = !1, range: S, anchor: C, anchorLine: w, autoBucket: T, onVisibleStatsChange: E, onPointClick: D, onPointHover: O, onPointLeave: A, overlays: j, priceLines: P, bands: F, bandStyles: I, renderBandLegend: B, classNames: V = {}, styles: H = {}, rangeSelect: U = !0, doubleClickReset: ae = !0, onRangeSelect: se, onReset: W, theme: ce, unstyled: le }, ue) {
1119
+ function ht({ data: e, definition: t, normalize: n, aggregate: r, magnetMode: a = y.MagnetOHLC, chartOptions: o, seriesOptions: s, className: c, ariaLabel: l = "Chart", liveButtonClassName: u, liveButtonLabel: d = "Jump to live", magnet: f = !0, flashLastPrice: m = !0, followLive: h = !0, ctrlWheelZoom: g = !0, renderLegend: _, renderTooltip: v, pinOnClick: b = !1, keyboard: x = !1, range: S, anchor: C, anchorLine: w, autoBucket: T, onVisibleStatsChange: E, onPointClick: D, onPointHover: O, onPointLeave: A, overlays: j, priceLines: P, bands: F, bandStyles: I, renderBandLegend: B, classNames: V = {}, styles: H = {}, rangeSelect: U = !0, doubleClickReset: ae = !0, onRangeSelect: se, onReset: W, theme: ce, unstyled: le }, ue) {
1119
1120
  let G = k(null), de = k(null), K = k(null), fe = k(null), q = p({
1120
1121
  theme: ce,
1121
1122
  unstyled: le
@@ -1126,7 +1127,7 @@ function ht({ data: e, definition: t, normalize: r, aggregate: i, magnetMode: a
1126
1127
  chartOptions: o,
1127
1128
  anchorLine: w,
1128
1129
  overlays: j
1129
- }), J = oe(G, t, pe, s), Y = Pe(J, e, r, i, T), ge = ve(J, he), { entries: X, bandOf: ye } = _e(J, Y, F, I, q);
1130
+ }), J = oe(G, t, pe, s), Y = Pe(J, e, n, r, T), ge = ve(J, he), { entries: X, bandOf: ye } = _e(J, Y, F, I, q);
1130
1131
  Ue(J, P), Je(J, Y, S), dt(J, Y, E);
1131
1132
  let be = ut(J, G, de, Y, {
1132
1133
  anchor: C,
@@ -1196,7 +1197,7 @@ function ht({ data: e, definition: t, normalize: r, aggregate: i, magnetMode: a
1196
1197
  className: V.rangeSelect,
1197
1198
  style: {
1198
1199
  ...ie,
1199
- background: n(q?.palette.crosshair, .1),
1200
+ background: i(q?.palette.crosshair, .1),
1200
1201
  ...H.rangeSelect
1201
1202
  },
1202
1203
  "aria-hidden": "true"
@@ -1240,7 +1241,7 @@ var vt = (e) => e(), yt = (e) => {
1240
1241
  };
1241
1242
  };
1242
1243
  function bt(e, t) {
1243
- return s({ autoscaleInfoProvider: e === "diverging" ? yt : vt }, t);
1244
+ return n({ autoscaleInfoProvider: e === "diverging" ? yt : vt }, t);
1244
1245
  }
1245
1246
  function xt(e, t, n, r) {
1246
1247
  let i = [];
@@ -1341,14 +1342,14 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
1341
1342
  "bottomFillColor2"
1342
1343
  ]
1343
1344
  }
1344
- }, Dt = T(function({ variant: e = "line", seriesOptions: t, baseValue: n, ariaLabel: r = Et[e].label, ...i }, a) {
1345
- let c = p(i), l = O(() => s(o(c, e), n !== void 0 && { baseValue: {
1345
+ }, Dt = T(function({ variant: e = "line", seriesOptions: t, baseValue: r, ariaLabel: i = Et[e].label, ...a }, s) {
1346
+ let c = p(a), l = O(() => n(o(c, e), r !== void 0 && { baseValue: {
1346
1347
  type: "price",
1347
- price: n
1348
+ price: r
1348
1349
  } }, t), [
1349
1350
  c,
1350
1351
  e,
1351
- n,
1352
+ r,
1352
1353
  t
1353
1354
  ]), u = E((t) => {
1354
1355
  let n = G(t), { colorKeys: r, styleKeys: i } = Et[e];
@@ -1358,9 +1359,9 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
1358
1359
  };
1359
1360
  }, [e]);
1360
1361
  return /* @__PURE__ */ M(Q, {
1361
- ...i,
1362
- ref: a,
1363
- ariaLabel: r,
1362
+ ...a,
1363
+ ref: s,
1364
+ ariaLabel: i,
1364
1365
  seriesOptions: l,
1365
1366
  definition: Et[e].definition,
1366
1367
  magnetMode: y.Magnet,
@@ -1383,18 +1384,18 @@ function kt(e, t) {
1383
1384
  }
1384
1385
  //#endregion
1385
1386
  //#region src/charts/HistogramChart/index.tsx
1386
- var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLine: i, colors: a, seriesOptions: o, ariaLabel: l = "Histogram chart", ...d }, f) {
1387
- let m = O(() => bt(t, o), [t, o]), h = p(d), g = O(() => xt(t, n, u(c(h, h?.histogram.threshold, "dashed"), r), u(c(h, h?.histogram.zero, "solid"), i)), [
1387
+ var At = T(function({ mode: t = "plain", threshold: r, thresholdLine: i, zeroLine: a, colors: o, seriesOptions: c, ariaLabel: u = "Histogram chart", ...d }, f) {
1388
+ let m = O(() => bt(t, c), [t, c]), h = p(d), g = O(() => xt(t, r, l(s(h, h?.histogram.threshold, "dashed"), i), l(s(h, h?.histogram.zero, "solid"), a)), [
1388
1389
  h,
1389
1390
  t,
1390
- n,
1391
1391
  r,
1392
- i
1393
- ]), { bar: _, over: v, positive: x, negative: S } = O(() => s(e(h), a), [h, a]), C = E((e) => {
1394
- let r = G(e);
1392
+ i,
1393
+ a
1394
+ ]), { bar: _, over: v, positive: x, negative: S } = O(() => n(e(h), o), [h, o]), C = E((e) => {
1395
+ let n = G(e);
1395
1396
  return {
1396
- ...r,
1397
- data: _t(r.data, t, n, {
1397
+ ...n,
1398
+ data: _t(n.data, t, r, {
1398
1399
  bar: _,
1399
1400
  over: v,
1400
1401
  positive: x,
@@ -1403,7 +1404,7 @@ var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLin
1403
1404
  };
1404
1405
  }, [
1405
1406
  t,
1406
- n,
1407
+ r,
1407
1408
  _,
1408
1409
  v,
1409
1410
  x,
@@ -1412,7 +1413,7 @@ var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLin
1412
1413
  return /* @__PURE__ */ M(Q, {
1413
1414
  ...d,
1414
1415
  ref: f,
1415
- ariaLabel: l,
1416
+ ariaLabel: u,
1416
1417
  seriesOptions: m,
1417
1418
  priceLines: g,
1418
1419
  definition: b,
@@ -1420,13 +1421,13 @@ var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLin
1420
1421
  aggregate: St,
1421
1422
  magnetMode: y.Magnet
1422
1423
  });
1423
- }), jt = T(function({ ariaLabel: e = "Candlestick chart", seriesOptions: t, ...n }, r) {
1424
- let i = p(n), a = O(() => s(l(i), t), [i, t]);
1424
+ }), jt = T(function({ ariaLabel: e = "Candlestick chart", seriesOptions: t, ...r }, i) {
1425
+ let a = p(r), o = O(() => n(c(a), t), [a, t]);
1425
1426
  return /* @__PURE__ */ M(Q, {
1426
- ...n,
1427
- ref: r,
1427
+ ...r,
1428
+ ref: i,
1428
1429
  ariaLabel: e,
1429
- seriesOptions: a,
1430
+ seriesOptions: o,
1430
1431
  definition: _,
1431
1432
  normalize: ue,
1432
1433
  aggregate: kt
@@ -1466,13 +1467,13 @@ var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLin
1466
1467
  } } : null;
1467
1468
  }
1468
1469
  draw(e) {
1469
- let t = this.chart, r = this.series;
1470
- if (!t || !r || this.points.length < 2) return;
1471
- let i = t.timeScale(), a = this.points.flatMap((e) => {
1472
- let t = F(i, e.time), n = r.priceToCoordinate(e.upper), a = r.priceToCoordinate(e.lower);
1473
- return t === null || n === null || a === null ? [] : [{
1470
+ let t = this.chart, n = this.series;
1471
+ if (!t || !n || this.points.length < 2) return;
1472
+ let r = t.timeScale(), a = this.points.flatMap((e) => {
1473
+ let t = F(r, e.time), i = n.priceToCoordinate(e.upper), a = n.priceToCoordinate(e.lower);
1474
+ return t === null || i === null || a === null ? [] : [{
1474
1475
  x: t,
1475
- upper: n,
1476
+ upper: i,
1476
1477
  lower: a
1477
1478
  }];
1478
1479
  }), o = a[0];
@@ -1483,7 +1484,7 @@ var At = T(function({ mode: t = "plain", threshold: n, thresholdLine: r, zeroLin
1483
1484
  let n = a[t];
1484
1485
  e.lineTo(n.x, n.lower);
1485
1486
  }
1486
- e.closePath(), e.fillStyle = n(this.color, this.opacity) ?? this.color, e.fill();
1487
+ e.closePath(), e.fillStyle = i(this.color, this.opacity) ?? this.color, e.fill();
1487
1488
  });
1488
1489
  }
1489
1490
  }, Nt = /* @__PURE__ */ new Set(), Pt = !1, $;
@@ -1655,7 +1656,7 @@ function en(e) {
1655
1656
  function tn(e, t, n) {
1656
1657
  return e.color ?? n[t % Math.max(1, n.length)] ?? "#191919";
1657
1658
  }
1658
- function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, markers: c = Qt, onPointClick: l, height: u = 340, className: d, ariaLabel: m = "Time series chart", profile: h = "editorial", axis: g = "time", categories: _, timeVisible: v = !1, formatTime: b, formatValue: x, extraTooltipRows: T, renderTooltip: E, chartOptions: ee, theme: O, unstyled: j }) {
1659
+ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, markers: c = Qt, onPointClick: l, height: u = 340, className: d, ariaLabel: f = "Time series chart", profile: h = "editorial", axis: g = "time", categories: _, timeVisible: v = !1, formatTime: b, formatValue: x, extraTooltipRows: T, renderTooltip: E, chartOptions: ee, theme: O, unstyled: j }) {
1659
1660
  let P = k(null), F = p({
1660
1661
  theme: O,
1661
1662
  unstyled: j
@@ -1673,13 +1674,13 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1673
1674
  renderTooltip: E,
1674
1675
  onPointClick: l
1675
1676
  };
1676
- let B = h === "editorial", V = g === "ordinal" ? _ ?? Jt : null, H = F ?? i;
1677
+ let B = h === "editorial", V = g === "ordinal" ? _ ?? Jt : null, H = F ?? r;
1677
1678
  D(() => {
1678
1679
  let e = P.current;
1679
1680
  if (e && B) return Ft(e);
1680
1681
  }, [B]), D(() => {
1681
- let i = P.current;
1682
- if (!i) return;
1682
+ let r = P.current;
1683
+ if (!r) return;
1683
1684
  let l = H.palette, d = l.categorical, f = e.some((e) => en(e) === "left") || t.some((e) => e.priceScale === "left"), p = e.length === 0 || e.some((e) => en(e) === "right") || t.some((e) => (e.priceScale ?? "right") === "right"), m = (e) => {
1684
1685
  let t = typeof e == "number" ? e : W(e);
1685
1686
  return t === null ? "" : V ? Vt(t, V) : z.current.formatTime?.(t) ?? Gt(t);
@@ -1690,7 +1691,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1690
1691
  rightPriceScale: p,
1691
1692
  tickMarkFormatter: m,
1692
1693
  timeFormatter: m
1693
- }) : s(a(H), {
1694
+ }) : n(a(H), {
1694
1695
  height: u,
1695
1696
  crosshair: { mode: y.Magnet },
1696
1697
  handleScale: { mouseWheel: !1 },
@@ -1702,43 +1703,43 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1702
1703
  tickMarkFormatter: m
1703
1704
  },
1704
1705
  localization: { timeFormatter: m }
1705
- }), g = C(i, s({ autoSize: !0 }, h, ee)), _ = /* @__PURE__ */ new Map(), b = e.map((e, t) => {
1706
- let r = tn(e, t, d), i = e.kind ?? "line", a = e.lineWidth ?? (i === "line" ? 2 : 1), o = {
1706
+ }), g = C(r, n({ autoSize: !0 }, h, ee)), _ = /* @__PURE__ */ new Map(), b = e.map((e, t) => {
1707
+ let n = tn(e, t, d), r = e.kind ?? "line", a = e.lineWidth ?? (r === "line" ? 2 : 1), o = {
1707
1708
  priceScaleId: en(e),
1708
1709
  priceLineVisible: !1,
1709
1710
  lastValueVisible: e.lastValueVisible ?? !1
1710
- }, s = i === "area" ? {
1711
+ }, s = r === "area" ? {
1711
1712
  ...o,
1712
- lineColor: r,
1713
+ lineColor: n,
1713
1714
  lineWidth: a,
1714
1715
  lineStyle: Kt[e.lineStyle ?? "solid"],
1715
- topColor: n(r, .2) ?? r,
1716
- bottomColor: n(r, 0) ?? r
1717
- } : i === "histogram" ? {
1716
+ topColor: i(n, .2) ?? n,
1717
+ bottomColor: i(n, 0) ?? n
1718
+ } : r === "histogram" ? {
1718
1719
  ...o,
1719
- color: r
1720
+ color: n
1720
1721
  } : {
1721
1722
  ...o,
1722
- color: r,
1723
+ color: n,
1723
1724
  lineWidth: a,
1724
1725
  lineStyle: Kt[e.lineStyle ?? "solid"],
1725
1726
  crosshairMarkerVisible: !0
1726
- }, l = g.addSeries(qt[i], s), u = Ut(e.data, V);
1727
+ }, l = g.addSeries(qt[r], s), u = Ut(e.data, V);
1727
1728
  l.setData(u), _.set(en(e), l);
1728
1729
  let f = c.flatMap((t) => {
1729
1730
  if (t.seriesId !== e.id) return [];
1730
- let n = Ht(t.time, V);
1731
- return n === null ? [] : [{
1732
- time: n,
1731
+ let r = Ht(t.time, V);
1732
+ return r === null ? [] : [{
1733
+ time: r,
1733
1734
  position: t.position ?? "inBar",
1734
1735
  shape: t.shape ?? "circle",
1735
- color: t.color ?? r,
1736
+ color: t.color ?? n,
1736
1737
  text: t.text
1737
1738
  }];
1738
1739
  });
1739
1740
  return f.length > 0 && w(l, f), {
1740
1741
  spec: e,
1741
- color: r,
1742
+ color: n,
1742
1743
  rows: u,
1743
1744
  apiSeries: l
1744
1745
  };
@@ -1754,8 +1755,8 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1754
1755
  }));
1755
1756
  }
1756
1757
  let x = b[0]?.apiSeries;
1757
- x && r.length > 0 && x.attachPrimitive(new X({
1758
- items: r.map((e) => ({
1758
+ x && o.length > 0 && x.attachPrimitive(new X({
1759
+ items: o.map((e) => ({
1759
1760
  from: e.from,
1760
1761
  to: e.to,
1761
1762
  key: e.id,
@@ -1763,7 +1764,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1763
1764
  color: e.fill
1764
1765
  })),
1765
1766
  style: (e) => {
1766
- let t = r.find((t) => t.id === e), n = t?.hatch;
1767
+ let t = o.find((t) => t.id === e), n = t?.hatch;
1767
1768
  return {
1768
1769
  fill: t?.fill,
1769
1770
  hatch: n !== !1 && {
@@ -1776,7 +1777,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1776
1777
  }
1777
1778
  }));
1778
1779
  let T = /* @__PURE__ */ new Map();
1779
- for (let e of o) {
1780
+ for (let e of s) {
1780
1781
  let t = _.get(e.scale ?? "right") ?? b[0]?.apiSeries;
1781
1782
  if (!t || (t.createPriceLine({
1782
1783
  price: e.value,
@@ -1844,8 +1845,8 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1844
1845
  }, [
1845
1846
  e,
1846
1847
  t,
1847
- r,
1848
1848
  o,
1849
+ s,
1849
1850
  c,
1850
1851
  F,
1851
1852
  u,
@@ -1858,7 +1859,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1858
1859
  chart: I,
1859
1860
  series: null
1860
1861
  } : null, P, !B);
1861
- let ie = P.current?.getBoundingClientRect(), U = L ? f([L.x, L.y], 12, [180, 56], [ie?.width || u, ie?.height || u]) : null;
1862
+ let ie = P.current?.getBoundingClientRect(), U = L ? m([L.x, L.y], 12, [180, 56], [ie?.width || u, ie?.height || u]) : null;
1862
1863
  return /* @__PURE__ */ N("div", {
1863
1864
  className: d,
1864
1865
  "data-profile": h,
@@ -1871,7 +1872,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1871
1872
  ref: P,
1872
1873
  style: ne,
1873
1874
  role: "img",
1874
- "aria-label": m
1875
+ "aria-label": f
1875
1876
  }), L && U && /* @__PURE__ */ N("div", {
1876
1877
  "data-part": "tooltip",
1877
1878
  style: {
@@ -1914,4 +1915,4 @@ function nn({ series: e, ribbons: t = Yt, ranges: r = Xt, guides: o = Zt, marker
1914
1915
  //#endregion
1915
1916
  export { oe as C, W as S, De as _, jt as a, me as b, Ot as c, St as d, Ct as f, Q as g, xt as h, Mt as i, Dt as l, bt as m, Lt as n, At as o, _t as p, Ft as r, kt as s, nn as t, Tt as u, X as v, F as w, G as x, he as y };
1916
1917
 
1917
- //# sourceMappingURL=TimeSeriesChart-BIwJxgnD.js.map
1918
+ //# sourceMappingURL=TimeSeriesChart-BzeHEtQl.js.map