@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
136 lines • 5.35 kB
TypeScript
import CSS from 'csstype';
import { Bounds } from "@sheetxl/common";
import { AdjustedColor, SchemeColorLookup, IndexedColorLookup, RGBAColor } from "../color";
import { HorizontalAlignment, VerticalAlignment, TextOverflow } from "../text/types";
import { BorderStroke } from '../cell/ICellBorder';
import { GradientFillValues, PatternFillValues, SheetPatternType } from '../cell/IFill';
import { UnderlineStyle } from '../font';
export interface ParsedFont {
family: string;
size?: string;
fallbacks?: string[];
}
export declare const fromMsoRotate: (value: number | string) => number;
export declare const toMsoRotate: (value: number) => number;
export declare const parseFont: (value: string) => ParsedFont;
export declare const toRGB: (adjustColor: AdjustedColor, darkMode?: boolean) => string;
export declare const toHex: (adjustColor: AdjustedColor, darkMode?: boolean) => string;
export declare const toCSSColor: (adjustColor: AdjustedColor, darkMode?: boolean) => string;
export declare const toCSSFontSize: (size: number) => string;
export declare const toCSSHorizontalTextAlign: (align: HorizontalAlignment) => CSS.Property.TextAlign;
export declare const toCSSTextDecoration: (underline: UnderlineStyle | boolean, strike: boolean) => CSS.Property.TextDecoration;
export declare const toCSSTextDecorationStyle: (underline: UnderlineStyle | boolean) => 'solid' | 'double';
export declare const toCSSTextUnderlineStyle: (underline: UnderlineStyle) => string;
export declare const parseCSSTextDecoration: (decoration: string) => {
underline: UnderlineStyle;
strike: boolean;
};
export declare const parseCSSTextUnderlineStyle: (underline: string) => UnderlineStyle;
/**
* Not this does not support super and sub. This are in
* @param align
* @returns
*/
export declare const toCSSVerticalAlign: (align: VerticalAlignment) => string;
export declare const toCSSWhiteSpace: (overflow: TextOverflow) => string;
export declare const toCSSFontFamily: (fontFamily: string, fontFamilyFallbacks: string[]) => string;
export declare const toCSSNumberFormat: (numberFormat: string) => string;
export declare const unicodeToChar: (text: string) => string;
export declare const charToUnicode: (text: string) => string;
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}
*/
export declare enum FontWeightClass {
Thin = "Thin",
Hairline = "Hairline",
ExtraLight = "Extra Light",
UltraLight = "Ultra Light",
Light = "Light",
Normal = "Normal",
Regular = "Regular",
Medium = "Medium",
SemiBold = "Semi Bold",
DemiBold = "Demi Bold",
Bold = "Bold",
ExtraBold = "Extra Bold",
UltraBold = "Ultra Bold",
Black = "Black",
Heavy = "Heavy",
ExtraBlack = "Extra Black",
UltraBlack = "Ultra Black"
}
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}
*/
export declare enum FontWeightNamed {
Lighter = "lighter",
Normal = "normal",
Bold = "bold",
Bolder = "bolder"
}
/**
* Return as numbered weight
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
* @param value
*/
export declare const parseFontWeight: (value: string) => number;
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}
*/
export declare enum FontSizeClass {
XXSmall = "xx-small",
XSmal = "x-small",
Small = "small",
Medium = "medium",
Large = "large",
XLarge = "x-large",
XXLarge = "xx-large",
XXXLarge = "xxx-large",
Smaller = "smaller",
Larger = "larger",
Math = "math"
}
export declare const parseFontSize: (value: string, normalSize?: number, defaultUnit?: string) => number | null;
/**
* looks for a color and then a support pattern stye
* @param value
* @param schemeLookup
* @param indexedColorLookup
* @param last
* @returns
*/
export declare const parsePattern: (value: string, schemeLookup?: SchemeColorLookup, indexedColorLookup?: IndexedColorLookup, last?: RGBAColor) => Partial<PatternFillValues>;
export declare const toCSSGradient: (gradientFill: GradientFillValues, darkMode?: boolean, _bounds?: Bounds) => string;
export declare const toCSSPattern: (patternType: SheetPatternType) => string;
export declare const toCSSBorderStroke: (stroke: BorderStroke) => string;
export declare const parseBorderStroke: (value: string, schemeLookup?: SchemeColorLookup, indexedColorLookup?: IndexedColorLookup, last?: RGBAColor) => BorderStroke;
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/text-align}
*/
export declare enum TextAlignClass {
Start = "start",
End = "end",
Left = "left",
Right = "right",
Center = "center",
Justify = "justify",
JustifyAll = "justify-all",
MatchParent = "match-parent"
}
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align}
*/
export declare enum VerticalAlignClass {
Baseline = "baseline",
Top = "top",
Middle = "middle",
Bottom = "bottom",
Sub = "sub",
Super = "super",
TextTop = "text-top",
Justify = "justify",// Excel seems to be copying 121?
Distributed = "distributed"
}
export declare const parseCSSTextAlign: (value: string) => HorizontalAlignment;
export declare const parseCSSVerticalAlign: (value: string) => VerticalAlignment;
//# sourceMappingURL=CSSUtils.d.ts.map