npm.io
0.16.9 • Published 8 months ago

@types/typography

Licence
MIT
Version
0.16.9
Deps
0
Size
6 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/typography

Summary

This package contains type definitions for typography (https://github.com/KyleAMathews/typography.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/typography.

index.d.ts

export interface BaseLine {
    fontSize: string;
    lineHeight: string;
}

export interface VerticalRhythm {
    rhythm: (value: number) => string;
    scale: (value: number) => BaseLine;
    adjustFontSizeTo: (value?: number | string) => object;
    linesForFontSize: (fontSize: number) => number;
    establishBaseline: () => BaseLine;
}

export interface GoogleFont {
    name: string;
    styles: string[];
}

export interface TypographyOptions {
    baseFontSize?: string | undefined;
    baseLineHeight?: number | undefined;
    scaleRatio?: number | undefined;
    googleFonts?: GoogleFont[] | undefined;
    headerFontFamily?: string[] | undefined;
    headerLineHeight?: number | undefined;
    bodyFontFamily?: string[] | undefined;
    headerColor?: string | undefined;
    bodyColor?: string | undefined;
    headerWeight?: number | string | undefined;
    bodyWeight?: number | string | undefined;
    boldWeight?: number | string | undefined;
    blockMarginBottom?: number | undefined;
    includeNormalize?: boolean | undefined;
    overrideStyles?:
        | ((
            VerticalRhythm: VerticalRhythm,
            options: TypographyOptions,
            styles: any,
        ) => object)
        | undefined;
    overrideThemeStyles?:
        | ((
            VerticalRhythm: VerticalRhythm,
            options: TypographyOptions,
            styles: any,
        ) => object)
        | undefined;
    plugins?: any[] | undefined;
}

declare class Typography {
    constructor(opts: TypographyOptions);
    options: TypographyOptions;
    createStyles(): string;
    toJSON(): object;
    injectStyles(): void;
    rhythm: VerticalRhythm["rhythm"];
    scale: VerticalRhythm["scale"];
    adjustFontSizeTo: VerticalRhythm["adjustFontSizeTo"];
    linesForFontSize: VerticalRhythm["linesForFontSize"];
    establishBaseline: VerticalRhythm["establishBaseline"];
}

export default Typography;

Additional Details

  • Last updated: Mon, 01 Dec 2025 2016 GMT
  • Dependencies: none

Credits

These definitions were written by Dominic Fallows.