@rekurt/openkline - v0.2.0
    Preparing search index...

    Interface LayoutState

    Serialized chart state without the data window. This is the "share via URL" flavor — small enough to fit in a query param after base64 encoding, typically a few hundred bytes.

    Restoring a LayoutState over a chart that already has data is fine: loadState will skip setData when no data field is present and restore only the visual/interaction layer (viewport, chartType, theme, indicators, drawings).

    version: 1 is the schema version. Bump it on breaking changes and migrate old states inside loadState.

    interface LayoutState {
        alerts?: Alert[];
        chartType: ChartType | string & {};
        drawings: DrawingSnapshot[];
        indicators: IndicatorConfig[];
        resolution: string;
        symbol: string;
        theme: ThemeMode | ThemeColors;
        version: 1;
        viewport: {
            autoFollow: boolean;
            candleWidth: number;
            priceScaleMode?: PriceScaleMode;
            startIndex: number;
        };
    }

    Hierarchy (View Summary)

    Index

    Properties

    alerts?: Alert[]

    Price alerts (C3). Optional + additive: Alert is already a flat, JSON-safe shape so it persists as-is. States written before C3 omit the field and load back with no alerts — no schema bump or migration needed. A fired one-shot alert serializes with active: false, so it restores disarmed (it won't immediately re-fire on the next tick).

    chartType: ChartType | string & {}

    Built-in type, or a host-registered custom series type.

    drawings: DrawingSnapshot[]
    indicators: IndicatorConfig[]
    resolution: string
    symbol: string
    version: 1
    viewport: {
        autoFollow: boolean;
        candleWidth: number;
        priceScaleMode?: PriceScaleMode;
        startIndex: number;
    }

    Type Declaration

    • autoFollow: boolean
    • candleWidth: number
    • OptionalpriceScaleMode?: PriceScaleMode

      Price-axis scale mode. Optional + additive: states written before F1 omit it and load back as 'linear', so no schema bump needed.

    • startIndex: number