0.16.7 • Published 6 months ago

@types/typography v0.16.7

Weekly downloads
4,322
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for typography 0.16
// Project: https://github.com/KyleAMathews/typography.js
// Definitions by: Boye <https://github.com/boyeborg>
//                 Krzysztof Żuraw <https://github.com/krzysztofzuraw>
//                 Dominic Fallows <https://github.com/dominicfallows>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2

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: Fri, 02 Jul 2021 19:37:29 GMT
  • Dependencies: none
  • Global values: none

Credits

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