@tony01/astroneum 0.4.1-beta.2 → 0.4.1-beta.25

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 (55) hide show
  1. package/CHANGELOG.md +281 -237
  2. package/LICENSE +21 -21
  3. package/README.md +250 -198
  4. package/dist/{Indicator-BBI3L_lx.d.ts → Indicator-BQQcVGGT.d.ts} +51 -227
  5. package/dist/astroneum.css +1 -1
  6. package/dist/chunk-47YGQEL5.js +399 -0
  7. package/dist/chunk-67XM5LOK.js +2 -0
  8. package/dist/{chunk-2YYGUSVX.js → chunk-DFJMDDL5.js} +1 -1
  9. package/dist/chunk-EFAS6F4C.js +59 -0
  10. package/dist/chunk-EHZN52CY.js +2 -0
  11. package/dist/chunk-HKLWNPMP.js +35 -0
  12. package/dist/chunk-ONPPQW65.js +2 -0
  13. package/dist/chunk-SCTHEM27.js +3 -0
  14. package/dist/chunk-UQXYMB6X.js +2 -0
  15. package/dist/chunk-WSIR5T2M.js +3 -0
  16. package/dist/entries/alerts.d.ts +36 -10
  17. package/dist/entries/alerts.js +1 -1
  18. package/dist/entries/datafeeds/crypto.d.ts +5 -1
  19. package/dist/entries/datafeeds/crypto.js +1 -1
  20. package/dist/entries/datafeeds/polygon.d.ts +3 -1
  21. package/dist/entries/datafeeds/polygon.js +1 -1
  22. package/dist/entries/headless.d.ts +78 -0
  23. package/dist/entries/headless.js +2 -0
  24. package/dist/entries/multichart.d.ts +12 -1
  25. package/dist/entries/multichart.js +1 -1
  26. package/dist/entries/replay.d.ts +3 -1
  27. package/dist/entries/script.d.ts +2 -68
  28. package/dist/entries/script.js +1 -1
  29. package/dist/entries/watchlist.d.ts +32 -2
  30. package/dist/entries/watchlist.js +1 -1
  31. package/dist/entries/workspace.d.ts +61 -0
  32. package/dist/entries/workspace.js +2 -0
  33. package/dist/index-BiXdqLA4.d.ts +45 -0
  34. package/dist/index-_JgHTy8X.d.ts +19 -0
  35. package/dist/index.d.ts +188 -27
  36. package/dist/index.js +1 -1
  37. package/dist/script-BU9StbN-.d.ts +120 -0
  38. package/dist/types-W6SIYQ9m.d.ts +232 -0
  39. package/dist/types-yETgeYsE.d.ts +28 -0
  40. package/dist/zh-CN-NDTUDZGZ.js +3 -0
  41. package/package.json +157 -147
  42. package/dist/chunk-4YOLQ5DC.js +0 -2
  43. package/dist/chunk-I4YQBP2M.js +0 -3
  44. package/dist/chunk-OOMZRONH.js +0 -35
  45. package/dist/chunk-PV2GAINM.js +0 -2
  46. package/dist/chunk-YW3STIPY.js +0 -653
  47. package/dist/zh-CN-Y2C6RSOI.js +0 -3
  48. package/docs/STRUCTURE.md +0 -231
  49. package/docs/TODO-DESIGN.md +0 -261
  50. package/docs/TODO.md +0 -222
  51. package/docs/api.md +0 -528
  52. package/docs/datafeed-guide.md +0 -311
  53. package/docs/design-astroneum.md +0 -479
  54. package/docs/plugin-development.md +0 -565
  55. package/docs/tv-functions-skill.md +0 -706
