p1-charts 0.2.0 → 0.4.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 (168) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +158 -4
  3. package/dist/CategoryBarChart-KYzsjGwg.js +715 -0
  4. package/dist/CategoryBarChart-KYzsjGwg.js.map +1 -0
  5. package/dist/ChartFrame-DOEsou-R.js +403 -0
  6. package/dist/ChartFrame-DOEsou-R.js.map +1 -0
  7. package/dist/ChartLegend-B8ZmIG2y.js +46 -0
  8. package/dist/ChartLegend-B8ZmIG2y.js.map +1 -0
  9. package/dist/{Heatmap-C1XcTUg1.js → Heatmap-Bwhf305C.js} +278 -272
  10. package/dist/Heatmap-Bwhf305C.js.map +1 -0
  11. package/dist/{PieLegend-BZsv9IbF.js → PieLegend-16E6W10x.js} +94 -111
  12. package/dist/PieLegend-16E6W10x.js.map +1 -0
  13. package/dist/PolarChart-C_vPz-3K.js +489 -0
  14. package/dist/PolarChart-C_vPz-3K.js.map +1 -0
  15. package/dist/Sparkline-BApLVWfg.js +110 -0
  16. package/dist/Sparkline-BApLVWfg.js.map +1 -0
  17. package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BZMLERDZ.js} +530 -529
  18. package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BZMLERDZ.js.map} +1 -1
  19. package/dist/category.d.ts +5 -2
  20. package/dist/category.d.ts.map +1 -1
  21. package/dist/category.js +4 -3
  22. package/dist/charts/CategoryBarChart/index.d.ts +3 -1
  23. package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
  24. package/dist/charts/Heatmap/index.d.ts.map +1 -1
  25. package/dist/charts/PolarChart/index.d.ts.map +1 -1
  26. package/dist/charts/ScatterChart/index.d.ts +1 -1
  27. package/dist/charts/ScatterChart/index.d.ts.map +1 -1
  28. package/dist/charts/Sparkline/index.d.ts +5 -2
  29. package/dist/charts/Sparkline/index.d.ts.map +1 -1
  30. package/dist/components/ChartFrame/index.d.ts +7 -0
  31. package/dist/components/ChartFrame/index.d.ts.map +1 -0
  32. package/dist/components/ChartLegend/index.d.ts +13 -0
  33. package/dist/components/ChartLegend/index.d.ts.map +1 -0
  34. package/dist/components/ChartStory/index.d.ts +7 -0
  35. package/dist/components/ChartStory/index.d.ts.map +1 -0
  36. package/dist/components/HeatmapCells/index.d.ts +1 -1
  37. package/dist/components/HeatmapCells/index.d.ts.map +1 -1
  38. package/dist/{css-C-rsk7-l.js → css-BTZA9hea.js} +2 -2
  39. package/dist/{css-C-rsk7-l.js.map → css-BTZA9hea.js.map} +1 -1
  40. package/dist/heatmap.js +1 -1
  41. package/dist/hooks/useMarkMemory.d.ts +9 -0
  42. package/dist/hooks/useMarkMemory.d.ts.map +1 -0
  43. package/dist/hooks/usePieTween.d.ts.map +1 -1
  44. package/dist/hooks/useSteps.d.ts +4 -0
  45. package/dist/hooks/useSteps.d.ts.map +1 -0
  46. package/dist/hooks/useTween.d.ts +12 -0
  47. package/dist/hooks/useTween.d.ts.map +1 -0
  48. package/dist/index.d.ts +16 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +122 -117
  51. package/dist/index.js.map +1 -1
  52. package/dist/motion.utils-DFoqptDi.js +55 -0
  53. package/dist/motion.utils-DFoqptDi.js.map +1 -0
  54. package/dist/pie.js +1 -1
  55. package/dist/scatter.d.ts +4 -1
  56. package/dist/scatter.d.ts.map +1 -1
  57. package/dist/scatter.js +3 -2
  58. package/dist/series.js +1 -1
  59. package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
  60. package/dist/shared-C1pGJV4T.js.map +1 -0
  61. package/dist/sparkline.d.ts +1 -1
  62. package/dist/sparkline.d.ts.map +1 -1
  63. package/dist/sparkline.js +2 -2
  64. package/dist/standalone/p1-charts.standalone.js +13 -0
  65. package/dist/standalone.d.ts +27 -0
  66. package/dist/standalone.d.ts.map +1 -0
  67. package/dist/story.d.ts +11 -0
  68. package/dist/story.d.ts.map +1 -0
  69. package/dist/story.js +7 -0
  70. package/dist/theme.js +3 -3
  71. package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DF_e8LxQ.js} +132 -113
  72. package/dist/theme.utils-DF_e8LxQ.js.map +1 -0
  73. package/dist/tooltip.utils-CXD_NapA.js +9 -0
  74. package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
  75. package/dist/types/category.d.ts +26 -0
  76. package/dist/types/category.d.ts.map +1 -1
  77. package/dist/types/heatmap.d.ts +3 -0
  78. package/dist/types/heatmap.d.ts.map +1 -1
  79. package/dist/types/heatmapParts.d.ts +2 -0
  80. package/dist/types/heatmapParts.d.ts.map +1 -1
  81. package/dist/types/motion.d.ts +31 -0
  82. package/dist/types/motion.d.ts.map +1 -0
  83. package/dist/types/pie.d.ts +3 -4
  84. package/dist/types/pie.d.ts.map +1 -1
  85. package/dist/types/polar.d.ts +3 -0
  86. package/dist/types/polar.d.ts.map +1 -1
  87. package/dist/types/scatter.d.ts +34 -0
  88. package/dist/types/scatter.d.ts.map +1 -1
  89. package/dist/types/sparkline.d.ts +3 -0
  90. package/dist/types/sparkline.d.ts.map +1 -1
  91. package/dist/types/story.d.ts +73 -0
  92. package/dist/types/story.d.ts.map +1 -0
  93. package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-D0bQ3LQq.js} +2 -2
  94. package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-D0bQ3LQq.js.map} +1 -1
  95. package/dist/useControllable-Crsr0byh.js +11 -0
  96. package/dist/useControllable-Crsr0byh.js.map +1 -0
  97. package/dist/useMarkMemory-CLNY6TtT.js +15 -0
  98. package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
  99. package/dist/useTween-B0G0CcvM.js +46 -0
  100. package/dist/useTween-B0G0CcvM.js.map +1 -0
  101. package/dist/utils/category.utils.d.ts +15 -1
  102. package/dist/utils/category.utils.d.ts.map +1 -1
  103. package/dist/utils/color.utils.d.ts +9 -0
  104. package/dist/utils/color.utils.d.ts.map +1 -1
  105. package/dist/utils/csv.utils.d.ts +6 -0
  106. package/dist/utils/csv.utils.d.ts.map +1 -0
  107. package/dist/utils/motion.utils.d.ts +25 -0
  108. package/dist/utils/motion.utils.d.ts.map +1 -1
  109. package/dist/utils/pieTween.utils.d.ts +1 -1
  110. package/dist/utils/pieTween.utils.d.ts.map +1 -1
  111. package/dist/utils/scatter.utils.d.ts +17 -1
  112. package/dist/utils/scatter.utils.d.ts.map +1 -1
  113. package/dist/utils/sparkline.utils.d.ts +15 -0
  114. package/dist/utils/sparkline.utils.d.ts.map +1 -1
  115. package/dist/utils/theme.utils.d.ts +1 -1
  116. package/dist/utils/theme.utils.d.ts.map +1 -1
  117. package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
  118. package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
  119. package/package.json +16 -5
  120. package/src/category.ts +5 -1
  121. package/src/charts/CategoryBarChart/index.tsx +310 -62
  122. package/src/charts/Heatmap/index.tsx +4 -0
  123. package/src/charts/PolarChart/index.tsx +98 -5
  124. package/src/charts/ScatterChart/index.tsx +164 -18
  125. package/src/charts/Sparkline/index.tsx +54 -7
  126. package/src/components/ChartFrame/index.tsx +180 -0
  127. package/src/components/ChartLegend/index.tsx +46 -0
  128. package/src/components/ChartStory/index.tsx +184 -0
  129. package/src/components/HeatmapCells/index.tsx +5 -2
  130. package/src/hooks/useMarkMemory.ts +29 -0
  131. package/src/hooks/usePieTween.ts +9 -44
  132. package/src/hooks/useSteps.ts +77 -0
  133. package/src/hooks/useTween.ts +112 -0
  134. package/src/index.ts +24 -1
  135. package/src/scatter.ts +4 -1
  136. package/src/sparkline.ts +1 -1
  137. package/src/standalone.tsx +68 -0
  138. package/src/story.ts +19 -0
  139. package/src/types/category.ts +27 -0
  140. package/src/types/heatmap.ts +3 -0
  141. package/src/types/heatmapParts.ts +2 -0
  142. package/src/types/motion.ts +35 -0
  143. package/src/types/pie.ts +3 -3
  144. package/src/types/polar.ts +3 -0
  145. package/src/types/scatter.ts +23 -0
  146. package/src/types/sparkline.ts +3 -0
  147. package/src/types/story.ts +103 -0
  148. package/src/utils/category.utils.ts +111 -2
  149. package/src/utils/color.utils.ts +48 -0
  150. package/src/utils/csv.utils.ts +28 -0
  151. package/src/utils/motion.utils.ts +124 -0
  152. package/src/utils/pieTween.utils.ts +1 -2
  153. package/src/utils/scatter.utils.ts +22 -5
  154. package/src/utils/sparkline.utils.ts +69 -0
  155. package/src/utils/theme.utils.ts +18 -15
  156. package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
  157. package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
  158. package/dist/Heatmap-C1XcTUg1.js.map +0 -1
  159. package/dist/PieLegend-BZsv9IbF.js.map +0 -1
  160. package/dist/PolarChart-BUEhn3CI.js +0 -334
  161. package/dist/PolarChart-BUEhn3CI.js.map +0 -1
  162. package/dist/Sparkline-DtNhxGVo.js +0 -67
  163. package/dist/Sparkline-DtNhxGVo.js.map +0 -1
  164. package/dist/motion.utils-C1eaZJdQ.js +0 -9
  165. package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
  166. package/dist/theme.utils-CP1XtGIe.js.map +0 -1
  167. package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
  168. package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,24 +1,29 @@
