@wick-charts/vue 0.5.1 → 0.6.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.
- package/README.md +18 -3
- package/dist/BarSeries.vue.js +26 -20
- package/dist/CandlestickSeries.vue.js +30 -24
- package/dist/ChartContainer.vue.js +88 -65
- package/dist/HeatmapSeries.vue.js +40 -0
- package/dist/HeatmapSeries.vue2.js +4 -0
- package/dist/LineSeries.vue.js +26 -20
- package/dist/PieSeries.vue.js +24 -18
- package/dist/core/dist/animation/animator.js +21 -21
- package/dist/core/dist/animation/config.js +114 -87
- package/dist/core/dist/animation/easing.js +3 -1
- package/dist/core/dist/animation/intro-wave.js +68 -0
- package/dist/core/dist/axis/dom-labels.js +13 -14
- package/dist/core/dist/chart/badge-animator.js +56 -0
- package/dist/core/dist/chart/edge-indicators.js +28 -13
- package/dist/core/dist/chart/last-value.js +18 -17
- package/dist/core/dist/chart/y-target.js +13 -12
- package/dist/core/dist/chart.js +679 -452
- package/dist/core/dist/components/annotation-chip.js +28 -0
- package/dist/core/dist/components/edge-indicator.js +58 -26
- package/dist/core/dist/components/loading-indicator.js +46 -0
- package/dist/core/dist/components/marker.js +49 -31
- package/dist/core/dist/components/reference-line.js +27 -36
- package/dist/core/dist/components/time-region.js +30 -28
- package/dist/core/dist/data/store.js +38 -19
- package/dist/core/dist/data/sync.js +60 -38
- package/dist/core/dist/heatmap-tooltip.js +16 -0
- package/dist/core/dist/interactions/handler.js +67 -43
- package/dist/core/dist/perf/perf-hud.js +5 -5
- package/dist/core/dist/scales/x-scale.js +85 -37
- package/dist/core/dist/scales/y-scale.js +38 -27
- package/dist/core/dist/series/bar-intro.js +18 -0
- package/dist/core/dist/series/bar.js +337 -205
- package/dist/core/dist/series/base-multi-layer.js +224 -96
- package/dist/core/dist/series/candlestick-intro.js +57 -0
- package/dist/core/dist/series/candlestick.js +454 -276
- package/dist/core/dist/series/heatmap.js +387 -0
- package/dist/core/dist/series/line-intro.js +85 -0
- package/dist/core/dist/series/line.js +590 -282
- package/dist/core/dist/series/painters/builtins.js +2 -2
- package/dist/core/dist/series/pie.js +396 -259
- package/dist/core/dist/series/register-builtins.js +8 -7
- package/dist/core/dist/series/types.js +6 -0
- package/dist/core/dist/series/wave-intro.js +26 -0
- package/dist/core/dist/theme/create.js +69 -63
- package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
- package/dist/core/dist/theme/themes/sand-dune.js +2 -2
- package/dist/core/dist/utils/color.js +109 -34
- package/dist/core/dist/utils/deep-equal.js +18 -0
- package/dist/core/dist/utils/time.js +25 -19
- package/dist/index.d.ts +1405 -123
- package/dist/index.js +177 -130
- package/dist/ui/Crosshair.vue.js +20 -21
- package/dist/ui/HeatmapTooltip.vue.js +96 -0
- package/dist/ui/HeatmapTooltip.vue2.js +4 -0
- package/dist/ui/InfoBar.vue.js +46 -47
- package/dist/ui/Legend.vue.js +80 -79
- package/dist/ui/PieLegend.vue.js +5 -5
- package/dist/ui/PieTooltip.vue.js +77 -67
- package/dist/ui/Tooltip.vue.js +60 -60
- package/dist/ui/YAxis.vue.js +2 -2
- package/dist/ui/YLabel.vue.js +94 -61
- package/package.json +2 -2
- package/src/BarSeries.vue +23 -7
- package/src/CandlestickSeries.vue +23 -7
- package/src/ChartContainer.vue +134 -12
- package/src/HeatmapSeries.vue +69 -0
- package/src/LineSeries.vue +23 -7
- package/src/PieSeries.vue +22 -6
- package/src/index.ts +84 -3
- package/src/ui/Crosshair.vue +1 -2
- package/src/ui/HeatmapTooltip.vue +144 -0
- package/src/ui/InfoBar.vue +1 -2
- package/src/ui/Legend.vue +13 -0
- package/src/ui/Marker.vue +1 -1
- package/src/ui/PieTooltip.vue +10 -0
- package/src/ui/ReferenceLine.vue +2 -2
- package/src/ui/TimeRegion.vue +2 -2
- package/src/ui/Tooltip.vue +2 -2
- package/src/ui/YLabel.vue +123 -8
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { BarSeriesDef as
|
|
2
|
-
import { CandlestickSeriesDef as
|
|
1
|
+
import { BarSeriesDef as r } from "./bar.js";
|
|
2
|
+
import { CandlestickSeriesDef as i } from "./candlestick.js";
|
|
3
3
|
import { registerSeriesDefinition as e } from "./definition.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { HeatmapSeriesDef as t } from "./heatmap.js";
|
|
5
|
+
import { LineSeriesDef as s } from "./line.js";
|
|
6
|
+
import { PieSeriesDef as o } from "./pie.js";
|
|
7
|
+
function D() {
|
|
8
|
+
e(i), e(s), e(r), e(o), e(t);
|
|
8
9
|
}
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
D as registerBuiltinSeries
|
|
11
12
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { easeInOutCubic as n } from "../animation/easing.js";
|
|
2
|
+
const o = 0.35;
|
|
3
|
+
function p(e = {}) {
|
|
4
|
+
const t = e.travel ?? o;
|
|
5
|
+
return (s) => ({
|
|
6
|
+
element: (r) => ({
|
|
7
|
+
offsetY: (1 - r.progress) * s.height * t,
|
|
8
|
+
alpha: r.progress
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function i() {
|
|
13
|
+
return () => ({
|
|
14
|
+
element: (e) => ({ alpha: e.progress })
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function u() {
|
|
18
|
+
return (e) => ({
|
|
19
|
+
clip: { toX: n(e.progress) * e.width }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
i as fadeIntro,
|
|
24
|
+
p as riseIntro,
|
|
25
|
+
u as wipeIntro
|
|
26
|
+
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { lighten as E } from "../utils/color.js";
|
|
2
|
-
import { resolveCandlestickBodyColor as
|
|
1
|
+
import { deriveHeatmapRamp as P, lighten as E } from "../utils/color.js";
|
|
2
|
+
import { resolveCandlestickBodyColor as O } from "./resolve.js";
|
|
3
3
|
function g(a) {
|
|
4
4
|
if (!a.startsWith("#") || a.length !== 4) return a;
|
|
5
5
|
const o = a[1], s = a[2], n = a[3];
|
|
6
6
|
return `#${o}${o}${s}${s}${n}${n}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function z(a) {
|
|
9
9
|
const o = g(a);
|
|
10
10
|
return !o.startsWith("#") || o.length < 7 ? !1 : parseInt(o.slice(1, 3), 16) * 0.299 + parseInt(o.slice(3, 5), 16) * 0.587 + parseInt(o.slice(5, 7), 16) * 0.114 < 128;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const { name: o = "Custom", description: s, fontUrl: n = null } = a,
|
|
14
|
-
background:
|
|
12
|
+
function N(a) {
|
|
13
|
+
const { name: o = "Custom", description: s, fontUrl: n = null } = a, r = g(a.background), e = z(r), f = e ? "#d1d4dc" : "#24292f", b = e ? "#787b86" : "#8b949e", t = e ? "#26a69a" : "#2da44e", h = e ? "#ef5350" : "#cf222e", w = e ? "#2962ff" : "#0969da", m = e ? "rgba(42,46,57,0.6)" : "rgba(200,200,200,0.5)", y = e ? "rgba(150,150,150,0.5)" : "rgba(170,170,170,0.3)", S = e ? p(r, 0.1) : x(r, 0.05), $ = e ? l(r, 0.92) : l(r, 0.95), I = e ? l(p(r, 0.15), 0.6) : "rgba(200,200,200,0.5)", T = v, C = a.candlestick?.up?.body ?? t, k = a.candlestick?.down?.body ?? h, u = O(C), c = O(k), L = (F) => F >= 0 ? u : c, i = a.line?.color ?? w, M = a.tooltip?.textColor ?? f, B = a.axis?.textColor ?? b, A = a.typography?.fontFamily ?? T, R = a.typography?.fontSize ?? 12, U = a.chartGradient ?? (e ? [p(r, 0.04), x(r, 0.06)] : [p(r, 0.06), r]), _ = {
|
|
14
|
+
background: r,
|
|
15
15
|
chartGradient: U,
|
|
16
16
|
typography: {
|
|
17
17
|
fontFamily: A,
|
|
18
|
-
fontSize:
|
|
18
|
+
fontSize: R
|
|
19
19
|
},
|
|
20
20
|
grid: {
|
|
21
|
-
color: a.grid?.color ??
|
|
21
|
+
color: a.grid?.color ?? m,
|
|
22
22
|
style: a.grid?.style ?? "solid"
|
|
23
23
|
},
|
|
24
24
|
candlestick: {
|
|
25
25
|
up: {
|
|
26
26
|
body: C,
|
|
27
|
-
wick: a.candlestick?.up?.wick ??
|
|
27
|
+
wick: a.candlestick?.up?.wick ?? u
|
|
28
28
|
},
|
|
29
29
|
down: {
|
|
30
30
|
body: k,
|
|
31
|
-
wick: a.candlestick?.down?.wick ??
|
|
31
|
+
wick: a.candlestick?.down?.wick ?? c
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
line: {
|
|
35
|
-
color:
|
|
35
|
+
color: i,
|
|
36
36
|
width: a.line?.width ?? 1,
|
|
37
|
-
areaTopColor: a.line?.areaTopColor ?? i
|
|
38
|
-
areaBottomColor: a.line?.areaBottomColor ?? i
|
|
37
|
+
areaTopColor: a.line?.areaTopColor ?? l(i, 0.08),
|
|
38
|
+
areaBottomColor: a.line?.areaBottomColor ?? l(i, 0.01)
|
|
39
39
|
},
|
|
40
|
-
seriesColors: a.seriesColors ?? [
|
|
40
|
+
seriesColors: a.seriesColors ?? [i, t, h],
|
|
41
41
|
bar: {
|
|
42
42
|
color: a.bar?.color ?? L
|
|
43
43
|
},
|
|
@@ -46,12 +46,18 @@ function G(a) {
|
|
|
46
46
|
// read as an aggregate, and it already adapts to theme polarity.
|
|
47
47
|
otherColor: a.pie?.otherColor ?? B
|
|
48
48
|
},
|
|
49
|
+
heatmap: {
|
|
50
|
+
// Single-hue sequential ramp — see deriveHeatmapRamp. Shared with the
|
|
51
|
+
// renderer's no-token fallback so hand-built theme literals and
|
|
52
|
+
// createTheme presets paint the same wash.
|
|
53
|
+
colors: a.heatmap?.colors ?? P(r, i)
|
|
54
|
+
},
|
|
49
55
|
bands: {
|
|
50
|
-
upper: a.bands?.upper ??
|
|
51
|
-
lower: a.bands?.lower ??
|
|
56
|
+
upper: a.bands?.upper ?? i,
|
|
57
|
+
lower: a.bands?.lower ?? c
|
|
52
58
|
},
|
|
53
59
|
crosshair: {
|
|
54
|
-
color: a.crosshair?.color ??
|
|
60
|
+
color: a.crosshair?.color ?? y,
|
|
55
61
|
labelBackground: a.crosshair?.labelBackground ?? S,
|
|
56
62
|
labelTextColor: a.crosshair?.labelTextColor ?? M
|
|
57
63
|
},
|
|
@@ -64,35 +70,35 @@ function G(a) {
|
|
|
64
70
|
},
|
|
65
71
|
yLabel: {
|
|
66
72
|
fontSize: a.yLabel?.fontSize ?? 11,
|
|
67
|
-
upBackground: a.yLabel?.upBackground ??
|
|
68
|
-
downBackground: a.yLabel?.downBackground ??
|
|
73
|
+
upBackground: a.yLabel?.upBackground ?? u,
|
|
74
|
+
downBackground: a.yLabel?.downBackground ?? c,
|
|
69
75
|
neutralBackground: a.yLabel?.neutralBackground ?? S,
|
|
70
76
|
textColor: a.yLabel?.textColor ?? "#ffffff"
|
|
71
77
|
},
|
|
72
78
|
tooltip: {
|
|
73
|
-
fontSize: a.tooltip?.fontSize ??
|
|
79
|
+
fontSize: a.tooltip?.fontSize ?? R,
|
|
74
80
|
background: a.tooltip?.background ?? $,
|
|
75
81
|
textColor: M,
|
|
76
82
|
borderColor: a.tooltip?.borderColor ?? I
|
|
77
83
|
},
|
|
78
|
-
navigator:
|
|
79
|
-
dark:
|
|
80
|
-
bg:
|
|
84
|
+
navigator: W({
|
|
85
|
+
dark: e,
|
|
86
|
+
bg: r,
|
|
81
87
|
neutralFg: B,
|
|
82
88
|
upBody: C,
|
|
83
89
|
downBody: k,
|
|
84
|
-
upBase:
|
|
85
|
-
downBase:
|
|
90
|
+
upBase: u,
|
|
91
|
+
downBase: c,
|
|
86
92
|
config: a.navigator
|
|
87
93
|
})
|
|
88
94
|
};
|
|
89
|
-
return { name: o, description: s, fontUrl: n, dark:
|
|
95
|
+
return { name: o, description: s, fontUrl: n, dark: e, theme: _ };
|
|
90
96
|
}
|
|
91
|
-
function
|
|
92
|
-
const { dark: o, bg: s, neutralFg: n, upBody:
|
|
97
|
+
function W(a) {
|
|
98
|
+
const { dark: o, bg: s, neutralFg: n, upBody: r, downBody: e, upBase: f, downBase: b, config: t } = a, h = t?.background ?? "transparent", w = o ? "rgba(255,255,255,1)" : "rgba(0,0,0,1)", m = t?.handle?.color ?? d(w, 0.3), y = t?.mask?.fill ?? d(s, o ? 0.78 : 0.82);
|
|
93
99
|
return {
|
|
94
100
|
height: t?.height ?? 48,
|
|
95
|
-
background:
|
|
101
|
+
background: h,
|
|
96
102
|
borderColor: t?.borderColor ?? d(n, o ? 0.18 : 0.22),
|
|
97
103
|
line: {
|
|
98
104
|
color: t?.line?.color ?? n,
|
|
@@ -102,11 +108,11 @@ function z(a) {
|
|
|
102
108
|
},
|
|
103
109
|
candlestick: {
|
|
104
110
|
up: {
|
|
105
|
-
body: t?.candlestick?.up?.body ??
|
|
106
|
-
wick: t?.candlestick?.up?.wick ??
|
|
111
|
+
body: t?.candlestick?.up?.body ?? r,
|
|
112
|
+
wick: t?.candlestick?.up?.wick ?? f
|
|
107
113
|
},
|
|
108
114
|
down: {
|
|
109
|
-
body: t?.candlestick?.down?.body ??
|
|
115
|
+
body: t?.candlestick?.down?.body ?? e,
|
|
110
116
|
wick: t?.candlestick?.down?.wick ?? b
|
|
111
117
|
}
|
|
112
118
|
},
|
|
@@ -117,60 +123,60 @@ function z(a) {
|
|
|
117
123
|
borderWidth: t?.window?.borderWidth ?? 0
|
|
118
124
|
},
|
|
119
125
|
handle: {
|
|
120
|
-
color:
|
|
126
|
+
color: m,
|
|
121
127
|
width: t?.handle?.width ?? 6
|
|
122
128
|
},
|
|
123
129
|
mask: {
|
|
124
|
-
fill:
|
|
130
|
+
fill: y
|
|
125
131
|
}
|
|
126
132
|
};
|
|
127
133
|
}
|
|
128
134
|
function d(a, o) {
|
|
129
|
-
if (a.startsWith("#") && a.length === 7) return
|
|
135
|
+
if (a.startsWith("#") && a.length === 7) return l(a, o);
|
|
130
136
|
const s = a.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
131
137
|
return s ? `rgba(${s[1]},${s[2]},${s[3]},${o})` : a;
|
|
132
138
|
}
|
|
133
|
-
function
|
|
134
|
-
const s = g(a), n = parseInt(s.slice(1, 3), 16),
|
|
135
|
-
return `rgba(${n}, ${
|
|
139
|
+
function l(a, o) {
|
|
140
|
+
const s = g(a), n = parseInt(s.slice(1, 3), 16), r = parseInt(s.slice(3, 5), 16), e = parseInt(s.slice(5, 7), 16);
|
|
141
|
+
return `rgba(${n}, ${r}, ${e}, ${o})`;
|
|
136
142
|
}
|
|
137
143
|
function p(a, o) {
|
|
138
144
|
return a.startsWith("#") ? E(g(a), o) : a;
|
|
139
145
|
}
|
|
140
146
|
function x(a, o) {
|
|
141
147
|
if (!a.startsWith("#")) return a;
|
|
142
|
-
const s = g(a), n = Math.max(0, Math.round(parseInt(s.slice(1, 3), 16) * (1 - o))),
|
|
143
|
-
return `#${n.toString(16).padStart(2, "0")}${
|
|
148
|
+
const s = g(a), n = Math.max(0, Math.round(parseInt(s.slice(1, 3), 16) * (1 - o))), r = Math.max(0, Math.round(parseInt(s.slice(3, 5), 16) * (1 - o))), e = Math.max(0, Math.round(parseInt(s.slice(5, 7), 16) * (1 - o)));
|
|
149
|
+
return `#${n.toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}${e.toString(16).padStart(2, "0")}`;
|
|
144
150
|
}
|
|
145
|
-
function
|
|
151
|
+
function D(a) {
|
|
146
152
|
const o = a.startsWith("#") && a.length === 7 ? [p(a, 0.2), x(a, 0.15)] : [a, a];
|
|
147
153
|
return Object.defineProperty(o, "source", { value: a, enumerable: !1 }), o;
|
|
148
154
|
}
|
|
149
|
-
const
|
|
155
|
+
const H = "'JetBrains Mono', 'Fira Code', monospace", K = "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap", v = "'Outfit', -apple-system, BlinkMacSystemFont, sans-serif", V = "https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&display=swap", j = "'Roboto Mono', monospace", q = "https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;600&display=swap", Q = "'IBM Plex Mono', monospace", X = "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap", Y = "'Fira Code', monospace", Z = "https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap", aa = "'Source Code Pro', monospace", oa = "https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap", ta = "'Space Mono', monospace", sa = "https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap", ra = "'Plus Jakarta Sans', sans-serif", ea = "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap", na = "'Caveat', 'Comic Sans MS', cursive", ia = "https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap";
|
|
150
156
|
export {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
na as CAVEAT,
|
|
158
|
+
ia as CAVEAT_URL,
|
|
159
|
+
Y as FIRA,
|
|
160
|
+
Z as FIRA_URL,
|
|
155
161
|
v as GEIST,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
V as GEIST_URL,
|
|
163
|
+
Q as IBM,
|
|
164
|
+
X as IBM_URL,
|
|
165
|
+
ra as JAKARTA,
|
|
166
|
+
ea as JAKARTA_URL,
|
|
167
|
+
H as MONO,
|
|
168
|
+
K as MONO_URL,
|
|
169
|
+
j as ROBOTO,
|
|
170
|
+
q as ROBOTO_URL,
|
|
171
|
+
aa as SOURCE_CODE,
|
|
172
|
+
oa as SOURCE_CODE_URL,
|
|
173
|
+
ta as SPACE_MONO,
|
|
174
|
+
sa as SPACE_MONO_URL,
|
|
175
|
+
D as autoGradient,
|
|
176
|
+
N as createTheme,
|
|
171
177
|
x as darkenHex,
|
|
172
178
|
g as expandHex,
|
|
173
|
-
|
|
174
|
-
|
|
179
|
+
l as hexToRgba,
|
|
180
|
+
z as isDarkBg,
|
|
175
181
|
p as lightenHex
|
|
176
182
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTheme as o, SPACE_MONO_URL as e, SPACE_MONO as r, autoGradient as a } from "../create.js";
|
|
2
|
-
const
|
|
2
|
+
const t = o({
|
|
3
3
|
name: "Mint Breeze",
|
|
4
4
|
background: "#f6f5ee",
|
|
5
5
|
candlestick: {
|
|
@@ -29,5 +29,5 @@ const d = o({
|
|
|
29
29
|
chartGradient: ["#f8f7f0", "#f6f5ee"]
|
|
30
30
|
});
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
t as mintBreeze
|
|
33
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTheme as o, SOURCE_CODE_URL as r, SOURCE_CODE as e, autoGradient as a } from "../create.js";
|
|
2
|
-
const
|
|
2
|
+
const b = o({
|
|
3
3
|
name: "Sand Dune",
|
|
4
4
|
background: "#f4f0e8",
|
|
5
5
|
candlestick: {
|
|
@@ -29,5 +29,5 @@ const t = o({
|
|
|
29
29
|
chartGradient: ["#f8f4ec", "#f4f0e8"]
|
|
30
30
|
});
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
b as sandDune
|
|
33
33
|
};
|
|
@@ -1,37 +1,112 @@
|
|
|
1
|
-
function
|
|
2
|
-
return typeof
|
|
3
|
-
}
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return [parseInt(
|
|
7
|
-
}
|
|
8
|
-
function
|
|
9
|
-
return !
|
|
10
|
-
}
|
|
11
|
-
function
|
|
12
|
-
return `#${
|
|
13
|
-
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
if (n.startsWith("
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
1
|
+
function J(r, n) {
|
|
2
|
+
return typeof r == "function" ? r(n) : r;
|
|
3
|
+
}
|
|
4
|
+
const w = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
5
|
+
function b(r) {
|
|
6
|
+
return [parseInt(r.slice(1, 3), 16), parseInt(r.slice(3, 5), 16), parseInt(r.slice(5, 7), 16)];
|
|
7
|
+
}
|
|
8
|
+
function v(r) {
|
|
9
|
+
return !r.startsWith("#") || r.length !== 4 ? r : `#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`;
|
|
10
|
+
}
|
|
11
|
+
function F(r, n, t) {
|
|
12
|
+
return `#${r.toString(16).padStart(2, "0")}${n.toString(16).padStart(2, "0")}${t.toString(16).padStart(2, "0")}`;
|
|
13
|
+
}
|
|
14
|
+
function $(r) {
|
|
15
|
+
const n = v(r);
|
|
16
|
+
if (n.startsWith("#")) {
|
|
17
|
+
if (n.length < 7) return null;
|
|
18
|
+
const [e, a, s] = b(n);
|
|
19
|
+
return Number.isNaN(e) || Number.isNaN(a) || Number.isNaN(s) ? null : [e, a, s];
|
|
20
|
+
}
|
|
21
|
+
const t = r.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
|
|
22
|
+
return t ? [Number(t[1]), Number(t[2]), Number(t[3])] : null;
|
|
23
|
+
}
|
|
24
|
+
function K(r) {
|
|
25
|
+
const n = $(r);
|
|
26
|
+
if (!n) return !1;
|
|
27
|
+
const [t, e, a] = n;
|
|
28
|
+
return t * 0.299 + e * 0.587 + a * 0.114 > 150;
|
|
29
|
+
}
|
|
30
|
+
function O(r, n) {
|
|
31
|
+
if (r.startsWith("rgba")) return r.replace(/[\d.]+\)\s*$/, `${n})`);
|
|
32
|
+
if (r.startsWith("rgb(")) return r.replace(/^rgb\((.*)\)$/i, `rgba($1, ${n})`);
|
|
33
|
+
const t = r + n, e = w.get(t);
|
|
34
|
+
if (e) return e;
|
|
35
|
+
const [a, s, i] = b(v(r)), u = Number.isNaN(a) || Number.isNaN(s) || Number.isNaN(i) ? r : `rgba(${a}, ${s}, ${i}, ${n})`;
|
|
36
|
+
return w.set(t, u), u;
|
|
37
|
+
}
|
|
38
|
+
function P(r, n) {
|
|
39
|
+
const t = r + n;
|
|
40
|
+
let e = C.get(t);
|
|
41
|
+
if (e) return e;
|
|
42
|
+
const [a, s, i] = b(r);
|
|
43
|
+
return e = F(
|
|
44
|
+
Math.min(255, Math.round(a + (255 - a) * n)),
|
|
45
|
+
Math.min(255, Math.round(s + (255 - s) * n)),
|
|
46
|
+
Math.min(255, Math.round(i + (255 - i) * n))
|
|
47
|
+
), C.set(t, e), e;
|
|
48
|
+
}
|
|
49
|
+
const E = 1e4, f = /* @__PURE__ */ new Map();
|
|
50
|
+
function l(r) {
|
|
51
|
+
const n = r / 255;
|
|
52
|
+
return n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
53
|
+
}
|
|
54
|
+
function M(r) {
|
|
55
|
+
const n = r <= 31308e-7 ? r * 12.92 : 1.055 * r ** 0.4166666666666667 - 0.055;
|
|
56
|
+
return Math.max(0, Math.min(255, Math.round(n * 255)));
|
|
57
|
+
}
|
|
58
|
+
function I(r, n, t) {
|
|
59
|
+
const e = l(r), a = l(n), s = l(t), i = Math.cbrt(0.4122214708 * e + 0.5363325363 * a + 0.0514459929 * s), u = Math.cbrt(0.2119034982 * e + 0.6806995451 * a + 0.1073969566 * s), o = Math.cbrt(0.0883024619 * e + 0.2817188376 * a + 0.6299787005 * s);
|
|
60
|
+
return [
|
|
61
|
+
0.2104542553 * i + 0.793617785 * u - 0.0040720468 * o,
|
|
62
|
+
1.9779984951 * i - 2.428592205 * u + 0.4505937099 * o,
|
|
63
|
+
0.0259040371 * i + 0.7827717662 * u - 0.808675766 * o
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
function G(r, n, t) {
|
|
67
|
+
const e = (r + 0.3963377774 * n + 0.2158037573 * t) ** 3, a = (r - 0.1055613458 * n - 0.0638541728 * t) ** 3, s = (r - 0.0894841775 * n - 1.291485548 * t) ** 3;
|
|
68
|
+
return [
|
|
69
|
+
M(4.0767416621 * e - 3.3077115913 * a + 0.2309699292 * s),
|
|
70
|
+
M(-1.2684380046 * e + 2.6097574011 * a - 0.3413193965 * s),
|
|
71
|
+
M(-0.0041960863 * e - 0.7034186147 * a + 1.707614701 * s)
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
function R(r) {
|
|
75
|
+
const n = r.match(/^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)/i);
|
|
76
|
+
if (!n) return 1;
|
|
77
|
+
const t = Number(n[1]);
|
|
78
|
+
return Number.isFinite(t) ? Math.max(0, Math.min(1, t)) : 1;
|
|
79
|
+
}
|
|
80
|
+
function y(r, n, t) {
|
|
81
|
+
const e = Math.max(0, Math.min(1, t)), a = $(r), s = $(n);
|
|
82
|
+
if (!a || !s) return e < 0.5 ? r : n;
|
|
83
|
+
const i = Math.round(e * 255), u = `${r}\0${n}\0${i}`, o = f.get(u);
|
|
84
|
+
if (o) return o;
|
|
85
|
+
const [z, H, L] = a, [T, j, k] = s, [N, g, d] = I(z, H, L), [q, A, B] = I(T, j, k), c = i / 255, [p, x, S] = G(N + (q - N) * c, g + (A - g) * c, d + (B - d) * c), m = R(r), W = R(n);
|
|
86
|
+
let h;
|
|
87
|
+
if (m >= 1 && W >= 1)
|
|
88
|
+
h = F(p, x, S);
|
|
89
|
+
else {
|
|
90
|
+
const D = Math.round((m + (W - m) * c) * 1e3) / 1e3;
|
|
91
|
+
h = `rgba(${p}, ${x}, ${S}, ${D})`;
|
|
92
|
+
}
|
|
93
|
+
return f.size >= E && f.clear(), f.set(u, h), h;
|
|
94
|
+
}
|
|
95
|
+
function Q(r, n) {
|
|
96
|
+
return [y(r, n, 0.12), n];
|
|
97
|
+
}
|
|
98
|
+
function X(r, n) {
|
|
99
|
+
if (r.length === 0) return "#000000";
|
|
100
|
+
if (r.length === 1) return r[0];
|
|
101
|
+
const t = (Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : 0) * (r.length - 1), e = Math.min(r.length - 2, Math.floor(t));
|
|
102
|
+
return y(r[e], r[e + 1], t - e);
|
|
32
103
|
}
|
|
33
104
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
105
|
+
Q as deriveHeatmapRamp,
|
|
106
|
+
O as hexToRgba,
|
|
107
|
+
K as isLightColor,
|
|
108
|
+
P as lighten,
|
|
109
|
+
y as mixColors,
|
|
110
|
+
J as resolveColor,
|
|
111
|
+
X as sampleRamp
|
|
37
112
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function o(r, e) {
|
|
2
|
+
if (r === e) return !0;
|
|
3
|
+
if (r === null || e === null || typeof r != "object" || typeof e != "object" || Array.isArray(r) !== Array.isArray(e)) return !1;
|
|
4
|
+
if (Array.isArray(r) && Array.isArray(e))
|
|
5
|
+
return r.length === e.length && r.every((n, y) => o(n, e[y]));
|
|
6
|
+
if (r instanceof Date || e instanceof Date)
|
|
7
|
+
return r instanceof Date && e instanceof Date && r.getTime() === e.getTime();
|
|
8
|
+
if (!f(r) || !f(e)) return !1;
|
|
9
|
+
const a = r, t = e, i = Object.keys(a), s = Object.keys(t);
|
|
10
|
+
return i.length === s.length && i.every((n) => n in t && o(a[n], t[n]));
|
|
11
|
+
}
|
|
12
|
+
function f(r) {
|
|
13
|
+
const e = Object.getPrototypeOf(r);
|
|
14
|
+
return e === Object.prototype || e === null;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
o as deepEqual
|
|
18
|
+
};
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
function
|
|
1
|
+
function m(e) {
|
|
2
2
|
return e instanceof Date ? e.getTime() : e;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time:
|
|
4
|
+
function c(e) {
|
|
5
|
+
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time: m(t.time) }));
|
|
6
6
|
}
|
|
7
7
|
function u(e) {
|
|
8
|
-
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time:
|
|
8
|
+
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time: m(t.time) }));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function l(e) {
|
|
11
11
|
if (e.length < 2) return 864e5;
|
|
12
12
|
const t = [];
|
|
13
13
|
for (let n = 1; n < Math.min(e.length, 20); n++)
|
|
14
14
|
t.push(e[n] - e[n - 1]);
|
|
15
15
|
return t.sort((n, i) => n - i), t[Math.floor(t.length / 2)];
|
|
16
16
|
}
|
|
17
|
-
function s(e, t) {
|
|
18
|
-
const
|
|
19
|
-
return t >= 31536e6 ?
|
|
17
|
+
function s(e, t, n) {
|
|
18
|
+
const i = new Date(e), r = n?.locale ?? "en-US", o = n?.timeZone, a = n?.hour12 ?? !1;
|
|
19
|
+
return t >= 31536e6 ? i.toLocaleDateString(r, { year: "numeric", timeZone: o }) : t >= 864e5 ? i.toLocaleDateString(r, { month: "short", day: "numeric", timeZone: o }) : t >= 36e5 ? i.toLocaleTimeString(r, { hour: "2-digit", minute: "2-digit", hour12: a, timeZone: o }) : i.toLocaleTimeString(r, {
|
|
20
20
|
hour: "2-digit",
|
|
21
21
|
minute: "2-digit",
|
|
22
22
|
second: "2-digit",
|
|
23
|
-
hour12:
|
|
23
|
+
hour12: a,
|
|
24
|
+
timeZone: o
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
return new Date(e).toLocaleDateString("en-US", {
|
|
27
|
+
function f(e, t) {
|
|
28
|
+
return new Date(e).toLocaleDateString(t?.locale ?? "en-US", {
|
|
29
|
+
month: "short",
|
|
30
|
+
day: "numeric",
|
|
31
|
+
year: "numeric",
|
|
32
|
+
timeZone: t?.timeZone
|
|
33
|
+
});
|
|
28
34
|
}
|
|
29
|
-
function
|
|
30
|
-
const t = [1e3, 5e3, 1e4, 15e3, 3e4], n = [6e4, 5 * 6e4, 10 * 6e4, 15 * 6e4, 30 * 6e4], i = [36e5, 2 * 36e5, 4 * 36e5, 6 * 36e5, 12 * 36e5],
|
|
31
|
-
return e < 6e4 ? [...t, ...n, ...i, ...
|
|
35
|
+
function h(e) {
|
|
36
|
+
const t = [1e3, 5e3, 1e4, 15e3, 3e4], n = [6e4, 5 * 6e4, 10 * 6e4, 15 * 6e4, 30 * 6e4], i = [36e5, 2 * 36e5, 4 * 36e5, 6 * 36e5, 12 * 36e5], r = [864e5, 7 * 864e5, 30 * 864e5, 90 * 864e5], o = [31536e6, 2 * 31536e6, 5 * 31536e6, 10 * 31536e6, 25 * 31536e6, 50 * 31536e6, 100 * 31536e6];
|
|
37
|
+
return e < 6e4 ? [...t, ...n, ...i, ...r, ...o] : e < 36e5 ? [...n, ...i, ...r, ...o] : e < 864e5 ? [...i, ...r, ...o] : e < 31536e6 ? [...r, ...o] : o;
|
|
32
38
|
}
|
|
33
39
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
l as detectInterval,
|
|
41
|
+
f as formatDate,
|
|
36
42
|
s as formatTime,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
h as niceTimeIntervals,
|
|
44
|
+
c as normalizeOHLCArray,
|
|
45
|
+
m as normalizeTime,
|
|
40
46
|
u as normalizeTimePointArray
|
|
41
47
|
};
|