declare module "listener/IListener" { /** * Namespace used for listeners to events. */ export namespace IListener { /** * A callback for the listener. */ interface Callback { (source: S, params?: any): any; } /** * The listener objects */ type Callbacks = Partial<{ [Property in keyof EVENTS]: IListener.Callback; }>; /** * Additional options for a listener. */ interface Options { /** * If true, the listener will be removed after the first time it is called. * * @defaultValue false; */ once?: boolean; /** * Determines if the listeners is part of the transaction. * * @defaultValue If the listener is added during a transaction this will be true. * * @remarks * There are subtle differences between a transactional listener and a non-transactional listener. * * A transactional listener: * * Will not be fire during undo/redo. * * Will be reverted to it's original add/remove state during an undo/redo. * * A non-transactional listener: * Will not be fire on any change. */ transactional?: boolean; } interface Remove { (): void; } interface ISource { /** * Add a set of callbacks to receive notification. * * @param listeners The callbacks object. * @param options Options * @returns A function that can be called to remove the listener. * * @remarks * Listeners are fired in the order that they are added. * */ addListeners(listeners: IListener.Callbacks, options?: IListener.Options): IListener.Remove; } } } declare module "listener/index" { export * from "listener/IListener"; } declare module "i18n/i18n" { export const FLOAT_SEP_STR = "."; export const REGEX_FLOAT_STR = "\\s*([-]?[0-9e]*[.]?[0-9]+)"; export const REGEX_SIMPLE_FLOAT_STR = "\\s*([-]?[0-9e]*[.]?[0-9]+)"; } declare module "i18n/index" { export * as i18n from "i18n/i18n"; } declare module "color/_ColorUtils" { export const RegExRGB: RegExp; export const RegExRGBA: RegExp; export const RegExLRGB: RegExp; export const RegExLRGBA: RegExp; export const RegExHSL: RegExp; export const RegExHSLA: RegExp; export const RegExHEX: RegExp; export const RegExHEXA: RegExp; export const RegExIndex: RegExp; export const parseParts: (partR: string | number, partG: string | number, partB: string | number) => number[]; export const divideRGB: (input: number[], divisor?: number) => number[]; export const multiplyRGB: (input: number[], factor?: number) => number[]; export const roundRGB: (input: number[], sigFigs?: number) => number[]; export const clampRGB: (rgb: number[], linear?: boolean) => number[]; export const clampAlpha: (number: number) => number; export const clampHue: (hue: number) => number; export const srgb2lin: (rgb: number[]) => number[]; export const lin2srgb: (rgb: number[]) => number[]; /** * Convert HSL values to a RGB Color. * An array with: * * H - Hue is specified as degrees in the range 0 - 360. * * S - Saturation is specified as a percentage in the range 1 - 100. * * L - Luminance is specified as a percentage in the range 1 - 100. * @param hsl Array with [h, s, l] * @returns An array containing the 3 RGB values. */ export const hsl2rgb: (hsl: number[]) => number[]; export const hue2rgb: (p: number, q: number, h: number) => number; /** * Convert a RGB Color to it corresponding HSL values. * * @returns an array containing the 3 HSL values. */ export const rgb2hsl: (rgb: number[]) => number[]; export const HSLComponent: { readonly HUE: 0; readonly SATURATION: 1; readonly LUMINANCE: 2; }; export type HSLComponent = typeof HSLComponent[keyof typeof HSLComponent]; export const RGBAComponent: { readonly RED: 0; readonly GREEN: 1; readonly BLUE: 2; readonly ALPHA: 3; }; export type RGBAComponent = typeof RGBAComponent[keyof typeof RGBAComponent]; export const ColorShiftType: { readonly SET: 0; readonly OFF: 1; readonly MOD: 2; }; export type ColorShiftType = typeof ColorShiftType[keyof typeof ColorShiftType]; export class ColorAdjustment { _private: { name: string; amount: number; }; constructor(name: string, amount: number); get name(): string; get amount(): number; } type CompTransform = (comp: number, lrgb: number[]) => number; export const applyLRGBTransform: (srgb: number[], compTransform: CompTransform) => number[]; export const applyShade: (srgb: number[], val: number) => number[]; export const applyETint: (srgb: number[], val: number) => number[]; export const applyTint: (srgb: number[], val: number) => number[]; export const applyHSL: (space: HSLComponent, srgb: number[], val: number) => number[]; export const applyHSLOff: (space: HSLComponent, srgb: number[], val: number) => number[]; export const applyHSLMod: (space: HSLComponent, srgb: number[], val: number) => number[]; export const applyRGB: (space: RGBAComponent, srgb: number[], val: number, type: ColorShiftType) => number[]; export const applyGray: (srgb: number[]) => number[]; export const applyComplement: (srgb: number[]) => number[]; export const applyInverse: (rgb: number[], linear?: boolean) => number[]; export const applyGamma: (srgb: number[]) => number[]; export const applyInverseGamma: (srgb: number[]) => number[]; /** * Returns the hex value without the leading '#'. * * @param r Red as a value between 0 and 255. * @param g Green as a value between 0 and 255. * @param b Blue as a value between 0 and 255. */ export const rgbToHex: (r: number, g: number, b: number, a?: number) => string; /** * This rotates Hue using the same algo that CSS uses. * * This was copied from https://hg.mozilla.org/mozilla-central/file/390d478480f9/gfx/src/FilterSupport.cpp */ export const rotateHueCss: (srgb: number[], angle: number) => number[]; } declare module "color/ColorSpace" { /** * Color definitions available in various ColorSpaces. */ export namespace ColorSpace { /** * A color in the Red, Green, Blue color space. */ class RGBA { protected _private: { red: number; green: number; blue: number; alpha: number; }; constructor(red: number, green: number, blue: number, alpha?: number); get red(): number; get green(): number; get blue(): number; get alpha(): number; toString(alpha?: boolean): string; isEqual(other: ColorSpace.RGBA): boolean; isAlmostEqual(other: ColorSpace.RGBA): boolean; } /** * A color in the Hue, Saturation, Luminosity color space. */ class HSLA { private _private; constructor(hue: number, sat: number, lum: number, alpha: number); get hue(): number; get sat(): number; get lum(): number; get alpha(): number; toString(alpha?: boolean): string; isEqual(other: ColorSpace.HSLA): boolean; isAlmostEqual(other: ColorSpace.HSLA): boolean; } /** * A color (Red, Green, Blue) encoded in hexadecimal. */ class HEX extends ColorSpace.RGBA { toString(alpha?: boolean): string; } } } declare module "color/IColor" { import { ColorSpace } from "color/ColorSpace"; /** * Represents a color with optional adjustments applied. * * An `IColor` consists of: * - `baseColor`: The underlying color, which can be a scheme color (e.g., Accent1), a built-in color (e.g., 'red', 'blue'), * or defined using various color models (RGB, Hex, HSL). * - `adjustments` (optional): An ordered list of color adjustments that modify the `baseColor`. * These adjustments can include effects like grayscale, inversion, or modifications to specific color components (red, alpha, etc.). * @see * {@link AdjustmentType} */ export interface IColor { /** * The base value for the color before adjustments. */ getVal(): string; /** * Return the color adjustments. */ getAdjustments(): readonly IColor.Adjustment[]; /** * Return as RGBA with adjustments applied. * @param darkMode */ toRGBA(darkMode?: boolean): IColor.ISpace.RGBA; /** * Return as HSLA with adjustments applied. * @param darkMode */ toHSLA(darkMode?: boolean): IColor.ISpace.HSLA; /** * Return a HEX with adjustments applied. * @param darkMode */ toHex(darkMode?: boolean): IColor.ISpace.HEX; /** * Return a string usable with CSS color properties. * * @param darkMode If `true` dark colors will be used. * @param alpha If `true` alpha will be applied. */ toCSS(darkMode?: boolean, alpha?: boolean): string; /** * Returns a new color that is derived from this color with the adjustments applied. * @param adjustments An array of Adjustments */ adjust(adjustments: readonly IColor.Adjustment[]): IColor; /** * Returns the color as either 'black or white' depending on the luminance. * @param threshold The threshold to determine if the color is dark or light. @defaultValue '186' */ toBlackOrWhite(darkMode?: boolean, threshold?: number): IColor; /** * Return the color as a string. * @remarks */ toString(): string; /** * Return the type of color value used (e.g., scheme, named, index, hsl, rgb, hex). */ getType(): IColor.Type; /** * Returns true if the other color will resolve to the same rgb values as this color. * @param other The other color to compare. */ isEqual(other: any): boolean; /** * For runtime type checking. */ readonly isIColor: true; } /** * {@inheritDoc IColor} * @see * ### **Interface** * * {@link IColor} * * ### **Implementation** * * {@link IColor} */ export namespace IColor { /** * Represents a color space. */ namespace ISpace { /** * A color in the Red, Green, Blue color space. */ type RGBA = ColorSpace.RGBA; /** * A color in the Hue, Saturation, Luminosity color space. */ type HSLA = ColorSpace.HSLA; /** * A color (Red, Green, Blue) encoded in hexadecimal. */ type HEX = ColorSpace.HEX; } /** * Represents various adjustment types for color properties, allowing fine-tuned control over * attributes such as transparency, hue, saturation, luminance, and RGB components. * * The adjusts are based on the DrawML OOXML specification, with an additional adjustment type (`ETint`) * based on the Excel tint shading algorithm. * * * Adjustments can be chained to achieve complex color transformations. */ const AdjustmentType: { /** * Adjusts the transparency level of a color. */ readonly Alpha: "alpha"; /** * Adjusts the transparency offset of a color. */ readonly AlphaOff: "alphaOff"; /** * Modifies the transparency of a color by a multiplier. */ readonly AlphaMod: "alphaMod"; /** * Adjusts the hue of a color. */ readonly Hue: "hue"; /** * Adjusts the saturation of a color. */ readonly Sat: "sat"; /** * Adjusts the luminance (brightness) of a color. */ readonly Lum: "lum"; /** * Applies an offset to the hue of a color. */ readonly HueOff: "hueOff"; /** * Applies an offset to the saturation of a color. */ readonly SatOff: "satOff"; /** * Applies an offset to the luminance of a color. */ readonly LumOff: "lumOff"; /** * Modifies the hue of a color by a multiplier. */ readonly HueMod: "hueMod"; /** * Modifies the saturation of a color by a multiplier. */ readonly SatMod: "satMod"; /** * Modifies the luminance of a color by a multiplier. */ readonly LumMod: "lumMod"; /** * Adjusts the red component of a color. */ readonly Red: "red"; /** * Adjusts the green component of a color. */ readonly Green: "green"; /** * Adjusts the blue component of a color. */ readonly Blue: "blue"; /** * Applies an offset to the red component of a color. */ readonly RedOff: "redOff"; /** * Applies an offset to the green component of a color. */ readonly GreenOff: "greenOff"; /** * Applies an offset to the blue component of a color. */ readonly BlueOff: "blueOff"; /** * Modifies the red component of a color by a multiplier. */ readonly RedMod: "redMod"; /** * Modifies the green component of a color by a multiplier. */ readonly GreenMod: "greenMod"; /** * Modifies the blue component of a color by a multiplier. */ readonly BlueMod: "blueMod"; /** * Shades a color, making it darker by reducing its luminance. */ readonly Shade: "shade"; /** * Tints a color, making it lighter by increasing its luminance. */ readonly Tint: "tint"; /** * Tints a color based on Excel's specific tint shading algorithm. */ readonly ETint: "eTint"; /** * Converts a color to grayscale. */ readonly Gray: "gray"; /** * Creates a complementary color. */ readonly Comp: "comp"; /** * Inverts a color. */ readonly Inv: "inv"; /** * Applies gamma correction to a color. */ readonly Gamma: "gamma"; /** * Inverts the gamma correction of a color. */ readonly InvGamma: "invGamma"; }; type AdjustmentType = typeof AdjustmentType[keyof typeof AdjustmentType]; /** * Represents a color adjustment. * * @remarks * All percentages are expresses as 0-100 except alpha which is 0-1. */ type Adjustment = { [key in IColor.AdjustmentType]?: boolean | number; }; /** * Represents a value and adjustment. */ interface Definition { val: string; adjs?: readonly IColor.Adjustment[]; } /** * Associate a color definition with a human-readable label. * @remarks * Useful for displaying color options in a UI. */ interface DefinitionWithLabel { description: string; definition: IColor.Definition; } type Serializable = string | IColor | (string | IColor); /** * Lookup a color by the Schema key. This should consult a DocTheme if available. */ type SchemeLookup = (key: IColor.Scheme) => ColorSpace.RGBA; /** * Lookup a color by the Indexed value. * @see * {@link https://github.com/closedxml/closedxml/wiki/Excel-Indexed-Colors | Excel Indexed Colors} */ type IndexedLookup = (index: number) => ColorSpace.RGBA; /** * Named (builtin) colors defined in DrawingML aka known/system colors * * This enum provides a comprehensive list of named colors, including system-defined colors, * standard HTML colors, and additional named colors. Each color is represented as a string * corresponding to its name. * * @see * * {@link https://msdn.microsoft.com/library/system.drawing.knowncolor.aspx | KnownColor Enumeration} * * {@link https://msdn.microsoft.com/library/system.windows.media.colors.aspx | Colors Class} */ const Named: { /** * The system-defined color of the active window's border. */ readonly ActiveBorder: "activeBorder"; /** * The system-defined color of the active window's caption. */ readonly ActiveCaption: "activeCaption"; /** * The system-defined color of the text in the active window's caption. */ readonly CaptionText: "captionText"; /** * The system-defined color of the application workspace. */ readonly AppWorkspace: "appWorkspace"; /** * The system-defined color of the face of a button. */ readonly BtnFace: "btnFace"; /** * The system-defined color of the shadow of a button. */ readonly BtnShadow: "btnShadow"; /** * The system-defined color of a 3D dark shadow. */ readonly DkShadow3d: "3dDkShadow"; /** * The system-defined color of the highlight of a button. */ readonly BtnHighlight: "btnHighlight"; /** * The system-defined color of a 3D light. */ readonly Light3d: "3dLight"; /** * The system-defined color of the text on a button. */ readonly BtnText: "btnText"; /** * The system-defined color of the background. */ readonly Background: "background"; /** * The system-defined color of gray text. */ readonly GrayText: "grayText"; /** * The system-defined color of the highlight. */ readonly Highlight: "highlight"; /** * The system-defined color of the text in the highlight. */ readonly HighlightText: "highlightText"; /** * The system-defined color of a hot light. */ readonly HotLight: "hotLight"; /** * The system-defined color of the inactive window's border. */ readonly InactiveBorder: "inactiveBorder"; /** * The system-defined color of the inactive window's caption. */ readonly InactiveCaption: "inactiveCaption"; /** * The system-defined color of the text in the inactive window's caption. */ readonly InactiveCaptionText: "inactiveCaptionText"; /** * The system-defined color of the background of an information tooltip. */ readonly InfoBk: "infoBk"; /** * The system-defined color of the text in an information tooltip. */ readonly InfoText: "infoText"; /** * The system-defined color of a menu. */ readonly Menu: "menu"; /** * The system-defined color of the text in a menu. */ readonly MenuText: "menuText"; /** * The system-defined color of a scroll bar. */ readonly ScrollBar: "scrollBar"; /** * The system-defined color of a window. */ readonly Window: "window"; /** * The system-defined color of a window frame. */ readonly WindowFrame: "windowFrame"; /** * The system-defined color of the text in a window. */ readonly WindowText: "windowText"; /** * The system-defined color of transparency. */ readonly Transparent: "transparent"; /** * The color AliceBlue. */ readonly AliceBlue: "aliceBlue"; /** * The color AntiqueWhite. */ readonly AntiqueWhite: "antiqueWhite"; /** * The color Aqua. */ readonly Aqua: "aqua"; /** * The color Aquamarine. */ readonly Aquamarine: "aquamarine"; /** * The color Azure. */ readonly Azure: "azure"; /** * The color Beige. */ readonly Beige: "beige"; /** * The color Bisque. */ readonly Bisque: "bisque"; /** * The color Black. */ readonly Black: "black"; /** * The color BlanchedAlmond. */ readonly BlanchedAlmond: "blanchedAlmond"; /** * The color Blue. */ readonly Blue: "blue"; /** * The color BlueViolet. */ readonly BlueViolet: "blueViolet"; /** * The color Brown. */ readonly Brown: "brown"; /** * The color BurlyWood. */ readonly BurlyWood: "burlyWood"; /** * The color CadetBlue. */ readonly CadetBlue: "cadetBlue"; /** * The color Chartreuse. */ readonly Chartreuse: "chartreuse"; /** * The color Chocolate. */ readonly Chocolate: "chocolate"; /** * The color Coral. */ readonly Coral: "coral"; /** * The color CornflowerBlue. */ readonly CornflowerBlue: "cornflowerBlue"; /** * The color Cornsilk. */ readonly Cornsilk: "cornsilk"; /** * The color Crimson. */ readonly Crimson: "crimson"; /** * The color Cyan. */ readonly Cyan: "cyan"; /** * The color DarkBlue. */ readonly DkBlue: "dkBlue"; /** * The color DarkCyan. */ readonly DkCyan: "dkCyan"; /** * The color DarkGoldenrod. */ readonly DkGoldenrod: "dkGoldenrod"; /** * The color DarkGray. */ readonly DkGray: "dkGray"; /** * The color DarkGreen. */ readonly DkGreen: "dkGreen"; /** * The color DarkKhaki. */ readonly DkKhaki: "dkKhaki"; /** * The color DarkMagenta. */ readonly DkMagenta: "dkMagenta"; /** * The color DarkOliveGreen. */ readonly DkOliveGreen: "dkOliveGreen"; /** * The color DarkOrange. */ readonly DkOrange: "dkOrange"; /** * The color DarkOrchid. */ readonly DkOrchid: "dkOrchid"; /** * The color DarkRed. */ readonly DkRed: "dkRed"; /** * The color DarkSalmon. */ readonly DkSalmon: "dkSalmon"; /** * The color DarkSeaGreen. */ readonly DkSeaGreen: "dkSeaGreen"; /** * The color DarkSlateBlue. */ readonly DkSlateBlue: "dkSlateBlue"; /** * The color DarkSlateGray. */ readonly DkSlateGray: "dkSlateGray"; /** * The color DarkTurquoise. */ readonly DkTurquoise: "dkTurquoise"; /** * The color DarkViolet. */ readonly DkViolet: "dkViolet"; /** * The color DeepPink. */ readonly DeepPink: "deepPink"; /** * The color DeepSkyBlue. */ readonly DeepSkyBlue: "deepSkyBlue"; /** * The color DimGray. */ readonly DimGray: "dimGray"; /** * The color DodgerBlue. */ readonly DodgerBlue: "dodgerBlue"; /** * The color Firebrick. */ readonly Firebrick: "firebrick"; /** * The color FloralWhite. */ readonly FloralWhite: "floralWhite"; /** * The color ForestGreen. */ readonly ForestGreen: "forestGreen"; /** * The color Fuchsia. */ readonly Fuchsia: "fuchsia"; /** * The color Gainsboro. */ readonly Gainsboro: "gainsboro"; /** * The color GhostWhite. */ readonly GhostWhite: "ghostWhite"; /** * The color Gold. */ readonly Gold: "gold"; /** * The color Goldenrod. */ readonly Goldenrod: "goldenrod"; /** * The color Gray. */ readonly Gray: "gray"; /** * The color Green. */ readonly Green: "green"; /** * The color GreenYellow. */ readonly GreenYellow: "greenYellow"; /** * The color Honeydew. */ readonly Honeydew: "honeydew"; /** * The color HotPink. */ readonly HotPink: "hotPink"; /** * The color IndianRed. */ readonly IndianRed: "indianRed"; /** * The color Indigo. */ readonly Indigo: "indigo"; /** * The color Ivory. */ readonly Ivory: "ivory"; /** * The color Khaki. */ readonly Khaki: "khaki"; /** * The color Lavender. */ readonly Lavender: "lavender"; /** * The color LavenderBlush. */ readonly LavenderBlush: "lavenderBlush"; /** * The color LawnGreen. */ readonly LawnGreen: "lawnGreen"; /** * The color LemonChiffon. */ readonly LemonChiffon: "lemonChiffon"; /** * The color LightBlue. */ readonly LtBlue: "ltBlue"; /** * The color LightCoral. */ readonly LtCoral: "ltCoral"; /** * The color LightCyan. */ readonly LtCyan: "ltCyan"; /** * The color LightGoldenrodYellow. */ readonly LtGoldenrodYellow: "ltGoldenrodYellow"; /** * The color LightGray. */ readonly LtGray: "ltGray"; /** * The color LightGreen. */ readonly LtGreen: "ltGreen"; /** * The color LightPink. */ readonly LtPink: "ltPink"; /** * The color LightSalmon. */ readonly LtSalmon: "ltSalmon"; /** * The color LightSeaGreen. */ readonly LtSeaGreen: "ltSeaGreen"; /** * The color LightSkyBlue. */ readonly LtSkyBlue: "ltSkyBlue"; /** * The color LightSlateGray. */ readonly LtSlateGray: "ltSlateGray"; /** * The color LightSteelBlue. */ readonly LtSteelBlue: "ltSteelBlue"; /** * The color LightYellow. */ readonly LtYellow: "ltYellow"; /** * The color Lime. */ readonly Lime: "lime"; /** * The color LimeGreen. */ readonly LimeGreen: "limeGreen"; /** * The color Linen. */ readonly Linen: "linen"; /** * The color Magenta. */ readonly Magenta: "magenta"; /** * The color Maroon. */ readonly Maroon: "maroon"; /** * The color MediumAquamarine. */ readonly MedAquamarine: "medAquamarine"; /** * The color MediumBlue. */ readonly MedBlue: "medBlue"; /** * The color MediumOrchid. */ readonly MedOrchid: "medOrchid"; /** * The color MediumPurple. */ readonly MedPurple: "medPurple"; /** * The color MediumSeaGreen. */ readonly MedSeaGreen: "medSeaGreen"; /** * The color MediumSlateBlue. */ readonly MedSlateBlue: "medSlateBlue"; /** * The color MediumSpringGreen. */ readonly MedSpringGreen: "medSpringGreen"; /** * The color MediumTurquoise. */ readonly MedTurquoise: "medTurquoise"; /** * The color MediumVioletRed. */ readonly MedVioletRed: "medVioletRed"; /** * The color MidnightBlue. */ readonly MidnightBlue: "midnightBlue"; /** * The color MintCream. */ readonly MintCream: "mintCream"; /** * The color MistyRose. */ readonly MistyRose: "mistyRose"; /** * The color Moccasin. */ readonly Moccasin: "moccasin"; /** * The color NavajoWhite. */ readonly NavajoWhite: "navajoWhite"; /** * The color Navy. */ readonly Navy: "navy"; /** * The color OldLace. */ readonly OldLace: "oldLace"; /** * The color Olive. */ readonly Olive: "olive"; /** * The color OliveDrab. */ readonly OliveDrab: "oliveDrab"; /** * The color Orange. */ readonly Orange: "orange"; /** * The color OrangeRed. */ readonly OrangeRed: "orangeRed"; /** * The color Orchid. */ readonly Orchid: "orchid"; /** * The color PaleGoldenrod. */ readonly PaleGoldenrod: "paleGoldenrod"; /** * The color PaleGreen. */ readonly PaleGreen: "paleGreen"; /** * The color PaleTurquoise. */ readonly PaleTurquoise: "paleTurquoise"; /** * The color PaleVioletRed. */ readonly PaleVioletRed: "paleVioletRed"; /** * The color PapayaWhip. */ readonly PapayaWhip: "papayaWhip"; /** * The color PeachPuff. */ readonly PeachPuff: "peachPuff"; /** * The color Peru. */ readonly Peru: "peru"; /** * The color Pink. */ readonly Pink: "pink"; /** * The color Plum. */ readonly Plum: "plum"; /** * The color PowderBlue. */ readonly PowderBlue: "powderBlue"; /** * The color Purple. */ readonly Purple: "purple"; /** * The color Red. */ readonly Red: "red"; /** * The color RosyBrown. */ readonly RosyBrown: "rosyBrown"; /** * The color RoyalBlue. */ readonly RoyalBlue: "royalBlue"; /** * The color SaddleBrown. */ readonly SaddleBrown: "saddleBrown"; /** * The color Salmon. */ readonly Salmon: "salmon"; /** * The color SandyBrown. */ readonly SandyBrown: "sandyBrown"; /** * The color SeaGreen. */ readonly SeaGreen: "seaGreen"; /** * The color SeaShell. */ readonly SeaShell: "seaShell"; /** * The color Sienna. */ readonly Sienna: "sienna"; /** * The color Silver. */ readonly Silver: "silver"; /** * The color SkyBlue. */ readonly SkyBlue: "skyBlue"; /** * The color SlateBlue. */ readonly SlateBlue: "slateBlue"; /** * The color SlateGray. */ readonly SlateGray: "slateGray"; /** * The color Snow. */ readonly Snow: "snow"; /** * The color SpringGreen. */ readonly SpringGreen: "springGreen"; /** * The color SteelBlue. */ readonly SteelBlue: "steelBlue"; /** * The color Tan. */ readonly Tan: "tan"; /** * The color Teal. */ readonly Teal: "teal"; /** * The color Thistle. */ readonly Thistle: "thistle"; /** * The color Tomato. */ readonly Tomato: "tomato"; /** * The color Turquoise. */ readonly Turquoise: "turquoise"; /** * The color Violet. */ readonly Violet: "violet"; /** * The color Wheat. */ readonly Wheat: "wheat"; /** * The color White. */ readonly White: "white"; /** * The color WhiteSmoke. */ readonly WhiteSmoke: "whiteSmoke"; /** * The color Yellow. */ readonly Yellow: "yellow"; /** * The color YellowGreen. */ readonly YellowGreen: "yellowGreen"; /** * The system-defined color of the face of a button. */ readonly ButtonFace: "buttonFace"; /** * The system-defined color of the highlight of a button. */ readonly ButtonHighlight: "buttonHighlight"; /** * The system-defined color of the shadow of a button. */ readonly ButtonShadow: "buttonShadow"; /** * The system-defined color of the gradient active caption. */ readonly GradientActiveCaption: "gradientActiveCaption"; /** * The system-defined color of the gradient inactive caption. */ readonly GradientInactiveCaption: "gradientInactiveCaption"; /** * The system-defined color of the menu bar. */ readonly MenuBar: "menuBar"; /** * The system-defined color of the menu highlight. */ readonly MenuHighlight: "menuHighlight"; }; type Named = typeof Named[keyof typeof Named]; /** * Represents predefined colors from a color scheme, used in document themes. */ const Scheme: { /** * Background color 1. */ readonly Bg1: "bg1"; /** * Background color 2. */ readonly Bg2: "bg2"; /** * Text color 1. */ readonly Tx1: "tx1"; /** * Text color 2. */ readonly Tx2: "tx2"; /** * Accent color 1. */ readonly Accent1: "accent1"; /** * Accent color 2. */ readonly Accent2: "accent2"; /** * Accent color 3. */ readonly Accent3: "accent3"; /** * Accent color 4. */ readonly Accent4: "accent4"; /** * Accent color 5. */ readonly Accent5: "accent5"; /** * Accent color 6. */ readonly Accent6: "accent6"; /** * Hyperlink color. */ readonly Hlink: "hlink"; /** * Followed hyperlink color. */ readonly FolHlink: "folHlink"; }; type Scheme = typeof Scheme[keyof typeof Scheme]; /** * Indicates the Color Type used. */ const Type: { readonly Scheme: "scheme"; readonly Named: "named"; readonly Index: "index"; readonly HSL: "hsl"; readonly RGB: "rgb"; readonly LRGB: "lrgb"; readonly Hex: "hex"; }; type Type = typeof Type[keyof typeof Type]; } } declare module "color/_BuiltInIndexDefs" { import { ColorSpace } from "color/ColorSpace"; /** @internal */ export const _BuiltInIndexDefs: (index: number) => ColorSpace.RGBA; } declare module "color/_BuiltInNamedDefs" { /** * Preset colors defined in DrawingML aka known/system colors * * @see * * {@link https://msdn.microsoft.com/library/system.drawing.knowncolor.aspx | KnownColor Enumeration} * * {@link https://msdn.microsoft.com/library/system.windows.media.colors.aspx | Colors Class} */ type RGBA = { r: number; g: number; b: number; a?: number; }; type ColorMapping = { id: number; name: string; rgbaColor: RGBA; system: boolean; }; class NamedDefLookup { _lookupByName: Map; constructor(); valueOfName(name: string): ColorMapping; } export const _BuiltInNamedDefs: NamedDefLookup; } declare module "color/_BuiltInSchemeDefs" { import { IColor } from "color/IColor"; export type SchemeDef = { scheme: string | IColor.Scheme; description: string; }; export const _BuiltInSchemeDefs: (scheme: string) => SchemeDef | null; } declare module "color/Color" { import { ColorSpace } from "color/ColorSpace"; import { IColor } from "color/IColor"; /** * Capabilities for working with {@link IColor | colors}. * * Advanced color customization and compatibility with CSS and Office color schemes. * * Key features include: * - Accessing a collection of built-in colors (Named, Scheme, Index). * - Creating customized colors with color adjustments. * - Defining and and converting between different color models (RGB, HEX, HSL). * * @see * {@link IColor} */ export class Color implements IColor { private _private; constructor(value: string | IColor | IColor.Definition, schemeLookup?: IColor.SchemeLookup, indexedLookup?: IColor.IndexedLookup, last?: ColorSpace.RGBA); private _parse; private _forceDark; private _resolve; /** * @hidden * TODO - Rationalize this. Do we want a constructor a static parse? */ static parse(input: string | IColor, schemeLookup?: IColor.SchemeLookup, indexedLookup?: IColor.IndexedLookup, last?: ColorSpace.RGBA): IColor | null; /** * Returns the default color scheme lookup that Colors will use if none is provided. */ static getDefaultSchemeLookup(): IColor.SchemeLookup; /** {@inheritDoc IColor.isEqual} */ isEqual(other: any): boolean; /** {@inheritDoc IColor.getVal} */ getVal(): string; /** {@inheritDoc IColor.getAdjustments} */ getAdjustments(): readonly IColor.Adjustment[]; /** {@inheritDoc IColor.adjust} */ adjust(adjustments: IColor.Adjustment[]): IColor; /** {@inheritDoc IColor.getType} */ getType(): IColor.Type; /** {@inheritDoc IColor.toCSS} */ toCSS(darkMode?: boolean, alpha?: boolean): string; /** {@inheritDoc IColor.toRGBA} */ toRGBA(darkMode?: boolean): IColor.ISpace.RGBA; /** {@inheritDoc IColor.toHSLA} */ toHSLA(darkMode?: boolean): IColor.ISpace.HSLA; /** {@inheritDoc IColor.toHex} */ toHex(darkMode?: boolean): IColor.ISpace.HEX; /** {@inheritDoc IColor.toBlackOrWhite} */ toBlackOrWhite(darkMode?: boolean, threshold?: number): IColor; get [Symbol.toStringTag](): string; /** {@inheritDoc IColor.toString} */ toString(): string; /** {@inheritDoc IColor.isIColor} */ get isIColor(): true; } } declare module "color/index" { export * from "color/IColor"; export * from "color/Color"; } declare module "type/ITypes" { import type { RunCoords, Bounds, RangeCoords } from '@sheetxl/utils'; /** * A collection of types. */ export namespace ITypes { /** * Associate an optional value with a {@link RangeCoords}. */ interface RangeCoordValue extends RangeCoords { value?: T; } /** * Associate an option value with a {@link RunCoords}. */ interface RunCoordValue extends RunCoords { value?: T; } /** * Associate an option value with a {@link Bounds}. */ interface BoundsValue extends Bounds { value?: T; } /** * Options for controlling selection behavior, including scrolling and focus. */ interface SelectOptions { /** * If `true` or if a valid `ScrollIntoViewOptions` object is provided, * the selected element will be scrolled into view. * * @remarks * - If a `ScrollIntoViewOptions` object is provided, it will control the exact scrolling behavior. * - If `false` (or omitted), the selected element will not be scrolled into view. * * @defaultValue false */ scrollIntoView?: boolean | globalThis.ScrollIntoViewOptions; /** * If `true`, the selected element will automatically receive focus after being selected. * * @remarks * - If `false` (or omitted), the element will not automatically receive focus. * * @defaultValue false */ autoFocus?: boolean; } } } declare module "type/IProperties" { import type { Scalar, IRange } from '@sheetxl/primitives'; /** * Contains interfaces for working with properties. */ export namespace IProperties { /** * Represents an interface for ranged items with customizable properties, * supporting operations such as retrieving properties at a given coordinate, * cloning with updates, splitting, and merging. * * @typeParam P - The type representing the properties associated with the range. * @typeParam J - The type representing the JSON-serializable representation of the range. */ interface ICellRanged

{ /** * Retrieves the coordinates for the range. * * @returns The range's coordinates. * * @remarks * The coordinates are not the coordinates where this is contained but the coordinates for access getPropertiesAt. */ getCoords(): Readonly; /** * Retrieves the properties associated with a specified cell within the range. * * @param rowIndex The row index within the range. * @param colIndex The column index within the range. * @param value The value at the coordinates. * @returns The properties associated with the specified cell as a read-only object. */ getPropertiesAt(rowIndex: number, colIndex: number, value: Scalar): Readonly

; /** * Creates a new instance of the range with specified updates applied. * * @param updates The updates to apply to the range's properties. * @returns A new `ICellRanged` instance with the applied updates. */ cloneWithUpdate?(updates: IProperties.ResolvableProperties

): this; } /** * Recursively converts a type into a derived type where any field can be a string or a function that takes the old value. */ type ResolvableProperties = Partial<{ [Property in keyof T]: T[Property] | string | null | ResolvableProperties; }>; } } declare module "type/ICollection" { import type { JSONSerializableAsync } from '@sheetxl/utils'; import type { IListener } from "listener/index"; /** * Interface used for all ICollections. */ export interface ICollection { /** * Returns the items in the collection. */ getItems(options?: ICollection.GetItemsOptions): T[]; /** * Returns the total items available. * * @remarks * Useful as a quick escape for getItems. */ getCount(): number; } /** * {@inheritDoc ICollection} * @see * ### **Interface** * * {@link ICollection} */ export namespace ICollection { /** * Options for getting items from the collection. * * @remarks * This placeholder is extended by implementations of ICollection */ interface GetItemsOptions { } /** * Collection that can be persisted. */ interface IPersistable { /** * Used for saving items. Returns a handler that will allow for writing JSON records * only save the items that were accessed within the persist scope. */ beginPersist(): ICollection.IPersistScope; } /** * A transient scope for items to ids that can be used for references. * * @see * {@link IPersistable.beginPersist} */ interface IPersistScope { /** * For a shared string this will return a number that can be used to reference the item in the persisted json. * @param item The to return an identifier for. */ add(item: JSONSerializableAsync | J): number | null; /** * For a given persist id this will return the item. * * @param id */ at(id: number): JSONSerializableAsync | J | null; /** * Called when done persisting. */ endPersist(): void; /** * Loads the json. * * @param json */ fromJSON(json: J[]): void; /** * Return a array of resources that have been added via `add`. * * @remarks * This can be called multiple times.. */ toJSONAsync(): Promise; } /** * Collection Events. */ interface Events { /** * Called when collections have changes. */ onCollectionChange?(source: ICollection): void; /** * Called when the collection has been updated due to a undo/redo and a rerender is required. */ onInvalidated?(source: ICollection): void; } interface IListeners extends IListener.Callbacks, ICollection.Events> { } } } declare module "type/index" { export * from "type/ITypes"; export * from "type/IProperties"; export * from "type/ICollection"; } declare module "transaction/ITransaction" { import { ITypes } from "type/index"; import { IListener } from "listener/index"; /** * Objects that implement this interface have ACID properties. */ export interface ITransaction { /** * Begin a transaction with self contained, non-eventing updates. * * @remarks * `description` is useful for debugging and logging. * * Transactions are treated as a stack so with fifo remove. When the final commit is applied * to global only the final transaction will be maintained. * * @param options The description of the transaction or options. * @param onClose A callback for when the transaction is closed (due to either a commit or rollback). */ beginTransaction(options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): ITransaction; /** * Commit the transaction and all children transactions to the parent transaction. * * @param options A final description or options to apply on commit. */ commit(options?: ITransaction.StoreOperationOptions): ITransaction; /** * Discard all changes and children transaction changes. */ rollback(): ITransaction; /** * If root transaction will return self. */ getParent(): ITransaction; /** * A unique id for this transaction. This will be the same id for all sub transactions. */ getId(): string; /** * Describes the current transaction. */ getDescription(): string; /** * 0-Based depth of the current transaction. If 0 then it's globally available. */ getDepth(): number; /** * Returns the state associated to a record for the current transaction or globally if there are no open transactions. * * @param model The `ITransactional` object. */ getState(model: any): Readonly; /** * Update the state for a record. * * @param model * @param state */ updateState(model: any, state: (Readonly> | ((prev: Readonly) => Readonly))): STATE; /** * All states in the current transaction. */ getStates(): Map; /** * Returns the view associated with this transaction. */ getView(): Record | null; } /** * {@inheritDoc ITransaction} * @see * ### **Interface** * * {@link ITransaction} */ export namespace ITransaction { /** * Objects that implement this interface allow for batch operations. */ interface ITransactional { /** * A unique identifier for the record. This will never change. * * @remarks * This enables the record to be identified across transactions and users in a collaborative environment. */ getUUID?(): string; /** * Provides a mechanism to perform a set of operations in a batch. * * @param callback A callback that performs multiple operations all within the same transaction. * @param options Description of the operation or additional options. Used for tracking undo/redo and history. Default Value `User Operation`. */ doBatch(callback: (commit: ITransaction.ICommit) => R | Promise, options?: string | ITransaction.OperationOptions): R | Promise; /** * Batches all 'transactional' changes until they have all be committed or rolled back. * * @remarks * Any changes that are made to this object will be reflected in the local record but * not committed to the transactional store until the batch is popped. * * Useful for operations that are longer running but generally not recommended * as it keeps a transaction open. {@link doBatch} is the preferred option. * * @param options Description of the operation or additional options. Used for tracking undo/redo and history. Default Value `User Operation`. */ beginCommit(options?: string | ITransaction.OperationOptions): ITransaction; /** * Close the record and cleans resources. Can't be undone. */ close(): void; /** * Returns `true` if no more operations are allowed. */ isClosed(): boolean; } interface ICommit { /** * Returns the unique identifier for the commit. */ getId(): string; /** * A human readable description of the commit. */ getDescription(): string; /** * Additional meta information set during open and close. */ getMeta(): Readonly>; /** * The author of the commit. */ getAuthor(): any; /** * The time the commit was created. */ getTimestamp(): number; /** * Returns the operation that was used to create the commit. * * @remarks * It is possible that a batch operation was used to create the commit. */ getOperation(): Readonly; } /** * When the first transaction this will contain the name of parameters of the input */ interface Operation { /** * The name of the operations. * * @remarks * This name should be unique per model type. This is used for audit and collaboration. */ name: string; /** * The parameters for the operation. */ params?: PARAMS; } interface RestoreOptions { /** * If provided restore will only select if the view matches the id. * * @defaultValue undefined - Any view will be selected. * * @remarks * This is used for collaboration. */ viewId?: string; /** * If true will force the restore even if there are open transactions. * * @defaultValue false */ force?: boolean; } interface StoreConstructorOptions { /** * The creator of the transactions. */ author?: string; /** * If true will try to default to synchronous eventing. * * @defaultValue 'setDefaultSync' */ sync?: boolean; /** * If true will not track changes for restoring. * @defaultValue false * * @remarks * Useful for creating temporary models that don't need to be tracked. */ transient?: boolean; } interface IStore { /** * Add a listener to listen for changes. */ addListener(listener: ITransaction.IListeners): IListener.Remove; /** * Add a listener for state changes to a specific model. * * @param model * @param listener */ addStateListener(model: any, listener: ITransaction.IStateListener): IListener.Remove; /** * Returns the last commits of commits. * @param commitId The commit id to start from. * @param max - The maximum number of commits to return. *default* `100`. */ getLog(commitId: string, max?: number): ITransaction.ICommit[]; /** * Returns the total number of commits. */ getCommitCount(): number; /** * Returns the current commit. * * @remarks * Returns either the last completed commit or the current pending. */ getCurrentCommit(): ITransaction.ICommit; /** * Returns true if there is an open transaction. */ isOpenTransaction(): boolean; /** * Returns the current view associated with the entire commit. * * @remarks * Will return `null` if there is no open transaction. */ getPendingView(): Record | null; /** * Returns the current state associated to a model for the current transaction or globally if there are no open transactions. * * @param model The `ITransactional` object. */ getState(model: any): Readonly; /** * Begin a transaction using the current commit. * @param options * @param onClose */ beginCommit(options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): ITransaction; /** * Used by `ITransactional` objects. Both to expose `doBatch` and to implement * their own internal transactions. */ doBatch(callback: (commit: ITransaction.ICommit) => R | Promise, options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): Promise | R; /** * Remove model from the commit. * * @param model The model to remove. * @returns A flag indicating if anything was removed. * * @remarks * Fires remove event. */ remove(model: any): boolean; /** * Set the state to a previous history point. * * @param commitId * @param options * * @remarks * Can be any previous restore point available in before the current commit * or after the current commit. */ restore(commitId: string, options?: ITransaction.RestoreOptions): ITransaction.ICommit; /** * Revert is similar to restore in that it moves the state but it applies view * updates in reverse order. * * @param commitId * @param options * * @remarks * Can be any previous restore point available in before the current commit * or after the current commit. */ revert(commitId: string, options?: ITransaction.RestoreOptions): ITransaction.ICommit; } /** * Listener interface for TransactionStore */ interface IListeners { /** * Called when a commit is started. * * @param commit The commit handle. * * @remarks * This allows for additional transactional changes to be made such as transaction listeners. */ onCommitStart?(commit: ITransaction.ICommit): void; /** * Called after a successful commit. * * @param commit * * @remarks * * A rollback will not trigger this event. * * A restore/revert will trigger this event. */ onCommitEnd?(commit: ITransaction.ICommit): void; /** * Called if the commit changes for any reason. * * @param commit */ onCommitChange?(commit: ITransaction.ICommit): void; } interface IStateListener { /** * Called synchronously at the beginning of a transaction before a record is changed. * * @remarks * If this throws an exception then all records within the transaction will not * be applied. */ onBeforeCommitStart?(state: STATE, view: VIEW, commit: ITransaction.ICommit): void; /** * Called during a transaction. * * @remarks * This is when changes should be applied. The view will only be provided if restore is used. */ onBeforeCommitEnd?(state: STATE, view: VIEW, commit: ITransaction.ICommit): void; /** * Called after the transaction. This is generally used for cleanup or ui notification. */ onAfterStateChange?(state: STATE, view: VIEW, commit: ITransaction.ICommit, isRevert: boolean, isRestore: boolean): void; /** * Called if the restore or revert is called. This is called asynchronously As should only have passive actions. */ onRestoreOrRevert?(state: STATE, view: VIEW, commit: ITransaction.ICommit, isUndo: boolean): void; /** * Called when a model is removed from the transaction. */ onClose?(commit: ITransaction.ICommit): void; } /** * Called when a transaction is closed. */ interface CloseCallback { (transaction: ITransaction, isRollback: boolean, options: ITransaction.OperationOptions): void; } /** * Options for Operations that change the state. */ interface OperationOptions { /** * A human description. * * @defaultValue 'determined by the set operation and locale' */ description?: string; /** * If `true` or set then this will select the affect item after the transaction is complete. * * @remarks * If this is set to `true` then any restore will also select. */ autoSelect?: boolean | ITypes.SelectOptions; } /** * Options for operations with the store. */ interface StoreOperationOptions extends OperationOptions { /** * If set to `true`, prevents further transactions from being pushed onto the stack * until the current transaction is complete. Once the current transaction is either * committed or rolled back, this restriction is automatically lifted. * * @defaultValue false */ preventFurtherTransactions?: boolean; /** * If set to `true`, The commit will not create a new snapshot but instead merge with the existing. * * @defaultValue false * * @remarks * * Ths is used for internal listeners and historical corrections. * * This is only read for the top transaction. * * This should generally be avoided as the audits and history are lost. */ forceAmend?: boolean; /** * Stored with the commit. */ meta?: Record; /** * Used to record audit points. */ operation?: ITransaction.Operation; viewAfter?: VIEW | ((prev: VIEW) => VIEW); viewBefore?: VIEW | ((prev: VIEW) => VIEW); } } } declare module "transaction/Transaction" { import { IListener } from "listener/index"; import { ITransaction } from "transaction/ITransaction"; interface CommitRecord { id?: string; description?: string; meta?: Record; timestamp: number; author?: any; states?: Map; operation?: ITransaction.Operation; viewBefore?: Record; viewAfter?: Record; previousId?: string; version: number; } interface CommitContainer { record: CommitRecord; commit: ITransaction.ICommit; } /** * Events are never fired on sub transactions. Only when making changes to the root * either directly or through a final commit. Any models that want to fire non transactional * events should do this directly. */ export class TransactionStore implements ITransaction.IStore { protected _listeners: Set; protected _listenersState: Map>; protected _commits: Map; protected _transactionStack: AbstractTransaction[]; protected _transactionOpen: boolean; protected _locked: boolean; protected _isSync: boolean; protected _isTransient: boolean; protected _author: any; protected _current: CommitContainer; protected _pending: CommitContainer; protected _cacheModel: any; protected _cacheState: any; protected _states: Map; constructor(options?: ITransaction.StoreConstructorOptions); /** * Sets the transaction store to be synchronous or asynchronous. * * @param sync * * @remarks * This is used for unit tests only. */ static setDefaultSync: (sync: boolean) => void; /** {@inheritDoc ITransaction.IStore.getLog} */ getLog(commitId: string, max?: number): ITransaction.ICommit[]; /** {@inheritDoc ITransaction.IStore.getCommitCount} */ getCommitCount(): number; /** {@inheritDoc ITransaction.IStore.isOpenTransaction} */ isOpenTransaction(): boolean; /** {@inheritDoc ITransaction.IStore.getView} */ getPendingView(): Record | null; /** {@inheritDoc ITransaction.IStore.getState} */ getState(model: any): Readonly; /** {@inheritDoc ITransaction.IStore.getCurrentCommit} */ getCurrentCommit(): ITransaction.ICommit; /** {@inheritDoc ITransaction.IStore.restore} */ restore(commitId: string, options?: ITransaction.RestoreOptions): ITransaction.ICommit; /** {@inheritDoc ITransaction.IStore.revert} */ revert(commitId: string, options?: ITransaction.RestoreOptions): ITransaction.ICommit; protected _getCommitContainer(commitId: string, options?: ITransaction.RestoreOptions): CommitContainer; protected _pruneForwards(_commitId: string): void; /** {@inheritDoc ITransaction.IStore.beginCommit} */ beginCommit(options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): ITransaction; /** {@inheritDoc ITransaction.IStore.doBatch} */ doBatch(callback: (commit: ITransaction.ICommit) => R | Promise, options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): Promise | R; /** {@inheritDoc ITransaction.IStore.remove} */ remove(model: any): boolean; /** {@inheritDoc ITransaction.IStore.addListener} */ addListener(listener: ITransaction.IListeners): IListener.Remove; /** {@inheritDoc ITransaction.IStore.addStateListener} */ addStateListener(model: any, listener: ITransaction.IStateListener): IListener.Remove; protected dispatchEvents(dispatcher: () => void, async?: boolean): void; protected _commitRecord(container: CommitContainer, states: Map, forceAmend: boolean): void; _notifyStates(event: keyof ITransaction.IStateListener, container: CommitContainer, states: Map, view?: Record, isRevert?: boolean, isRestore?: boolean, async?: boolean): void; _notify(event: keyof ITransaction.IListeners, commit: ITransaction.ICommit, async?: boolean): void; } abstract class AbstractTransaction implements ITransaction { protected _states: Map; protected _description: string; protected _meta: Record; protected _children: Set; protected _depth: number; protected _descriptions: string[]; protected _container: CommitContainer; protected _closed: boolean; constructor(container: CommitContainer, options: ITransaction.StoreOperationOptions); /** {@inheritDoc ITransaction.getView} */ getView(): Record; /** {@inheritDoc ITransaction.getState} */ abstract getState(model: any): STATE; /** {@inheritDoc ITransaction.rollback} */ abstract rollback(): ITransaction; /** {@inheritDoc ITransaction.getParent} */ abstract getParent(): ITransaction; /** {@inheritDoc ITransaction.getId} */ abstract getId(): string; /** {@inheritDoc ITransaction.getDepth} */ getDepth(): number; /** {@inheritDoc ITransaction.getDescription} */ getDescription(): string; /** {@inheritDoc ITransaction.getStates} */ getStates(): Map; /** {@inheritDoc ITransaction.beginTransaction} */ beginTransaction(options?: ITransaction.StoreOperationOptions, onClose?: ITransaction.CloseCallback): ITransaction; /** {@inheritDoc ITransaction.updateState} */ updateState(model: any, state: Readonly> | ((prev: Readonly) => Readonly)): STATE; /** {@inheritDoc ITransaction.commit} */ commit(options?: ITransaction.StoreOperationOptions): ITransaction; /** {@inheritDoc ITransaction.isClose} */ isClose(): boolean; protected _ensureOpen(): void; _removeChild(child: AbstractTransaction): void; protected _mergeStates(statesChild: Map): Map; } } declare module "transaction/TransactionUndoManager" { import { UndoManager } from '@sheetxl/utils'; import { ITransaction } from "transaction/index"; /** * UndoManager that wraps transaction commits and restores these. */ export class TransactionUndoManager extends UndoManager { private _transactions; private _removeLister; constructor(transactions?: ITransaction.IStore, maxStack?: number); clear(): void; /** * Close the undo manager and remove the listener. */ close(): void; } } declare module "transaction/index" { export * from "transaction/ITransaction"; export * from "transaction/Transaction"; export * from "transaction/TransactionUndoManager"; } declare module "resource/IResource" { import type { JSONSerializableAsync } from '@sheetxl/utils'; /** * A resource is an item referenced elsewhere with the application. * This will track when a resource is no longer being used and can be removed. */ export interface IResource extends JSONSerializableAsync { /** * Returns the resource as a Promise to array buffer. */ toBuffer(): Promise; /** * The mimetype of the resource. */ getType(): Promise; /** * An optional name for the resource. */ getName(): string | null; /** * For saving to json resources. */ toJSONAsync(): Promise; /** * Add a reference to the resource. * @param ref The object to strongly hold the resource. */ addReference(ref: any): void; /** * Delete a reference to the resource. * @param ref */ deleteReference(ref: any): void; /** * This does not follow the standard listener pattern and is only called once. * @param listener */ addUnloadListener(listener: IResource.IUnloadListener): void; /** * `true` if the resource if all references have been deleted. */ isClosed(): boolean; /** * For runtime type checking. */ readonly isIResource: true; } /** * {@inheritDoc IResource} * @see * ### **Interface** * * {@link IResource} */ export namespace IResource { interface IUnloadListener { onUnload: (ref: IResource) => void; } interface JSON { /** * A type for the data. */ type?: string; /** * A base64 encoded string of the data. */ base64: string; /** * The name of the resource. * This is optional but if provided then resource lookup will use this as a cache key. */ name?: string; } } } declare module "resource/IResourceCollection" { import type { JSONSerializableAsync, FetchArgs } from '@sheetxl/utils'; import type { ICollection } from "type/index"; import type { IResource } from "resource/IResource"; /** * Collections of {@link IResource}. */ export interface IResourceCollection extends ICollection { /** * Add a resource to a collection with an initial reference. * @param resource * @remarks * Resources are not removed from the the collection. They are autoGCed when there are no references. */ add(resource: string | IResource | IResourceCollection.AddOptions): IResource; /** * Returns a list of all resources in the collection. * @param options */ getItems(options?: ICollection.GetItemsOptions): IResource[]; /** * Used for saving resource. Returns a visitor that will allow for a toJSON that * will only save the resource that were accessed within the persist scope. */ beginPersist(): IResourceCollection.IPersistScope; } /** * {@inheritDoc IResourceCollection} * @see * ### **Interface** * * {@link IResourceCollection} */ export namespace IResourceCollection { /** * When adding a shared source there are a number of ways to create it * Either from a base64 string, a buffer, a fetch, or a custom resolve function. */ interface AddOptions { /** * An encoding for the resource. One and only of these should be provided */ base64?: string | Promise; fetch?: string | FetchArgs; buffer?: ArrayBuffer | Promise | (() => ArrayBuffer | Promise); file?: File | Promise; /** * Type type of the resource. * * @remarks * This must be a known type */ type?: string; /** * The name of the resource. * This is optional and purely for human consumption and is not used by the system. */ name?: string; } interface GetItemsOptions extends ICollection.GetItemsOptions { } interface IPersistScope { /** * For a resource this will return a number that can be used to reference the resource in the persisted json. * @param resource */ toResourceId(resource: JSONSerializableAsync): number | null; /** * For a given resourceId this will return the resource. * @param resourceId */ fromResourceId(resourceId: number): JSONSerializableAsync | null; /** * Called when done persisting. */ endPersist(): void; /** * Loads the json. * @param json */ fromJSON(json: J[]): void; /** * This can be called multiple times. */ toJSONAsync(): Promise; } } } declare module "resource/_ResourceMessages" { export const ERROR_DUPLICATE_DATA_VALUES: string; export const ERROR_NO_DATA_VALUES: string; export const CLOSED_MODEL: string; } declare module "resource/Resource" { import { IResource } from "resource/IResource"; import { IResourceCollection } from "resource/IResourceCollection"; export class Resource implements IResource { private _name; private _refs; private _listeners; private _isClosed; private _asArrayBufferResolve; private _asArrayBuffer; private _type; constructor(options: IResourceCollection.AddOptions); /** {@inheritDoc IResource.getName} */ getName(): string; /** {@inheritDoc IResource.toJSONAsync} */ toJSONAsync(): Promise; /** {@inheritDoc IResource.toBuffer} */ toBuffer(): Promise; /** {@inheritDoc IResource.getType} */ getType(): Promise; /** {@inheritDoc IResource.addReference} */ addReference(ref: any): void; /** {@inheritDoc IResource.deleteReference} */ deleteReference(ref: any): void; /** {@inheritDoc IResource.addUnloadListener} */ addUnloadListener(listener: IResource.IUnloadListener): void; /** {@inheritDoc IResource.isIResource} */ get isIResource(): true; /** {@inheritDoc IResource.isClosed} */ isClosed(): boolean; } } declare module "resource/ResourceCollection" { import { IResource } from "resource/IResource"; import { IResourceCollection } from "resource/IResourceCollection"; export class ResourceCollection implements IResourceCollection { private _resources; private _persistOpen; constructor(); /** {@inheritDoc IResourceCollection.add} */ add(res: string | IResource | IResourceCollection.AddOptions): IResource; /** {@inheritDoc IResourceCollection.getItems} */ getItems(options?: IResourceCollection.GetItemsOptions): IResource[]; /** {@inheritDoc IResourceCollection.getCount} */ getCount(): number; /** {@inheritDoc IResourceCollection.beginPersist} */ beginPersist(): IResourceCollection.IPersistScope; } } declare module "resource/index" { export * from "resource/IResource"; export * from "resource/Resource"; export * from "resource/IResourceCollection"; export * from "resource/ResourceCollection"; } declare module "model/IModel" { import type { ITransaction } from "transaction/index"; import type { IListener } from "listener/index"; /** * A model interface is a interface that has: * * 1. Eventing * 2. Transactional * 3. Potentially delete * 4. Potentially readonly */ export interface IModel extends ITransaction.ITransactional { /** * Add Listeners. * * @see * {@link IListener.ISource.addListeners} */ addListeners(listeners: L, options?: IListener.Options): IListener.Remove; /** * Delete the item. * * @remarks * Not all objects can be deleted. */ delete?(options?: ITransaction.OperationOptions): void; /** * If the model unable to be modified. */ isReadOnly(): boolean; /** * If the model unable to be modified. */ isDeleted(): boolean; /** * Returns an immutable type string. */ getType(): string; /** * For runtime type checking. */ readonly isIModel: true; } /** * {@inheritDoc IModel} * @see * ### **Interface** * * {@link IModel} */ export namespace IModel { /** * IListener for {@link IModel} events. */ interface Events { /** * Called when any state has been modified. */ onAnyChange?(source: IModel): void; /** * Called when the readOnly status is updated. */ onReadOnlyChange?(source: IModel): void; /** * Called when the model has been deleted. */ onDelete?(source: IModel): void; /** * Called when the transaction is closed. */ onClose?(source: IModel): void; /** * Called when the state has been updated due to a undo/redo and a rerender is required. */ onInvalidated?(source: IModel): void; } interface IListeners extends IListener.Callbacks { } type DeletedCallback = () => void; type ReadOnlyCallback = () => void; interface ConstructorOptions { /** * Use for the creation transaction description. */ createDescription?: string; /** * The type of the model. */ type?: string; /** * If the item is readonly. */ isReadOnly?(): boolean; /** * Notify if the readonly has been updated from the container. * @param callback */ setContainerReadOnlyCallback?(callback: IModel.ReadOnlyCallback): void; /** * Delete from the container. */ deleteFromContainer?(options?: ITransaction.OperationOptions): void; /** * A transaction store that can be used to undo/redo changes to the model. */ transactions?: ITransaction.IStore; /** * JSON state to load. */ json?: J; } } } declare module "model/_ModelMessages" { export const MODEL_CLOSED = "Model has been closed. No further operations are allowed."; export const ERROR_READONLY = "We can't update. The item is read only."; export const CREATE_DESCRIPTION = "Create Model"; export const NAME_REQUIRED = "Name is required"; export const MODEL_DELETED = "Model has been deleted."; } declare module "listener/ListenerEmitter" { import { type ITransaction } from "transaction/index"; import type { IListener } from "listener/IListener"; interface Entry { remove?: IListener.Remove; listeners: IListener.Callbacks; } type EntrySet = Set>; interface Pending { commitId: string; listeners: IListener.Callback[]; removes: IListener.Remove[]; options: NotifyOptions; } interface NotifyOptions { params?: T | null; source?: any; async?: boolean; transactional?: boolean; } /** * Manages Listeners * * @remarks * A few rules to know: * * * non-transactional listeners are fired after the commit end and are conflated. */ export class ListenerEmitter { protected _transactions: ITransaction.IStore; protected _transactionsRemoveListener: IListener.Remove; protected _src: SOURCE; protected _listeners: EntrySet; protected _pending: Pending[]; constructor(src: SOURCE, transactions?: ITransaction.IStore); /** {@inheritDoc IListener.ISource.addListeners} */ addListeners(listeners: IListener.Callbacks, options?: IListener.Options): IListener.Remove; protected _doNotify(listeners: IListener.Callback[], removes?: IListener.Remove[], options?: NotifyOptions, fired?: Set>): Promise; /** * Notify listeners. */ notify(key: keyof EVENTS, options?: NotifyOptions): void | Promise; close(): void; } } declare module "model/AbstractModel" { import { ITransaction } from "transaction/index"; import { IListener } from "listener/index"; import { IModel } from "model/IModel"; import { ListenerEmitter } from "listener/ListenerEmitter"; /** * Abstract implement of `IModel`. */ export abstract class AbstractModel implements IModel { protected _emitter: ListenerEmitter; protected _options: IModel.ConstructorOptions; protected _transactions: ITransaction.IStore; protected _transactionsRemoveListener: IListener.Remove; protected _closed: boolean; constructor(options: IModel.ConstructorOptions); /** @internal */ protected _fromJSON(_json: JSON): void; isReadOnly(): boolean; isDeleted(): boolean; getType(): string; get isIModel(): true; /** @internal */ protected _processTransactionDone(_transaction: ITransaction): void; /** @internal */ protected _getDescription(): string; /** @internal */ protected _getState(): Readonly; /** @internal */ protected _beginCommit(options?: string | ITransaction.OperationOptions): ITransaction; /** @internal */ protected _getTransactions(): ITransaction.IStore; /** @internal */ protected _updateState(updateState?: Partial, //(prevState: STATE) => STATE, options?: ITransaction.OperationOptions, events?: (keyof EVENTS)[]): this; /** @internal */ protected _getEmitter(): ListenerEmitter; /** @internal */ protected _processInit(): void; /** @internal */ protected _processStateChange(_state: STATE, _view: VIEW, _commit: ITransaction.ICommit): void; /** @internal */ protected _processRestoreOrRevert(_state: STATE, _view: VIEW, _commit: ITransaction.ICommit): void; delete(options?: ITransaction.OperationOptions): void; /** @internal */ protected _delete(): void; /** @internal */ protected _processOnContainerDeleted(): void; /** @internal */ protected _processDelete(): void; /** @internal */ protected _processOnContainerReadOnly(): void; /** {@inheritDoc IListener.ISource.addListeners} */ addListeners(listeners: IListener.Callbacks, options?: IListener.Options): IListener.Remove; /** {@inheritDoc ITransaction.ITransactional.beginCommit} */ beginCommit(options?: string | ITransaction.OperationOptions): ITransaction; /** {@inheritDoc ITransaction.ITransactional.doBatch} */ doBatch(callback: (commit: ITransaction.ICommit) => Promise | R, options?: string | ITransaction.OperationOptions): Promise | R; /** {@inheritDoc ITransaction.ITransactional.isClosed} */ isClosed(): boolean; /** {@inheritDoc ITransaction.ITransactional.close} */ close(): void; } /** * Interfaces for creating `IAnchored`. * * @see * ### **Interface** * * {@link AbstractModel} */ export namespace AbstractModel { interface State { isDeleted: boolean; } interface CommitView { } } } declare module "model/index" { export * from "model/IModel"; export * from "model/AbstractModel"; } declare module "history/IHistory" { import type { ReferenceableClipboard } from '@sheetxl/utils'; /** * Encapsulates functionalities crucial for maintaining a comprehensive version history * and audit trail within the spreadsheet application. It provides mechanisms to capture, store, * and manage snapshots of the spreadsheet's state at various points in time. * * The primary motivations behind this namespace are: * * - **Versioning and Undo/Redo**: Maintain a detailed history of changes, allowing for easy rollback or review. * - **Copy/Paste**: Create transferable references. * - **Auditing/Change logs**: Enable accountability by tracking who made changes and when they occurred. * - **Snapshot Management**: Efficiently capture and restore spreadsheet states for backup, * analysis, or reuse. * * By offering robust versioning and auditing capabilities, this namespace contributes to a more * reliable, transparent, and user-friendly spreadsheet experience. */ export namespace IHistory { /** * Represents an immutable reference to an `Record`, capturing its content and metadata. * @template D The type of the destination for `copyTo`. * @template S The type of the source for `getSource``. * @template C The type of the coordinates the snapshot is bound to. * @template J The type of the JSON for `toJSON`. */ interface ISnapshot { /** * Copies the snapshot to the specified range. * * @param destination The destination `Snapshot source` where the snapshot will be copied. * @param options {@link IHistory.CopyToOptions} * * @returns A promise that resolves when the copy is complete, or `void` if no asynchronous operation is required. */ copyTo(destination: D, options?: IHistory.CopyToOptions): Promise | C; /** * The source that created the snapshot. * This is used to quickly do comparisons. */ getSource(): S; /** * Retrieves the coordinates that bound the current snapshot. * * @remarks * Different types of snapshots may have different coordinate systems. */ getCoords?(): Readonly; /** * Converts the snapshot to a plain text representation. * * @returns A string or promise resolving to the text representation of the snapshot. */ toText?(): Promise | string; /** * Converts the snapshot to an HTML representation. * * @returns A string or promise resolving to the HTML representation of the snapshot. */ toHtml?(): Promise | string; /** * Converts the snapshot to an image blob. * * @returns A `Blob` or promise resolving to the image representation of the snapshot. */ toImage?(): Promise | Blob; /** * Converts the snapshot to a JSON object. * * @returns A JSON object or promise resolving to the JSON representation of the snapshot. */ toJSON?(): Promise | J; /** * A user friendly name of a the snapshot item. */ getName?(): string; /** * Return the options used when creating. * @remarks * This is done so that we can create a copy. */ getMarkOptions(): ReferenceableClipboard.CopyOptions; /** * For runtime type checking. */ readonly isISnapshot: true; } /** * Options for creating {@link IHistory.ISnapshot}. * **PLACEHOLDER** */ interface GetSnapshotOptions { } /** * Copy options for {@link IHistory.ISnapshot}. * **PLACEHOLDER** */ interface CopyToOptions extends GetSnapshotOptions { } /** * Interface for objects that supports returning ISnapshot. */ interface ISnapshotSource { /** * Represents an immutable reference to an `ICellRange`, capturing its content and metadata. * It may include complex objects such as tables, shapes, images, listeners, or other items. */ getSnapshot(options?: ReferenceableClipboard.CopyOptions): IHistory.ISnapshot; } } } declare module "history/index" { export * from "history/IHistory"; } declare module "hyperlink/IHyperlink" { /** * Represents a hyperlink for linking to either a URL or a cell address. */ export interface IHyperlink { /** * Open the hyperlink. * * @param target Specifies where to open the linked document. DefaultValue `getTarget()`. * @param features Passed to the window open context for external resource. * * @see * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/open) */ open(target?: '_self' | '_blank', features?: string): Promise; /** * This is either the address or the cell value. */ getDisplayText(): string; /** * This can be a url or a cell address. * * @remarks * A sheet address needs to start with a #. */ getAddress(): string; /** * Tet for showing addition information about the link that will be * displayed as a tooltip. * * @remarks * Excel has an undocumented tooltip length limit of 255 characters. */ getTooltip(): string; /** * Specified the target frame when opening this Hyperlink. * @defaultValue `newWindow` */ getTarget(): string; /** * For runtime type checking. */ readonly isIHyperlink: true; } /** * {@inheritDoc IHyperlink} * @see * ### **Interface** * * {@link IHyperlink} */ export namespace IHyperlink { /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = Partial; /** * Used when updating the the value. * @see * `ICellRange.setHyperlink` */ type Update = IHyperlink.Modifiers | IHyperlink | string | null; /** * Properties available to `IHyperlinks`. */ interface Properties { /** {@inheritDoc IHyperlink.getDisplayText} */ displayText?: string; /** {@inheritDoc IHyperlink.getAddress} */ address: string; /** {@inheritDoc IHyperlink.getTooltip} */ tooltip?: string; /** {@inheritDoc IHyperlink.getTarget} */ target?: string; } /** * A JSON representation useful for persistence. */ type JSON = Partial> | string; } } declare module "hyperlink/index" { export * from "hyperlink/IHyperlink"; } declare module "comment/IComment" { import type { ICellRange } from "cellRange/index"; /** * TODO - Implement IComment. * TODO - how to make this threaded? * TODO - rationalize this with notes? * -Each Comment will have a unique id and a parent that it is a reply to. * * ? How to add root range.addComment(content) ? (only allows for 1 root) * https://learn.microsoft.com/en-us/javascript/api/office-scripts/excelscript/excelscript.contenttype?view=office-scripts * * Excel has a resolved/done status * Excel has mentions? */ export interface IComment { getContent(): string; setContent(content: string): void; getUserId(): string; delete(): void; getCreationDate(): Date; } /** * {@inheritDoc IComment} * @see * ### **Interface** * * {@link IComment} */ export namespace IComment { interface Properties { /** * The content of the comment. */ content?: any; asNote?: boolean; } /** * For persisting. */ interface JSON extends IComment.Properties { /** * Required for referencing in replies. */ id: string; /** * The id for author or the comment the comment. */ personId: string; /** * The reference for the comment. */ ref?: ICellRange.RefJSON; /** * If this is a reply, the id of the parent comment. */ parentId?: string; /** * An unordered list of mention ids. * @remarks * These are not order dependent. */ mentionsIds?: string[]; /** * The date the comment was created. */ dt?: Date | string; /** * The comment has been marked as done. */ done?: boolean; } interface MentionJSON { /** * The id for the mention. */ id: string; /** * The id for author or the comment the comment. */ personId: string; /** * The start of the mention. */ startIndex?: number; /** * The length of the mention. */ length?: number; } /** * Represents a reference to person. Either in a comment, protection clause or mention. */ interface PersonJSON { /** * A human readable string for the name. */ displayName: string; /** * A unique identifier. */ id: string; /** * The id for authorizing against the providerId. */ userId?: string; /** * The system that provided the person. */ providerId?: string; } } } declare module "comment/index" { export * from "comment/IComment"; } declare module "fill/IFill" { import type { Properties as CSSProperties } from 'csstype'; import type { Rectangle, Bounds } from '@sheetxl/utils'; import { IColor } from "color/index"; import { IStyle } from "style/index"; /** * Defines how an area or shape is filled with color or a pattern. */ export interface IFill { /** * Returns the type of fill used. */ getType(): IFill.Type; /** * Returns the fill as a set of css string that are suitable for css. * @remarks * * Not all fill styles will offer an exact css equivalent. * Additionally due to the nature of css having different properties for the same logic value * (for example color, backgroundColor) */ toCSS(darkMode?: boolean, bounds?: Bounds): CSSProperties; /** * Returns the fill as a JSON object. */ toJSON(): IFill.JSON; /** * For type checking. */ readonly isIFill: true; } /** * {@inheritDoc IFill} * @see * ### **Interface** * * {@link IFill} */ export namespace IFill { /** * Types of fill styles used for painting surfaces. */ const Type: { /** * No fill. */ readonly None: "none"; /** * A solid color. */ readonly Solid: "solid"; /** * A gradient */ readonly Gradient: "gradient"; /** * A pattern. */ readonly Pattern: "pattern"; /** * An Image. * @remarks * * Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint). */ readonly Image: "pattern"; /** * An Image. * @remarks * * Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint). */ readonly Background: "background"; /** * Inherit the fill from the group. * @remarks * * This has no effect if not in a group. * * Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint). */ readonly Group: "group"; /** * For allowing custom types. * @remarks * Placeholder and not yet implemented. This will have a function callback. */ readonly Custom: "custom"; }; type Type = typeof Type[keyof typeof Type]; /** * Represents the types of gradients that can be applied to shapes or other elements. */ const GradientType: { /** * A linear gradient, where colors transition along a straight line. */ readonly Linear: "linear"; /** * A path-based gradient, where colors transition along a defined path. * * @remarks * * Currently not directly supported by the rendering engine. */ readonly Path: "path"; /** * A circular gradient, where colors transition radially from a central point. * * @remarks * Not supported by Excel. */ readonly Circular: "circular"; /** * A rectangular gradient, where colors transition within a rectangular shape. * * @remarks * Not supported by Excel or SheetXL rendering engine. */ readonly Rect: "rect"; }; type GradientType = typeof GradientType[keyof typeof GradientType]; /** * Specifies how a tile is mirrored or flipped when filling a shape or container. */ const TileMirror: { /** * No mirroring is applied. */ readonly None: "none"; /** * The tile is mirrored vertically (flipped along the y-axis). */ readonly Vertical: "v"; /** * The tile is mirrored horizontally (flipped along the x-axis). */ readonly Horizontal: "h"; /** * The tile is mirrored both vertically and horizontally. */ readonly Both: "b"; }; type TileMirror = typeof TileMirror[keyof typeof TileMirror]; /** * Contains the built-in pattern types. * * @remarks * **TODO** - Rationalize with full drawML list. */ const BuiltInSheetPattern: { /** * 'None' style * * @remarks * Acts like a none fill */ readonly None: "none"; /** * 'None' style * * @remarks * Acts like a solid fill */ readonly Solid: "solid"; /** * 'Dark Gary' style */ readonly DarkGray: "darkGray"; /** * 'Medium Gray' style */ readonly MediumGray: "mediumGray"; /** * 'Light Gray' style */ readonly LightGray: "lightGray"; /** * 'Gray 0.0625' style */ readonly Gray0625: "gray0625"; /** * 'Gray 0.125' style */ readonly Gray125: "gray125"; /** * 'Dark Horizontal' style */ readonly DarkHorizontal: "darkHorizontal"; /** * 'Dark Vertical' style */ readonly DarkVertical: "darkVertical"; /** * 'Dark Down' style */ readonly DarkDown: "darkDown"; /** * 'Dark Up' style */ readonly DarkUp: "darkUp"; /** * 'Dark Grid' style */ readonly DarkGrid: "darkGrid"; /** * 'Dark Trellis' style */ readonly DarkTrellis: "darkTrellis"; /** * 'Light Horizontal' style */ readonly LightHorizontal: "lightHorizontal"; /** * 'Light Vertical' style */ readonly LightVertical: "lightVertical"; /** * 'Light Down' style */ readonly LightDown: "lightDown"; /** * 'Light Up' style */ readonly LightUp: "lightUp"; /** * 'Light Grid' style */ readonly LightGrid: "lightGrid"; /** * 'Light Trellis' style */ readonly LightTrellis: "lightTrellis"; /** * 'Custom' style * @remarks * Then a pattern must be provided. * * **Not yet implemented** */ readonly Custom: "custom"; }; type BuiltInSheetPattern = typeof BuiltInSheetPattern[keyof typeof BuiltInSheetPattern]; interface Properties { /** * @see * {@link IFill.getType} */ type: IFill.Type; } /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = Partial; /** * Options for updating a fill. */ type Update = IFill | Modifiers | string | null; /** * A JSON representation useful for persistence. */ interface JSON extends Properties { } /** * No fill is applied; the area is transparent. */ interface INone extends IFill { /** * Fill type is always {@link IFill.Type.None}. */ getType(): typeof IFill.Type.None; toJSON(): NoneJSON; } interface NoneProperties extends IFill.Properties { /** * @see * {@link IFill.ISolid.getColor} */ type: typeof IFill.Type.None; } interface NoneJSON extends NoneProperties { } /** * A single color fill. */ interface ISolid extends IFill { /** * Fill type is always {@link IFill.Type.Solid}. */ getType(): typeof IFill.Type.Solid; /** * Returns the color of the fill. */ getColor(): IColor; /** * Sets the stroke color. * * @param color The stroke color. */ setColor(color: IColor.Serializable | null, options?: IStyle.UpdateOptions): IFill.ISolid; } interface SolidProperties extends IFill.Properties { /** * @see * {@link IFill.ISolid.getColor} */ color: C; /** * @see * {@link IFill.ISolid.getType} */ type: typeof IFill.Type.Solid; } interface SolidJSON extends SolidProperties { } interface TileProperties { /** * @see * {@link IFill.ITile.getAlign} */ align?: string; /** * @see * {@link IFill.ITile.getMirror} */ mirror?: IFill.TileMirror; /** * @see * {@link IFill.ITile.getBounds} */ bounds?: Rectangle; /** * Create blur noise at the edges of the tile. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stitchTiles} */ stitch?: boolean; } /** * Represents a tile used for filling shapes or other elements with a repeating pattern. */ interface ITile { /** * Specifies the alignment of the tile within its container. * * @remarks * - Possible values: 'tl', 't', 'tr', 'l', 'c', 'r', 'bl', 'b', 'br' (representing top-left, top, top-right, etc.) */ getAlign(): string; /** * Determines how the tile is mirrored or flipped when filling the container. */ getMirror(): IFill.TileMirror; /** * Defines the rectangular bounds of the tile pattern. */ getBounds(): Rectangle; } interface GradientStopProperties { /** * @see * {@link IFill.IGradientStop.getOffset} */ offset?: number; /** * @see * {@link IFill.IGradientStop.getColor} */ color: C; } /** * Indicates a color change occurs. */ interface IGradientStop { /** * If not specified then the offsets will be equally weighted based off of the number of stops. */ getOffset(): number; /** * The color of the stop. */ getColor(): IColor; } interface GradientProperties extends IFill.Properties { /** * @see * {@link IFill.IGradient.getType} */ type: typeof IFill.Type.Gradient; /** * @see * {@link IFill.IGradient.getStops} */ stops?: (GradientStopProperties | C)[]; /** * @see * {@link IFill.IGradient.getGradientType} */ gradientType?: IFill.GradientType; /** * @see * {@link IFill.IGradient.getAngle} */ angle?: number; /** * @see * {@link IFill.IGradient.getFillTo} */ fillTo?: Rectangle; } /** * A gradient fill, where colors transition across the area. */ interface IGradient extends IFill { /** * Fill type is always {@link IFill.Type.Gradient}. */ getType(): typeof IFill.Type.Gradient; /** * The stops for the gradient. * * @remarks * * This must be at least two stops. */ getStops(): IGradientStop[]; /** * Sets the gradient stops. * * @param stops The gradient stops. */ setStops(stops: (IGradientStop | IColor.Serializable | null)[], options?: IStyle.UpdateOptions): IFill.IGradient; /** * The type of gradient. * @defaultValue GradientType.Linear */ getGradientType(): IFill.GradientType; /** * Sets the gradient type. * * @param type The gradient type. */ setGradientType(type: IFill.GradientType | null, options?: IStyle.UpdateOptions): IFill.IGradient; /** * The angle of the gradient in degrees if gradient type is linear. */ getAngle(): number; /** * Sets the rotation * * @param angle The angle */ setAngle(angle: number | null, options?: IStyle.UpdateOptions): IFill.IGradient; /** * Used for path and circular gradients. */ getFillTo(): Rectangle; /** * Sets the fill area for the gradient. * * @param fillTo The fill area. */ setFillTo(fillTo: Rectangle | null, options?: IStyle.UpdateOptions): IFill.IGradient; /** * Converts the gradient fill to a JSON representation. */ toJSON(): GradientJSON; } interface GradientJSON extends GradientProperties { } /** * A pattern fill, using a repeating pattern to fill the area. */ interface IPattern extends IFill { /** * Fill type is always {@link IFill.Type.Pattern}. */ getType(): typeof IFill.Type.Pattern; /** * The foreground color for the pattern. */ getForeground(): IColor; /** * Sets the foreground color. * * @param color The foreground color. */ setForeground(color: IColor.Serializable | null, options?: IStyle.UpdateOptions): IFill.IPattern; /** * The background color for the pattern. */ getBackground(): IColor; /** * Sets the background color. * * @param color The background color. */ setBackground(color: IColor.Serializable | null, options?: IStyle.UpdateOptions): IFill.IPattern; /** * The type of pattern used. */ getPatternType(): IFill.BuiltInSheetPattern; /** * Sets the pattern type. * * @param type The pattern type. */ setPatternType(type: IFill.BuiltInSheetPattern | null, options?: IStyle.UpdateOptions): IFill.IPattern; /** * Converts the pattern fill to a JSON representation. */ toJSON(): PatternJSON; } interface PatternProperties extends IFill.Properties { /** * @see * {@link IFill.IPattern.getType} */ type: typeof IFill.Type.Pattern; /** * @see * {@link IFill.IPattern.getForeground} */ foreground?: C; /** * @see * {@link IFill.IPattern.getBackground} */ background?: C; /** * @see * {@link IFill.IPattern.getPatternType} */ patternType?: IFill.BuiltInSheetPattern; } interface PatternJSON extends PatternProperties { } } } declare module "fill/index" { export * from "fill/IFill"; } declare module "text/AutoNumberingScheme" { export enum AutoNumberingSchemeType { /** * Lowercase alphabetic character enclosed in parentheses. Example: (a), (b), * (c), ... */ alphaLcParenBoth = 0, /** * Uppercase alphabetic character enclosed in parentheses. Example: (A), (B), * (C), ... */ alphaUcParenBoth = 1, /** * Lowercase alphabetic character followed by a closing parenthesis. Example: * a), b), c), ... */ alphaLcParenRight = 2, /** * Uppercase alphabetic character followed by a closing parenthesis. Example: * A), B), C), ... */ alphaUcParenRight = 3, /** * Lowercase Latin character followed by a period. Example: a., b., c., ... */ alphaLcPeriod = 4, /** * Uppercase Latin character followed by a period. Example: A., B., C., ... */ alphaUcPeriod = 5, /** * Arabic numeral enclosed in parentheses. Example: (1), (2), (3), ... */ arabicParenBoth = 6, /** * Arabic numeral followed by a closing parenthesis. Example: 1), 2), 3), ... */ arabicParenRight = 7, /** * Arabic numeral followed by a period. Example: 1., 2., 3., ... */ arabicPeriod = 8, /** * Arabic numeral. Example: 1, 2, 3, ... */ arabicPlain = 9, /** * Lowercase Roman numeral enclosed in parentheses. Example: (i), (ii), (iii), * ... */ romanLcParenBoth = 10, /** * Uppercase Roman numeral enclosed in parentheses. Example: (I), (II), (III), * ... */ romanUcParenBoth = 11, /** * Lowercase Roman numeral followed by a closing parenthesis. Example: i), ii), * iii), ... */ romanLcParenRight = 12, /** * Uppercase Roman numeral followed by a closing parenthesis. Example: I), II), * III), .... */ romanUcParenRight = 13, /** * Lowercase Roman numeral followed by a period. Example: i., ii., iii., ... */ romanLcPeriod = 14, /** * Uppercase Roman numeral followed by a period. Example: I., II., III., ... */ romanUcPeriod = 15, /** * Double byte circle numbers. */ circleNumDbPlain = 16, /** * Wingdings black circle numbers. */ circleNumWdBlackPlain = 17, /** * Wingdings white circle numbers. */ circleNumWdWhitePlain = 18, /** * Double-byte Arabic numbers with double-byte period. */ arabicDbPeriod = 19, /** * Double-byte Arabic numbers. */ arabicDbPlain = 20, /** * Simplified Chinese with single-byte period. */ ea1ChsPeriod = 21, /** * Simplified Chinese. */ ea1ChsPlain = 22, /** * Traditional Chinese with single-byte period. */ ea1ChtPeriod = 23, /** * Traditional Chinese. */ ea1ChtPlain = 24, /** * Japanese with double-byte period. */ ea1JpnChsDbPeriod = 25, /** * Japanese/Korean. */ ea1JpnKorPlain = 26, /** * Japanese/Korean with single-byte period. */ ea1JpnKorPeriod = 27, /** * Bidi Arabic 1 (AraAlpha) with ANSI minus symbol. */ arabic1Minus = 28, /** * Bidi Arabic 2 (AraAbjad) with ANSI minus symbol. */ arabic2Minus = 29, /** * Bidi Hebrew 2 with ANSI minus symbol. */ hebrew2Minus = 30, /** * Thai alphabetic character followed by a period. */ thaiAlphaPeriod = 31, /** * Thai alphabetic character followed by a closing parenthesis. */ thaiAlphaParenRight = 32, /** * Thai alphabetic character enclosed by parentheses. */ thaiAlphaParenBoth = 33, /** * Thai numeral followed by a period. */ thaiNumPeriod = 34, /** * Thai numeral followed by a closing parenthesis. */ thaiNumParenRight = 35, /** * Thai numeral enclosed in parentheses. */ thaiNumParenBoth = 36, /** * Hindi alphabetic character followed by a period. */ hindiAlphaPeriod = 37, /** * Hindi numeric character followed by a period. */ hindiNumPeriod = 38, /** * Hindi numeric character followed by a closing parenthesis. */ hindiNumParenRight = 39, /** * Hindi alphabetic character followed by a period. */ hindiAlpha1Period = 40 } } declare module "text/Bullet" { import { Bounds } from '@sheetxl/utils'; import { AutoNumberingSchemeType } from "text/AutoNumberingScheme"; export interface IBullet { readonly fontName: string; readonly fontSize: number; readonly autoNumberScheme: AutoNumberingSchemeType; readonly startAt: number; readonly character: string; readonly imageScale: number; readonly imageNaturalWidth: number; readonly imageNaturalHeight: number; readonly bounds?: Bounds; } export class DefaultBullet implements IBullet { private _fontName; private _fontSize; private _autoNumberScheme; private _startAt; private _character; private _imageScale; private _imageNaturalWidth; private _imageNaturalHeight; private _bounds?; get fontName(): string; get fontSize(): number; get autoNumberScheme(): AutoNumberingSchemeType; get startAt(): number; get character(): string; get imageScale(): number; get imageNaturalWidth(): number; get imageNaturalHeight(): number; get bounds(): Bounds; } } declare module "text/TextBoxAlignment" { import { ITextFrame } from "text/ITextFrame"; import { IStyle } from "style/index"; /** * Provided options for aligned text within a bounding box. */ export interface ITextBoxAlignment { /** * Types of horizontal alignment. */ getHorizontal(): ITextFrame.HorizontalAlignment; /** * Sets the horizontal alignment * * @param horizontal The horizontal alignment */ setHorizontal(horizontal: ITextFrame.HorizontalAlignment | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * Types of horizontal alignment. */ getVertical(): ITextFrame.VerticalAlignment; /** * Sets the vertical alignment * * @param vertical The vertical alignment */ setVertical(vertical: ITextFrame.VerticalAlignment | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * An integer value, where an increment of 1 represents 3 spaces. * Indicates the number of spaces (of the normal style font) of indentation for text in a cell. * * @remarks * This is only applied for alignments: left, right, and distributed. */ getIndent(): number; /** * Sets the indentation * * @param indent The indentation */ setIndent(indent: number | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * Indicates additional number of spaces of indentation to adjust for text in a cell. */ getRelativeIndent(): number; /** * Sets the relative indentation * * @param relativeIndent The relative indentation */ setRelativeIndent(relativeIndent: number | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * The behavior for text that does not fit with the cell bounds. * @see * {@link ITextFrame.Overflow} */ getOverflow(): ITextFrame.Overflow; /** * Sets the overflow behavior * * @param overflow The overflow behavior */ setOverflow(overflow: ITextFrame.Overflow | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * Rotation of the text. * @defaultValue 0 */ getRotation(): number; /** * Sets the rotation * * @param rotation The rotation */ setRotation(rotation: number | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * If the text should stack vertically instead of horizontally. */ getStacked(): boolean; /** * Sets the stacked * * @param stacked The stacked */ setStacked(stacked: boolean | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * If the cells justified or distributed alignment should be used on the last line of text. * (This is typical for East Asian alignments but not typical in other contexts.) */ getJustifyLastLine(): boolean; /** * Sets the justified last line * * @param justifyLastLine The justified last line */ setJustifyLastLine(justifyLastLine: boolean | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; /** * The direction the cell is being read. */ getReadingDirection(): ITextFrame.ReadingDirection; /** * Sets the reading direction * * @param readingDirection The reading direction */ setReadingDirection(readingDirection: ITextFrame.ReadingDirection | null, options?: IStyle.UpdateOptions): ITextBoxAlignment; toJSON(): ITextBoxAlignment.JSON; /** * For runtime type checking. */ readonly isITextBoxAlignment: true; } /** * Provided options for aligned text within a bounding box. */ export namespace ITextBoxAlignment { /** * Text alignment rules for when text is placed in a bounding box. * (for example a TableCell or a Shape). */ interface Properties { horizontal?: ITextFrame.HorizontalAlignment; vertical?: ITextFrame.VerticalAlignment; indent?: number; relativeIndent?: number; overflow?: ITextFrame.Overflow; rotation?: number; stacked?: boolean; justifyLastLine?: boolean; readingDirection?: ITextFrame.ReadingDirection; } interface JSON extends Properties { } /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = Partial; /** * Options for updating an ITextBoxAlignment. */ type Update = ITextBoxAlignment | Modifiers | string | null; } } declare module "text/ITextFrame" { import { TextAlign as CSSTextAlign } from 'csstype'; import type { Size, Bounds, Rectangle } from '@sheetxl/utils'; import { TextVisitor } from "text/TextVisitor"; import { ITextLine } from "text/TextLine"; import { ITextParagraph } from "text/TextParagraph"; import { ITextBoxAlignment as _IAlignment } from "text/TextBoxAlignment"; /** * Represents a rectangular container for text and its formatting within a document. * * A TextFrame allows precise control over the positioning, size (width and height), * layout, and appearance of text content. */ export interface ITextFrame { readonly wrapped: boolean; readonly insets: Rectangle; readonly orientation: ITextFrame.Orientation; readonly autoFit: ITextFrame.Autofit; readonly fontScale: number; readonly vertical: boolean; readonly columnCount: number; readonly columnSpacing: number; readonly verticalAlignment: ITextFrame.VerticalAlignment; /** * This is different then center aligned text. */ readonly horizontalCentered: boolean; readonly lineReduction: number; readonly isSpaceFirstLastPara: boolean; /** * Returns the presetTextWarp. * TODO - implement this. */ readonly presetTextWarp: string; readonly paragraphs: ITextParagraph[]; visitParas(visitor: TextVisitor): void; visitLines(visitor: TextVisitor): void; /** * Before using the bounds of a textFrame the layout must be called. * This will then return a a clone of this ITextFrame that can be * placed and rendered. * * @param dimensions will cause the text to wrap. If bounds are not specified or only a dimension then it will not wrap. */ layout(dimensions?: Partial): ITextFrame; /** * This is the bound of a textfield include any whitespace */ readonly bounds: Readonly; /** * This is the bound of a text not include whitespace */ readonly textBounds: Readonly; readonly lines: ITextLine[]; /** * Creates a simple text frame that can be used for rendering and/or measuring. * @param text The text to use * @param allowWrap If `true` then will try to wrap on natural breaks. Defaults the the current settings. */ createTemporaryTextFrame(text: string, allowWrap?: boolean): ITextFrame; } /** * {@inheritDoc ITextFrame} * @see * ### **Interface** * * {@link ITextFrame} */ export namespace ITextFrame { namespace IAlignment { type Properties = _IAlignment.Properties; type JSON = _IAlignment.JSON; /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = _IAlignment.Modifiers; /** * Options for updating an IAlignment. */ type Update = _IAlignment.Update; } type IAlignment = _IAlignment; /** * Represents a tab stop within a text frame or paragraph. */ class TabStop { /** * The position (offset) of the tab stop relative to the left margin of the container, measured in points. */ offset: number; /** * The alignment of text at the tab stop. */ align: ITextFrame.TabStopAlignment; } /** * Horizontal alignment of text within a cell. */ const HorizontalAlignment: { /** * Aligned based on the data value. * Text data is left-aligned. Numbers, dates, and times are right-aligned. Boolean types are centered. */ readonly General: "general"; /** * Aligned to the left. */ readonly Left: "left"; /** * Aligned in the center. */ readonly Center: "center"; /** * Aligned to the right. */ readonly Right: "right"; /** * Aligned to the left and right margins. * Spacing will be inserted between 'words . */ readonly Justify: "justify"; /** * Each 'word' in each line of text inside the cell is evenly distributed * across the width of the cell, with flush right and left margins. * * When there is also an indent value to apply, both the left and right side * of the cell are padded by the indent value. * A 'word' is a set of characters with no space character in them. * Two lines inside a cell are separated by a carriage return. */ readonly Distributed: "distributed"; /** * The horizontal alignment is centered across multiple cells. * The number of cells is determined by the number of consecutive blank cells * that also have an alignment of CenterContinuous. */ readonly CenterContinuous: "centerContinuous"; /** * The value of the cell should be repeated across the entire width of the cell. * If blank cells to the right also have the fill alignment, they are also filled * with the value, using a convention similar to centerContinuous. */ readonly Fill: "fill"; }; type HorizontalAlignment = typeof HorizontalAlignment[keyof typeof HorizontalAlignment]; /** * Specifies the vertical alignment of text within a text frame. */ const VerticalAlignment: { /** * Aligned to the top. */ readonly Top: "top"; /** * Aligned to the center. */ readonly Center: "center"; /** * Aligned to the bottom. */ readonly Bottom: "bottom"; /** * The vertical alignment of lines of text is distributed vertically, * where each line of text inside the cell is evenly distributed across the height of the cell, * with flush top and bottom margins. */ readonly Justify: "justify"; /** * Just like Justify, expect that all lines with a single word are centered and the last line is also distributed. */ readonly Distributed: "distributed"; }; type VerticalAlignment = typeof VerticalAlignment[keyof typeof VerticalAlignment]; /** * Specifies the orientation in which text is displayed. */ const Orientation: { /** * Horizontal text. This is the default. */ readonly Horizontal: "horizontal"; /** * Vertical orientation. * * @remarks * Each line is 90 degrees rotated clockwise, so it goes from top to bottom; each next line is to the left from * the previous one. */ readonly Vertical: "90"; /** * Vertical orientation. * * @remarks * Each line is 270 degrees rotated clockwise, so it goes from bottom to top; each next line is to the right from * the previous one. */ readonly Vertical270: "270"; /** * Determines if all of the text is vertical; ('one letter on top of another'). * * **Not Supported** */ readonly Stacked: "stacked"; }; type Orientation = typeof Orientation[keyof typeof Orientation]; /** * Specifies the reading order of text within a text frame. */ const ReadingDirection: { /** * The reading direction is automatically determined based on the text content. */ readonly Auto: "auto"; /** * The reading direction is from left to right. */ readonly LeftToRight: "ltr"; /** * The reading direction is from right to left. */ readonly RightToLeft: "rtl"; }; type ReadingDirection = typeof ReadingDirection[keyof typeof ReadingDirection]; /** * The behavior of the text when it exceeds the size of the bounding box. */ const Overflow: { /** * Visible means that the text will attempt to be visible on overflow. * It can still be obscured (either z-index, or another blocking element) or fall out of the viewport. */ readonly Visible: "visible"; /** * Wrap text to keep within the left right margins but may overflow vertically. */ readonly Wrap: "wrap"; /** * Note - This is not part of the OOXML spec */ readonly Clip: "clip"; /** * Shrinks text to fit within the bounding area */ readonly Shrink: "shrink"; /** Not OOXML spec - Not support */ readonly Ellipsis: "ellipsis"; }; type Overflow = typeof Overflow[keyof typeof Overflow]; /** * How the text should fit within the bounding area. */ const Autofit: { /** * Specifies that text within the text body should not be auto-fit to the bounding box. * Auto-fitting is when text within a text box is scaled in order to remain inside * the text box. */ readonly None: "none"; /** * Specifies that text within the text body should be normally auto-fit to the bounding box. * AutoFitting is when text within a text box is scaled in order to remain inside the text box. * *

* Example: Consider the situation where a user is building a diagram and needs * to have the text for each shape that they are using stay within the bounds of the shape. * An easy way this might be done is by using NORMAL autofit *

*/ readonly Normal: "normal"; /** * Specifies that a shape should be auto-fit to fully contain the text described within it. * Auto-fitting is when text within a shape is scaled in order to contain all the text inside. * *

* Example: Consider the situation where a user is building a diagram and needs to have * the text for each shape that they are using stay within the bounds of the shape. * An easy way this might be done is by using SHAPE autofit *

*/ readonly Shape: "shape"; }; type Autofit = typeof Autofit[keyof typeof Autofit]; /** * Specifies the alignment of a tab stop within a text frame or paragraph. */ const TabStopAlignment: { /** * The default tab stop alignment, typically left-aligned for left-to-right text and right-aligned for right-to-left text. */ readonly Default: "default"; /** * Aligns text at the tab stop to the left. */ readonly Left: "left"; /** * Aligns text at the tab stop to the right. */ readonly Right: "right"; /** * Centers text at the tab stop. */ readonly Center: "center"; }; type TabStopAlignment = typeof TabStopAlignment[keyof typeof TabStopAlignment]; interface CloneableTextFrame extends ITextFrame { clone(visitor?: TextVisitor): ITextFrame; equals(other: ITextFrame): boolean; } /** * Returns a css equivalent of the horizontal text alignment. */ const toCSSHorizontalTextAlign: (align: ITextFrame.HorizontalAlignment) => CSSTextAlign; } } declare module "text/impl/WordWrapUtils" { export class WordWrapUtils { static NL: string; static DefaultLineSpacing: number; static DefaultTabWidth: number; } } declare module "text/TextParagraph" { import { Bounds } from '@sheetxl/utils'; import { ITextFrame } from "text/ITextFrame"; import { TextVisitor } from "text/TextVisitor"; import { IBullet } from "text/Bullet"; import { ITextRun, PlacedTextRun } from "text/TextRun"; /** * Represents a collection of runs with specific information about white spacing before/after. */ export interface ITextParagraph { /** * This is used if the run doesn't have a font or in the case where there is no run (Empty line) */ readonly defaultFontSize: number; readonly defaultTabSize: number; readonly tabOverrides: ITextFrame.TabStop[]; readonly spacingBefore: number; readonly spacingAfter: number; readonly lineSpacing: number; readonly align: ITextFrame.HorizontalAlignment; readonly endParagraphSize: number; readonly indentLevel: number; readonly leadingIndent: number; readonly hangingIndent: number; readonly rightMargin: number; readonly bullet: IBullet; readonly runs: ITextRun[]; } export interface PlacedTextParagraph extends ITextParagraph { /** * Bounds is not copied during clone. */ readonly bounds?: Bounds; readonly runs: PlacedTextRun[]; } export interface CloneableTextParagraph extends ITextParagraph { clone(visitor?: TextVisitor): ITextParagraph; equals(other: ITextParagraph): boolean; } export class DefaultTextParagraph implements ITextParagraph, PlacedTextParagraph, CloneableTextParagraph { private _private; private _bounds; constructor(overrides: Partial); clone(visitor?: TextVisitor): ITextParagraph; equals(other: ITextParagraph): boolean; get bounds(): Bounds; get defaultFontSize(): number; get defaultTabSize(): number; get tabOverrides(): ITextFrame.TabStop[]; get spacingBefore(): number; get spacingAfter(): number; get lineSpacing(): number; get align(): ITextFrame.HorizontalAlignment; get endParagraphSize(): number; get indentLevel(): number; get leadingIndent(): number; get hangingIndent(): number; get rightMargin(): number; get bullet(): IBullet; get runs(): ITextRun[]; } } declare module "text/TextVisitor" { import { ITextRun } from "text/TextRun"; import { ITextParagraph } from "text/TextParagraph"; import { ITextLine } from "text/TextLine"; import { ITextFrame } from "text/ITextFrame"; export interface TextVisitor { visitTextRun?: (run: ITextRun, index: number, count: number) => Partial | void; visitTextParagraph?: (paragraph: ITextParagraph, index: number, count: number) => Partial | void; visitTextLine?: (line: ITextLine, index: number, count: number) => Partial | void; visitTextFrame?: (frame: ITextFrame) => Partial | void; } } declare module "text/TextRun" { import { Bounds } from '@sheetxl/utils'; import { IText } from "text/IText"; import { TextVisitor } from "text/TextVisitor"; /** * Represents a contiguous span of characters within a text frame that share the same formatting. */ export interface ITextRun { /** * The actual text content of the run. */ readonly text: string; /** * The font name applied to the text run. * If not specified, it inherits the font name from its parent paragraph. */ readonly fontName: string; /** * The font size applied to the text run. * If not specified, it inherits the font size from its parent paragraph. */ readonly fontSize: number; /** * Indicates whether the text is bold. */ readonly bold: boolean; /** * Indicates whether the text is italicized. */ readonly italic: boolean; readonly superSub: boolean; /** * Specifies the additional spacing between characters (in ems). */ readonly letterSpacing: number; /** * Specifies the minimum font size (in points) at which character kerning will be applied. * If omitted, kerning will be applied for all font sizes down to 0 points. */ readonly kerningMin: number; /** * Specifies the capitalization style to be applied to the text during layout and rendering. * This does not affect the actual stored text content. */ readonly smallCaps: IText.SmallCaps; /** * Vertical offset of the text (as a percentage of font height), * shifting it up (positive values) or down (negative values). * This does not affect the line height. */ readonly offset: number; /** * Specifies the strikethrough style applied to the text. */ readonly strikeStyle: IText.StrikeStyle; } export interface PlacedTextRun extends ITextRun { /** * Bounds is not copied during clone. */ readonly bounds?: Bounds; } export interface CloneableTextRun extends ITextRun { clone(visitor?: TextVisitor): ITextRun; equals(other: TextVisitor): boolean; } export class DefaultTextRun implements ITextRun, PlacedTextRun, CloneableTextRun { private _private; private _bounds?; constructor(overrides: Partial, bounds?: Bounds); clone(visitor?: TextVisitor): ITextRun; equals(other: TextVisitor): boolean; get bounds(): Bounds; get text(): string; get fontName(): string; get bold(): boolean; get italic(): boolean; get fontSize(): number; get superSub(): boolean; get letterSpacing(): number; get kerningMin(): number; get smallCaps(): IText.SmallCaps; get offset(): number; get strikeStyle(): IText.StrikeStyle; } } declare module "text/TextLine" { import { Bounds } from '@sheetxl/utils'; import { IBullet } from "text/Bullet"; import { ITextRun } from "text/TextRun"; /** * Represents a single line with an ITextFrame */ export interface ITextLine { readonly bullet: IBullet; readonly runs: ITextRun[]; readonly bounds: Bounds; readonly baseline: number; } /** * A default text line. */ export class DefaultTextLine implements ITextLine { _private: any; constructor(bounds: Bounds, baseline: number, runs: ITextRun[]); get bounds(): any; get baseline(): any; get runs(): any; get bullet(): any; } } declare module "text/IText" { import { ITextLine as _ITextLine } from "text/TextLine"; import { ITextParagraph as _ITextParagraph } from "text/TextParagraph"; import { ITextRun as _ITextRun } from "text/TextRun"; import { IBullet as _IBullet } from "text/Bullet"; /** * Capabilities for working with text. */ export namespace IText { type ITextLine = _ITextLine; type ITextParagraph = _ITextParagraph; type ITextRun = _ITextRun; type IBullet = _IBullet; /** * Specifies capitalization options for text within a text frame. */ const SmallCaps: { /** * Normal capitalization. */ readonly None: "none"; /** * Capitalize every letter but reduce the the size of all but the first letter. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps} */ readonly Small: "small"; /** * Convert all text to uppercase. */ readonly All: "all"; }; type SmallCaps = typeof SmallCaps[keyof typeof SmallCaps]; /** * Indicate how and if a line will be drawing horizontally through the middle of the text. */ const StrikeStyle: { /** * No strike-through */ readonly None: "none"; /** * A single line. */ readonly Single: "single"; /** * A double line. */ readonly Double: "double"; }; type StrikeStyle = typeof StrikeStyle[keyof typeof StrikeStyle]; } } declare module "font/_FontUtils" { import { IFont } from "font/IFont"; export const DefaultMinFontSize: number; export const DefaultMaxFontSize: number; export const DefaultMaxFontPrecision: number; export const DefaultLineHeightMultiplier: number; export const defaultHorizontalPadding: (fontSize: number) => number; export const defaultVerticalPadding: (_fontSize: number) => number; /** * The size to scale a font for super/sub text. * @remarks * **NOT IMPLEMENTED** This should read from the font but is currently hardcoded to `0.6`. * * This will be moved to 'Measurer' */ export const superSubScale: (_fontFamily: string, _fontSize?: number, _verticalAlign?: IFont.VerticalAlignment) => number; /** * The distance in pixels to shift a font for super/sub text. * @remarks * **NOT IMPLEMENTED** This should read from the font but is currently hardcoded to `+1/5 -1/5`. * * This will be moved to 'Measurer' */ export const superSubShift: (fontFamily: string, fontSize?: number, verticalAlign?: IFont.VerticalAlignment) => number; } declare module "font/SimpleFontMeasurer" { import { IFont } from "font/IFont"; export const getInstance: () => IFont.Measurer; export const getDeviceScale: () => number; } declare module "font/FontKitFontMeasurer" { import { IFont } from "font/IFont"; export const setFontFolder: (path: string) => void; /** * TODO - use fs selection to determine: * 1. panose * 2. if bold, italic */ export const FontKitFontMeasurer: IFont.Measurer; export const getInstance: () => IFont.Measurer; export const getDeviceScale: () => number; } declare module "font/IFont" { /** * Namespace for fonts * * {@link IFont} */ export namespace IFont { /** * Specifies the style of the font (normal, italic). */ const Style: { /** * The standard, non-italicized font style. */ readonly Normal: "normal"; /** * The italicized font style. */ readonly Italic: "italic"; }; type Style = typeof Style[keyof typeof Style]; /** * Specifies the font scheme, indicating its role in the document's typography. */ const Scheme: { /** * The primary font used for headings and major text elements. */ readonly Major: "major"; /** * The secondary font used for body text and less prominent elements. */ readonly Minor: "minor"; /** * No specific font scheme is assigned. */ readonly None: "none"; }; type Scheme = typeof Scheme[keyof typeof Scheme]; /** * Specifies the style of underline applied to text. */ const UnderlineStyle: { /** * No underline. */ readonly None: "none"; /** * A double underline. */ readonly Double: "double"; /** * A double underline used in accounting contexts (typically thicker and below the descenders). */ readonly DoubleAccounting: "doubleAccounting"; /** * A single underline. */ readonly Single: "single"; /** * A single underline used in accounting contexts (typically below the descenders). */ readonly SingleAccounting: "singleAccounting"; }; type UnderlineStyle = typeof UnderlineStyle[keyof typeof UnderlineStyle]; /** * Vertical alignment of text within a line. * @see * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align} */ const VerticalAlignment: { /** * Aligns the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned. */ readonly Baseline: "baseline"; /** * Aligns the baseline of the element with the subscript-baseline of its parent. */ readonly Sub: "sub"; /** * Aligns the baseline of the element with the superscript-baseline of its parent. */ readonly Super: "super"; }; type VerticalAlignment = typeof VerticalAlignment[keyof typeof VerticalAlignment]; /** * Advanced text metrics. */ interface ExtendedMetrics extends Partial, Partial { /** * This is the lineHeight and includes the lineGap */ readonly lineHeight: number; } interface Metrics { readonly underlinePosition?: number; readonly underlineThickness?: number; readonly strikePosition?: number; readonly strikeThickness?: number; readonly italicAngle?: number; readonly lineHeight: number; readonly baseline: number; readonly lineGap: number; } interface MetricOptions { isBold?: boolean; isItalic?: boolean; letterSpacing?: number; } interface Measurer { (text: string, size: number, family: string, options?: IFont.MetricOptions): IFont.ExtendedMetrics; } /** * Override the default mechanism for measuring text. * * @param measurer {@link IFont.Measurer} */ const setSharedMeasurer: (measurer: IFont.Measurer) => void; /** * Returns the {@link IFont.Measurer} used for measuring text. * * @see * {@link setSharedMeasurer} */ const getSharedMeasurer: () => IFont.Measurer; /** * Returns scaling to use for the current device. */ const getDeviceScale: () => number; /** * Provides a font-family fallback based on the PANOSE hex string. * * @param hexPanose The PANOSE string. * @returns a font-family fallback. */ const getPanoseFallback: (hexPanose: string) => string; /** * Represents a font face, encapsulating information about a specific typeface. */ interface IFontFace { /** * Serializes the font face information into a JSON-compatible object. * * @returns A plain JavaScript object representing the font face data. */ toJSON(): any; /** * The name of the font face (e.g., 'Arial', 'Times New Roman'). */ getFamily(): string; /** * The pitch (or classification) of the font face (e.g., 'variable', 'fixed'). */ getPitch(): string; /** * The Panose classification string for the font face, providing information about its visual characteristics. * @returns `null` if unable to generate. */ getPanose(): string | null; /** * Returns a string representation of the font face. */ toString(): string; /** * A flag indicating that this object is an `IFont` instance. * Useful for runtime type checking. */ readonly isIFont: true; } /** * Font families supported by all/most browsers/platforms. */ const GenericName: { readonly Serif: "serif"; readonly SanSerif: "sans-serif"; readonly MonoSpace: "monospace"; readonly Cursive: "cursive"; readonly Fantasy: "fantasy"; readonly SystemUI: "system-ui"; readonly UISystem: "ui-system"; readonly UISerif: "ui-serif"; readonly UISanSerif: "ui-sans-serif"; readonly UIMonoSpace: "ui-monospace"; readonly UIRounded: "ui-rounded"; readonly Math: "math"; readonly Emoji: "emoji"; readonly Fangsong: "fangsong"; }; type GenericName = typeof GenericName[keyof typeof GenericName]; } } declare module "font/Font" { import { IFont } from "font/IFont"; /** * read only font face * @hidden */ export class SimpleFontFace implements IFont.IFontFace { _private: any; constructor(input: any); toJSON(): any; /** {@inheritDoc IFont.getFamily} */ getFamily(): string; /** {@inheritDoc IFont.getPitch} */ getPitch(): string; /** {@inheritDoc IFont.getPanose} */ getPanose(): string | undefined; toString(): any; get isIFont(): true; } } declare module "font/IFontCollection" { import { IFont } from "font/IFont"; export interface FontHandle { fontRef: IFont.IFontFace; loaded: boolean; } export function setFontList(fontList: IFont.IFontFace[] | string[]): void; export function getFontList(): readonly FontHandle[]; export interface FindBestMatchOptions { /** * Defaults to false */ bold?: boolean; /** * Defaults to false */ italic?: boolean; /** * A list of font names or generic font family */ fallbacks?: string[]; panose?: string; } /** * Tries to find a font that match the fontName exactly. If this is not found then it will use the fallback * options if provided. If there is no font and no font fallback it will return null. * @param fontName The font name to find * @returns The FontHandle */ export const findBestMatch: (fontName: string, options?: FindBestMatchOptions) => FontHandle; } declare module "font/FontUtils" { /** * A list of font sizes for showing in drop downs. */ export const DefaultFontSizes: readonly number[]; /** * Searches an array of numbers for the next value. */ export const findNextFontSize: (size: number, increase?: boolean, steps?: readonly number[]) => number; } declare module "font/index" { export * as IFontCollection from "font/IFontCollection"; export * from "font/IFont"; export * from "font/Font"; export * as FontUtils from "font/FontUtils"; } declare module "text/richtext/IStyledFont" { import { Properties as CSSProperties } from 'csstype'; import { IColor } from "color/index"; import { IFont } from "font/index"; import { IStyle } from "style/index"; /** * Represents a font with styling color. */ export interface IStyledFont { /** * This can be set as a string using html values such as 'Arial 11pt' but will be resolved to a single font. Fallbacks and fontSize will be * marshalled into their correct property. */ getFamily(): string; /** * @see {@link IStyledFont.getFamily} */ setFamily(family: string | null, options?: IStyle.UpdateOptions): IStyledFont; /** * A list of fonts and their fallbacks. These can also be provided in the fontFamily attribute but will * be normalized to here. */ getFallbacks(): string[]; /** * @see {@link IStyledFont.setFallbacks} */ setFallbacks(fallbacks: string[] | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Font size is either a number in points or a string that can be converted such as '14px', '1.5em'. */ getSize(): number; /** * @see {@link IStyledFont.setSize} */ setSize(size: number | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The weight of the characters. */ getWeight(): number; /** * @see {@link IStyledFont.setWeight} */ setWeight(weight: number | null, options?: IStyle.UpdateOptions): IStyledFont; /** * @default `IFont.Style.Normal` */ getStyle(): IFont.Style; /** * @see {@link IStyledFont.setStyle} */ setStyle(style: IFont.Style | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The text color. * * @remarks * Currently only solid fill is supported but this will be expanded to allow all fill types similar to DrawML. */ getFill(): IColor; /** * @see {@link IStyledFont.setFill} */ setFill(fill: IColor | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Adds or removes additional spacing between the characters. */ getLetterSpacing(): number; /** * @see {@link IStyledFont.setLetterSpacing} */ setLetterSpacing(letterSpacing: number | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Sets the underline style. If true defaults to single. If false or null defaults to none. * * @default `IFont.UnderlineStyle.None` */ getUnderline(): IFont.UnderlineStyle; /** * @see {@link IStyledFont.setUnderline} */ setUnderline(underline: IFont.UnderlineStyle | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The effect draws the text with a line through it. */ getStrike(): boolean; /** * @see {@link IStyledFont.setStrike} */ setStrike(strike: boolean | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Defines the font scheme to use. * @default `IFont.Scheme.Minor` */ getScheme(): IFont.Scheme; /** * @see {@link IStyledFont.setScheme} */ setScheme(scheme: IFont.Scheme | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Returns the vertical alignment of the text within a text line. * * @remarks * If the IFont.VerticalAlignment is superscript or subscript then the font size should also render smaller. */ getVerticalAlignment(): IFont.VerticalAlignment; /** * @see {@link IStyledFont.setVerticalAlignment} */ setVerticalAlignment(verticalAlignment: IFont.VerticalAlignment | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The effect draws a shadow around the text. * * @remarks * Not rendered by Excel or SheetXL. */ getShadow(): boolean; /** * @see {@link IStyledFont.setShadow} */ setShadow(shadow: boolean | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The effect draws the text as an outline. * * @remarks * Not rendered by Excel or SheetXL. */ getOutline(): boolean; /** * @see {@link IStyledFont.setOutline} */ setOutline(outline: boolean | null, options?: IStyle.UpdateOptions): IStyledFont; /** * The effect extends or stretches out the text. * * @remarks * Not rendered by Excel or SheetXL. */ getExtend(): boolean; /** * @see {@link IStyledFont.setExtend} */ setExtend(extend: boolean | null, options?: IStyle.UpdateOptions): IStyledFont; /** * Returns `true` if the font is either a superscript or a subscript. */ isSuperSub(): boolean; /** * Returns the size to scale the font for super/sub text. */ getSuperSubScale(): number; /** * Returns the number of pixels to shift the font for super/sub text. */ getSuperSubShift(): number; /** * Compare against another font to see if they will have the same font measure * This is used to optimize updates by not re-calcing the width/height * * @param other The other style font */ isEqualMeasure(other: IStyledFont): boolean; /** * Returns the font styles as a set of css string that are suitable for css. * * @remarks * Not all fill styles will offer an exact css equivalent. * Additionally due to the nature of css having different properties for the same logic value * (for example color, backgroundColor) */ toCSS(darkMode?: boolean, zoom?: number, ignoreNormal?: boolean): CSSProperties; /** * Serializes to a JSON object. */ toJSON(): IStyledFont.JSON; /** * For runtime type checking. */ readonly isIStyledFont: true; } /** * {@inheritDoc IStyledFont} * @see * ### **Interface** * * {@link IStyledFont} */ export namespace IStyledFont { /** * Represents a font with color. */ interface Properties { family?: string; fallbacks?: string[]; size?: number; weight?: number | string; style?: IFont.Style; fill?: C; letterSpacing?: number; underline?: boolean | IFont.UnderlineStyle | null; strike?: boolean; scheme?: IFont.Scheme; verticalAlign?: IFont.VerticalAlignment; shadow?: boolean; outline?: boolean; extend?: boolean; } /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = Partial>; /** * Options for updating a font. */ type Update = IStyledFont | Modifiers | string | null; interface JSON extends Properties { } } } declare module "text/richtext/index" { export * from "text/richtext/IStyledFont"; } declare module "text/TextUtils" { /** * Will try to find a valid text value from a template by incrementing a last number. * * @param template The string to use for a baseline for generating new text values. * @param isValidName A callback for validating the current text. * @returns A string for the first valid text. */ export const findValidTextValue: (template: string, isValidName: (candidate: string) => boolean, maxIncrement?: number) => string; /** * Capitalizes the first character of a string and optionally lowercases the rest of the string. * * @param str The input string to be processed. * @param lowerCaseRest A boolean flag indicating whether to convert the rest of the string to lowercase. * If `true`, the remaining characters (after the first) will be converted to lowercase. * If `false`, the remaining characters will remain unchanged. * * @returns A new string with the first character capitalized and the rest lowercased if the `lowerCaseRest` flag is `true`. * If the `lowerCaseRest` flag is `false`, only the first character is capitalized, and the rest of the string remains unchanged. * * @example * ``` * capitalize("hello"); // Returns "Hello" * capitalize("hello", true); // Returns "Hello" * capitalize("HELLO", true); // Returns "Hello" * capitalize("123abc", true); // Returns "123abc" * capitalize("", true); // Returns "" * ``` */ export const capitalize: (str: string, lowerCaseRest?: boolean) => string; /** * Extracts the file extension from a file path. * * @param path The file path from which to extract the file extension. * * @returns The file extension in lowercase. Returns an empty string if the path is invalid or has no extension. * * @example * ``` * getFileNameExtension("example.txt"); // Returns "txt" * getFileNameExtension("/path/to/file.jpg"); // Returns "jpg" * getFileNameExtension("no_extension"); // Returns "" * getFileNameExtension(""); // Returns "" * ``` */ export const getFileNameExtension: (path: string) => string; /** * Extracts the base name (file name without extension) from a file path. * * @param path The file path from which to extract the base name. * @param shouldCapitalize A boolean flag indicating whether to capitalize the base name. Defaults to `false`. * * @returns The base name of the file. The base name will be capitalized if `shouldCapitalize` is `true`. * * @example * ``` * getBaseName("example.txt"); // Returns "Example" * getBaseName("/path/to/file.jpg"); // Returns "File" * getBaseName("file_without_extension", false); // Returns "file_without_extension" * getBaseName("", false); // Returns "" * ``` */ export const getBaseName: (path: string, shouldCapitalize?: boolean) => string; /** * Converts a snake_case or kebab-case string to camelCase. * * @param str The snake_case or kebab-case string to convert. * @returns The string converted to camelCase. * * @example * ```ts * snakeToCamel('snake_case_string'); // Returns 'snakeCaseString' * snakeToCamel('kebab-case-string'); // Returns 'kebabCaseString' * ``` */ export const snakeToCamel: (str: string) => string; /** * Converts a camelCase string to snake_case. * * @param str The camelCase string to convert. * @returns The string converted to snake_case. * * @example * ```ts * camelToSnake('camelCaseString'); // Returns 'camel_case_string' * ``` */ export const camelToSnake: (str: string) => string; /** * Trims a string to a specified maximum length and adds an ellipsis (`…`) if the string exceeds the limit. * * @param str The string to trim. * @param maxLength The maximum length of the string before truncation (default is 36). * @returns The truncated string with an ellipsis if it exceeds the specified length. * * @example * ```ts * clampString('This is a long string', 10); // Returns 'This is a …' * ``` */ export const clampString: (str: string, maxLength?: number) => string; /** * Counts the number of decimal places in a numeric string. * * @param input The string representation of a number. * @returns The number of decimal places. Returns 0 if there are no decimal places. * * @example * ```ts * countDecimals('123.456'); // Returns 3 * countDecimals('123'); // Returns 0 * ``` */ export const countDecimals: (input: string) => number; export const DefaultUnQuoteRegEx: RegExp; /** * Checks if a string is enclosed in matching quotes. * * @param str The string to check. * @returns `true` if the string is quoted with matching characters, `false` otherwise. */ export const isQuoted: (str: string) => boolean; /** * Removes the enclosing quotes from a string. * * @param str The string to unquote. * @returns The unquoted string. */ export const unquote: (str: string) => string; /** * Encloses a string in the specified quote character. * * @param str The string to quote. * @param char The quote character to use (default is a single quote `'`). * @returns The quoted string. */ export const quote: (str: string, char?: string) => string; /** * Splits a string by a delimiter, ignoring any quoted sections. * * @param str The string to split. * @param delimiter The delimiter to split by (default is undefined). * @param quote The quote character used to ignore splits inside quoted sections (default is undefined). * @returns An array of strings split by the delimiter, ignoring quoted sections. */ export const splitUnquoted: (str: string, delimiter?: string, quote?: string) => string[]; /** * Validates if a string is a valid HTTP or HTTPS URL. * * @param value The string to check. * @returns `true` if the string is a valid HTTP or HTTPS URL, `false` otherwise. */ export const isValidHttpUrl: (value: string) => boolean; /** * Validates if a string is a valid email. * * @param text The string to check. * @returns `true` if the string is a valid email, `false` otherwise. */ export const isValidEmail: (text: string) => boolean; /** * Converts a number to alphabet. * @param i The number to stringify */ export const numberToAlphabet: (i: number) => string; } declare module "text/index" { export * from "text/IText"; export * from "text/ITextFrame"; export * from "text/richtext/index"; export * from "text/TextBoxAlignment"; export * as TextUtils from "text/TextUtils"; } declare module "border/IBorder" { import { IProperties } from "type/index"; import type { IColor } from "color/index"; import { IStyle } from "style/index"; export namespace IBorder { /** * @remarks * This is a limited implementation of border that matches OOXMl and Excel. * TODO - Review and rationalize with css. * * Excel online breaks weight and styling into two properties but... (I ) * * Excel only supports the enums as they are defined in OOXML. * * @see * {@link https://learn.microsoft.com/en-us/javascript/api/excel/excel.cellborder?view=excel-js-preview#excel-excel-cellborder-style-member} */ const StrokeStyle: { readonly None: "none"; readonly DashDot: "dashDot"; readonly MediumDashDot: "mediumDashDot"; readonly Dotted: "dotted"; readonly Hair: "hair"; readonly Thin: "thin"; readonly Medium: "medium"; readonly Thick: "thick"; readonly MediumDashDotDot: "mediumDashDotDot"; readonly DashDotDot: "dashDotDot"; readonly Dashed: "dashed"; readonly MediumDashed: "mediumDashed"; readonly SlantDashDot: "slantDashDot"; readonly Double: "double"; }; type StrokeStyle = typeof StrokeStyle[keyof typeof StrokeStyle]; const Edge: { readonly Left: "left"; readonly Top: "top"; readonly Right: "right"; readonly Bottom: "bottom"; /** * @remarks * `horizontal` and `vertical` properties are supported for setting values but get converted top/left/bottom/right for individual cells. * These will always be null in the IStyle. */ readonly Horizontal: "horizontal"; /** * @inheritdoc Edge.Horizontal */ readonly Vertical: "vertical"; readonly DiagonalUp: "diagonalUp"; readonly DiagonalDown: "diagonalDown"; }; type Edge = typeof Edge[keyof typeof Edge]; /** * Used for look ups and drop drowns. */ interface Definition { style: StrokeStyle; description: string; width: number; pattern: number[]; } interface IStroke { getStyle(): StrokeStyle; /** * Sets the stroke style. * * @param style The stroke style. */ setStyle(style: IBorder.StrokeStyle | string | null, options?: IStyle.UpdateOptions): IBorder.IStroke; getColor(): IColor; /** * Sets the stroke color. * * @param color The stroke color. */ setColor(color: IColor.Serializable | null, options?: IStyle.UpdateOptions): IBorder.IStroke; /** * Returns all the set properties and their values for the border. */ getProperties(): IBorder.StrokeProperties; /** * Returns a set of CSSStyleDeclaration that approximate the stroke. */ toCSS(): Partial; /** * @returns `true` StrokeStyle is `None`. */ isNone(): boolean; /** * For runtime type checking. */ readonly isIStroke: true; } interface StrokeProperties { style?: IBorder.StrokeStyle; color?: C; } interface StrokeJSON { style?: IBorder.StrokeStyle; color?: string; } type Properties = { [key in IBorder.Edge]?: IBorder.StrokeProperties; }; /** * Modifiers describe a partial list of properties that can be set with values or shorthand strings. */ type Modifiers = Partial; /** * Options for updating a border. */ type Update = IBorder | Modifiers | string | null; /** * JSON representation of a border. */ type JSON = { [key in IBorder.Edge]?: IBorder.StrokeJSON; }; } /** * Provides information for describing a border around a shape. */ export interface IBorder { /** * @returns The left border. */ getLeft(): IBorder.IStroke; /** * Sets the left border. * * @param edge The border edge. */ setLeft(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * @returns The top border. */ getTop(): IBorder.IStroke; /** * Sets the top border. * * @param edge The border edge. */ setTop(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * @returns The right border. */ getRight(): IBorder.IStroke; /** * Sets the right border. * * @param edge The border edge. */ setRight(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * @returns The bottom border. */ getBottom(): IBorder.IStroke; /** * Sets the bottom border. * * @param edge The border edge. */ setBottom(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * @returns The diagonalUp border. */ getDiagonalUp(): IBorder.IStroke; /** * Sets the diagonalUp border. * * @param edge The border edge. */ setDiagonalUp(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * @returns The diagonalDown border. */ getDiagonalDown(): IBorder.IStroke; /** * Sets the diagonalDown border. * * @param edge The border edge. */ setDiagonalDown(edge: IBorder.IStroke | IProperties.ResolvableProperties | string | null, options?: IStyle.UpdateOptions): IBorder; /** * If there are any borders that are not none. */ isEmpty(): boolean; toJSON(): IBorder.JSON; /** * Returns all the set properties and their values for the border. */ getProperties(): IBorder.Properties; /** * List of customizations modifiers for the border. */ /** * For runtime type checking. */ readonly isIBorder: true; } /** * {@inheritDoc IBorder} * @see * ### **Interface** * * {@link IBorder} */ export namespace IBorder { /** * Compare two strokes for logical equality. */ const isEqualStrokes: (a: IBorder.IStroke, b: IBorder.IStroke) => boolean; /** * Returns the opposite border edge. This only works for Left,Right,Top,Bottom * all other edges return themselves. * @param edge The edge. * @returns The opposite edge or the input value. */ const oppositeEdge: (edge: Edge) => Edge; /** * List of Border definitions. This provides an order for display purposes. */ const BuiltInDefinitionsArray: Definition[]; /** * Provides a quick way to access border definitions by StrokeStyle. */ const BuiltInDefinitions: Map; } } declare module "border/index" { export * from "border/IBorder"; } declare module "numFmt/NumberFormatType" { /** * Represents the built-in categorization of a number format, or 'Custom' if the format is not recognized as a built-in type. * * Excel has the following: * @see * {@link https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformats?view=openxml-2.8.1} */ export const Type: { /** * The default format, displays numbers as entered. */ readonly General: "General"; /** * Displays numbers with a thousands separator and two decimal places. */ readonly Number: "Number"; /** * Formats numbers as currency with a currency symbol and two decimal places. */ readonly Currency: "Currency"; /** * Formats numbers as currency, aligning currency symbols and decimal points in a column. */ readonly Accounting: "Accounting"; /** * Displays dates in a short format (e.g., "M/d/yyyy"). */ readonly ShortDate: "Short Date"; /** * Displays dates in a long format (e.g., "dddd, MMMM d, yyyy"). */ readonly LongDate: "Long Date"; /** * Displays dates in a medium format (e.g., "d-mmm-yy"). */ readonly MediumDate: "Medium Date"; /** * Displays times in a short format (e.g., "h:mm AM/PM"). */ readonly ShortTime: "Short Time"; /** * Displays times in a medium format (e.g., "h:mm:ss AM/PM"). */ readonly MediumTime: "Medium Time"; /** * Displays times in a long format (e.g., "h:mm:ss.000 AM/PM"). */ readonly LongTime: "Long Time"; /** * Displays numbers with a thousands separator. */ readonly Comma: "Comma"; /** * Displays numbers as percentages with a percent symbol. */ readonly Percentage: "Percentage"; /** * Displays numbers as fractions. */ readonly Fraction: "Fraction"; /** * Displays numbers in scientific notation. */ readonly Scientific: "Scientific"; /** * Treats the cell content as text, even if it appears to be a number. */ readonly Text: "Text"; /** * A placeholder for special or custom number formats. */ readonly Special: "Special"; /** * Indicates a user-defined or custom number format. */ readonly Custom: "Custom"; }; export type Type = typeof Type[keyof typeof Type]; } declare module "date/date-fns/constants/index" { /** * @module constants * @summary Useful constants * @description * Collection of useful date constants. * * The constants could be imported from `date-fns/constants`: * * ```ts * import { maxTime, minTime } from 'date-fns/constants'; * * function isAllowedTime(time) { * return time <= maxTime && time >= minTime; * } * ``` */ /** * @constant * @name millisecondsInMinute * @summary Milliseconds in 1 minute */ export const millisecondsInMinute = 60000; /** * @constant * @name millisecondsInHour * @summary Milliseconds in 1 hour */ export const millisecondsInHour = 3600000; /** * @constant * @name millisecondsInSecond * @summary Milliseconds in 1 second */ export const millisecondsInSecond = 1000; /** * @constant * @name constructFromSymbol * @summary Symbol enabling Date extensions to inherit properties from the reference date. * * The symbol is used to enable the `constructFrom` function to construct a date * using a reference date and a value. It allows to transfer extra properties * from the reference date to the new date. It's useful for extensions like * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as * a constructor argument. */ export const constructFromSymbol: unique symbol; } declare module "date/date-fns/types" { import { type constructFromSymbol } from "date/date-fns/constants/index"; import type { Locale } from "date/date-fns/locale/types"; export type * from "date/date-fns/locale/types"; /** * The argument type. */ export type DateArg = DateType | number | string; /** * Date extension interface that allows to transfer extra properties from * the reference date to the new date. It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) * that accept a time zone as a constructor argument. */ export interface ConstructableDate extends Date { [constructFromSymbol]: (value: DateArg & {}) => DateType; } /** * The generic date constructor. Replicates the Date constructor. Used to build * generic functions. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). */ export interface GenericDateConstructor { /** * The date constructor. Creates date with the current date and time. * * @returns The date instance */ new (): DateType; /** * The date constructor. Creates date with the passed date, number of * milliseconds or string to parse. * * @param value - The date, number of milliseconds or string to parse * * @returns The date instance */ new (value: DateArg & {}): DateType; /** * The date constructor. Creates date with the passed date values (year, * month, etc.) Note that the month is 0-indexed. * * @param year - The year * @param month - The month. Note that the month is 0-indexed. * @param date - The day of the month * @param hours - The hours * @param minutes - The minutes * @param seconds - The seconds * @param ms - The milliseconds * * @returns The date instance */ new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): DateType; } /** * The duration object. Contains the duration in the units specified by the * object. */ export interface Duration { /** The number of years in the duration */ years?: number; /** The number of months in the duration */ months?: number; /** The number of weeks in the duration */ weeks?: number; /** The number of days in the duration */ days?: number; /** The number of hours in the duration */ hours?: number; /** The number of minutes in the duration */ minutes?: number; /** The number of seconds in the duration */ seconds?: number; } /** * The duration unit type alias. */ export type DurationUnit = keyof Duration; /** * An object that combines two dates to represent the time interval. * * @typeParam StartDate - The start `Date` type. * @typeParam EndDate - The end `Date` type. */ export interface Interval = DateArg, EndType extends DateArg = DateArg> { /** The start of the interval. */ start: StartType; /** The end of the interval. */ end: EndType; } /** * A version of {@link Interval} that has both start and end resolved to Date. */ export type NormalizedInterval = Interval; /** * The era. Can be either 0 (AD - Anno Domini) or 1 (BC - Before Christ). */ export type Era = 0 | 1; /** * The year quarter. Goes from 1 to 4. */ export type Quarter = 1 | 2 | 3 | 4; /** * The day of the week type alias. Unlike the date (the number of days since * the beginning of the month), which begins with 1 and is dynamic (can go up to * 28, 30, or 31), the day starts with 0 and static (always ends at 6). Look at * it as an index in an array where Sunday is the first element and Saturday * is the last. */ export type Day = 0 | 1 | 2 | 3 | 4 | 5 | 6; /** * The month type alias. Goes from 0 to 11, where 0 is January and 11 is * December. */ export type Month = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11; /** * FirstWeekContainsDate is used to determine which week is the first week of * the year, based on what day the January, 1 is in that week. * * The day in that week can only be 1 (Monday) or 4 (Thursday). * * Please see https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system for more information. */ export type FirstWeekContainsDate = 1 | 4; /** * The date values, used to set or get date object values. */ export interface DateValues { /** The year */ year?: number; /** The month */ month?: number; /** The day of the month */ date?: number; /** The hours */ hours?: number; /** The minutes */ minutes?: number; /** The seconds */ seconds?: number; /** The milliseconds */ milliseconds?: number; } /** * The number rounding method. */ export type RoundingMethod = "ceil" | "floor" | "round" | "trunc"; /** * The ISO string format. * * - basic: Minimal number of separators * - extended: With separators added to enhance human readability */ export type ISOStringFormat = "extended" | "basic"; /** * The ISO date representation. Represents which component the string includes, * date, time or both. */ export type ISOStringRepresentation = "complete" | "date" | "time"; /** * The step function options. Used to build function options. */ export interface StepOptions { /** The step to use when iterating */ step?: number; } /** * The week function options. Used to build function options. */ export interface WeekOptions { /** Which day the week starts on. */ weekStartsOn?: Day; } /** * The first week contains date options. Used to build function options. */ export interface FirstWeekContainsDateOptions { /** See {@link FirstWeekContainsDate} for more details. */ firstWeekContainsDate?: FirstWeekContainsDate; } /** * The localized function options. Used to build function options. * * @typeParam LocaleFields - The locale fields used in the relevant function. Defines the minimum set of locale fields that must be provided. */ export interface LocalizedOptions { /** The locale to use in the function. */ locale?: Pick; } /** * The ISO format function options. Used to build function options. */ export interface ISOFormatOptions { /** The format to use: basic with minimal number of separators or extended * with separators added to enhance human readability */ format?: ISOStringFormat; /** The date representation - what component to format: date, time\ * or both (complete) */ representation?: ISOStringRepresentation; } /** * The rounding options. Used to build function options. */ export interface RoundingOptions { /** The rounding method to use */ roundingMethod?: RoundingMethod; } /** * Additional tokens options. Used to build function options. */ export interface AdditionalTokensOptions { /** If true, allows usage of the week-numbering year tokens `YY` and `YYYY`. * See: https://date-fns.org/docs/Unicode-Tokens */ useAdditionalWeekYearTokens?: boolean; /** If true, allows usage of the day of year tokens `D` and `DD`. * See: https://date-fns.org/docs/Unicode-Tokens */ useAdditionalDayOfYearTokens?: boolean; } /** * Nearest minute type. Goes from 1 to 30, where 1 is the nearest minute and 30 * is nearest half an hour. */ export type NearestMinutes = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30; /** * Nearest hour type. Goes from 1 to 12, where 1 is the nearest hour and 12 * is nearest half a day. */ export type NearestHours = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** * The nearest minutes function options. Used to build function options. * * @deprecated Use {@link NearestToUnitOptions} instead. */ export type NearestMinutesOptions = NearestToUnitOptions; /** * The nearest unit function options. Used to build function options. */ export interface NearestToUnitOptions { /** The nearest unit to round to. E.g. for minutes `15` to round to quarter * hours. */ nearestTo?: Unit; } /** * The context options. Used to build function options. */ export interface ContextOptions { /** * The context to use in the function. It allows to normalize the arguments * to a specific date instance, which is useful for extensions like [`TZDate`](https://github.com/date-fns/tz). */ in?: ContextFn | undefined; } /** /** * The context function type. It's used to normalize the input arguments to * a specific date instance, which is useful for extensions like [`TZDate`](https://github.com/date-fns/tz). */ export type ContextFn = (value: DateArg & {}) => DateType; /** * Resolves passed type or array of types. */ export type MaybeArray = Type | Type[]; } declare module "date/date-fns/locale/types" { import type { DateArg, Day, Era, FirstWeekContainsDateOptions, LocalizedOptions, Month, Quarter, WeekOptions } from "date/date-fns/types"; /** * The locale object with all functions and data needed to parse and format * dates. This is what each locale implements and exports. */ export interface Locale { /** The locale code (ISO 639-1 + optional country code) */ code: string; /** The function to format distance */ formatDistance: FormatDistanceFn; /** The function to relative time */ formatRelative: FormatRelativeFn; /** The object with functions used to localize various values */ localize: Localize; /** The object with functions that return localized formats */ formatLong: FormatLong; /** The object with functions used to match and parse various localized values */ match: Match; /** An object with locale options */ options?: LocaleOptions; } /** * The locale options. */ export interface LocaleOptions extends WeekOptions, FirstWeekContainsDateOptions { } /** * The function that takes a token (i.e. halfAMinute) passed by `formatDistance` * or `formatDistanceStrict` and payload, and returns localized distance. * * @param token - The token to localize * @param count - The distance number * @param options - The object with options * * @returns The localized distance in words */ export type FormatDistanceFn = (token: FormatDistanceToken, count: number, options?: FormatDistanceFnOptions) => string; /** * The {@link FormatDistanceFn} function options. */ export interface FormatDistanceFnOptions { /** Add "X ago"/"in X" in the locale language */ addSuffix?: boolean; /** The distance vector. -1 represents past and 1 future. Tells which suffix * to use. */ comparison?: -1 | 0 | 1; } /** * The function used inside the {@link FormatDistanceFn} function, implementing * formatting for a particular token. */ export type FormatDistanceTokenFn = ( /** The distance as number to format */ count: number, /** The object with options */ options?: FormatDistanceFnOptions) => string; /** * The tokens map to string templates used in the format distance function. * It looks like this: * * const formatDistanceLocale: FormatDistanceLocale = { * lessThanXSeconds: 'តិចជាង {{count}} វិនាទី', * xSeconds: '{{count}} វិនាទី', * // ... * } * * @typeParam Template - The property value type. */ export type FormatDistanceLocale