1
1
  "use client";
2
- import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, m as c, n as l, p as u, r as d, s as f, u as p } from "./theme.utils-CP1XtGIe.js";
3
- import { a as m, c as h, i as g, l as _, o as v, r as y, s as b } from "./visibility.utils-nMI5a_Et.js";
4
- import { a as x, c as S, d as ee, f as C, i as w, l as T, m as E, n as te, o as D, p as O, r as k, s as ne, t as re, u as A } from "./Heatmap-C1XcTUg1.js";
5
- import { n as j, t as ie } from "./useChartTheme-B06p_jvu.js";
6
- import { C as ae, S as M, _ as oe, a as N, b as P, c as F, d as I, f as L, g as R, h as z, i as B, l as se, m as V, n as ce, o as le, p as ue, r as de, s as fe, t as pe, u as me, v as H, w as U, x as W, y as he } from "./TimeSeriesChart-BIwJxgnD.js";
7
- import { a as ge, i as _e, n as ve, o as ye, r as be, t as xe } from "./PieLegend-BZsv9IbF.js";
8
- import { t as Se } from "./CategoryBarChart-YEJ9VB8h.js";
9
- import { r as Ce, t as we } from "./PolarChart-BUEhn3CI.js";
10
- import { t as Te } from "./Sparkline-DtNhxGVo.js";
11
- import { t as Ee } from "./bin.utils-Ch1y7YDn.js";
12
- import { i as De, n as Oe, r as ke, t as Ae } from "./css-C-rsk7-l.js";
13
- import { HistogramSeries as G } from "lightweight-charts";
14
- import { Children as je, forwardRef as K, isValidElement as q, useEffect as J, useImperativeHandle as Me, useMemo as Y, useRef as X, useState as Ne } from "react";
2
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, p as d, r as f, s as p, u as m, y as h } from "./theme.utils-DF_e8LxQ.js";
3
+ import { a as g, c as _, i as v, n as y, o as b, r as x, s as S } from "./visibility.utils-wuc3ZS8D.js";
4
+ import { a as ee, c as C, d as w, f as T, i as E, l as te, m as D, n as O, o as k, p as ne, r as re, s as A, t as j, u as M } from "./Heatmap-Bwhf305C.js";
5
+ import { i as N, n as P, r as F } from "./motion.utils-DFoqptDi.js";
6
+ import { n as I, t as L } from "./useChartTheme-D0bQ3LQq.js";
7
+ import { C as ie, S as R, _ as ae, a as z, b as B, c as V, d as oe, f as se, g as ce, h as le, i as ue, l as de, m as H, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as U, w as W, x as G, y as ye } from "./TimeSeriesChart-BZMLERDZ.js";
8
+ import { a as be, i as xe, n as Se, o as Ce, r as we, t as Te } from "./PieLegend-16E6W10x.js";
9
+ import { t as Ee } from "./useTween-B0G0CcvM.js";
10
+ import { a as De, i as Oe, t as ke } from "./CategoryBarChart-KYzsjGwg.js";
11
+ import { t as Ae } from "./useMarkMemory-CLNY6TtT.js";
12
+ import { t as je } from "./ChartLegend-B8ZmIG2y.js";
13
+ import { r as Me, t as Ne } from "./PolarChart-C_vPz-3K.js";
14
+ import { t as Pe } from "./Sparkline-BApLVWfg.js";
15
+ import { t as Fe } from "./bin.utils-Ch1y7YDn.js";
16
+ import { i as Ie, n as Le, r as Re, t as ze } from "./css-BTZA9hea.js";
17
+ import { a as Be, i as Ve, n as He, r as Ue, t as We } from "./ChartFrame-DOEsou-R.js";
18
+ import { Children as Ge, forwardRef as K, isValidElement as q, useEffect as J, useImperativeHandle as Ke, useMemo as Y, useRef as X, useState as qe } from "react";
15
19
  import { jsx as Z, jsxs as Q } from "react/jsx-runtime";