package/README.md CHANGED
@@ -1,198 +1,250 @@
1
- # Astroneum
2
-
3
- Professional financial charting library for React applications — now with
4
- TradingView-class features, zero licensing fees, and MIT license.
5
-
6
- [![npm version](https://img.shields.io/npm/v/astroneum?label=npm)](https://www.npmjs.com/package/astroneum)
7
- [![npm downloads](https://img.shields.io/npm/dm/astroneum)](https://www.npmjs.com/package/astroneum)
8
- [![React 18-19](https://img.shields.io/badge/react-18%20%7C%2019-149eca)](https://react.dev/)
9
- [![TypeScript](https://img.shields.io/badge/typescript-ready-3178c6)](https://www.typescriptlang.org/)
10
- [![Node >=18](https://img.shields.io/badge/node-%3E%3D18-339933)](https://nodejs.org/)
11
- [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
12
-
13
- ![Astroneum chart — dark theme with EMA, MACD, RSI and volume indicators](screenshort-1.png)
14
-
15
- ![Astroneum chart — dark theme with multi-pane indicators](screenshort-2.png)
16
-
17
- ## Features
18
-
19
- ### Chart Types
20
- - **Candlestick, OHLC, bar, area, line, Heikin-Ashi** — rendered via Canvas2D / WebGL2 with GPU acceleration
21
- - **Non-time-based bars** — Renko, Kagi, Tick, Range, and Point & Figure generators
22
- - **Multi-chart grid** (2/4/8/16 panes) and **multi-period stacked layout** (e.g. 4H + 1H + 15m)
23
-
24
- ### Indicators & Analysis
25
- - **28 built-in indicators** — SMA, EMA, MACD, RSI, KDJ, Bollinger Bands, TRIX, SAR, and more
26
- - **Volume Profile** — horizontal histogram with POC, Value Area, and price-level bucketing
27
- - **ZigZag + auto pattern detection** — swing highs/lows, support/resistance clustering
28
- - **Depth of Market** — bid/ask volume ladder visualization
29
- - **Compare/Overlay** — second symbol normalized to percentage on same pane
30
- - **Multi-timeframe indicators** — resample any TF, forward-fill to lower TF bars
31
- - **Custom indicator plugins** via `registerIndicatorPlugin()` with Canvas2D or WebGL2 render path
32
- - **Script editor** — sandboxed Pine-Script–inspired JS environment for custom indicators
33
-
34
- ### Drawing Tools
35
- - **18 drawing tools** — trend lines, Fibonacci (circle, spiral, extension, segment, fan), Gann boxes, pitchforks, Elliott waves, harmonic patterns (ABCD, XABCD), and **measure/ruler tool**
36
- - **Magnet/Snap** — snap to bar OHLC within 8px, angle snap to 0°/30°/45°/60°/90°
37
- - **Drawing style presets** (7 built-in + custom) with live preview and per-drawing color
38
- - **Undo/Redo** — `UndoManager` with 50-entry depth via Ctrl+Z / Ctrl+Y
39
- - **Copy/Paste drawings** — Ctrl+C/V across charts via clipboard
40
- - **Lock all drawings** toggle
41
- - **Session visualizer** — auto session high/low/open/close lines
42
-
43
- ### Navigation & UX
44
- - **Keyboard shortcuts** — arrows pan, Page/Home/End scroll/jump, mouse wheel zoom at cursor
45
- - **Crosshair sync** across multi-chart and multi-period layouts
46
- - **Price axis scaling** — linear, log, percentage, indexed-to-100
47
- - **Chart templates** — save/load named configurations to localStorage
48
- - **Accessibility** — `accessible` prop with aria-live OHLCV announcement
49
- - **State serialization** — full chart state persistence & recovery via `serializeState()`/`loadState()`
50
-
51
- ### Data & Performance
52
- - **Off-main-thread indicator pool** — Web Workers + TypedArray column store
53
- - **OPFS historical cache** — binary bar data persisted to Origin Private File System
54
- - **FlatBuffers binary codec** (`BarsCodec`) — 40 bytes per bar, efficient storage & transfer
55
- - **TickAnimator** — smooth close/high/low interpolation at 60fps
56
- - **TaskScheduler** with priority queue (data > indicator > overlay)
57
- - **SharedArrayBuffer** ring buffer when `crossOriginIsolated`
58
-
59
- ### Datafeeds
60
- - **StandardCryptoDatafeed** — 100+ symbols, Binance/Bitget/OKX futures, real-time WebSocket
61
- - **DefaultDatafeed & WebSocketDatafeed** — Polygon.io REST + WebSocket
62
- - **WebTransportDatafeed** — experimental HTTP/3 QUIC support
63
- - **BYO datafeed** — 4-method interface (`searchSymbols`, `getHistoryData`, `subscribe`, `unsubscribe`)
64
-
65
- ### Developer Experience
66
- - **Fully typed TypeScript** — branded financial types (`Price`, `Volume`, `Timestamp`)
67
- - **8 tree-shakeable subpath exports** — import only what you need
68
- - **19 locales** — lazy-loaded on demand, dark/light/high-contrast themes
69
- - **SSR-safe** — `'use client'` on every entry, Next.js App Router compatible
70
- - **MIT license** — no usage limits, no watermark, no "Powered by" branding
71
-
72
- ---
73
-
74
- ## Install
75
-
76
- ```bash
77
- npm install astroneum
78
- ```
79
-
80
- `react` and `react-dom` ≥ 18 are peer dependencies.
81
-
82
- ## Quick Start
83
-
84
- ```tsx
85
- import { useMemo, useRef, useState } from 'react'
86
- import {
87
- AstroneumChart,
88
- createStandardCryptoDatafeed,
89
- STANDARD_CRYPTO_SYMBOLS,
90
- type AstroneumHandle,
91
- type Period,
92
- type SymbolInfo,
93
- } from '@tony01/astroneum'
94
- import 'astroneum/style.css'
95
-
96
- export default function App() {
97
- const chartRef = useRef<AstroneumHandle>(null)
98
- const datafeed = useMemo(() => createStandardCryptoDatafeed(), [])
99
- const [symbol] = useState<SymbolInfo>(STANDARD_CRYPTO_SYMBOLS[0])
100
- const [period] = useState<Period>({ multiplier: 1, timespan: 'hour', text: '1H' })
101
-
102
- return (
103
- <AstroneumChart
104
- ref={chartRef}
105
- symbol={symbol}
106
- period={period}
107
- datafeed={datafeed}
108
- theme="dark"
109
- subIndicators={['VOL']}
110
- style={{ width: '100%', height: 560 }}
111
- />
112
- )
113
- }
114
- ```
115
-
116
- ## Key Props
117
-
118
- | Prop | Type | Description |
119
- |------|------|-------------|
120
- | `symbol` | `SymbolInfo` | Symbol to display |
121
- | `period` | `Period` | Timeframe (1m, 5m, 1H, 4H, D, etc.) |
122
- | `datafeed` | `Datafeed` | Data source (crypto, Polygon, or custom) |
123
- | `theme` | `string` | `'dark'`, `'light'`, or `'high-contrast'` |
124
- | `barStyle` | `'candle' \| 'heikin_ashi'` | Candle rendering style |
125
- | `priceScale` | `'linear' \| 'log' \| 'percent' \| 'indexed'` | Price axis scale |
126
- | `locale` | `string` | BCP-47 locale (e.g. `'ja-JP'`) |
127
- | `drawingBarVisible` | `boolean` | Show drawing toolbar |
128
- | `mainIndicators` | `IndicatorDef[]` | Main pane indicators |
129
- | `subIndicators` | `string[]` | Sub-pane indicators (`['VOL', 'MACD', 'RSI']`) |
130
- | `plugins` | `ChartPlugin[]` | Custom plugins with lifecycle hooks |
131
- | `accessible` | `boolean` | Screen-reader support |
132
- | `style` / `className` | | Container styling |
133
-
134
- ## Subpath Exports
135
-
136
- ```tsx
137
- // Main entry
138
- import { AstroneumChart, DefaultDatafeed } from '@tony01/astroneum'
139
-
140
- // Tree-shakeable subpaths
141
- import { BarReplay } from '@tony01/astroneum/replay'
142
- import { MultiChartLayout } from '@tony01/astroneum/multichart'
143
- import { MultiPeriodLayout } from '@tony01/astroneum' // same symbol, stacked periods
144
- import { WatchlistManager } from '@tony01/astroneum/watchlist'
145
- import { PortfolioTracker } from '@tony01/astroneum/portfolio'
146
- import { AlertManager } from '@tony01/astroneum/alerts'
147
- import { ScriptEngine } from '@tony01/astroneum/script'
148
- import { UndoManager } from '@tony01/astroneum'
149
- import { ChartTemplateManager } from '@tony01/astroneum'
150
- import { SessionVisualizer } from '@tony01/astroneum'
151
-
152
- // Datafeeds
153
- import { createStandardCryptoDatafeed, STANDARD_CRYPTO_SYMBOLS } from '@tony01/astroneum/datafeeds/crypto'
154
- import { DefaultDatafeed, WebSocketDatafeed } from '@tony01/astroneum/datafeeds/polygon'
155
-
156
- // Utilities
157
- import { heikinAshi } from '@tony01/astroneum' // OHLC → Heikin-Ashi transform
158
- import { zigzag, detectSupportResistance } from '@tony01/astroneum' // pattern detection
159
- import { resampleBars, forwardFill } from '@tony01/astroneum' // multi-TF resampling
160
- import { generateRenko, generateKagi,
161
- generateTickBars, generateRangeBars,
162
- generatePointAndFigure } from '@tony01/astroneum' // non-time-based bars
163
- import { transformCandles, untransformPrice } from '@tony01/astroneum' // price scale transforms
164
-
165
- // Plugins
166
- import { volumeProfilePlugin, domPlugin, zigzagPlugin,
167
- pointAndFigurePlugin } from '@tony01/astroneum' // registerIndicatorPlugin(...)
168
- import { createCompareIndicator } from '@tony01/astroneum' // compare symbols overlay
169
- ```
170
-
171
- ## Browser Support
172
-
173
- | Browser | Minimum | Notes |
174
- |---------|---------|-------|
175
- | Chrome / Edge | 110+ | Full WebGL2 + OPFS |
176
- | Firefox | 115+ | Full WebGL2 |
177
- | Safari | 16.4+ | Full WebGL2, OPFS on 17+ |
178
- | iOS Safari | 16.4+ | Touch + pinch |
179
-
180
- Graceful fallback: no WebGL2 → Canvas2D, no OPFS → in-memory cache, no OffscreenCanvas → main-thread calc.
181
-
182
- ## Next.js Usage
183
-
184
- ```ts
185
- // next.config.ts
186
- const nextConfig = { transpilePackages: ['astroneum'] }
187
- ```
188
-
189
- ```tsx
190
- // app/layout.tsx
191
- import 'astroneum/style.css'
192
- ```
193
-
194
- The library ships with `'use client'` built in — no extra directive needed.
195
-
196
- ## License
197
-
198
- MIT — use it anywhere, no fees, no limits, no branding requirement.
1
+ # Astroneum
2
+
3
+ Professional financial charting library for React applications — now with
4
+ TradingView-class features, zero licensing fees, and MIT license.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/%40tony01%2Fastroneum?label=npm)](https://www.npmjs.com/package/@tony01/astroneum)
7
+ [![npm downloads](https://img.shields.io/npm/dm/%40tony01%2Fastroneum)](https://www.npmjs.com/package/@tony01/astroneum)
8
+ [![React 18-19](https://img.shields.io/badge/react-18%20%7C%2019-149eca)](https://react.dev/)
9
+ [![TypeScript](https://img.shields.io/badge/typescript-ready-3178c6)](https://www.typescriptlang.org/)
10
+ [![Node >=18](https://img.shields.io/badge/node-%3E%3D18-339933)](https://nodejs.org/)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
12
+
13
+ ![Astroneum chart — dark theme with EMA, MACD, RSI and volume indicators](screenshort-1.png)
14
+
15
+ ![Astroneum chart — dark theme with multi-pane indicators](screenshort-2.png)
16
+
17
+ ## Features
18
+
19
+ ### Chart Types
20
+ - **Candlestick, OHLC, bar, area, line, Heikin-Ashi** — rendered via Canvas2D / WebGL2 with GPU acceleration
21
+ - **Non-time-based bars** — Renko, Kagi, Tick, Range, and Point & Figure generators
22
+ - **Multi-chart grid** (2/4/8/16 panes) and **multi-period stacked layout** (e.g. 4H + 1H + 15m)
23
+
24
+ ### Indicators & Analysis
25
+ - **50 built-in indicators** — SMA, EMA, MACD, RSI, KDJ, Bollinger Bands, TRIX, SAR, and more
26
+ - **Volume Profile** — horizontal histogram with POC, Value Area, and price-level bucketing
27
+ - **ZigZag + auto pattern detection** — swing highs/lows, support/resistance clustering
28
+ - **Depth of Market** — bid/ask volume ladder visualization
29
+ - **Compare/Overlay** — second symbol normalized to percentage on same pane
30
+ - **Multi-timeframe indicators** — resample any TF, forward-fill to lower TF bars
31
+ - **Custom indicator plugins** via `registerIndicatorPlugin()` with Canvas2D or WebGL2 render path
32
+ - **Script editor** — sandboxed Pine-Script–inspired JS environment for custom indicators
33
+ - **Deterministic strategy backtesting** — bounded script signal contract, trade/equity/drawdown result types, and a demo report surface; not broker execution
34
+
35
+ ### Drawing Tools
36
+ - **20 drawing tools** ? trend lines, Fibonacci (circle, spiral, extension, segment, fan), Gann boxes, pitchforks, Elliott waves, harmonic patterns (ABCD, XABCD), cursor modes, zoom, and **measure/ruler tool**
37
+ - **Magnet/Snap** — snap to bar OHLC within 8px, angle snap to 0°/30°/45°/60°/90°
38
+ - **Drawing style presets** (7 built-in + custom) with live preview and per-drawing color
39
+ - **Undo/Redo** — `UndoManager` with 50-entry depth via Ctrl+Z / Ctrl+Y
40
+ - **Copy/Paste drawings** — Ctrl+C/V across charts via clipboard
41
+ - **Lock all drawings** toggle
42
+ - **Session visualizer** — auto session high/low/open/close lines
43
+
44
+ ### Navigation & UX
45
+ - **Keyboard shortcuts** — arrows pan, Page/Home/End scroll/jump, mouse wheel zoom at cursor
46
+ - **Crosshair sync** across multi-chart and multi-period layouts
47
+ - **Price axis scaling** — linear, log, percentage, indexed-to-100
48
+ - **Chart templates** — save/load named configurations to localStorage
49
+ - **Accessibility** — `accessible` prop with aria-live OHLCV announcement
50
+ - **State serialization** — full chart state persistence & recovery via `serializeState()`/`loadState()`
51
+
52
+ ### Data & Performance
53
+ - **Off-main-thread indicator pool** — Web Workers + TypedArray column store
54
+ - **OPFS historical cache** — binary bar data persisted to Origin Private File System
55
+ - **FlatBuffers binary codec** (`BarsCodec`) — 40 bytes per bar, efficient storage & transfer
56
+ - **TickAnimator** — smooth close/high/low interpolation at 60fps
57
+ - **TaskScheduler** with priority queue (data > indicator > overlay)
58
+ - **SharedArrayBuffer** ring buffer when `crossOriginIsolated`
59
+
60
+ ### Datafeeds
61
+ - **StandardCryptoDatafeed** — 100+ symbols, Binance/Bitget/OKX futures, real-time WebSocket
62
+ - **DefaultDatafeed & WebSocketDatafeed** — Polygon.io REST + WebSocket
63
+ - **WebTransportDatafeed** — experimental HTTP/3 QUIC support
64
+ - **BYO datafeed** — 4-method interface (`searchSymbols`, `getHistoryData`, `subscribe`, `unsubscribe`)
65
+
66
+ ### Developer Experience
67
+ - **Fully typed TypeScript** — branded financial types (`Price`, `Volume`, `Timestamp`)
68
+ - **10 tree-shakeable subpath exports** — import only what you need
69
+ - **18 locale JSON files** ? lazy-loaded on demand, dark/light/high-contrast themes
70
+ - **SSR-safe** — `'use client'` on every entry, Next.js App Router compatible
71
+ - **MIT license** — no usage limits, no watermark, no "Powered by" branding
72
+
73
+ ---
74
+
75
+ ## Install
76
+
77
+ ```bash
78
+ npm install @tony01/astroneum
79
+ ```
80
+
81
+ `react` and `react-dom` ≥ 18 are peer dependencies.
82
+
83
+ ## Quick Start
84
+
85
+ ```tsx
86
+ import { useMemo, useRef, useState } from 'react'
87
+ import {
88
+ AstroneumChart,
89
+ createStandardCryptoDatafeed,
90
+ STANDARD_CRYPTO_SYMBOLS,
91
+ type AstroneumHandle,
92
+ type Period,
93
+ type SymbolInfo,
94
+ } from '@tony01/astroneum'
95
+ import '@tony01/astroneum/style.css'
96
+
97
+ export default function App() {
98
+ const chartRef = useRef<AstroneumHandle>(null)
99
+ const datafeed = useMemo(() => createStandardCryptoDatafeed(), [])
100
+ const [symbol] = useState<SymbolInfo>(STANDARD_CRYPTO_SYMBOLS[0])
101
+ const [period] = useState<Period>({ multiplier: 1, timespan: 'hour', text: '1H' })
102
+
103
+ return (
104
+ <AstroneumChart
105
+ ref={chartRef}
106
+ symbol={symbol}
107
+ period={period}
108
+ datafeed={datafeed}
109
+ theme="dark"
110
+ subIndicators={['VOL']}
111
+ style={{ width: '100%', height: 560 }}
112
+ />
113
+ )
114
+ }
115
+ ```
116
+
117
+ ## Key Props
118
+
119
+ | Prop | Type | Description |
120
+ |------|------|-------------|
121
+ | `symbol` | `SymbolInfo` | Symbol to display |
122
+ | `period` | `Period` | Timeframe (1m, 5m, 1H, 4H, D, etc.) |
123
+ | `datafeed` | `Datafeed` | Data source (crypto, Polygon, or custom); may implement optional batched `getQuotes` for watchlists |
124
+ | `theme` | `string` | `'dark'`, `'light'`, or `'high-contrast'` |
125
+ | `barStyle` | `'candle' \| 'heikin_ashi'` | Candle rendering style |
126
+ | `priceScale` | `'linear' \| 'log' \| 'percent' \| 'indexed'` | Price axis scale |
127
+ | `locale` | `string` | BCP-47 locale (e.g. `'ja-JP'`) |
128
+ | `drawingBarVisible` | `boolean` | Show drawing toolbar |
129
+ | `mainIndicators` | `IndicatorDef[]` | Main pane indicators |
130
+ | `subIndicators` | `string[]` | Sub-pane indicators (`['VOL', 'MACD', 'RSI']`) |
131
+ | `plugins` | `ChartPlugin[]` | Custom plugins with lifecycle hooks |
132
+ | `accessible` | `boolean` | Screen-reader support |
133
+ | `style` / `className` | | Container styling |
134
+
135
+ ## Subpath Exports
136
+
137
+ ```tsx
138
+ // Main entry
139
+ import { AstroneumChart, DefaultDatafeed } from '@tony01/astroneum'
140
+
141
+ // Tree-shakeable subpaths
142
+ import { createChart } from '@tony01/astroneum/headless'
143
+ import { BarReplay } from '@tony01/astroneum/replay'
144
+ import { MultiChartLayout } from '@tony01/astroneum/multichart'
145
+ import { MultiPeriodLayout } from '@tony01/astroneum' // same symbol, stacked periods
146
+ import { WatchlistManager } from '@tony01/astroneum/watchlist' // persisted lists, sort, columns, colors, live snapshots
147
+ import { PortfolioTracker } from '@tony01/astroneum/portfolio'
148
+ import { AlertManager } from '@tony01/astroneum/alerts'
149
+ import { ScriptEngine } from '@tony01/astroneum/script'
150
+ import { UndoManager } from '@tony01/astroneum'
151
+ import { ChartTemplateManager } from '@tony01/astroneum'
152
+ import { SessionVisualizer } from '@tony01/astroneum'
153
+
154
+ // Datafeeds
155
+ import { createStandardCryptoDatafeed, STANDARD_CRYPTO_SYMBOLS } from '@tony01/astroneum/datafeeds/crypto'
156
+ import { DefaultDatafeed, WebSocketDatafeed } from '@tony01/astroneum/datafeeds/polygon'
157
+
158
+ // Utilities
159
+ import { heikinAshi } from '@tony01/astroneum' // OHLC → Heikin-Ashi transform
160
+ import { zigzag, detectSupportResistance } from '@tony01/astroneum' // pattern detection
161
+ import { resampleBars, forwardFill } from '@tony01/astroneum' // multi-TF resampling
162
+ import { generateRenko, generateKagi,
163
+ generateTickBars, generateRangeBars,
164
+ generatePointAndFigure } from '@tony01/astroneum' // non-time-based bars
165
+ import { transformCandles, untransformPrice } from '@tony01/astroneum' // price scale transforms
166
+
167
+ // Plugins
168
+ import { volumeProfilePlugin, domPlugin, zigzagPlugin,
169
+ pointAndFigurePlugin } from '@tony01/astroneum' // registerIndicatorPlugin(...)
170
+ import { createCompareIndicator } from '@tony01/astroneum' // compare symbols overlay
171
+ ```
172
+
173
+ ## Headless Engine
174
+
175
+ `@tony01/astroneum/headless` exposes the rendering engine without React,
176
+ Astroneum UI, stylesheets, datafeeds, keyboard shortcuts, or network behavior.
177
+ The host supplies the container, bars, controls, persistence, and lifecycle.
178
+
179
+ ```ts
180
+ import {
181
+ asPrice,
182
+ asTimestamp,
183
+ createChart,
184
+ destroyChart,
185
+ registerBuiltInExtensions,
186
+ } from '@tony01/astroneum/headless'
187
+
188
+ registerBuiltInExtensions()
189
+
190
+ const chart = createChart(document.getElementById('chart')!)
191
+ chart.replaceBars([{
192
+ timestamp: asTimestamp(Date.UTC(2026, 7, 29)),
193
+ open: asPrice(100),
194
+ high: asPrice(105),
195
+ low: asPrice(98),
196
+ close: asPrice(103),
197
+ }])
198
+
199
+ destroyChart(chart)
200
+ ```
201
+
202
+ Calling `createChart()` twice with the same container returns the same instance.
203
+ `destroyChart()` is idempotent and releases the container for a later mount.
204
+ `replaceBars()` requires strictly ascending, finite UTC-millisecond OHLCV data;
205
+ `updateBar()` may replace the current last bar or append a newer bar. Invalid data
206
+ throws without mutating current bars. Calling either method switches that chart to
207
+ host-owned data and detaches any explicitly configured engine data loader.
208
+
209
+ Built-in indicator and drawing registration is explicit and process-wide. Call
210
+ `registerBuiltInExtensions()` once before creating studies or drawings. The
211
+ headless entry does not require `style.css`.
212
+
213
+ Typed `registerIndicatorPlugin()` helpers and raw `registerIndicator()` /
214
+ `registerOverlay()` primitives let the host supply study and drawing behavior.
215
+ `getViewportState()` returns only versioned bar spacing and right-offset bar count;
216
+ `setViewportState()` validates and clamps those fields against current bars and
217
+ container geometry. Restore it after bars load. Screenshot export composites the
218
+ ordered Canvas2D, WebGL, WebGPU, worker-canvas, and GPU-text layers.
219
+
220
+ `createStandardCryptoDatafeed()` implements batched watchlist snapshots for Binance, Bitget, and OKX. Custom datafeeds can opt in with `getQuotes(symbols)`; consumers without it continue to work and display unavailable quote values.
221
+
222
+ ## Browser Support
223
+
224
+ | Browser | Minimum | Notes |
225
+ |---------|---------|-------|
226
+ | Chrome / Edge | 110+ | Full WebGL2 + OPFS |
227
+ | Firefox | 115+ | Full WebGL2 |
228
+ | Safari | 16.4+ | Full WebGL2, OPFS on 17+ |
229
+ | iOS Safari | 16.4+ | Touch + pinch |
230
+
231
+ Graceful fallback: no WebGL2 → Canvas2D, no OPFS → in-memory cache, no OffscreenCanvas → main-thread calc.
232
+
233
+ ## Next.js Usage
234
+
235
+ ```ts
236
+ // next.config.ts
237
+ const nextConfig = { transpilePackages: ['@tony01/astroneum'] }
238
+ ```
239
+
240
+ ```tsx
241
+ // app/layout.tsx
242
+ import '@tony01/astroneum/style.css'
243
+ ```
244
+
245
+ The library ships with `'use client'` built in — no extra directive needed.
246
+
247
+ ## License
248
+
249
+ MIT — use it anywhere, no fees, no limits, no branding requirement. The package
250
+ retains the upstream copyright notice for Kowit Charoenratchatabhan.