@livo-build/charts 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -19
- package/dist/core/chart.d.ts +44 -2
- package/dist/core/chart.js +123 -11
- package/dist/core/feed.js +27 -6
- package/dist/core/indicators.d.ts +36 -0
- package/dist/core/indicators.js +119 -0
- package/dist/core/ohlc.d.ts +10 -0
- package/dist/core/ohlc.js +30 -0
- package/dist/core/polymarket.d.ts +53 -0
- package/dist/core/polymarket.js +173 -0
- package/dist/core/renderer.d.ts +19 -4
- package/dist/core/renderer.js +217 -34
- package/dist/core/signals.d.ts +63 -0
- package/dist/core/signals.js +234 -0
- package/dist/core/types.d.ts +31 -8
- package/dist/index.d.ts +9 -4
- package/dist/index.js +5 -3
- package/dist/react/HyperliquidChart.d.ts +4 -2
- package/dist/react/HyperliquidChart.js +11 -3
- package/dist/react/PolymarketChart.d.ts +45 -0
- package/dist/react/PolymarketChart.js +95 -0
- package/dist/react/PriceChart.d.ts +18 -3
- package/dist/react/PriceChart.js +16 -4
- package/dist/react/SignalsChart.d.ts +37 -0
- package/dist/react/SignalsChart.js +95 -0
- package/dist/react/ui.d.ts +13 -2
- package/dist/react/ui.js +46 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.js +2 -0
- package/package.json +2 -2
package/dist/react/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
import type { ChartTheme } from "../core/types";
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { ChartTheme, ChartType, DrawMode } from "../core/types";
|
|
3
3
|
/**
|
|
4
4
|
* Toolbar/legend styling derived from the chart {@link ChartTheme}, so the chrome tracks
|
|
5
5
|
* the chart instead of being hardcoded dark. Active buttons reuse the crosshair-pill
|
|
@@ -11,3 +11,14 @@ export declare function toolbarUi(theme: ChartTheme): {
|
|
|
11
11
|
barStyle: CSSProperties;
|
|
12
12
|
muted: string;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* A centered loading overlay (themed SVG spinner + label) for the feed charts — render it
|
|
16
|
+
* over the chart host while the first page is in flight. Absolutely positioned (the host's
|
|
17
|
+
* wrapper is `position: relative`), pointer-events-none, and self-styled (no CSS needed).
|
|
18
|
+
* The spinner animates via inline SVG SMIL, so it works without a stylesheet or @keyframes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadingOverlay(theme: ChartTheme, label?: string): ReactNode;
|
|
21
|
+
/** The chart-type button group: candle / line / baseline / Heikin-Ashi. */
|
|
22
|
+
export declare function typeButtons(theme: ChartTheme, type: ChartType, setType: (t: ChartType) => void): ReactNode;
|
|
23
|
+
/** The drawing-tool button group: trendline / h-line / fib / rectangle / clear. */
|
|
24
|
+
export declare function drawButtons(theme: ChartTheme, mode: DrawMode, setMode: (fn: (prev: DrawMode) => DrawMode) => void, onClear: () => void): ReactNode;
|
package/dist/react/ui.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* Toolbar/legend styling derived from the chart {@link ChartTheme}, so the chrome tracks
|
|
3
4
|
* the chart instead of being hardcoded dark. Active buttons reuse the crosshair-pill
|
|
@@ -27,3 +28,48 @@ export function toolbarUi(theme) {
|
|
|
27
28
|
};
|
|
28
29
|
return { btn, sepStyle, barStyle, muted: theme.axis };
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* A centered loading overlay (themed SVG spinner + label) for the feed charts — render it
|
|
33
|
+
* over the chart host while the first page is in flight. Absolutely positioned (the host's
|
|
34
|
+
* wrapper is `position: relative`), pointer-events-none, and self-styled (no CSS needed).
|
|
35
|
+
* The spinner animates via inline SVG SMIL, so it works without a stylesheet or @keyframes.
|
|
36
|
+
*/
|
|
37
|
+
export function loadingOverlay(theme, label = "Loading…") {
|
|
38
|
+
return (_jsxs("div", { style: {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
inset: 0,
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
gap: 11,
|
|
46
|
+
pointerEvents: "none",
|
|
47
|
+
color: theme.axis,
|
|
48
|
+
fontFamily: "ui-monospace, monospace",
|
|
49
|
+
fontSize: 12,
|
|
50
|
+
letterSpacing: 0.3,
|
|
51
|
+
}, children: [_jsxs("svg", { width: "32", height: "32", viewBox: "0 0 50 50", style: { display: "block" }, "aria-label": "loading", children: [_jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: theme.grid, strokeWidth: "5" }), _jsx("path", { d: "M25 5 a 20 20 0 0 1 20 20", fill: "none", stroke: theme.line, strokeWidth: "5", strokeLinecap: "round", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "0.85s", repeatCount: "indefinite" }) })] }), _jsx("span", { style: { opacity: 0.75 }, children: label })] }));
|
|
52
|
+
}
|
|
53
|
+
/** The chart-type button group: candle / line / baseline / Heikin-Ashi. */
|
|
54
|
+
export function typeButtons(theme, type, setType) {
|
|
55
|
+
const { btn } = toolbarUi(theme);
|
|
56
|
+
const items = [
|
|
57
|
+
["candle", "▮▯", "Candles"],
|
|
58
|
+
["line", "╱", "Line"],
|
|
59
|
+
["baseline", "⎓", "Baseline area"],
|
|
60
|
+
["heikin", "HA", "Heikin-Ashi"],
|
|
61
|
+
];
|
|
62
|
+
return items.map(([t, label, title]) => (_jsx("button", { style: btn(type === t), title: title, onClick: () => setType(t), children: label }, t)));
|
|
63
|
+
}
|
|
64
|
+
/** The drawing-tool button group: trendline / h-line / fib / rectangle / clear. */
|
|
65
|
+
export function drawButtons(theme, mode, setMode, onClear) {
|
|
66
|
+
const { btn } = toolbarUi(theme);
|
|
67
|
+
const tool = (m, label, title) => (_jsx("button", { style: btn(mode === m), title: title, onClick: () => setMode((prev) => (prev === m ? "none" : m)), children: label }, m));
|
|
68
|
+
return [
|
|
69
|
+
tool("trendline", "↗", "Draw trendline (drag)"),
|
|
70
|
+
tool("hline", "—", "Draw horizontal line (click)"),
|
|
71
|
+
tool("fib", "fib", "Fibonacci retracement (drag)"),
|
|
72
|
+
tool("rect", "▭", "Rectangle (drag)"),
|
|
73
|
+
_jsx("button", { style: btn(false), title: "Clear drawings (double-click a line to delete one)", onClick: onClear, children: "\u232B" }, "clear"),
|
|
74
|
+
];
|
|
75
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -2,3 +2,7 @@ export { PriceChart } from "./react/PriceChart";
|
|
|
2
2
|
export type { PriceChartProps } from "./react/PriceChart";
|
|
3
3
|
export { HyperliquidChart } from "./react/HyperliquidChart";
|
|
4
4
|
export type { HyperliquidChartProps } from "./react/HyperliquidChart";
|
|
5
|
+
export { PolymarketChart } from "./react/PolymarketChart";
|
|
6
|
+
export type { PolymarketChartProps } from "./react/PolymarketChart";
|
|
7
|
+
export { SignalsChart } from "./react/SignalsChart";
|
|
8
|
+
export type { SignalsChartProps } from "./react/SignalsChart";
|
package/dist/react.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
// livo-charts — React bindings. Import from `@livo-build/charts/react`.
|
|
2
2
|
export { PriceChart } from "./react/PriceChart";
|
|
3
3
|
export { HyperliquidChart } from "./react/HyperliquidChart";
|
|
4
|
+
export { PolymarketChart } from "./react/PolymarketChart";
|
|
5
|
+
export { SignalsChart } from "./react/SignalsChart";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livo-build/charts",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "livo-charts — a lightweight, dependency-free canvas charting library (candlesticks, zoom/pan, crosshair,
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "livo-charts — a lightweight, dependency-free canvas charting library (candlesticks/line/baseline/Heikin-Ashi, zoom/pan, crosshair, MA/RSI/MACD/Stochastic/ATR indicators, volume profile, drawing tools, and live Hyperliquid/Polymarket/Signal-Radar feeds) with a framework-agnostic core and a React wrapper.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "./dist/index.js",
|