@types/typography
TypeScript icon, indicating that this package has built-in type declarations

0.16.7 • Public • Published

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: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Boye, Krzysztof Żuraw, and Dominic Fallows.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @types/typography

Weekly Downloads

2,666

Version

0.16.7

License

MIT

Unpacked Size

6.8 kB

Total Files

5

Last publish

Collaborators

  • types