/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { Formatters } from "@elaraai/east-ui-components"; import { type WhenLevel } from "./date.js"; import { type CandidateContext } from "../candidates.js"; import { type SheetColumnMeta } from "../model.js"; import { type LinkVocabulary } from "../link/grammar.js"; import type { SheetCellValue, SheetContextValue, SheetLinkValue, SheetRegisterMemberValue } from "../values.js"; /** The outcome of parsing an editor buffer. */ export type ParseOutcome = /** An empty buffer — the blank cell. */ { kind: "blank"; } /** A recognised value. */ | { kind: "cell"; cell: SheetCellValue; } /** Unrecognised — retained as invalid draft text at the gesture boundary. */ | { kind: "unrecognised"; }; /** What a parse may need beside the text and the column. */ export interface ParseContext extends CandidateContext { /** The viewer's formatters — a number reads with their separators, as the cells print (#852). */ words: Formatters; /** Today, UTC midnight. */ today: Date; /** The base column's date for a date column with `base`, when the row holds one. */ baseDate?: Date | undefined; /** The wire copilot context for a custom kind's `parse`. */ wireContext?: SheetContextValue | undefined; /** A link / set column's vocabulary — the grammar resolves against it. */ linkVocab?: LinkVocabulary | undefined; } /** A cell of one arm — built through `variant()`, so it carries the brand the encoder needs. */ export declare function cellOf(tag: "Null", value: null): SheetCellValue; export declare function cellOf(tag: "Boolean", value: boolean): SheetCellValue; export declare function cellOf(tag: "String", value: string): SheetCellValue; export declare function cellOf(tag: "Float", value: number): SheetCellValue; export declare function cellOf(tag: "Integer", value: bigint): SheetCellValue; export declare function cellOf(tag: "DateTime", value: Date): SheetCellValue; export declare function cellOf(tag: "Link", value: SheetLinkValue): SheetCellValue; /** Parse the editor buffer for a column. */ export declare function parseCell(meta: SheetColumnMeta, text: string, ctx: ParseContext): ParseOutcome; /** * A cell's EDIT form — what the editor opens with: a register member in the * words its cell shows, its label (#1536); dates `17/11/26`, numbers bare * with the viewer's decimal separator (`1234,5` in German — the grammar reads * it back, #852); a date at the time level, or one carrying a time of day, * keeps it (`17/11/26 19:00`). * * @param cell - The cell * @param meta - Its column * @param words - The viewer's formatters * @param level - A date column's level for the row * @param member - The register member the cell holds the key of, where it holds one * @returns The text */ export declare function editText(cell: SheetCellValue | undefined, meta: SheetColumnMeta, words: Formatters, level?: WhenLevel, member?: SheetRegisterMemberValue): string; /** The labels of a link's members, for the clipboard's two-column form. */ export declare function linkHalvesText(link: SheetLinkValue): [string, string]; //# sourceMappingURL=index.d.ts.map