@lifeart/gxt
Version:
<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">
256 lines (254 loc) • 5.84 kB
TypeScript
import { PdfStyle } from './types';
export type StyleSheetStyles<T extends Record<string, PdfStyle>> = {
[K in keyof T]: PdfStyle;
};
/**
* Create a stylesheet with named styles
* This provides type safety and allows for future optimizations
*
* @example
* const styles = StyleSheet.create({
* container: {
* flexDirection: 'row',
* padding: 10,
* },
* title: {
* fontSize: 24,
* fontWeight: 'bold',
* },
* });
*/
export declare const StyleSheet: {
/**
* Create a stylesheet from an object of style definitions
*/
create<T extends Record<string, PdfStyle>>(styles: T): StyleSheetStyles<T>;
/**
* Flatten an array of styles into a single style object
*/
flatten(styles: (PdfStyle | undefined | null | false)[]): PdfStyle;
/**
* Compose multiple styles together
*/
compose(...styles: (PdfStyle | undefined | null | false)[]): PdfStyle;
/**
* Absolute fill style (fills parent container)
*/
absoluteFill: PdfStyle;
/**
* Absolute fill object (same as absoluteFill but as an object for spreading)
*/
absoluteFillObject: PdfStyle;
};
/**
* Common page sizes in points (72 dpi)
*/
export declare const PageSizes: {
readonly A0: {
readonly width: 2384;
readonly height: 3370;
};
readonly A1: {
readonly width: 1684;
readonly height: 2384;
};
readonly A2: {
readonly width: 1191;
readonly height: 1684;
};
readonly A3: {
readonly width: 842;
readonly height: 1191;
};
readonly A4: {
readonly width: 595;
readonly height: 842;
};
readonly A5: {
readonly width: 420;
readonly height: 595;
};
readonly A6: {
readonly width: 298;
readonly height: 420;
};
readonly A7: {
readonly width: 210;
readonly height: 298;
};
readonly A8: {
readonly width: 148;
readonly height: 210;
};
readonly A9: {
readonly width: 105;
readonly height: 148;
};
readonly A10: {
readonly width: 74;
readonly height: 105;
};
readonly B0: {
readonly width: 2835;
readonly height: 4008;
};
readonly B1: {
readonly width: 2004;
readonly height: 2835;
};
readonly B2: {
readonly width: 1417;
readonly height: 2004;
};
readonly B3: {
readonly width: 1001;
readonly height: 1417;
};
readonly B4: {
readonly width: 709;
readonly height: 1001;
};
readonly B5: {
readonly width: 499;
readonly height: 709;
};
readonly B6: {
readonly width: 354;
readonly height: 499;
};
readonly B7: {
readonly width: 249;
readonly height: 354;
};
readonly B8: {
readonly width: 176;
readonly height: 249;
};
readonly B9: {
readonly width: 125;
readonly height: 176;
};
readonly B10: {
readonly width: 88;
readonly height: 125;
};
readonly C0: {
readonly width: 2599;
readonly height: 3677;
};
readonly C1: {
readonly width: 1837;
readonly height: 2599;
};
readonly C2: {
readonly width: 1298;
readonly height: 1837;
};
readonly C3: {
readonly width: 918;
readonly height: 1298;
};
readonly C4: {
readonly width: 649;
readonly height: 918;
};
readonly C5: {
readonly width: 459;
readonly height: 649;
};
readonly C6: {
readonly width: 323;
readonly height: 459;
};
readonly C7: {
readonly width: 230;
readonly height: 323;
};
readonly C8: {
readonly width: 162;
readonly height: 230;
};
readonly C9: {
readonly width: 113;
readonly height: 162;
};
readonly C10: {
readonly width: 79;
readonly height: 113;
};
readonly LETTER: {
readonly width: 612;
readonly height: 792;
};
readonly LEGAL: {
readonly width: 612;
readonly height: 1008;
};
readonly TABLOID: {
readonly width: 792;
readonly height: 1224;
};
readonly EXECUTIVE: {
readonly width: 522;
readonly height: 756;
};
readonly FOLIO: {
readonly width: 612;
readonly height: 936;
};
readonly RA0: {
readonly width: 2438;
readonly height: 3458;
};
readonly RA1: {
readonly width: 1729;
readonly height: 2438;
};
readonly RA2: {
readonly width: 1219;
readonly height: 1729;
};
readonly RA3: {
readonly width: 865;
readonly height: 1219;
};
readonly RA4: {
readonly width: 610;
readonly height: 865;
};
readonly SRA0: {
readonly width: 2551;
readonly height: 3628;
};
readonly SRA1: {
readonly width: 1814;
readonly height: 2551;
};
readonly SRA2: {
readonly width: 1276;
readonly height: 1814;
};
readonly SRA3: {
readonly width: 907;
readonly height: 1276;
};
readonly SRA4: {
readonly width: 638;
readonly height: 907;
};
};
/**
* Get page dimensions for a given size
*/
export declare function getPageSize(size: keyof typeof PageSizes | {
width: number;
height: number;
} | [number, number], orientation?: 'portrait' | 'landscape'): {
width: number;
height: number;
};
/**
* Parse a CSS unit value to points
* Supports: pt, in, cm, mm, px, %
*/
export declare function parseUnit(value: string | number, containerSize?: number): number;