export declare const AnchorLocation: { readonly TopLeft: "tl"; readonly Top: "t"; readonly TopRight: "tr"; readonly Left: "l"; readonly Center: "c"; readonly Right: "r"; readonly BottomLeft: "bl"; readonly Bottom: "b"; readonly BottomRight: "br"; }; export declare type AnchorLocation = typeof AnchorLocation[keyof typeof AnchorLocation]; declare const arrayBufferToBase64: (buffer: ArrayBuffer) => string; /** * Move an array item to a different position. Returns a new array with the item moved to the new position. */ declare function arrayMove(array: T[], from: number, to: number): T[]; /** * Converts a given value to a number, returning `0` if the value cannot be parsed * as a valid finite number. * * The function first attempts to coerce the value into a number using `parseAsNumber`. * If the resulting number is `NaN` or `Infinity`, the function returns `0`. Otherwise, * it returns the parsed number. * * @param value The value to be converted to a number. * @returns The parsed number if it's finite, otherwise `0`. * * @example * ```typescript * asNumber("123"); // 123 * asNumber("abc"); // 0 * asNumber(null); // 0 * asNumber("12.34"); // 12.34 * asNumber(Infinity); // 0 * ``` */ declare const asNumber: (value: any) => number; export declare interface AxisOrientationFlags { vertical: boolean; horizontal: boolean; } declare const base64ToArrayBuffer: (base64: string) => ArrayBuffer; /** * Accept a blob and returns a promise of an string. */ declare const blobToString: (blob: Blob) => Promise; /** * Represents a point with size. */ export declare interface Bounds extends Point, Size { } export declare namespace BufferUtils { export { DEFAULT_MIME_TYPE, base64ToArrayBuffer, arrayBufferToBase64, blobToString } } /** * Converts a camelCase string to a human-readable format with spaces between words. * * @param strInput The camelCase string to convert. * @returns The string converted to pretty case, with spaces between words and the first letter capitalized. * * @example * ```ts * camelToPrettyCase('camelCaseString'); // Returns "Camel Case String" * ``` */ declare const camelToPrettyCase: (strInput: string) => string; declare const cancelTimeout: (timeoutID: TimeoutID) => void; declare const canUseDOM: boolean; /** * Converts a value to string. * @param value The value to cast. * @returns `undefined` if value was null or void. */ declare const castToString: (value: any) => string | undefined; /** * The coordinates of a cell in a 2D space. */ export declare interface CellCoords { /** * The column index of the cell. */ colIndex: number; /** * The row index of the cell. */ rowIndex: number; sheetName?: string; } /** * Create a 1x1 dimension RangeCoord from a CellCoords. * * @param coords * @param reused * * @remarks * Returns null if null is passed in. */ declare const cellToRange: (coords: CellCoords, reused?: RangeCoords) => RangeCoords; export declare class ChainedError extends Error { private _cause; constructor(message: string, cause?: Error); get cause(): Error; } export declare const ClipboardUtils: { readBlobFromClipboard: (clipboard: Clipboard, mimeType: string) => Promise; readStringFromClipboard: (clipboard: Clipboard, mimeType?: string) => Promise; readHTMLFromClipboard: (clipboard: Clipboard, mimeType?: string) => Promise; clearClipboard: (clipboard: Clipboard) => Promise; }; declare const cloneObject: (value: any) => any; /** * Comparator that sorts coords by column then row. * Returns > 1 if a is before b. */ declare const columnFirstCellComparator: (a: CellCoords, b: CellCoords) => number; /** * Comparator that sorts ranges by column then row. */ declare const columnFirstRangeComparator: (a: RangeCoords, b: RangeCoords) => number; export declare namespace CommonMessages { export { MESSAGE_ERROR_INVALID_ARG } } export declare namespace CommonUtils { export { arrayMove, throttle, debounce, isNode, deepFreeze, toSafeJSON, deepEqual, deepmerge as deepMerge, EmptyArray, EmptyObject, validEnumValue, camelToPrettyCase, textToKey, uuidV4, asNumber, isNumeric, SplitNumber, splitNumber, roundAccurately, cloneObject, isEqualArrays, isEqualObjectKeys, isEqualBounds, isObject, removeEmptyProperties, removeListenerAll, transpose, removeEqualValues, mergeContentful, diffValues, findEqualOrGreater, findEqualOrLesser, rafThrottle, nextTick, TimeoutID, cancelTimeout, requestTimeout, castToString, isNullOrUndefined, isDefined, isEmpty, isPromiseLike, isRectIntersect, canUseDOM, isRectInsideRect, subtractRect, getFromPath, setToPath, openFileDialog, getDPI, consoleWithNoSource, OSType, getOS, hasFocus, whenFocus, findNextStep } } declare const consoleWithNoSource: (...params: any) => Promise; export declare namespace CoordUtils { export { mergeRangedValues, EmptyCell, EmptyRange, columnFirstRangeComparator, rowFirstRangeComparator, columnFirstCellComparator, rowFirstCellComparator, reverseRowFirstCellComparator, reverseColumnFirstCellComparator, createRangeComparator, createCellComparator, isEqualCells, isEqualRanges, isCellWithinRange, isRangeWithinRange, isRangesIntersect, isEqualRangesArrays, isSingleCell, cellToRange, intersectRanges, unionRanges, indexOfCoords, isEqualSelectionCoords, CoordValidator, unionRangesArrays, isValidRange, extendRangeToUnionRanges, extendRangeToIntersectingRanges, translateRange, sanitizeRange, defaultRange, IConflatingRanges, createConflatingRanges } } /** * Interface for validating RangeCoords. */ declare interface CoordValidator { (coords: RangeCoords, oobMessage?: string): void; } /** * Returns a Comparator for cells with support for range orientation and reverse. */ declare const createCellComparator: (orientation?: RangeOrientation, reverse?: boolean) => ((a: CellCoords, b: CellCoords) => number); /** * Returns api for incrementally building ranges against minor and optionally major. * * @param canMerge A function that can merge values. * @param isColumn A flag indicating the ranges are column based. Defaults to `false` (row). * @remarks * Assumes ordered writes. */ declare const createConflatingRanges: (canMerge?: (a: T, b: T, isColumn: boolean) => T, isColumn?: boolean) => IConflatingRanges; /** * Returns a Comparator for ranges with support for range orientation and reverse. */ declare const createRangeComparator: (orientation?: RangeOrientation, reverse?: boolean) => ((a: RangeCoords, b: RangeCoords) => number); declare const DATA_URL_PNG_PREFIX: string; /** * Returns a function, that, as long as it continues to be invoked, will not * be triggered. The function will be called after it stops being called for * N milliseconds. If `immediate` is passed, trigger the function on the * leading edge, instead of the trailing. * * @param func The function * @param wait Delay in milliseconds * @param immediate It true will execute the first time immediately * @template T - The type of the function * @template R - The type returned from the function * @remarks * * **Attribution** - https://davidwalsh.name/function-debounce * * **Attribution** - https://github.com/component/debounce */ declare function debounce(func: T, wait?: number, immediate?: boolean): R; declare function deepEqual(a: any, b: any): boolean; /** * Deeply freeze and entire graph. */ declare function deepFreeze(obj: T): T; declare function deepmerge(target: any, source: any, options?: any): any; declare namespace deepmerge { var all: (array: any[], options?: any) => any; } declare const DEFAULT_MIME_TYPE: string; /** * Implements INotifier by using console. * * @remarks * Overrides can be provided by setting a setOverrides . */ export declare class DefaultNotifier implements INotifier { protected _onceMessageKeys: Set; protected _overrides: Partial | null; /** * Override the default notifier. * * @param overrides */ setOverrides(overrides: Partial | null): void; /** * Returns the delegate notifier. */ getOverrides(): Partial | null; protected _write(key: keyof INotifier, message: any, options?: NotifierOptions): void; /** @inheritdoc INotifier.log */ log(message: string, options?: NotifierOptions): void; /** @inheritdoc INotifier.error */ error(error: string | Error, options?: NotifierOptions): void; /** @inheritdoc INotifier.warn */ warn(message: string, options?: NotifierOptions): void; /** @inheritdoc INotifier.debug */ debug(message: string, options?: NotifierOptions): void; } /** * Ensure a partial range has default values */ declare const defaultRange: (range: Partial, defaultPartialRange: RangeCoords, reuseRange?: RangeCoords) => RangeCoords; /** * Deferred is a utility class to create a promise that can be resolved or rejected without * having to pass an executor function. */ export declare class Deferred { private _resolve; private _result; private _handled; private _reject; private _error; private _promise; constructor(); resolve(result?: T | Promise): void; reject(error?: any): void; wait(): Promise; } /** * Simple util that scans 2 objects and returns a new * object with values from check that are different than template. */ declare const diffValues: (check: Object, template: Object) => Object; /** * Flags for indicating which size properties are set. */ export declare interface DimensionsFlags { /** * Indicates if the width is set. */ width: boolean; /** * Indicates if the height is set. */ height: boolean; } /** * Indicates a direction along an axis. */ export declare const Direction: { /** * Indicates an upward direction. */ readonly Up: "up"; /** * Indicates a downward direction. */ readonly Down: "down"; /** * Indicates a leftward direction. */ readonly Left: "left"; /** * Indicates a rightward direction. */ readonly Right: "right"; }; export declare type Direction = typeof Direction[keyof typeof Direction]; /** * Describes the state of an edit mode. Some examples are: * * insert * * overwrite * * copy (with args for cut, format) */ export declare interface EditMode { /** * A unique key for the edit mode. */ key: string; /** * A human readable description of the edit mode. */ description?: string; /** * Optional arguments */ args?: T; /** * A cursor to use when the edit mode is active. */ cursor?: string; /** * Called when the edit mode is replaced. * The newMode is passed in if there is one. */ onModeChange?: (newMode: EditMode | null) => void; } export declare interface EditModeHandler { setMode: SetEditMode; getMode: () => EditMode; } declare const EmptyArray: any; /** * Frozen Bounds for easy comparisons. */ declare const EmptyBounds: Bounds; /** * Frozen CellCoords for easy comparisons. */ declare const EmptyCell: CellCoords; declare const EmptyObject: any; /** * Frozen RangeCoords for easy comparisons. */ declare const EmptyRange: RangeCoords; /** * Frozen Rectangle for easy comparisons. */ declare const EmptyRect: Rectangle; /** * Frozen TopLeft for easy comparisons. */ declare const EmptyTopLeft: TopLeft; export declare const ErrorUtils: { collectErrorChain: (error: Error, expected?: boolean) => Array<{ error: Error; depth: number; }>; }; /** * Special classification that that indicated the error is caused by user input. */ export declare class ExpectedError extends Error { constructor(message: string, options?: ErrorOptions); } /** * Get maximum bound of an range given other ranges. Returns the union. (useful for to merged cell selection). * * @param range The range to extends * @param ranges Surrounding ranges. */ declare const extendRangeToIntersectingRanges: (range: Readonly, ranges: Readonly) => RangeCoords; /** * Returns a union of all ranges. * * @param range The range to extends * @param ranges Surrounding ranges. */ declare const extendRangeToUnionRanges: (range: Readonly, ranges: Readonly) => RangeCoords; /** * Options for retrieving resources using fetch. */ export declare interface FetchArgs { /** * The input to fetch, which can be a string URL, a URL object, or a Request object. */ input: string | URL | Request; /** * The options for the fetch request. */ init?: RequestInit; /** * Timeout in milliseconds for fetch operations. * * When the source is a URL or FetchArgs, this timeout will be applied. * If the fetch operation takes longer than this timeout, it will be aborted. * * @default 30000 (30 seconds) */ timeout?: number; } /** * Simple binary search that returns the offset of item that is >= the value 'x' passed in. */ declare const findEqualOrGreater: (arr: readonly T[], x: number, f?: ((v: T) => number)) => number; declare const findEqualOrLesser: (arr: readonly T[], x: number, f?: ((v: T) => number)) => number; /** * A simple stepper. */ declare const findNextStep: (size: number, increase?: boolean, defaultStep?: number, min?: number, max?: number) => number; declare const getDPI: () => number; declare const getFromPath: (obj: Record, path: string) => Record; declare const getImageDataUrl: (asUrl: string, quality?: number) => Promise<{ elemImg: HTMLImageElement; dataUrl: string; }>; declare const getOS: () => OSType; declare const hasFocus: (elementSource: HTMLElement | SVGElement, ignoreDoc?: boolean) => boolean; declare interface IConflatingRanges { append: (major: number, minor: number, value?: T) => void; done: (merge?: boolean | ((from: [RangedValue, b: RangedValue], destination: RangeCoords, orientation: RangeOrientation) => RangeCoords | null | undefined)) => RangedValue[]; } declare interface IImageDetails { mimeType: string; naturalSize: Size; asUrl: string; asSVGText?: string; } export declare namespace ImageUtils { export { DATA_URL_PNG_PREFIX, getImageDataUrl, IImageDetails, loadImageDetails } } /** * Returns an index for the first range that the coord is contained within or -1 if not found. */ declare const indexOfCoords: (coords: CellCoords, ranges: readonly RangeCoords[]) => number; /** * Interface that provides notification. */ export declare interface INotifier { /** * Useful when informing the user of something but are not expecting a response. * * @param message The log message to display. * @param options Options for the log notification. */ log(message: string, options?: NotifierOptions): void; /** * Should return error object exception. * * @param error The error message or object to display. * @param options Options for the error notification. */ error(error: string | Error, options?: NotifierOptions): void; /** * Should return error object exception. * * @param message The warning message to display. * @param options Options for the warning notification. */ warn(message: string, options?: NotifierOptions): void; /** * For debug logging. * * @param message The debug message to display. * @param options Options for the debug notification. */ debug(message: string, options?: NotifierOptions): void; } /** * The Internal clipboard is a replacement for the native clipboard api. * This should be used for several reasons: * 1. Guarantees that the intra-application clipboard actions will work even if system clipboard is unavailable. * * This can be because the browser doesn't support it (e.g. Firefox) * * The user has restricted native clipboard access * * 2. Polyfill for onclipboardchange event. * * 3. Implements {@link ReferenceableClipboard}. These are items that add a paste callback to the clipboard to allow for items * to only be copied when the paste operation is performed. * * InternalClipboard will attempt to sync with the native clipboard unless sync is false. * * If a mimetype is text/html/image then value will be copied to the clipboard. * * @remarks * * **TODO** - If native copy/paste events are fired wrap them. * * **TODO** - Once private web mimeTypes are widely supported we can use them rather than embedding into html * * **TODO** - Allow for service worker to copy across tabs and sessions. */ export declare class InternalClipboard implements ReferenceableClipboard { private _state; private _nativeClipboard; private _disableCheckOnFocus; private _listeners; private _listenersCapture; private _onFocus; private _onBlur; constructor(options?: InternalClipboard.ConstructorOptions); protected _checkForChanges(): Promise; protected _init(): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/read) */ read(): Promise; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/write) */ write(data: ClipboardItems): Promise; /* Excluded from this release type: _write */ writeReference(data: T): Promise; clear(native?: boolean): void; readReference(): Promise; /** * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/readText) */ readText(): Promise; /** * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText) */ writeText(data: string): Promise; /** * Events types supported: copy, cut, paste, nativeSyncWarning, and (clipboardchange as a polyfill) * @param type A known string type. * @param callback A Callback. * @param options Listener options. * @remarks * AddEventListenerOptions.signal is not supported. * useCapture is not supported. * @see * {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener} */ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void; /** * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ dispatchEvent(event: Event): boolean; /** * Removes the event listener in target's event listener list with the same type, callback, and options. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) */ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; close(): void; } /** * {@inheritDoc InternalClipboard} * @see * ### **Interface** * * {@link InternalClipboard} */ export declare namespace InternalClipboard { /** * Options for creating a new InternalClipboard */ export interface ConstructorOptions { /** * If provided the clipboard will sync with the native clipboard. * @remarks * Set to null or false to disable nativeClipboard. * @defaultValue globalThis.navigator.clipboard */ nativeClipboard?: Clipboard | boolean; /** * Allow for disabling clipboard read on window focus. This is * a 'polyfill' for clipboard change events but has some performance impact. */ disableCheckOnFocus?: boolean; } /** * Common Error messages related to the internal clipboard. */ const ErrorMessages: { Safari: string; Perms: string; PermsWrite: string; PermsRead: string; }; /** * A Global instance. */ const Global: InternalClipboard; } /** * Finds the intersection of 2 ranges. * * @returns `null` if no intersection. */ declare const intersectRanges: (a: RangeCoords, b: RangeCoords, reuse?: RangeCoords) => RangeCoords; /** * Indicates that an option is repeatable. */ export declare interface IRepeatableOperation { /** * A human readable description of the operation. */ readonly description: string; /** * Repeat the operation. */ repeat(): void; } /** * Returns true if `coords` is within `range`. * * @param cell CellCoords * @param range RangeCoords * * @remarks * Null safe */ declare const isCellWithinRange: (cell: CellCoords, range: RangeCoords) => boolean; declare const isDefined: (value: any) => boolean; /** * Returns `true` if `undefined` or `null` or `''`. */ declare const isEmpty: (value: any) => boolean; /** * Checks whether two arrays are equal in terms of length and element values. * * The function compares the arrays for strict equality (`===`) for each element. * It first checks if the arrays reference the same object and returns `true` in that case. * If not, it ensures both arguments are arrays of the same length, and then compares their elements. * * @typeParam T - The type of the elements in the arrays. * @param a The first array to compare. * @param b The second array to compare. * @returns `true` if the arrays are equal in length and content, `false` otherwise. * * @example * ```typescript * isEqualArrays([1, 2, 3], [1, 2, 3]); // true * isEqualArrays([1, 2, 3], [1, 2, 4]); // false * isEqualArrays([1, 2], [1, 2, 3]); // false * isEqualArrays([], []); // true * ``` */ declare const isEqualArrays: (a: T, b: T) => boolean; /** * Check if two bounds are equal. * @param a The first bounds. * @param b The second bounds. */ declare const isEqualBounds: (a: Bounds | undefined, b: Bounds | undefined) => boolean; /** * Check if two coords are equal. * @param a First CellCoords * @param b Second CellCoords */ declare const isEqualCells: (a: CellCoords | null, b: CellCoords | null) => boolean; /** * This just looks at the key at the top level. It does not compare * actual instances or traverse. */ declare const isEqualObjectKeys: (a: T, b: T) => boolean; /** * Check if two ranges are equal. * * @param a First RangeCoords * @param b Second RangeCoords * * @remarks * Null safe */ declare const isEqualRanges: (a?: RangeCoords, b?: RangeCoords) => boolean; /** * Check if two ranges arrays are equal * @param a First Range Array. * @param b Second Range Array. */ declare const isEqualRangesArrays: (a?: readonly RangeCoords[], b?: readonly RangeCoords[]) => boolean; /** * Compares two SelectionCoords. * @param a First SelectionCoords * @param b Second SelectionCoords * @returns A flag indicating the values are logically the same. */ declare const isEqualSelectionCoords: (a: SelectionCoords, b: SelectionCoords) => boolean; /** * Returns true if the current environment is Node.js. */ declare function isNode(): boolean; declare const isNullOrUndefined: (value: any) => boolean; /** * Checks if a given value can be parsed as a finite number. * * This function attempts to coerce the provided value into a number using `parseAsNumber` * and then determines if the result is both finite and of type `number`. * It filters out `NaN`, `Infinity`, `-Infinity`, and non-numeric types. * * @param value The value to be checked. * @returns `true` if the value can be parsed as a finite number, `false` otherwise. * * @example * ``` * isNumeric("123"); // true * isNumeric("12.34"); // true * isNumeric("12e5"); // true * isNumeric("abc"); // false * isNumeric(null); // false * isNumeric(Infinity); // false * ``` */ declare const isNumeric: (value: any) => boolean; declare const isObject: (obj: any) => boolean; /** * Checks if the value is a Promise-like object. */ declare const isPromiseLike: (obj: any) => boolean; /** * Check if 2 ranges overlap. * * @param a First RangeCoords * @param b Second RangeCoords */ declare const isRangesIntersect: (a: RangeCoords, b: RangeCoords) => boolean; /** * Returns true `inner` range is completely contained within 'outer' range. * @param inner Inner range. * @param outer Outer range. */ declare const isRangeWithinRange: (inner: RangeCoords, outer: RangeCoords) => boolean; /** * Check if rect is inside another rect. * * @param needle Inside `Rectangle` * @param haystack Outside `Rectangle` */ declare const isRectInsideRect: (needle: Rectangle, haystack: Rectangle) => boolean; /** * Check if rectangles intersect. * @param a * @param b */ declare const isRectIntersect: (a: Rectangle, b: Rectangle) => boolean; /** * Returns a flag indicating if the range is valid && colStart === colEnd && rowStart === rowEnd. * @param range A RangeCoord to check. */ declare const isSingleCell: (range: RangeCoords | undefined) => boolean; /** * Validate a RangeCoords. * @param range The range to validate. */ declare const isValidRange: (range: RangeCoords) => boolean; export declare interface IUndoManagerListener { onStackChange?(): void; } /** * An operation that can be undone. */ export declare interface IUndoOperation { /** * A human readable description of the operation. */ readonly description: string; /** * The size of the undo operation. This allows the undo stack to be based on the operation size NOT the stack size. * For example a very large write operation will take more memory than many small ones. */ readonly size?: number; /** * Undo the operations * * @returns redo function or void if not re-doable */ undo(): () => void | void; } /** * Interface for serializing objects to and from JSON. */ export declare interface JSONSerializable { /** * Save internal state to JSON */ toJSON(): J; /** * Load internal state from json */ fromJSON(json: J): void; } /** * Interface to indicate that an item has a toJSON but that it is async. */ export declare interface JSONSerializableAsync { /** * Asynchronously serialize the item to JSON. * * @returns A promise that resolves to the JSON representation of the item. */ toJSONAsync: () => Promise | J; } /** * Copied from https://github.com/epoberezkin/fast-json-stable-stringify/tree/master * MIT License. https://github.com/epoberezkin/fast-json-stable-stringify/tree/master?tab=License-1-ov-file */ export declare function JSONStableStringify(data: any, opts?: any): string; declare const loadImageDetails: (arrayBuffer: ArrayBuffer, mimeType?: string) => Promise; /** * Simple wrapper around deepMerge that returns * Takes a two json objects and returns a deeply merged Json object. * * The json object will remove nulls so to remove values set null as the options within the second argument * Merge plain Json object but not arrays or (currently) objects with functions * * @remarks * Will try to merge functions. */ declare const mergeContentful: (...args: any[]) => any; /** * Attempts to merge ranges that are guaranteed to not overlap. * * @defaultValue '2'. * * @remarks * * Setting to '0' will remove overlaps but not attempt to merge. * * Setting to '1' will remove overlaps in the initial orientation. * * Setting to '2' will remove most overlaps but may miss overlaps that resulted from the previous iterations. * * Setting to 'Number.MAX_SAFE_INTEGER' will run until no more ranges can be merged. */ declare function mergeRangedValues(ranges: RangedValue[], iterations?: number, getMerge?: (from: [RangedValue, b: RangedValue], destination: RangedValue, orientation: RangeOrientation) => RangedValue | null | undefined, orientation?: RangeOrientation, reuseArray?: [null, null]): RangedValue[]; declare const MESSAGE_ERROR_INVALID_ARG: (arg: any) => string; declare const MimeType_2: { readonly html: "text/html"; readonly plain: "text/plain"; readonly png: "image/png"; }; declare type MimeType_2 = typeof MimeType_2[keyof typeof MimeType_2]; export { MimeType_2 as MimeType } /** * Executes a callback function on the next tick of the event loop or animation frame. * This function provides a consistent way to defer execution across different environments. * * In browser environments, it uses requestAnimationFrame for smooth visual updates. * In Node.js or non-browser contexts, it uses setImmediate (if available) or setTimeout. * * @param callback - The function to execute on the next tick */ declare const nextTick: (callback: Function) => void; export declare const Notifier: DefaultNotifier; /** * Configuration for non-blocking notifications. */ export declare interface NotifierOptions { /** * Setting this to true will leave the notification on the screen unless it is dismissed (programmatically or through user interaction). * If `false` will be removed after a period of time. * * @defaultValue false */ persist?: boolean; /** * Ignores displaying notifications the same `message`. * * @defaultValue false */ preventDuplicate?: boolean; /** * If provided then then notification provider should not notify if the same id is used again. */ onceKey?: string; /** * Details about the notification. */ details?: any; } export declare class NotImplementedError extends ChainedError { constructor(message?: string, cause?: Error); } export declare class NullNotAllowedError extends ChainedError { constructor(message?: string, cause?: Error); } declare const openFileDialog: (accepts?: string) => Promise; declare const OSType: { readonly Windows: "windows"; readonly MacOS: "macos"; readonly IOS: "ios"; readonly Linux: "linux"; readonly Android: "android"; readonly Safari: "safari"; readonly Firefox: "firefox"; readonly Node: "node"; readonly Unknown: "unknown"; }; declare type OSType = typeof OSType[keyof typeof OSType]; /** * Special classification for error that are out of bounds. */ export declare class OutOfBoundsError extends ExpectedError { constructor(message?: string, cause?: Error); } export declare interface PaintableSurface { fill?: string; strokeFill?: string; strokeWidth?: number; } export declare interface PaintableText extends PaintableSurface { fontFamily?: string; fontSize?: number; fontWeight?: number; fontStyle?: string; letterSpacing?: number; decoration?: string; align?: string; vAlign?: string; wrap?: string; width?: number; } /** * Special classification that suggests there was a partial error. */ export declare class PartialError extends ChainedError { constructor(message?: string, cause?: Error); } /** * Represents a point in 2D space. */ export declare interface Point { /** * The x coordinate of the point. */ x: number; /** * The y coordinate of the point. */ y: number; } declare const rafThrottle: (callback: Function) => any; /** * The coordinates of a cell range in a 2D space. * The rowStart and colStart must be less than or equal to rowEnd and colEnd respectively. * If all of the values are the same this represents a single cell. */ export declare interface RangeCoords { /** * Left column */ colStart: number; /** * Top row */ rowStart: number; /** * Right column */ colEnd: number; /** * Bottom row */ rowEnd: number; sheetName?: string; } /** * Extends RangeCoords to include a value. */ export declare interface RangedValue extends RangeCoords { /** * The value of the range. * * @remarks * This is optional because it may be used to represent a range of cells that are not yet set. */ value?: T; } export declare const RangeOrientation: { readonly Column: "column"; readonly Row: "row"; }; export declare type RangeOrientation = typeof RangeOrientation[keyof typeof RangeOrientation]; /** * Allows for either direction or both. (But not none). */ export declare const RangeOrientations: { readonly Both: "both"; readonly Column: "column"; readonly Row: "row"; }; export declare type RangeOrientations = typeof RangeOrientations[keyof typeof RangeOrientations]; /** * Represents a rectangle with left, top, right, and bottom coordinates. */ export declare interface Rectangle { /** * The left coordinate of the rectangle. */ left: number; /** * The top coordinate of the rectangle. */ top: number; /** * The right coordinate of the rectangle. */ right: number; /** * The bottom coordinate of the rectangle. */ bottom: number; } /** * Extended clipboard that allows for writing non serializable objects * to the clipboard. */ export declare interface ReferenceableClipboard extends Clipboard { /** * Allows for an item to be added to the clipboard that is not a Blob. */ readReference(): Promise; /** * Allows for an item to be added to the clipboard that is not a serializable blob. */ writeReference(data: T): Promise; /** * Simple method for clearing the clipboard. * @param native By default this will only clear the reference. Set to `true` to clear the native clipboard items if available. */ clear(native?: boolean): void; } /** * {@inheritDoc ReferenceableClipboard} * @see * ### **Interface** * * {@link ReferenceableClipboard} */ export declare namespace ReferenceableClipboard { /** * Interface that allows for references to be copied. */ export interface ReferenceItem { /** * Indicates if the operation is a cut. * @defaultValue false */ isCut?(): boolean; /** * Allow items to be copied as text. */ toText?(): Promise | string; /** * Allow items to be copied as html. */ toHtml?(): Promise | string; /** * Allow items to be copied as an image Blob. */ toImage?(): Promise | Blob; /** * A key that indicates the type of item returned from {@link getItem}. * * @remarks * This should be unique key for the application. */ getItemType(): string; /** * Access to the underling reference. */ getItem?(): T; /** * When adding an item to the clipboard an EditMode can be associated. */ editMode?(): EditMode; /** * For runtime introspection. */ isClipboardItem: true; } /** * Represents the native data types that can be stored on the clipboard and accessed via the Clipboard API. */ export interface NativeItems { /** * Plain text content from the clipboard. */ text?: string; /** * HTML content from the clipboard, represented as a `Document` object. */ html?: Document; /** * Image data from the clipboard, represented as a `Blob` object. */ image?: Blob; } /** * A clipboard source is an interface will create a record to place on the clipboard. */ export interface Source { /** * A method that allows or focus to be called. (and supports an addEventListener('focus')) */ element: () => HTMLElement; /** * Create a ReferenceableClipboardItem to place on the clipboard. */ doCopy?: (options: CopyOptions) => ReferenceableClipboard.ReferenceItem | string; } /** * A clipboard target is an interface will read items from the clipboard. */ export interface Target { /** * A method that allows or focus to be called. (and supports an addEventListener('focus')) */ element: () => E; /** * If this is not specified then native paste will still be attempted. */ doPaste?: (item: ReferenceableClipboard.ReferenceItem, options: PasteOptions) => boolean | Promise; /** * Creates a `ReferenceableClipboardItem` from native clipboard items (text, html, or images). This is used to * import external clipboard data into an 'internal clipboard' representation. * * @param items Native clipboard items. * @param options Additional arguments for creating the `ReferenceableClipboardItem`. * @returns A `ReferenceableClipboardItem` (or a Promise resolving to one) if successful; * `null` if the data cannot be converted or the operation should be aborted. * * @throws `Error` If an error occurs during the creation of the `ReferenceableClipboardItem`. * The error will be caught and displayed to the user. */ importFromExternal?: (items: ReferenceableClipboard.NativeItems, options?: CopyOptions) => ReferenceableClipboard.ReferenceItem | Promise> | null; } /** * Copy options. */ export interface CopyOptions { /** * Indicates if a cut is desired. * @defaultValue false */ isCut?: boolean; /** * When performing a copy the editMode type to use. * @defaultValue 'copy' */ editMode?: EditMode; } /** * Paste options. */ export interface PasteOptions { /** * If true then formatting will be ignored. * @defaultValue false */ contentsOnly?: boolean; } } declare const removeEmptyProperties: (obj: any) => any; /** * Removes from update any values that are identical in original. * * @param update The object to update. * @param original The original object to compare against. * @param isEqual A function to compare values for equality. Defaults to strict equality. * * @remarks * This mutates the update object. */ declare const removeEqualValues: (update: any, original: any, isEqual?: (update: any, original: any) => boolean) => void; /** * A callback that is returned by listeners. To remove the listener. */ export declare interface RemoveListener { (): void; } declare const removeListenerAll: (removeListeners: [() => void]) => []; /** * Create a throttler based on RAF. * * @param callback The callback function * @param delay The delay */ declare const requestTimeout: (callback: Function, delay: number) => TimeoutID; /** * Comparator that sorts coords by column then row reversed */ declare const reverseColumnFirstCellComparator: (a: CellCoords, b: CellCoords) => number; /** * Comparator that sorts coords by row then column reversed */ declare const reverseRowFirstCellComparator: (a: CellCoords, b: CellCoords) => number; /** * Rounds a number to a specified number of decimal places, ensuring precision is maintained. * If no decimal places are provided, the default is 0 (rounds to the nearest integer). * * This function uses scientific notation to avoid floating-point precision errors * commonly associated with rounding in JavaScript. * * @param number The number to round. If the number is `null` or not finite (e.g., `Infinity`), `null` is returned. * @param decimalPlaces The number of decimal places to round to (default is 0). * @returns The rounded number, or `null` if the input is invalid. * * @example * ```typescript * roundAccurately(123.4567, 2); // 123.46 * roundAccurately(123.4567); // 123 * roundAccurately(123.4567, 0); // 123 * roundAccurately(null); // null * roundAccurately(Infinity); // null * ``` */ declare const roundAccurately: (number: number, decimalPlaces?: number) => number; /** * Comparator that sorts coords by row then column. */ declare const rowFirstCellComparator: (a: CellCoords, b: CellCoords) => number; /** * Comparator that sorts ranges by row then column. */ declare const rowFirstRangeComparator: (a: RangeCoords, b: RangeCoords) => number; /** * A RunCoords represents a discrete set of values in a single dimension. * * A `RunCoords` min and max are inclusive of the values; * so a run of length 1 would have a min equal to max. ``` // length of 1 let coord:RunCoords = { min: 3, max: 3 } ``` * * @remarks * A max of less than a min is invalid. */ export declare interface RunCoords { min: number; max: number; } /** * Returns a RangeCoord from a shape that has either RangeCoord properties or CellCoord properties. * * @param rangeOrCoords * @returns a new object that has only the values of a RangeCoords. */ declare const sanitizeRange: (rangeOrCoords: RangeCoords | CellCoords) => RangeCoords; /** * Represents a selection of ranges with an active range and an active cell. */ export declare interface SelectionCoords { /** * The cell coordinates that will receive * actions that operate on a single cell. * @remarks */ cell: Readonly; /** * A list of cell ranges that are currently selected. * @remarks * If this is missing it will be assumed to have a ranges of length 1 that matches the * CellCoords. */ ranges?: readonly RangeCoords[]; /** * The current range if any ranges are selected. * @defaultValue 'ranges.length - 1' * * @remarks * If the rangeIndex is outside the ranges bounds this will be the defaultValue. */ rangeIndex?: number; } export declare type SetEditMode = (value: EditMode | ((prev: EditMode) => EditMode)) => void; declare const setToPath: (obj: Record, path: string, value: Record) => Record; /** * Represents a shape that has a width and height. */ export declare interface Size { /** * The width of the shape. */ width: number; /** * The height of the shape. */ height: number; } /** * Describes the parts of floating point number. */ declare interface SplitNumber { /** * The integer part. */ ip: number; /** * The floating part. */ fp: number; /** * The number if digits for the integer part. */ ipLength: number; /** * The number of digits for the floating part. */ fpLength: number; } /** * Splits a number into the integer and fractional parts. Also returns the length of each * component for rounding and doesn't use string to be high performant. * This has a max precision of 7. */ declare const splitNumber: (value: number) => SplitNumber; /* Excluded from this release type: State */ /** * Breaks the outer rect into 1-4 parts based on the inner rect. * If the inner rect doesn't intersect then a 0 length array will be returned. * * This assumes both valid (bottom > top, right > left) and non zero rects * @param rectOuter The outer rectangle. * @param rectInner The inner rectangle. * @param vertical Subtract vertical before horizontal. Default Value `false`. */ declare const subtractRect: (rectOuter: Rectangle, rectInner: Rectangle, vertical?: boolean) => Rectangle[]; /** * Interface for tracking long running tasks. */ export declare interface TaskProgress { /** * When a import is started this will be called. * * @param details Optional details about the task. * @param total If total is provided this is the total amount of work to be done. * * @returns If a promise is returned, it will be awaited before proceeding. */ onStart?(details: TStart, total?: number): Promise | void; /** * May be called periodically to update the progress. * * @param amount The amount of progress made. */ onProgress?(amount: number): void; /** * May be called if a warning has occurred. * * @param message The warning message. * @param details Optional details for the warning. */ onWarning?(message?: string, details?: TWarning): void; /** * Called when the task is complete. */ onComplete?(): void; } export declare interface TextDimensions extends Size { maxLineHeight: number; } export declare interface TextMeasurer { naturalDimensions: (text: string, options?: TextMeasurerOptions) => TextDimensions; } /** * Simple DOM element to measure text size for non-rich text. * Supports text wrapping and letterSpacing based on HTML spans * * Usage * * ``` * const textMeasurer = new TextMeasurer() * textMeasurer.naturalBounds('Hello world').width * ``` */ export declare interface TextMeasurerOptions { maxWidth?: number; lineHeight?: string; paintableText?: PaintableText; scale?: number; } declare const textToKey: (str: string) => string; /** * Limits the number of times a function will be called within a given time. * @param func The function * @param limit Delay in milliseconds * @template T - The type of the function */ declare function throttle(func: T, limit: number): T; declare type TimeoutID = { id: number; }; /** * Represents a top-left coordinate in a 2D space. * * @remarks * This is similar to a Point but has a left, top to align with Rectangle. */ export declare interface TopLeft { /** * The x coordinate of the top-left corner. */ left: number; /** * The y coordinate of the top-left corner. */ top: number; } /** * Converts an object to a JSON-safe representation. This function ensures that * objects with custom `toJSON` or `toString` methods are properly serialized. * It also handles arrays and nested objects recursively. * * @param obj The object to be converted to a JSON-safe representation. * @returns The JSON-safe representation of the input object. */ declare function toSafeJSON(obj: any): any; /** * Translate a range by a specified row and column index. */ declare const translateRange: (range: RangeCoords, rowIndex?: number, colIndex?: number, reuseRange?: RangeCoords) => RangeCoords; /** * Transposes a 2D matrix (array of arrays). * * @param matrix The 2D array to transpose. * @returns The transposed 2D array. */ declare const transpose: (matrix: number[][]) => number[][]; /** * This error provides a predefined error code. */ export declare class TypedError extends Error { private _type; constructor(message: string, type: string); get type(): string; } /** * TypedObject is a metadata entry that enabled traversing. * * @remarks * * If a type has properties defined and is an Object then it will be traversed. * * If a type has arrayType defined and is an Array then it will be traversed. */ export declare interface TypedObject { /** * Returns null if shorthand is not understood. */ shorthand?: (shorthand: string | Partial

, context: C) => Partial

| null; /** * Returns a new T that is the result of merging the update into the original. * If this is not defined then the default merging logic will be applied * This is used for specialized updates of properties. */ merge?: (update: Partial

| ((original: P) => T), original: T | undefined, context: C) => Partial

| null; /** * Define the properties that are available. */ properties?: TypedObject.Properties, C>; /** * If the type is an array it can have an arrayType. * This should only be defined if the current TypeObject is an array. * This would be the un-arrayed type */ arrayType?: TypedObject; /** * Used for a determining a sub type based on the value. * * @param value The value to determine the subtype for. * @returns Another TypedObject */ getSubType?: (value: Partial

) => TypedObject; } export declare namespace TypedObject { /** * A wrapper around a property that enabled metadata typing. */ export type Properties = { [Property in keyof P]: TypedObject; }; export type ResolvableProperties = Partial<{ [Property in keyof T]: T[Property] | string | null | ResolvableProperties; }>; /** * Merged updates into updatesFrom. It used the template for values and the typedObject for navigating. * * @remarks * * Values not defined in the typed object will be shallow copied. * * This should only be used on simple objects that can be merged. (For example merging classes will strip away the class information) * * Note. We don't try to merge arrays. */ const resolveTypedUpdates:

(update: Readonly>, type: TypedObject, context: C, updateFrom?: P) => P; } export declare namespace TypesUtils { export { EmptyTopLeft, EmptyRect, EmptyBounds } } /** * A stack of undo/redo actions. */ export declare class UndoManager { private _listeners; private _maxStack; private _undoStack; private _redoStack; private _repeatOperation; private _undoDescriptions; private _redoDescriptions; /** * Creates a new undo manager. * * @remarks * By default the stack is limited to 100 items to match Excel. This can be changed by setting the maxStack argument. */ constructor(maxStack?: number); get maxStack(): number; /** * Undo the last actions on the stack. * * @param count number of actions to undo, default is 1. */ undo(count?: number): void; /** * Redo the last redo actions on the stack. * * @param count number of actions to undo, default is 1. * * @remarks * The redo stack a list of all items that have an undo. * Adding another item to the undo stack */ redo(count?: number): void; /** * Returns `true` if there are undo actions on the stack. */ hasUndo(): boolean; getTopUndoDescription(): string; /** * Returns `true` if there are redo actions on the stack. * * @remarks * These can be either as a result of an undo or a repeatable action. */ hasRedo(): boolean; getTopRedoDescription(): string; getUndoDescriptions(): readonly string[]; getRedoDescriptions(): readonly string[]; /** * Add an undo operation to the stack. */ addUndoOperation(operation: IUndoOperation): void; /** * Sets repeatable action. * * @remarks * A repeatable action is an action that a user can do multiple times 'usually on various selections'. For example styling a field * adding a similar operation to the undo stack is usually expected and has to be done done separately by the caller. * * * Clears the redo stack and does NOT add this operation to the undo stack. */ setRepeatableOperation(operation: IRepeatableOperation): void; /** * Clear the stack. */ clear(notify?: boolean): void; addListener(listener: IUndoManagerListener): RemoveListener; protected _notifyOnStackChange(): void; } /** * Finds the union of 2 ranges. * * @remarks * This is `null` safe. */ declare const unionRanges: (a: RangeCoords, b: RangeCoords, reuse?: RangeCoords) => RangeCoords; /** * Returns the smallest RangeCoords that encloses all ranges in the array. * Will return null if the range is empty. * * @param ranges An array of ranges to union. */ declare const unionRangesArrays: (ranges: readonly RangeCoords[], range?: RangeCoords, reuse?: RangeCoords) => RangeCoords; declare const uuidV4: () => string; /** * Validates the value is in the object keys. * * @param enumType An enum or object with keys * @param value A value that must match one of the keys */ declare const validEnumValue: (enumType: any, value: T) => void; declare const whenFocus: (elementSource: HTMLElement | SVGElement, ignoreDoc?: boolean) => Promise; export { }