SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface ReferenceModeState

    The app-wide reference-mode state — "what ranges are being shown/picked, and who (if anyone) drives". Held on its own bus (useReferenceMode) because the reference dimension is independent of editing: a selected chart shows ranges with no active input, and a formula edit shows/points while also being an edit session.

    interface ReferenceModeState {
        activeInput: IReferenceInputHandle | null;
        allowMulti?: boolean;
        dragging?: boolean;
        draggingIndex?: number;
        mode: ReferenceMode;
        onDone?: (args: ReferenceDoneArgs) => void;
        readOnly?: boolean;
        scope?: string;
        selection: IRangeSelection;
    }
    Index
    activeInput: IReferenceInputHandle | null

    The input currently driving point-mode gestures (the caret owner). null in 'show' with no editor — e.g. a selected chart that only displays its ranges. Point gestures route here when set.

    allowMulti?: boolean

    Whether this pick allows multiple ranges — Ctrl/Cmd+click on the grid then APPENDS a brand-new reference (which a text-backed consumer joins with a , separator). Declared by the PRODUCER, because it is a property of what's being picked: a formula edit allows it, a single-rectangle field (a chart series / table range) does not. Consumed by SheetReferenceLayer, which forwards it to the picker's allowMulti. Absent ⇒ allowed (the formula-edit default).

    dragging?: boolean

    true while a reference rectangle is actively being dragged/resized/drawn on the grid. Published by the reference layer (from the picker's drag lifecycle) so a consumer — e.g. the formula editor — can react to the gesture directly: hide its hint popup for the duration, or later render differently mid-drag. It is a transient GESTURE flag, distinct from mode (which is the armed/display disposition).

    draggingIndex?: number

    The reference INDEX being moved/resized while dragging — so a consumer can highlight exactly that reference (its token span in the text), in EVERY editor sharing this bus, not just the one that owns the write-back. undefined for a DRAW (a new range, no existing index) or when not dragging. Same ordering as a formula token's referenceIndex, so it maps straight onto the text.

    The two states of the reference (point) dimension — orthogonal to the edit dimension (EditorMode 'enter' | 'edit'). A cell formula edit or a selected chart can be in one of these while (independently) being in an edit mode or not.

    • 'show' — the reference ranges are displayed (and their rectangles drag/resize to re-scope an existing reference). A formula edit not armed for point, or a selected chart showing its source data.
    • 'point' — active picking: a grid drag draws/re-scopes the active reference, headers pick full rows/columns. The armed state.
    onDone?: (args: ReferenceDoneArgs) => void

    Finish the pick — invoked with 'accept' (Enter) / 'cancel' (Escape) by a reference LAYER when a done key lands on the grid while 'point' is armed (the case where no input has focus — a cross-sheet pick, where the grid holds focus and a focused editor would otherwise be the one consuming these keys). Supplied by the PRODUCER of this state, which is what keeps the layer producer-agnostic: the formula-edit producer maps it onto the edit session (editable.commit()/.cancel()), a session-less picker (a table-range / named-reference field) closes itself and returns focus to its own widget. When absent the layer does not consume the keys at all — they fall through to the grid as usual.

    readOnly?: boolean

    Show the ranges and nothing else — no move, no resize grips, no grid-draw.

    Declared by the PRODUCER, like allowMulti and scope, because it is a property of what is being shown: these ranges are an ANNOTATION rather than a pick. A hovered cell's reference cycle is the case it exists for — there is no text behind it for a drag to write back to, so an outline the user can grab would be an edit gesture with nowhere to go. 'show' on its own still allows the drag (that is how a chart's series is re-homed); this is the narrower disposition. Absent ⇒ interactive, the existing default.

    scope?: string

    Confines this pick to ONE sheet, by name — the sheet-count gate, sibling to allowMulti's range-count gate. Declared by the PRODUCER, because (like allowMulti) it is a property of what is being picked: a table's range and conditional formatting's "Applies to" live on a single sheet, while a chart's series and a formula edit span the workbook. Absent ⇒ unconfined (the formula-edit default).

    Consumed by SheetReferenceLayer: a pane whose sheet is not this one refuses the gesture outright — no draw, no re-scope, no point-nav — so the cross-sheet pick Excel offers by tabbing to another sheet simply isn't available. (Rendering needs no extra filter: a confined producer's ranges are all on this sheet, and the existing per-pane scope filter already drops everything else.)

    selection: IRangeSelection

    The ranges to render — the sdk IRangeSelection (the consumer wraps it for the grid layer). Can be multi-sheet (a formula referencing more than one sheet): every range, and selection's own active cell, carries its own scope (a sheet name) — there is deliberately no separate top-level "origin sheet" field here; a consumer reads scope straight off the coords it's already holding, same as everywhere else in this pipeline. A pane-level consumer (SheetReferenceLayer) filters to just its own sheet's ranges, but while 'point' is armed it takes the gesture on ANY pane (Excel: tab to another sheet and drag) — scope is the only thing that narrows that.