20
+ import { HistogramSeries as Je } from "lightweight-charts";
16
21
  //#region src/utils/squarify.utils.ts
17
- function Pe(e, t) {
18
- let n = b(e), [r, i] = g(e), a = t * t, o = n * n;
22
+ function Ye(e, t) {
23
+ let n = b(e), [r, i] = x(e), a = t * t, o = n * n;
19
24
  return Math.max(a * i / o, o / (a * r));
20
25
  }
21
- function Fe(e, t, n, r) {
26
+ function Xe(e, t, n, r) {
22
27
  let i = b(e.map((e) => t[e])), a = n.width >= n.height, o = i / (a ? n.height : n.width), s = 0;
23
28
  for (let i of e) {
24
29
  let e = t[i] / o;
@@ -44,7 +49,7 @@ function Fe(e, t, n, r) {
44
49
  height: Math.max(0, n.height - o)
45
50
  };
46
51
  }
47
- function Ie(e, t) {
52
+ function Ze(e, t) {
48
53
  y("squarify", e);
49
54
  let n = e.map(() => ({
50
55
  x: t.x,
@@ -56,18 +61,18 @@ function Ie(e, t) {
56
61
  let a = e.map((e) => e * i / r), o = a.map((e, t) => t).filter((e) => a[e] > 0).sort((e, t) => a[t] - a[e] || e - t), s = { ...t }, c = [], l = (e) => e.map((e) => a[e]);
57
62
  for (let e of o) {
58
63
  let t = Math.min(s.width, s.height), r = [...c, e];
59
- c.length === 0 || Pe(l(r), t) <= Pe(l(c), t) ? c = r : (s = Fe(c, a, s, n), c = [e]);
64
+ c.length === 0 || Ye(l(r), t) <= Ye(l(c), t) ? c = r : (s = Xe(c, a, s, n), c = [e]);
60
65
  }
61
- return c.length > 0 && Fe(c, a, s, n), n;
66
+ return c.length > 0 && Xe(c, a, s, n), n;
62
67
  }
63
68
  //#endregion
64
69
  //#region src/hooks/useNowLine.ts
65
- function Le(e, t, n) {
70
+ function Qe(e, t, n) {
66
71
  J(() => {
67
72
  let r = t.current;
68
73
  if (!e || !r) return;
69
74
  let { chart: i } = e, a = i.timeScale(), o = () => {
70
- let e = n === null ? null : U(a, n), t = e !== null && e >= 0 && e <= a.width();
75
+ let e = n === null ? null : W(a, n), t = e !== null && e >= 0 && e <= a.width();
71
76
  r.style.display = t ? "block" : "none", t && (r.style.transform = `translateX(${e + i.priceScale("left").width()}px)`);
72
77
  };
73
78
  return o(), a.subscribeVisibleLogicalRangeChange(o), a.subscribeSizeChange(o), () => {
@@ -86,14 +91,14 @@ function $(e) {
86
91
  }
87
92
  //#endregion
88
93
  //#region src/charts/HistogramPane/index.tsx
89
- function Re(e) {
94
+ function $e(e) {
90
95
  return null;
91
96
  }
92
97
  //#endregion
93
98
  //#region src/utils/timeline.utils.ts
94
- var ze = 18, Be = 5e3;
95
- function Ve(e, t) {
96
- let { palette: n, typography: r, timeline: i } = e, a = i.barHeight ?? ze, o = (e) => ({
99
+ var et = 18, tt = 5e3;
100
+ function nt(e, t) {
101
+ let { palette: n, typography: r, timeline: i } = e, a = i.barHeight ?? et, o = (e) => ({
97
102
  ...r.label,
98
103
  color: e
99
104
  }), s = [...t].reduce((e, t) => e + t.charCodeAt(0), 0);
@@ -133,10 +138,10 @@ function Ve(e, t) {
133
138
  text: o(n.background)
134
139
  };
135
140
  }
136
- function He(e, t = {}) {
137
- return (n) => u(e && Ve(e, n), e?.timeline.styles?.[n], t[n]);
141
+ function rt(e, t = {}) {
142
+ return (n) => o(e && nt(e, n), e?.timeline.styles?.[n], t[n]);
138
143
  }
139
- function Ue(e) {
144
+ function it(e) {
140
145
  return e.flatMap(({ start: e, end: t, eta: n, state: r, label: i, color: a }) => {
141
146
  let o = {
142
147
  from: e,
@@ -144,7 +149,7 @@ function Ue(e) {
144
149
  key: r,
145
150
  label: i,
146
151
  color: a
147
- }, s = n === void 0 ? null : M(n), c = M(e);
152
+ }, s = n === void 0 ? null : R(n), c = R(e);
148
153
  return s !== null && c !== null && s < c ? [{
149
154
  from: n,
150
155
  to: e,
@@ -152,62 +157,62 @@ function Ue(e) {
152
157
  }, o] : [o];
153
158
  });
154
159
  }
155
- function We(e) {
156
- let t = e.map(M).filter((e) => e !== null);
160
+ function at(e) {
161
+ let t = e.map(R).filter((e) => e !== null);
157
162
  return [...new Set(t)].sort((e, t) => e - t);
158
163
  }
159
- function Ge(e, t = 3600) {
160
- let n = We(e), r = n[0], i = n[n.length - 1];
164
+ function ot(e, t = 3600) {
165
+ let n = at(e), r = n[0], i = n[n.length - 1];
161
166
  if (r === void 0 || i === void 0 || !(t > 0)) return [];
162
- let a = Math.max(t, Math.ceil((i - r) / Be)), o = Math.floor(r / a) * a, s = Math.ceil(i / a) * a;
167
+ let a = Math.max(t, Math.ceil((i - r) / tt)), o = Math.floor(r / a) * a, s = Math.ceil(i / a) * a;
163
168
  return Array.from({ length: Math.max(1, (s - o) / a + 1) }, (e, t) => o + t * a);
164
169
  }
165
170
  //#endregion
166
171
  //#region src/hooks/usePaneRanges.ts
167
- function Ke(t, n, r) {
168
- let i = X([]);
172
+ function st(e, t, n) {
173
+ let r = X([]);
169
174
  J(() => {
170
- i.current = [];
171
- }, [t]), J(() => {
172
- if (!t) return;
173
- let a = i.current, o = t.chart.panes(), s = (e) => e?.pane.detachPrimitive(e.primitive);
174
- n.forEach((t, n) => {
175
- let i = o[n], c = a[n];
176
- if (c && (!t || c.pane !== i) && (s(c), c = a[n] = void 0), !t || !i) return;
177
- let l = [
178
- t.items,
179
- t.styles,
180
- r
175
+ r.current = [];
176
+ }, [e]), J(() => {
177
+ if (!e) return;
178
+ let i = r.current, a = e.chart.panes(), o = (e) => e?.pane.detachPrimitive(e.primitive);
179
+ t.forEach((e, t) => {
180
+ let r = a[t], s = i[t];
181
+ if (s && (!e || s.pane !== r) && (o(s), s = i[t] = void 0), !e || !r) return;
182
+ let c = [
183
+ e.items,
184
+ e.styles,
185
+ n
181
186
  ];
182
- if (c && e(c.inputs, l)) return;
183
- let u = {
184
- items: Ue(t.items),
185
- style: He(r, t.styles)
187
+ if (s && h(s.inputs, c)) return;
188
+ let l = {
189
+ items: it(e.items),
190
+ style: rt(n, e.styles)
186
191
  };
187
- if (c) {
188
- c.primitive.applyOptions(u), c.inputs = l;
192
+ if (s) {
193
+ s.primitive.applyOptions(l), s.inputs = c;
189
194
  return;
190
195
  }
191
- let d = new H(u);
192
- i.attachPrimitive(d), a[n] = {
193
- pane: i,
194
- primitive: d,
195
- inputs: l
196
+ let u = new U(l);
197
+ r.attachPrimitive(u), i[t] = {
198
+ pane: r,
199
+ primitive: u,
200
+ inputs: c
196
201
  };
197
- }), a.splice(n.length).forEach(s);
202
+ }), i.splice(t.length).forEach(o);
198
203
  });
199
204
  }
200
205
  //#endregion
201
206
  //#region src/hooks/usePaneSeries.ts
202
- function qe(n, r, i) {
203
- let o = X([]);
207
+ function ct(n, r, i) {
208
+ let s = X([]);
204
209
  return J(() => {
205
- o.current = [];
210
+ s.current = [];
206
211
  }, [n]), J(() => {
207
212
  if (!n) return;
208
- let { chart: s } = n, l = o.current, d = (e, t, r) => {
209
- let i = e === 0 ? n.series : s.addSeries(G, {}, e), a = u(i.options());
210
- return e > 0 && (i.applyOptions(t), s.panes()[e]?.setPreserveEmptyPane(!0)), {
213
+ let { chart: c } = n, l = s.current, u = (e, t, r) => {
214
+ let i = e === 0 ? n.series : c.addSeries(Je, {}, e), a = o(i.options());
215
+ return e > 0 && (i.applyOptions(t), c.panes()[e]?.setPreserveEmptyPane(!0)), {
211
216
  series: i,
212
217
  defaults: a,
213
218
  options: t,
@@ -215,86 +220,86 @@ function qe(n, r, i) {
215
220
  dataInputs: [],
216
221
  lineInputs: [],
217
222
  lines: [],
218
- normalized: W([])
223
+ normalized: G([])
219
224
  };
220
225
  };
221
226
  r.forEach((n, r) => {
222
- let o = n.mode ?? "plain", m = [o, n.seriesOptions], h = V(o, n.seriesOptions), g = l[r];
223
- g && r > 0 && !e(g.optionInputs, m) && (a(g.defaults, g.options, h) ? (s.removeSeries(g.series), g = void 0) : (g.series.applyOptions(u(c(g.defaults, g.options), h)), g.options = h, g.optionInputs = m)), g || (l[r] = g = d(r, h, m));
224
- let { bar: _, over: v, positive: y, negative: b } = u(t(i), n.colors), x = [
227
+ let s = n.mode ?? "plain", d = [s, n.seriesOptions], f = H(s, n.seriesOptions), g = l[r];
228
+ g && r > 0 && !h(g.optionInputs, d) && (e(g.defaults, g.options, f) ? (c.removeSeries(g.series), g = void 0) : (g.series.applyOptions(o(a(g.defaults, g.options), f)), g.options = f, g.optionInputs = d)), g || (l[r] = g = u(r, f, d));
229
+ let { bar: _, over: v, positive: y, negative: b } = o(t(i), n.colors), x = [
225
230
  n.data,
226
231
  n.whitespace,
227
- o,
232
+ s,
228
233
  n.threshold,
229
234
  _,
230
235
  v,
231
236
  y,
232
237
  b
233
238
  ];
234
- e(g.dataInputs, x) || (g.normalized = W(n.data), g.series.setData(n.whitespace ? We(n.whitespace).map((e) => ({ time: e })) : ue(g.normalized.data, o, n.threshold, {
239
+ h(g.dataInputs, x) || (g.normalized = G(n.data), g.series.setData(n.whitespace ? at(n.whitespace).map((e) => ({ time: e })) : me(g.normalized.data, s, n.threshold, {
235
240
  bar: _,
236
241
  over: v,
237
242
  positive: y,
238
243
  negative: b
239
244
  })), g.dataInputs = x);
240
245
  let S = [
241
- o,
246
+ s,
242
247
  n.threshold,
243
248
  n.thresholdLine,
244
249
  n.zeroLine,
245
250
  i
246
251
  ];
247
- if (!e(g.lineInputs, S)) {
252
+ if (!h(g.lineInputs, S)) {
248
253
  let { series: e } = g;
249
- g.lines.forEach((t) => e.removePriceLine(t)), g.lines = z(o, n.threshold, p(f(i, i?.histogram.threshold, "dashed"), n.thresholdLine), p(f(i, i?.histogram.zero, "solid"), n.zeroLine)).map((t) => e.createPriceLine(t)), g.lineInputs = S;
254
+ g.lines.forEach((t) => e.removePriceLine(t)), g.lines = le(s, n.threshold, m(p(i, i?.histogram.threshold, "dashed"), n.thresholdLine), m(p(i, i?.histogram.zero, "solid"), n.zeroLine)).map((t) => e.createPriceLine(t)), g.lineInputs = S;
250
255
  }
251
- s.panes()[r]?.setStretchFactor(n.height);
256
+ c.panes()[r]?.setStretchFactor(n.height);
252
257
  }), l.splice(r.length).forEach((e) => {
253
258
  if (e.series !== n.series) {
254
- s.removeSeries(e.series);
259
+ c.removeSeries(e.series);
255
260
  return;
256
261
  }
257
262
  e.lines.forEach((t) => e.series.removePriceLine(t)), e.series.setData([]);
258
263
  });
259
- for (let e = s.panes().length - 1; e >= Math.max(r.length, 1); e--) s.removePane(e);
260
- }), o;
264
+ for (let e = c.panes().length - 1; e >= Math.max(r.length, 1); e--) c.removePane(e);
265
+ }), s;
261
266
  }
262
267
  //#endregion
263
268
  //#region src/charts/ChartPanes/index.tsx
264
- var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
269
+ var lt = { display: "flex" }, ut = { flex: "none" }, dt = {
265
270
  boxSizing: "border-box",
266
271
  overflow: "hidden"
267
- }, Ze = {
272
+ }, ft = {
268
273
  position: "relative",
269
274
  flex: 1,
270
275
  minWidth: 0
271
- }, Qe = {
276
+ }, pt = {
272
277
  position: "absolute",
273
278
  inset: 0
274
- }, $e = {
279
+ }, mt = {
275
280
  position: "absolute",
276
281
  top: 0,
277
282
  left: 0,
278
283
  width: 1,
279
284
  display: "none",
280
285
  pointerEvents: "none"
281
- }, et = { layout: { panes: { enableResize: !1 } } }, tt = [], nt = (e) => e.value.toLocaleString(), rt = K(function({ children: e, now: t = null, axisLabel: r, chartOptions: i, ctrlWheelZoom: a = !0, ariaLabel: s = "Chart panes", className: c, classNames: d = {}, styles: f = {}, onPaneClick: p, onPaneHover: m, onPaneLeave: h, theme: g, unstyled: _ }, v) {
286
+ }, ht = { layout: { panes: { enableResize: !1 } } }, gt = [], _t = (e) => e.value.toLocaleString(), vt = K(function({ children: e, now: t = null, axisLabel: r, chartOptions: i, ctrlWheelZoom: a = !0, ariaLabel: c = "Chart panes", className: l, classNames: d = {}, styles: f = {}, onPaneClick: p, onPaneHover: m, onPaneLeave: h, theme: g, unstyled: _ }, v) {
282
287
  let y = X(null), b = X(null), x = X({
283
288
  onPaneClick: p,
284
289
  onPaneHover: m,
285
290
  onPaneLeave: h
286
- }), [S, ee] = Ne(0), [C, w] = Ne(null);
291
+ }), [S, ee] = qe(0), [C, w] = qe(null);
287
292
  x.current = {
288
293
  onPaneClick: p,
289
294
  onPaneHover: m,
290
295
  onPaneLeave: h
291
296
  };
292
- let T = ie({
297
+ let T = L({
293
298
  theme: g,
294
299
  unstyled: _
295
- }), E = T?.sizes.paneHeight ?? o.sizes.paneHeight, te = T?.sizes.laneHeight ?? E, D = [], O = [];
296
- je.forEach(e, (e) => {
297
- if (q(e) && e.type === Re && (D.push(null), O.push({
300
+ }), E = T?.sizes.paneHeight ?? s.sizes.paneHeight, te = T?.sizes.laneHeight ?? E, D = [], O = [];
301
+ Ge.forEach(e, (e) => {
302
+ if (q(e) && e.type === $e && (D.push(null), O.push({
298
303
  ...e.props,
299
304
  height: e.props.height ?? E
300
305
  })), q(e) && e.type === $) {
@@ -303,20 +308,20 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
303
308
  label: t,
304
309
  meta: n,
305
310
  height: r,
306
- data: tt,
311
+ data: gt,
307
312
  whitespace: i
308
313
  });
309
314
  }
310
315
  });
311
- let k = O[0], ne = Y(() => V(k?.mode ?? "plain", k?.seriesOptions), [k?.mode, k?.seriesOptions]), re = Y(() => u(l(T), et, a && {
316
+ let k = O[0], ne = Y(() => H(k?.mode ?? "plain", k?.seriesOptions), [k?.mode, k?.seriesOptions]), re = Y(() => o(u(T), ht, a && {
312
317
  handleScale: { mouseWheel: !1 },
313
318
  handleScroll: { mouseWheel: !1 }
314
319
  }, i), [
315
320
  T,
316
321
  a,
317
322
  i
318
- ]), A = ae(y, G, re, ne), j = qe(A, O, T);
319
- Ke(A, D, T), oe(A, y, a), J(() => {
323
+ ]), A = ie(y, Je, re, ne), j = ct(A, O, T);
324
+ st(A, D, T), ae(A, y, a), J(() => {
320
325
  if (!A) return;
321
326
  let e = A.chart.timeScale(), t = () => ee(e.height());
322
327
  return t(), e.subscribeSizeChange(t), () => e.unsubscribeSizeChange(t);
@@ -347,25 +352,25 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
347
352
  return e.subscribeCrosshairMove(r), e.subscribeClick(i), () => {
348
353
  e.unsubscribeCrosshairMove(r), e.unsubscribeClick(i);
349
354
  };
350
- }, [A, j]), Le(A, b, t === null ? null : M(t)), Me(v, () => A ? {
355
+ }, [A, j]), Qe(A, b, t === null ? null : R(t)), Ke(v, () => A ? {
351
356
  chart: A.chart,
352
357
  get series() {
353
358
  return j.current.map((e) => e.series);
354
359
  }
355
360
  } : null, [A, j]);
356
- let N = O.map((e) => e.height), P = T && u({ color: T.palette.now }, T.panes.now), F = P ? {
361
+ let M = O.map((e) => e.height), N = T && o({ color: T.palette.now }, T.panes.now), P = N ? {
357
362
  width: 0,
358
- borderLeft: `${P.width ?? 1}px ${P.style ?? "solid"} ${P.color}`
359
- } : {}, I = { width: T?.sizes.paneLabel }, L = { padding: T?.spacing.paneLabel }, R = n(T ? u(T.typography.title, T.panes.title) : void 0), z = n(T ? u(T.typography.value, T.panes.meta) : void 0), B = N.reduce((e, t) => e + t, 0) + Math.max(0, O.length - 1) + S;
363
+ borderLeft: `${N.width ?? 1}px ${N.style ?? "solid"} ${N.color}`
364
+ } : {}, F = { width: T?.sizes.paneLabel }, I = { padding: T?.spacing.paneLabel }, z = n(T ? o(T.typography.title, T.panes.title) : void 0), B = n(T ? o(T.typography.value, T.panes.meta) : void 0), V = M.reduce((e, t) => e + t, 0) + Math.max(0, O.length - 1) + S;
360
365
  return /* @__PURE__ */ Q("div", {
361
- className: c,
362
- style: Je,
366
+ className: l,
367
+ style: lt,
363
368
  children: [/* @__PURE__ */ Q("div", {
364
369
  "data-part": "labels",
365
370
  className: d.labels,
366
371
  style: {
367
- ...Ye,
368
- ...I,
372
+ ...ut,
373
+ ...F,
369
374
  ...f.labels
370
375
  },
371
376
  children: [O.map((e, t) => {
@@ -374,16 +379,16 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
374
379
  "data-part": "label",
375
380
  className: d.label,
376
381
  style: {
377
- ...Xe,
378
- ...L,
379
- height: N[t] + +(t > 0),
382
+ ...dt,
383
+ ...I,
384
+ height: M[t] + +(t > 0),
380
385
  ...f.label
381
386
  },
382
387
  children: [/* @__PURE__ */ Z("div", {
383
388
  "data-part": "title",
384
389
  className: d.title,
385
390
  style: {
386
- ...R,
391
+ ...z,
387
392
  ...f.title
388
393
  },
389
394
  children: e.label
@@ -391,17 +396,17 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
391
396
  "data-part": "meta",
392
397
  className: d.meta,
393
398
  style: {
394
- ...z,
399
+ ...B,
395
400
  ...f.meta
396
401
  },
397
- children: n ? (e.format ?? nt)(n) : e.meta
402
+ children: n ? (e.format ?? _t)(n) : e.meta
398
403
  })]
399
404
  }, t);
400
405
  }), /* @__PURE__ */ Z("div", {
401
406
  "data-part": "axis",
402
407
  className: d.axis,
403
408
  style: {
404
- ...Xe,
409
+ ...dt,
405
410
  height: S,
406
411
  ...f.axis
407
412
  },
@@ -411,22 +416,22 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
411
416
  "data-part": "plot",
412
417
  className: d.plot,
413
418
  style: {
414
- ...Ze,
415
- height: B,
419
+ ...ft,
420
+ height: V,
416
421
  ...f.plot
417
422
  },
418
423
  children: [/* @__PURE__ */ Z("div", {
419
424
  ref: y,
420
- style: Qe,
425
+ style: pt,
421
426
  role: "img",
422
- "aria-label": s
427
+ "aria-label": c
423
428
  }), /* @__PURE__ */ Z("div", {
424
429
  ref: b,
425
430
  "data-part": "now",
426
431
  className: d.now,
427
432
  style: {
428
- ...$e,
429
- ...F,
433
+ ...mt,
434
+ ...P,
430
435
  bottom: S,
431
436
  ...f.now
432
437
  },
@@ -434,13 +439,13 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
434
439
  })]
435
440
  })]
436
441
  });
437
- }), it = K(function({ lanes: e, step: t, ...n }, r) {
438
- let i = Y(() => Ge(e.flatMap((e) => e.items.flatMap(({ start: e, end: t, eta: n }) => n === void 0 ? [e, t] : [
442
+ }), yt = K(function({ lanes: e, step: t, ...n }, r) {
443
+ let i = Y(() => ot(e.flatMap((e) => e.items.flatMap(({ start: e, end: t, eta: n }) => n === void 0 ? [e, t] : [
439
444
  n,
440
445
  e,
441
446
  t
442
447
  ])), t), [e, t]);
443
- return /* @__PURE__ */ Z(rt, {
448
+ return /* @__PURE__ */ Z(vt, {
444
449
  ref: r,
445
450
  ...n,
446
451
  children: e.map(({ id: e, ...t }, n) => /* @__PURE__ */ Z($, {
@@ -450,6 +455,6 @@ var Je = { display: "flex" }, Ye = { flex: "none" }, Xe = {
450
455
  });
451
456
  });
452
457
  //#endregion
453
- export { me as BarChart, N as CandlestickChart, Se as CategoryBarChart, rt as ChartPanes, j as ChartThemeProvider, re as Heatmap, w as HeatmapLegend, le as HistogramChart, Re as HistogramPane, se as LineChart, ve as PieChart, xe as PieLegend, we as PolarChart, B as RibbonPrimitive, Ce as ScatterChart, R as SeriesChart, Te as Sparkline, H as TimeRangePrimitive, pe as TimeSeriesChart, it as TimelineChart, $ as TimelinePane, fe as aggregate, I as aggregatePoints, _e as arcPath, he as bandAt, Ee as bin, D as cellAt, d as createTheme, o as defaultTheme, ce as editorialChartOptions, ne as extremes, S as heatmapGrid, T as heatmapLayout, A as inRange, F as isUp, ee as normaliseRange, ke as p1Accents, Ae as p1CssVariables, De as p1Theme, Oe as p1ThemeFromCss, de as patchSquareCanvasLabels, m as pieArcs, ge as pieSlices, ye as placeLabels, C as pointerCell, v as quantize, O as rangeStats, P as resolveBandStyles, Ie as squarify, E as stepColor, h as symmetricExtent, s as themeFromCssVariables, _ as tidyTree, U as timeToX, L as toLinePoints, r as toSrgb, ie as useChartTheme, te as useHeatmapSelection, k as useHeatmapState, x as useHeatmapSteps, be as usePieState, i as withAlpha };
458
+ export { ve as BarChart, z as CandlestickChart, ke as CategoryBarChart, We as ChartFrame, je as ChartLegend, vt as ChartPanes, Ve as ChartStory, I as ChartThemeProvider, j as Heatmap, E as HeatmapLegend, pe as HistogramChart, $e as HistogramPane, de as LineChart, Se as PieChart, Te as PieLegend, Ne as PolarChart, ue as RibbonPrimitive, Me as ScatterChart, ce as SeriesChart, Pe as Sparkline, U as TimeRangePrimitive, _e as TimeSeriesChart, yt as TimelineChart, $ as TimelinePane, ge as aggregate, oe as aggregatePoints, xe as arcPath, ye as bandAt, Fe as bin, k as cellAt, r as contrastRatio, f as createTheme, s as defaultTheme, He as downloadCsv, P as easeInOutCubic, F as easeOutCubic, fe as editorialChartOptions, A as extremes, C as heatmapGrid, te as heatmapLayout, M as inRange, V as isUp, N as linear, Oe as niceExtent, De as niceStep, w as normaliseRange, Re as p1Accents, ze as p1CssVariables, Ie as p1Theme, Le as p1ThemeFromCss, he as patchSquareCanvasLabels, v as pieArcs, be as pieSlices, Ce as placeLabels, T as pointerCell, g as quantize, ne as rangeStats, i as readableInk, B as resolveBandStyles, Ze as squarify, D as stepColor, S as symmetricExtent, c as themeFromCssVariables, _ as tidyTree, W as timeToX, Ue as toCsv, se as toLinePoints, d as toSrgb, L as useChartTheme, O as useHeatmapSelection, re as useHeatmapState, ee as useHeatmapSteps, Ae as useMarkMemory, we as usePieState, Be as useSteps, Ee as useTween, l as withAlpha };
454
459
 
455
460
  //# sourceMappingURL=index.js.map