/** A single OHLCV bar. `candles` is an array of these. */ type Candle = { /** Bar open time as Unix epoch milliseconds. */ timeMs: number; /** Opening price. */ open: number; /** Highest price during the bar. */ high: number; /** Lowest price during the bar. */ low: number; /** Closing price. */ close: number; /** Traded volume during the bar. */ volume: number; }; /** * A color value: a hex string (`'#0d1117'`, or 8-digit `'#aarrggbb'`) or a * packed ARGB number. In `VroomTheme` every field is optional — omitted colors * keep the library default. */ type VroomColor = string | number; /** Color overrides for the chart, passed via the `theme` prop. */ type VroomTheme = { /** Chart + axis-strip background. */ background?: VroomColor; /** Up candle body fill. Wick and border default to this unless overridden. */ bull?: VroomColor; /** Down candle body fill. Wick and border default to this unless overridden. */ bear?: VroomColor; /** Generic up color for the price indicator, volume bars, and MACD histogram. Defaults to teal-green; independent of `bull`. */ accentBull?: VroomColor; /** Generic down color for the price indicator, volume bars, and MACD histogram. Defaults to red; independent of `bear`. */ accentBear?: VroomColor; /** Up candle body border (1px, drawn *inside* the body so it never changes candle width). Omit or set to the bull fill color to hide it. */ borderBull?: VroomColor; /** Down candle body border (1px, drawn *inside* the body so it never changes candle width). Omit or set to the bear fill color to hide it. */ borderBear?: VroomColor; /** Up candle wick color. Defaults to the bull fill color. */ wickBull?: VroomColor; /** Down candle wick color. Defaults to the bear fill color. */ wickBear?: VroomColor; /** Wick stroke width in px (applies to both up and down wicks). Defaults to 1. */ wickWidth?: number; /** Corner radius (px) of candle bodies. Defaults to 0 (square). */ candleRadius?: number; /** Round the wick end caps. Defaults to false. */ wickRoundCap?: boolean; /** * Corner radius (px) of the *top* of volume bars. Defaults to 0 (square). * * @deprecated Use `volume.radius`, which sits with the rest of the volume * styling. This still applies when `volume.radius` is omitted. */ volumeRadius?: number; /** Gridlines. */ grid?: VroomColor; /** Axis label text (price + time). */ axisText?: VroomColor; /** * Axis label size in integer CSS px, clamped to 10–14. Omit for 11. * * Shared by the price ticks, the time labels and the labels in indicator * panes (RSI, MACD, ATR). Badges follow it too unless `badgeFontSize` is set. */ axisFontSize?: number; /** * Text size on filled badges in integer CSS px, clamped to 10–14: the * current-price badge, the crosshair's price and time badges, and price-line * pills (unless `priceLinesStyle.fontSize` sets their own). Omit or pass 0 to * follow `axisFontSize`. */ badgeFontSize?: number; /** * Text size on the simple crosshair's capsule time badge, in CSS px; the * capsule scales with it. Omit for 15, or pass 0 to follow `badgeFontSize`. */ simpleCrosshairBadgeFontSize?: number; /** * React Native only. A .ttf/.otf file's bytes for the chart's text, e.g. axis * labels. Omit for the system font. */ fontData?: ArrayBuffer; /** * React Native only. A .ttf/.otf file's bytes for the badges `badgeFontSize` * sizes. Omit to follow `fontData`. */ badgeFontData?: ArrayBuffer; /** * Text drawn on a filled badge — the current-price indicator, the crosshair's * price and time badges, and price-line pills. Defaults to white, which reads * against the saturated fills those badges use on a dark theme; light themes * generally want a dark value here. * * Each of those badges can override it: `priceIndicatorBadgeText` for the * current-price badge, `crosshair.badgeTextColor` for the crosshair's badges, * and `badgeTextColor` on an individual {@link PriceLine}. */ badgeText?: VroomColor; /** Crosshair dashed lines. */ crosshair?: VroomColor; /** Crosshair target — the hollow ring/dot at the intersection. */ crosshairTarget?: VroomColor; /** Line-chart-mode close polyline color. Defaults to violet, matching the RSI line. */ lineColor?: VroomColor; /** * The line drawn across the plot while loading (see the `loading` prop). * Defaults to inheriting `axisText`, the tone Liveline draws its loading * line in. The breath keeps it faint, so it still reads as structure * rather than as a series. * * The line breathes between 14% and 30% of whatever color it ends up with, * on a cycle of about 2.4s. Any alpha given here multiplies into that, so * an opaque color is the usual choice. Pass `lineColor` to make the line * read as the chart's own series warming up instead, as Liveline does in * line mode. */ skeleton?: VroomColor; /** Line-chart-mode polyline stroke width in px, also the loading line's. Defaults to 1.5. */ lineWidth?: number; /** * Opacity of the gradient filled beneath the line-chart polyline, at its * strongest point. The fill uses `lineColor` and ramps to fully transparent at * the bottom of the price pane. Defaults to 0.28; set to 0 to disable the fill. */ lineGradientOpacity?: number; /** * How much to round the line chart's corners, from 0 (straight segments * between closes) to 1 (fully smooth). Defaults to 0. * * The curve is monotone-limited, so smoothing can never overshoot into a price * that didn't trade: every peak and trough stays on an actual close, and the * curve never leaves the range of the two closes it connects. Applies to the * gradient fill beneath the line as well, so the two stay flush. */ lineTension?: number; /** * Mark the line chart's newest end with a dot. Defaults to `true`. * * Takes its color from `line` and its radius from `lineTipDotRadius`. * * Only drawn in line mode, and it crossfades along with the line during a * candle↔line transition. */ lineTipDot?: boolean; /** * Radius of the `lineTipDot` in px. Defaults to 1.5× `lineWidth`, and never * less than 2px. The `lineTipPulse` ring scales with it: five sixths of the * radius wide, reaching 3.5× the radius at its widest. */ lineTipDotRadius?: number; /** * Pulse a ring outward from the tip dot, once every 1.5s. Defaults to `false`. * * Ignored when `lineTipDot` is off, and suppressed when the OS asks for reduced * motion. Because the ring never stops, enabling it keeps the chart repainting * continuously — leave it off for charts that should be able to go idle. */ lineTipPulse?: boolean; /** * Opacity of the `lineTipPulse` ring as it leaves the dot, from 0 to 1. The * ring fades from here to fully transparent as it grows. Defaults to 0.4. */ lineTipPulseOpacity?: number; /** * Dash length in px of the current-price indicator's dashed line. Defaults to 2. * * This is the length you see, caps included: with `priceIndicatorRoundCap` * on, the round ends are taken out of it rather than added to it. */ priceIndicatorDashLength?: number; /** * Gap in px between the current-price indicator's dashes. Defaults to 2; 0 * draws a solid line. * * Like `priceIndicatorDashLength`, this is the gap you see, caps included. */ priceIndicatorDashGap?: number; /** Stroke width in px of the current-price indicator's dashed line. Defaults to 1. */ priceIndicatorLineWidth?: number; /** * Opacity of the current-price indicator's dashed line, from 0 to 1. Defaults * to 1. * * Multiplies the alpha of `accentBull` / `accentBear`, so a translucent accent * gets fainter still. The price badge keeps the accent's own alpha. */ priceIndicatorLineOpacity?: number; /** Round the ends of the current-price indicator's dashes. Defaults to `false`. */ priceIndicatorRoundCap?: boolean; /** * Text on the current-price badge in the y-axis strip. Defaults to * `badgeText`. Useful when `accentBull` / `accentBear` are light enough that * the shared badge text doesn't read against them. */ priceIndicatorBadgeText?: VroomColor; /** * Show the price (y) axis strip down the right edge. Defaults to `true`. * * Hiding it collapses the strip and hands the reclaimed width to the plot, so * the candles widen to fill it. Its contents — price labels, the current-price * badge, the crosshair price badge, price-line axis badges — fade out ahead of * the collapse; gridlines and the price indicator's dotted line stay. Animated * over `transitionMs` unless the OS asks for reduced motion. * * The axis drag-to-scale region goes with the strip, so a hidden axis can't be * scaled by dragging it. */ showYAxis?: boolean; /** * Run the price series on under the y-axis strip, fading it out to the right * edge, instead of stopping it at the strip. Defaults to `false`. The labels * and badges stay drawn over it, and it goes with the strip as it hides. */ yAxisFade?: boolean; /** * Show the time (x) axis strip along the bottom. Defaults to `true`. * * Behaves like {@link VroomTheme.showYAxis}: the strip collapses, the plot * grows into it, and the time labels and crosshair time badge fade first. */ showXAxis?: boolean; /** Fixed decimals for every price label and badge (0–12); omit for automatic. */ priceDecimals?: number; /** Narrowest auto-fit range as a fraction of the mid price (0.02 = ±1%); omit for none. */ minPriceRangeRatio?: number; }; /** * How a same-asset interval switch animates. `'transform'` (default) lerps * each visible column into its counterpart. `'fade'` fades the old scene out * then the new one in — use when the two windows don’t share a 1:1 pairing * (e.g. a fixed lookback). */ type IntervalTransition = 'transform' | 'fade'; /** Theme color slots — mirrors the `VroomColorKey` enum in the C facade. */ declare enum ColorKey { Background = 0, Bull = 1, Bear = 2, Wick = 3, Grid = 4, AxisText = 5, Crosshair = 6, /** Retired slot (was TooltipBg, never rendered); indices below it are fixed. */ Reserved7 = 7, BadgeText = 8, CrosshairTarget = 9, BorderBull = 10, BorderBear = 11, WickBull = 12, WickBear = 13, AccentBull = 14, AccentBear = 15, Line = 16, Skeleton = 17, PriceIndicatorBadgeText = 18 } /** Theme float slots — mirrors the `VroomFloatKey` enum in the C facade. */ declare enum FloatKey { CandleWidthRatio = 0, WickWidth = 1, RightPadding = 2, AxisFontSize = 3, YAxisWidthRatio = 4, XAxisHeight = 5, VolumeOpacity = 6, IndicatorHeightFrac = 7, CandleRadius = 8, WickRoundCap = 9, VolumeRadius = 10, LineWidth = 11, LineGradientOpacity = 12, LineTension = 13, LineTipDot = 14, LineTipPulse = 15, BadgeFontSize = 16, LineTipPulseOpacity = 17, LineTipDotRadius = 18, PriceIndicatorDash = 19, PriceIndicatorGap = 20, PriceIndicatorWidth = 21, PriceIndicatorOpacity = 22, PriceIndicatorRoundCap = 23, YAxisFade = 24, SimpleCrosshairBadgeFontSize = 25, PriceDecimals = 26, MinPriceRangeRatio = 27, ReduceMotion = 28 } /** OHLCV readout for the candle under the crosshair. */ type CrosshairCandle = { timeMs: number; open: number; high: number; low: number; close: number; volume: number; }; /** * What the crosshair currently snaps to. `timeMs` is the snapped slot's * period-start time — set even in the empty space ahead of the most recent * candle. `candle` holds the OHLCV when a real candle sits at that slot, and is * null when the crosshair is parked on a future candle-aligned slot. */ type CrosshairInfo = { timeMs: number; /** * Free price at the crosshair's horizontal line (the price-badge value). Over * an indicator pane, the close of the candle under the vertical line; null on * a future slot there. */ price: number | null; /** -1 over the price pane; 0 = RSI, 1 = MACD, 2 = ATR. */ indicatorKind: number; /** The indicator pane's value at the line; null over the price pane or with nothing to scale. */ indicatorValue: number | null; candle: CrosshairCandle | null; }; /** Axis region sizes in CSS px, for hit-testing gestures on the JS side. */ type AxisMetrics = { yAxisWidth: number; xAxisHeight: number; /** Below-chart indicator pane height; 0 when no pane is shown. */ indicatorHeight: number; }; /** A moving-average overlay line, in the core's numeric encoding. */ type OverlaySpec = { /** 0 = SMA, 1 = EMA. */ kind: number; period: number; /** 0=close,1=open,2=high,3=low,4=hl2,5=hlc3,6=ohlc4 */ source: number; /** Packed 0xAARRGGBB. */ color: number; /** Stroke width in px. */ width: number; }; /** * The RSI pane, in the core's numeric encoding. The style fields carry an * inherit sentinel — a non-positive width or a fully transparent color tells * the core to fall back to its default. */ type RSISpec = { enabled: boolean; period: number; upperBand: number; lowerBand: number; maPeriod: number; /** Trendline: 0 = SMA, 1 = EMA. */ maKind: number; maVisible: boolean; /** Packed 0xAARRGGBB. */ lineColor: number; /** Stroke width in px. */ lineWidth: number; lineVisible: boolean; maColor: number; maWidth: number; /** Shared by both dashed band rules. */ bandColor: number; bandsVisible: boolean; /** Shade the stretches past each band, colored from the theme accents. */ extremeFill: boolean; }; /** * The session VWAP overlay, in the core's numeric encoding. Color and width * carry the same inherit sentinel as the other indicators. */ type VWAPSpec = { enabled: boolean; /** Session reset offset from UTC midnight, in minutes. */ resetOffsetMin: number; /** Packed 0xAARRGGBB. */ color: number; /** Stroke width in px. */ width: number; }; /** The Bollinger Bands overlay, in the core's numeric encoding. */ type BollingerSpec = { enabled: boolean; period: number; /** Standard-deviation multiplier. */ mult: number; /** 0=close,1=open,2=high,3=low,4=hl2,5=hlc3,6=ohlc4 */ source: number; /** Basis MA type: 0 = SMA, 1 = EMA. */ basisKind: number; /** Packed 0xAARRGGBB. */ upperColor: number; /** Stroke width in px. */ upperWidth: number; middleColor: number; middleWidth: number; lowerColor: number; lowerWidth: number; /** Translucent fill between the bands. */ fillEnabled: boolean; /** 0..1, multiplied into upperColor's alpha. */ fillOpacity: number; }; /** * The Ichimoku overlay, in the core's numeric encoding. Colors are packed * 0xAARRGGBB; widths are stroke px. * * `displacement` is in candle slots and is applied when drawing, not when * computing: the leading spans are plotted that many slots past the bar they * came from (running past the newest candle into empty time) and chikou that * many behind. */ type IchimokuSpec = { enabled: boolean; tenkanPeriod: number; kijunPeriod: number; senkouBPeriod: number; /** Slots the leading spans lead by and chikou lags by. */ displacement: number; tenkanColor: number; tenkanWidth: number; tenkanEnabled: boolean; kijunColor: number; kijunWidth: number; kijunEnabled: boolean; senkouAColor: number; senkouAWidth: number; senkouAEnabled: boolean; senkouBColor: number; senkouBWidth: number; senkouBEnabled: boolean; chikouColor: number; chikouWidth: number; chikouEnabled: boolean; /** Shade the cloud between the leading spans. */ cloudEnabled: boolean; /** Fill where senkou A is above senkou B. */ bullishCloudColor: number; /** Fill where senkou A is below senkou B. */ bearishCloudColor: number; /** 0..1, multiplied into the cloud color's alpha. */ cloudOpacity: number; }; /** * The Fair Value Gap overlay, in the core's numeric encoding. Colors are packed * 0xAARRGGBB. * * `boxLength`, `maxBarsBack` and `labelDistance` are all counted in candle * slots. Only `enabled`, `maxBarsBack`, `waitForClose` and `fillType` make the * core rescan for gaps — everything else is applied when drawing. */ type FairValueGapsSpec = { enabled: boolean; /** Slots back to scan for gaps. */ maxBarsBack: number; /** Withhold a gap until its third candle closes. */ waitForClose: boolean; /** 0 = a close past the far edge fills the gap, 1 = a wick reaching it does. */ fillType: number; /** Hide a filled gap outright, rather than truncating it at its fill bar. */ deleteAfterFill: boolean; /** Run boxes to the newest bar instead of ending them after boxLength slots. */ extendBoxes: boolean; boxLength: number; bullishColor: number; bearishColor: number; /** 0..1, multiplied into the fill color's alpha. */ opacity: number; borderEnabled: boolean; /** 0 = solid, 1 = dotted, 2 = dashed. */ borderStyle: number; borderWidth: number; bullishBorderColor: number; bearishBorderColor: number; labelsEnabled: boolean; label: string; /** Slots of clearance past the newest bar, used only under extendBoxes. */ labelDistance: number; /** Alpha 0 falls back to the box's border color. */ labelColor: number; /** Non-positive falls back to the axis font size. */ labelFontSize: number; /** Keep drawing a filled gap with its polarity flipped, until price reclaims it. */ showInverse: boolean; /** Fill for an inverted zone that is bullish, i.e. a violated bearish gap. */ inverseBullishColor: number; /** Fill for an inverted zone that is bearish, i.e. a violated bullish gap. */ inverseBearishColor: number; inverseLabel: string; }; /** * The MACD pane, in the core's numeric encoding. The style fields carry an * inherit sentinel — a non-positive width or a fully transparent color tells * the core to fall back to its default (or, for the histogram, to the theme * accent, and for the fading shades to their base color at half alpha). */ type MACDSpec = { enabled: boolean; fast: number; slow: number; signal: number; /** 0=close,1=open,2=high,3=low,4=hl2,5=hlc3,6=ohlc4 */ source: number; /** Fast/slow legs: 0 = SMA, 1 = EMA. */ maKind: number; /** Signal line: 0 = SMA, 1 = EMA. */ signalMaKind: number; /** MACD line, packed 0xAARRGGBB. */ lineColor: number; /** Stroke width in px. */ lineWidth: number; lineVisible: boolean; signalColor: number; signalWidth: number; signalVisible: boolean; histVisible: boolean; histUpColor: number; histUpFadingColor: number; histDownColor: number; histDownFadingColor: number; zeroColor: number; zeroVisible: boolean; }; /** * The ATR pane, in the core's numeric encoding. The style fields carry the same * inherit sentinel as MACD — a non-positive width or a fully transparent color * tells the core to fall back to its default. */ type ATRSpec = { enabled: boolean; period: number; /** 0 = Wilder's RMA, 1 = SMA, 2 = EMA. */ smoothing: number; /** Packed 0xAARRGGBB. */ lineColor: number; /** Stroke width in px. */ lineWidth: number; }; /** * The volume bars, in the core's numeric encoding. The style fields carry an * inherit sentinel — a negative number or a fully transparent color tells the * core to fall back to the matching theme key. */ type VolumeSpec = { enabled: boolean; /** Tallest bar as a fraction of the price pane. < 0 inherits 0.2. */ heightFrac: number; /** 0..1 (1 = opaque). < 0 inherits the theme's volume opacity. */ opacity: number; /** Top-corner radius in px. < 0 inherits the theme's volumeRadius. */ radiusPx: number; /** Packed 0xAARRGGBB. 0 inherits the theme's accentBull. */ upColor: number; /** Packed 0xAARRGGBB. 0 inherits the theme's accentBear. */ downColor: number; }; /** * A committed line drawing in the core's numeric encoding. Endpoints are in data * space (epoch ms + price) so the line tracks the candles on pan/zoom. */ type DrawingSpec = { aTime: number; aPrice: number; bTime: number; bPrice: number; /** Packed 0xAARRGGBB. */ color: number; /** Stroke width in px. */ width: number; /** * Geometry: 0 = line (a→b), 1 = box (a and b are opposite corners), * 2 = pencil (a freehand path — see `points`), 3 = path (straight segments * through `points`, ending in an arrowhead). */ kind: number; /** * The full point list for a pencil stroke (kind 2) or path (kind 3), in draw * order. Ignored for line and box, which are fully described by the a/b * anchors. */ points?: { timeMs: number; price: number; }[]; /** * Box (kind 1) interior fill, packed 0xAARRGGBB. Alpha 0 — the default — * means unset, and the interior falls back to `color` at 10% alpha. Ignored * by other kinds. */ fill?: number; /** * Protect the drawing from editing: its body still hit-tests (so it can be * selected and unlocked) but its handles neither draw nor hit. */ locked?: boolean; }; /** * Offset added to a path vertex index in `hitTestDrawing`'s `part`, so vertex * indices can't collide with the small per-kind part numbers (0..6). Mirrors * VROOM_DRAW_PART_VERTEX in vroom_chart.h. */ declare const DRAW_PART_VERTEX = 100; /** * Most vertices a single path may hold. Keeps `DRAW_PART_VERTEX + i` clear of * the next free part number, and keeps a stray click-storm from producing an * unreasonable drawing. Mirrors VROOM_PATH_MAX_POINTS in vroom_chart.h. */ declare const PATH_MAX_POINTS = 64; /** A single resting-liquidity band in the core's numeric encoding. */ type BandSpec = { minPrice: number; maxPrice: number; /** 0 = buy, 1 = sell. */ side: number; volume: number; }; /** Liquidity overlay bands + shared style, in the core's numeric encoding. */ type LiquiditySpec = { bands: BandSpec[]; /** Packed 0xAARRGGBB. */ buyColor: number; /** Packed 0xAARRGGBB. */ sellColor: number; /** Volume mapped to peak opacity; 0 = auto-scale to the largest band. */ maxVolume: number; minOpacity: number; maxOpacity: number; /** Leftward reach from the axis in px. */ widthPx: number; /** Leftward reach as a fraction of pane width. */ widthFrac: number; }; /** Bit flags for `PriceLineSpec.flags`. */ declare const PRICE_LINE_DRAGGABLE: number; declare const PRICE_LINE_CLOSABLE: number; declare const PRICE_LINE_AXIS_LABEL: number; declare const PRICE_LINE_EXTEND_LEFT: number; /** A single price status line in the core's numeric encoding. */ type PriceLineSpec = { price: number; /** Packed 0xAARRGGBB. */ color: number; /** Stroke width in px. */ width: number; /** 0 = solid, 1 = dotted, 2 = dashed. */ lineStyle: number; /** Body label. Empty hides the body pill. */ text: string; /** Trailing solid-fill segment. Empty hides it. */ quantity: string; /** Bitwise-or of the PRICE_LINE_* flags. */ flags: number; /** Packed 0xAARRGGBB axis-badge and quantity text. 0 inherits the theme's badgeText. */ badgeText: number; }; /** Price status lines + shared style, in the core's numeric encoding. */ type PriceLinesSpec = { lines: PriceLineSpec[]; /** Translucent body/close-button pill fill, packed 0xAARRGGBB. */ bodyBg: number; /** 0 = inherit the axis font size. */ fontSizePx: number; /** 0..1 of pane width: the label group's right-edge inset from the axis. */ lineLengthFrac: number; /** 0 = left, 1 = center, 2 = right. */ align: number; /** Brightness multiplier for the hovered segment; 1 = no highlight. */ hoverBoost: number; /** < 0 = the default 6px pill radius; otherwise clamped to 0–6. */ cornerRadiusPx: number; }; /** `FootprintSpec.side` values. */ declare const FOOTPRINT_BUY = 0; declare const FOOTPRINT_SELL = 1; /** * `FootprintHit.side` for the combined badge on a candle holding both sides. * Output only: never valid on a `FootprintSpec`. */ declare const FOOTPRINT_BOTH = 2; /** A single executed trade in the core's numeric encoding. */ type FootprintSpec = { /** Raw execution time in epoch ms — the core buckets it onto a candle. */ timeMs: number; /** FOOTPRINT_BUY or FOOTPRINT_SELL. */ side: number; }; /** Footprints + shared style, in the core's numeric encoding. */ type FootprintsSpec = { prints: FootprintSpec[]; /** Badge radius in px. 0 = the core's default. */ radiusPx: number; /** Unused by the core since a candle draws one badge; kept for the ABI. */ gapPx: number; /** Gap between the candle's high and the badge. 0 = default. */ marginPx: number; /** Brightness multiplier for the hovered badge; 1 = no highlight. */ hoverBoost: number; }; /** The footprint badge under a pixel, as reported by `hitTestFootprint`. */ type FootprintHit = { /** FOOTPRINT_BUY, FOOTPRINT_SELL, or FOOTPRINT_BOTH for a combined badge. */ side: number; /** Bar-open time of the candle the badge sits on. */ candleTimeMs: number; /** Badge center in CSS px, relative to the chart's top-left. */ x: number; y: number; radius: number; /** * The plot rect the badge was clipped to, same space as `x`/`y` and excluding * the axis strips — what a host tests a tooltip placement against. */ pane: { left: number; top: number; right: number; bottom: number; }; /** * Indices into the array last passed to `setFootprints` for every trade on that * candle — *both* sides, ascending by time. One hit is enough to fill a tooltip. */ indices: number[]; }; /** The crosshair plus button's style, in the core's numeric encoding. */ type CrosshairButtonSpec = { enabled: boolean; /** Badge corner radius; < 0 = default 6, clamped to 0..height/2. */ cornerRadiusPx: number; /** Brightness multiplier while hovered or open; <= 0 = 1.25. */ hoverBoost: number; }; /** The crosshair's style, in the core's numeric encoding. Negatives take the mode's defaults. */ type CrosshairStyleSpec = { /** 0 advanced, 1 simple, 2 none. */ mode: number; /** 0 dashed, 1 dotted, 2 solid; < 0 = solid in simple, dashed otherwise. */ lineStyle: number; /** Stroke px; <= 0 = 1. */ lineWidthPx: number; /** 0 datetime, 1 time, 2 date; < 0 = time in simple, datetime otherwise. */ timeFormat: number; hour12: boolean; /** Simple mode: badge top as a fraction of chart height (1 = top); < 0 = 1. */ simpleHeight: number; /** Simple mode: dim the plot right of the line. */ dimAhead: boolean; /** Simple mode: opacity of the dimmed region; < 0 = 0.35. */ dimOpacity: number; /** Packed 0xAARRGGBB badge fill. 0 inherits the theme's crosshairTarget. */ badgeColor: number; /** Packed 0xAARRGGBB badge text. 0 inherits the theme's badgeText. */ badgeText: number; }; /** The crosshair plus button's geometry, in CSS px from the chart's top-left. */ type CrosshairButtonHit = { left: number; top: number; right: number; bottom: number; /** Price at the crosshair's horizontal line. */ price: number; /** Snapped slot under the vertical line (real or future). */ timeMs: number; /** The price pane's plot rect, axis strips excluded. */ pane: { left: number; top: number; right: number; bottom: number; }; }; /** A continuous data coordinate at a pixel position (no candle snapping). */ type Coord = { timeMs: number; price: number; }; /** An axis-aligned rectangle in CSS px, relative to the chart's top-left. */ type RectPx = { x: number; y: number; width: number; height: number; }; /** * A single chart instance bound to a canvas. Method semantics match the native * handle one-to-one (see jsi.d.ts) so the two platforms behave identically. */ interface VroomChartHandle { /** Replace the full candle series (packed buffer; see packCandles). */ setCandles(packed: ArrayBuffer): void; /** Set the drawing size in CSS px plus the device pixel ratio. */ setSize(width: number, height: number, dpr: number): void; /** Override one theme color. `argb` is packed 0xAARRGGBB. */ setColor(key: ColorKey | number, argb: number): void; /** Override one theme float (e.g. wick width). */ setFloat(key: FloatKey | number, value: number): void; /** Pass 0, 0 to show all candles. */ setVisibleRange(startMs: number, endMs: number): void; /** * Target candle body width in px for the initial/reset framing. Larger = more * zoomed in; smaller = more zoomed out. 0 restores the default (~80 candles). * Affects initial framing only; an explicit setVisibleRange takes precedence. */ setDefaultCandleWidth(px: number): void; /** Render mode: 0 = candlesticks (default), 1 = line chart (close polyline). */ setChartType(mode: number): void; /** * Price-axis scale: 0 = linear (default), 1 = logarithmic. Snaps; a manual * price range is kept unless it reaches zero or below on entering log. */ setPriceScaleMode(mode: number): void; /** * Candle↔line morph blend for animated transitions. `collapse` folds candles * toward their close; `fade` crossfades candles→line. Both 0 = candles, * 1 = line. Driven per-frame by the host; setChartType snaps both. */ setMorph(collapse: number, fade: number): void; /** The current visible time window. {startMs: 0, endMs: 0} = uninitialized. */ getVisibleRange(): { startMs: number; endMs: number; }; /** * Reset to the fresh-mount view: frame the most recent ~80 candles and * re-enable continuous y auto-fit (the price range follows the visible * candles until the next manual y gesture). Use when the data series is * wholesale replaced — e.g. switching assets. */ resetView(): void; /** * Re-enable continuous y auto-fit only; the time window is untouched. Use * after repositioning the window for a same-asset data swap (e.g. a * timeframe switch) so the price scale re-fits the newly visible candles. * Under `autoscaleY` it puts the fit back to its default size after a * price-axis drag. */ resetPriceScale(): void; /** * Opt-in animated y auto-fit (the `autoscaleY` prop). While on, the price * range eases toward the visible candles as the view pans, and * `scalePriceAxis` scales how much room that fit leaves around them rather * than freezing the range. `animate` false snaps instead (reduced motion). */ setAutoscaleY(enabled: boolean, animate: boolean): void; /** * The visible price *envelope* — the min low / max high across the currently * visible candles, i.e. the extent the candles occupy rather than the (wider) * axis range. Null when no candles are visible. */ getVisiblePriceEnvelope(): { low: number; high: number; } | null; /** * Scale lock for a same-asset data swap that re-buckets the same price action * into a different high-low span (a timeframe switch). Rescales a *manual* * price range so the visible envelope keeps the exact pixel height and * position the given pre-swap envelope had — so candles don't suddenly shrink * or grow when the interval changes. * * Call after setCandles + setVisibleRange, passing the envelope read by * getVisiblePriceEnvelope before the swap. A no-op in auto-y mode (auto-fit is * already span-invariant); falls back to resetPriceScale when either envelope * is degenerate. */ preservePriceEnvelope(prevLow: number, prevHigh: number): void; /** * Capture the visible candle geometry so the next data swap can animate. * `'transform'` (default) lerps each slot into its counterpart; `'fade'` * fades the capture out then the new scene in. Call before setCandles, * then drive setIntervalMorph from 0 to 1. */ beginIntervalMorph(mode?: IntervalTransition): void; /** * Capture the visible geometry so the next setCandles can ease a live tick * into place. Always a transform, and unlike beginIntervalMorph it leaves the * axes alone — the interval hasn't changed, so its ticks must not fade. * Restarting one still in flight continues from the shape on screen, so ticks * arriving faster than the animation lands stay smooth. Call before * setCandles, then drive setIntervalMorph from 0 to 1. * * Not for an update that appends a bar: slots pair from the right edge, so a * new bar would shift every candle onto its neighbour's geometry. Advance the * visible range instead and let the series translate. */ beginStreamMorph(): void; /** * Advance the morph started by either begin method above. `t` (clamped to * 0..1) is the eased progress: 0 renders the captured geometry pixel- * identically to the pre-swap frame, 1 renders the new candles and releases * the capture. Driven per-frame by the host animation loop. */ setIntervalMorph(t: number): void; /** * Show or hide the loading line: a single stroke drawn across the plot in a * slow travelling sine, for a chart that is laid out but has no data yet. * Suppresses the axis text, price badge, crosshair and indicator panes while * it's up. * * `on` must mean "loading *and* holding no data" — the core takes it at face * value rather than checking its candle buffer, since a host mid-asset-switch * can still be holding the previous asset's bars. Pass `animate: false` for * reduced motion: the line draws still and the chart may go idle. * * Passing `false` abandons any hand-off in flight, which is what a failed or * superseded fetch wants. To hand off to data instead, use the hand-off * calls below. */ setLoading(on: boolean, animate?: boolean): void; /** * Start the hand-off: aim each vertex of the loading line at the close of * the candle that will occupy its column. * * Call *after* setCandles — it reads them to know where to aim — then * {@link beginLoadingReveal}. Optionally drive {@link setLoadingMorph} from 0 * to 1 in between to reshape the line onto the closes first, under a frozen * sine; the axes and candles stay suppressed while you do. */ beginLoadingMorph(): void; /** * Optional reshape before the reveal. `t` (clamped to 0..1) is the eased * progress: 0 renders the frozen sine, 1 the polyline through the candle * closes. */ setLoadingMorph(t: number): void; /** * The candles take over. Leaves the loading state and runs the reveal on the * core's own clock (about 0.9s): the line resolves onto the closes, centre * first, while the bars grow out of it and their colour fades up. Over * candles the line gives way to them; in line mode it becomes the series * line. * * Keep rendering while {@link isAnimating} is true. The reveal owns the * bars until it lands: {@link beginStreamMorph} and {@link setIntervalMorph} * are ignored meanwhile, and live updates fold into the growing bars. */ beginLoadingReveal(): void; /** Shift the visible range by dx/dy CSS px. */ pan(dx: number, dy: number): void; /** Shift the time window and price bounds without rescaling. */ translate(dx: number, dy: number): void; /** Directional zoom by per-axis factors around focus (fx, fy) in px. */ zoom(scaleX: number, scaleY: number, fx: number, fy: number): void; /** * Drag-on-y-axis price scaling; dy>0 widens the price range. Under * `autoscaleY` it scales the auto-fit, which goes on following the candles. */ scalePriceAxis(dy: number): void; /** Drag-on-x-axis time scaling; dx>0 widens the time window. */ scaleTimeAxis(dx: number): void; /** * Drag the separator between the price pane and the below-chart indicator * band. dy>0 (drag down) grows the price pane and shrinks the indicator band, * preserving candle pixel scale (the price range adjusts instead). */ resizeIndicatorPane(dy: number): void; /** * Scale the y-axis of the below-chart indicator pane containing `y` (px). * dy>0 (drag down) zooms out (widens the value range); dy<0 zooms in. RSI * scales about 50, MACD about its zero line. No-op when `y` is not over a pane. */ scaleIndicatorAxis(y: number, dy: number): void; /** Current axis dimensions for hit-testing in JS gestures. */ getAxisMetrics(): AxisMetrics; /** Show the crosshair at (x, y) CSS px (y already lifted above the pointer). */ setCrosshair(x: number, y: number): void; /** * Show the crosshair at a data-space position (epoch ms + price) instead of * pixels — used to mirror one chart's crosshair onto another (cross-chart * sync). Converts to pixels via this chart's own window/price scale; the * vertical line snaps to the candle for `timeMs`, the horizontal line sits at * `price`. Does not emit any callback. */ setCrosshairData(timeMs: number, price: number): void; /** Hide the crosshair. */ clearCrosshair(): void; /** * OHLCV of the candle the crosshair snaps to, or null when inactive or on an * empty slot (ahead of the most recent candle or over a gap). */ getCrosshairCandle(): CrosshairCandle | null; /** * The slot the crosshair snaps to (real candle or future candle-aligned * slot), or null when inactive. Unlike getCrosshairCandle this reports a * timeMs even in the empty space ahead of the most recent candle. */ getCrosshairInfo(): CrosshairInfo | null; setRSI(spec: RSISpec): void; setMACD(spec: MACDSpec): void; setATR(spec: ATRSpec): void; setOverlays(overlays: OverlaySpec[]): void; setVWAP(spec: VWAPSpec): void; setBollinger(spec: BollingerSpec): void; /** * The Ichimoku overlay. Enabling it also pulls the view forward far enough to * show the leading spans, which sit past the newest candle. */ setIchimoku(spec: IchimokuSpec): void; /** The Fair Value Gap overlay (shaded imbalance boxes on the price pane). */ setFairValueGaps(spec: FairValueGapsSpec): void; setVolume(spec: VolumeSpec): void; /** * Staggered volume-bar collapse: 0 = full height, 1 = all bars flat. Bars fall * tallest-first and land together; drive 1 → 0 to reveal them, which plays the * same cascade in reverse (shortest bar home first). * * Unlike setMorph, `t` must be **linear** progress — the core eases each bar * over its own slice of the timeline, so the curve is applied there. `easing` * indexes `linear | ease-in | ease-out | ease-in-out`. setVolume snaps this to * match its `enabled`, so it's only needed while animating. */ setVolumeCollapse(t: number, easing: number): void; /** * Collapses the axis strips: 0 leaves a strip at full size, 1 hides it. The * plot grows into whatever the strips give up, and their contents (labels, * price badge, crosshair and price-line badges) fade out over the first half * of the collapse so text is never squeezed into a strip too narrow for it. * * Unlike setVolumeCollapse, both take **eased** progress — there is no * per-element stagger for the core to distribute. */ setAxisCollapse(yT: number, xT: number): void; /** Replace the full set of committed line drawings. Pass [] to clear. */ setDrawings(drawings: DrawingSpec[]): void; /** * Replace the resting-liquidity overlay (bands + shared style). Pass a spec * with an empty `bands` array to clear the overlay. */ setLiquidity(liquidity: LiquiditySpec): void; /** * Replace the full set of price status lines (plus their shared style). Pass a * spec with an empty `lines` array to clear them. */ setPriceLines(priceLines: PriceLinesSpec): void; /** * Hit-test pixel (x, y) against the price lines. `part` is 0 for the line or * its label body (the drag target) and 1 for the close button; close buttons * win over lines and the nearest in y wins among several candidates. Only * draggable lines report part 0 and only closable lines report part 1. Null on * a miss. */ hitTestPriceLine(x: number, y: number): { index: number; part: number; } | null; /** * Mark a price line's segment as hovered so it renders highlighted. Pass -1 to * clear. `part` matches `hitTestPriceLine`. */ setPriceLineHover(index: number, part: number): void; /** * Drive the live drag preview: the line, its label and its badge render at * `price` with a ghost at the committed one. Pass -1 to end the preview. The * committed price is untouched — restate `setPriceLines` to apply the move. */ setPriceLineDrag(index: number, price: number): void; /** * Replace the full set of footprints (plus their shared style). Pass a spec with * an empty `prints` array to clear them. The core groups them onto candles * itself and regroups whenever the candles change, so passing raw fills with * their real execution times is correct at every interval. */ setFootprints(footprints: FootprintsSpec): void; /** * Hit-test pixel (x, y) against the footprint badges. Null on a miss; when two * badges overlap the nearest center wins. */ hitTestFootprint(x: number, y: number): FootprintHit | null; /** * Mark a footprint badge as hovered so it renders highlighted. Pass side -1 to * clear; the arguments otherwise match `hitTestFootprint`. */ setFootprintHover(candleTimeMs: number, side: number): void; /** Replace the crosshair plus button's style. `enabled: false` hides it. */ setCrosshairButton(spec: CrosshairButtonSpec): void; /** Replace the crosshair style (mode, lines, time badge, simple-mode options). */ setCrosshairStyle(spec: CrosshairStyleSpec): void; /** * Hover highlight and pinned (open) state. Pinning locks the crosshair to the * price under it; `setCrosshair` / `clearCrosshair` release the lock. */ setCrosshairButtonState(hovered: boolean, pinned: boolean): void; /** The plus button's current geometry; null when it isn't drawn. */ getCrosshairButton(): CrosshairButtonHit | null; /** Like `getCrosshairButton`, but null unless (x, y) falls on the button. */ hitTestCrosshairButton(x: number, y: number): CrosshairButtonHit | null; /** * Set the transient in-progress draft shown while placing a drawing. Node A is * always shown; node B is shown when `hasB`. `guide` also draws the live * preview (a guideline for a line, a preview rectangle for a box); when false * only the node dots show (the committed shape renders via setDrawings). * `kind` (0 = line, 1 = box) selects the preview geometry. `color`/`width` * style the preview. */ setDraft(aTime: number, aPrice: number, hasB: boolean, bTime: number, bPrice: number, guide: boolean, color: number, width: number, kind: number): void; /** * Begin a freehand (pencil) draft stroke, clearing any previous draft. Follow * with `appendDraftPoint` per captured sample; the growing path renders live. */ startDraftStroke(color: number, width: number): void; /** * Append one point to the in-progress freehand draft. Cheap enough to call on * every pointer move — the whole path is never restated. */ appendDraftPoint(timeMs: number, price: number): void; /** * Restate the in-progress path (kind 3) draft: the vertices placed so far, * plus an optional rubber-band end at `cursor` that carries the arrow tip. * A path grows one deliberate click at a time, so restating (rather than * appending) keeps the caller the sole owner of the vertex list — undoing a * point is just a shorter array. */ setDraftPath(points: { timeMs: number; price: number; }[], cursor: { timeMs: number; price: number; } | null, color: number, width: number): void; /** Clear the draft (hide in-progress node dots / guideline / stroke). */ clearDraft(): void; /** * Shift a whole committed drawing by a *relative* data-space delta — both * anchors and, for a pencil or path, every point. Used for live body dragging. */ translateDrawing(index: number, dTimeMs: number, dPrice: number): void; /** * Select a committed drawing (renders its handles). `index` -1 clears the * selection; `grabbedEndpoint` renders that handle 50% larger while dragging * (0/1 for a line, 0 for a box's normalized corner, the vertex index for a * path; -1 for none). */ setSelectedDrawing(index: number, grabbedEndpoint: number): void; /** Move one endpoint (0=A, 1=B) of a committed drawing to a new data anchor. */ moveDrawingEndpoint(index: number, endpoint: number, timeMs: number, price: number): void; /** * Move one vertex of a committed path (kind 3) to a new data anchor. No-op for * a drawing that isn't a path, or an out-of-range vertex. */ moveDrawingVertex(index: number, vertex: number, timeMs: number, price: number): void; /** * Hit-test pixel (x, y) against the committed drawings. Returns the drawing * `index`, `part`, and `t`, or null on a miss. For a line, `part` is 0 * (endpoint A), 1 (endpoint B), or 2 (body) and `t` is the 0..1 grab position * along the segment. For a box, `part` is 0..3 (the four corners) or 4 (body) * and `t` is 0. A pencil reports 5 (body); a path reports 6 (body) or * `DRAW_PART_VERTEX + i` for vertex `i`. Handle hits are only reported for the * selected drawing. */ hitTestDrawing(x: number, y: number): { index: number; part: number; t: number; } | null; /** * Pixel bounding box of committed drawing `index`, or null when the index is * out of range or the viewport is degenerate. Spans the shape's painted * extent — every anchor of a pencil or path, both corners of a line or box — * grown by half the stroke width. Read from live core state, so it stays * correct mid-reshape. */ drawingBounds(index: number): RectPx | null; /** * The continuous data coordinate at pixel (x, y) — not snapped to a candle * slot. Null when there are no candles or the viewport is degenerate. */ coordAt(x: number, y: number): Coord | null; /** * Pixel position of a data coordinate — the inverse of coordAt. Null when * there are no candles or the viewport is degenerate. */ project(timeMs: number, price: number): { x: number; y: number; } | null; /** True while any axis-label fade is in progress (drives the rAF loop). */ isAnimating(): boolean; /** Paint the current state to the canvas. */ present(): void; /** Release resources; the handle is unusable afterward. */ destroy(): void; } /** Factory for chart instances. The loaded core module implements this. */ interface VroomModule { /** Create a chart bound to `canvas`, attaching its rendering surface. */ create(canvas: HTMLCanvasElement): VroomChartHandle; } type WasmConfig = { /** * URL to the emscripten ES module (vroom_core.mjs). Omit to use the build * bundled in this package — in which case `wasmUrl` and `fontUrl` default to * the bundled assets too. */ moduleUrl?: string; /** URL to vroom_core.wasm. Defaults to resolving next to the module. */ wasmUrl?: string; /** URL to a .ttf/.otf used for axis/price/time labels. */ fontUrl?: string; /** * Custom loader for the emscripten ES module, if the default `import(url)` * doesn't survive your bundler. Bundler magic comments only take effect in * your own source, so this is the seam for supplying them: * * ```ts * // webpack / Next.js * importModule: (url) => import(/* webpackIgnore: true *\/ url) * // Vite / Rollup * importModule: (url) => import(/* @vite-ignore *\/ url) * ``` */ importModule?: (url: string) => Promise; }; declare const BYTES_PER_CANDLE = 48; /** Serialize candles into the packed little-endian buffer the core expects. */ declare function packCandles(candles: Candle[]): ArrayBuffer; /** Decode the packed buffer back to candles (inverse of packCandles). */ declare function unpackCandles(buf: ArrayBuffer): Candle[]; declare const COLOR_KEYS: Partial>; declare const FLOAT_KEYS: Partial>; declare const BOOL_KEYS: Partial>; /** * Parse a color into a packed 0xAARRGGBB integer (Skia's ARGB order). * - number → taken as already-packed ARGB * - 6-digit hex → opaque (alpha forced to ff) * - 8-digit hex → interpreted as AARRGGBB * Returns null for anything malformed so the caller can skip it. */ declare function parseColor(value: VroomColor): number | null; /** Push every provided theme color + numeric float into the handle; skip bad ones. */ declare function applyTheme(handle: VroomChartHandle, theme: VroomTheme): void; /** Split a packed 0xAARRGGBB integer into a CSS `rgba(...)` string. */ declare function argbToCss(argb: number): string; /** Options for loading the core. */ type LoadVroomOptions = { /** * Override how the Skia-WASM core is loaded. By default it comes from the * WASM build bundled in this package (turnkey, no asset hosting needed); * set `moduleUrl` to self-host it, or `importModule` to keep the bundled * assets but control the dynamic import your bundler emits. */ wasm?: WasmConfig; }; /** * Load the chart core. Cached: repeated calls share one module instance. * * Resolves to the Skia-WASM core bundled in this package, or the core at the * URLs in `opts.wasm`. The returned promise rejects if the WASM module fails to * load (and the cache is cleared so a later call can retry). */ declare function loadVroom(opts?: LoadVroomOptions): Promise; /** Test/HMR helper: drop the cached module so the next loadVroom() re-creates it. */ declare function resetVroomForTesting(): void; export { type ATRSpec, type AxisMetrics, BOOL_KEYS, BYTES_PER_CANDLE, type BandSpec, type BollingerSpec, COLOR_KEYS, ColorKey, type Coord, type CrosshairButtonHit, type CrosshairButtonSpec, type CrosshairCandle, type CrosshairInfo, type CrosshairStyleSpec, DRAW_PART_VERTEX, type DrawingSpec, FLOAT_KEYS, FOOTPRINT_BOTH, FOOTPRINT_BUY, FOOTPRINT_SELL, type FairValueGapsSpec, FloatKey, type FootprintHit, type FootprintSpec, type FootprintsSpec, type IchimokuSpec, type LiquiditySpec, type LoadVroomOptions, type MACDSpec, type OverlaySpec, PATH_MAX_POINTS, PRICE_LINE_AXIS_LABEL, PRICE_LINE_CLOSABLE, PRICE_LINE_DRAGGABLE, PRICE_LINE_EXTEND_LEFT, type PriceLineSpec, type PriceLinesSpec, type RSISpec, type RectPx, type VWAPSpec, type VolumeSpec, type VroomChartHandle, type VroomModule, type WasmConfig, applyTheme, argbToCss, loadVroom, packCandles, parseColor, resetVroomForTesting, unpackCandles };