6.0.4 • Published 6 months ago

@types/css-declaration-sorter v6.0.4

Weekly downloads
86,393
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/css-declaration-sorter

Summary

This package contains type definitions for css-declaration-sorter (https://github.com/Siilwyn/css-declaration-sorter#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/css-declaration-sorter.

index.d.ts

// Type definitions for css-declaration-sorter 6.0
// Project: https://github.com/Siilwyn/css-declaration-sorter#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.7

import { PluginCreator } from 'postcss';

/**
 * A Node.js module and PostCSS plugin to sort CSS, SCSS or Less declarations based on their property names.
 */
declare namespace cssDeclarationSorter {
    /**
     * Default, order in a simple alphabetical manner from a - z.
     */
    type Alphabetical = 'alphabetical';

    /**
     * Order from most important, flow affecting properties, to least important properties.
     * ```
     * 1. Box
     * 2. Border
     * 3. Background
     * 4. Text
     * 5. Other
     * ```
     */
    type SMACSS = 'smacss';

    /**
     * Order properties applying outside the box model, moving inward to intrinsic changes.
     * ```
     * 1. Positioning
     * 2. Visibility
     * 3. Box model
     * 4. Dimensions
     * 5. Text
     * ```
     */
    type ConcentricCSS = 'concentric-css';

    type SortOrder = Alphabetical | SMACSS | ConcentricCSS;

    /**
     * This function receives two declaration names and is expected
     * to return -1, 0 or 1 depending on the wanted order.
     */
    type SortFunction = (aProp: string, bProp: string) => -1 | 0 | 1;

    interface Options {
        /**
         * Provide the name of one of the built-in sort orders or a comparison function that is passed to `Array.sort`.
         * @default 'alphabetical'
         */
        order?: SortOrder | SortFunction | undefined;
        /**
         * To prevent breaking legacy CSS where shorthand declarations override longhand declarations
         * (also taking into account vendor prefixes) this option can enabled.
         * For example `animation-name: some; animation: greeting;` will be kept in this order when `keepOverrides` is `true`.
         */
        keepOverrides?: boolean | undefined;
    }

    type CssDeclarationSorter = PluginCreator<Options>;
}

declare const cssDeclarationSorter: cssDeclarationSorter.CssDeclarationSorter;
export = cssDeclarationSorter;

Additional Details

  • Last updated: Tue, 06 Jul 2021 20:32:33 GMT
  • Dependencies: @types/postcss
  • Global values: none

Credits

These definitions were written by Piotr Błażejewicz.

6.0.3

7 months ago

6.0.2

8 months ago

6.0.4

6 months ago

6.0.1

3 years ago

6.0.0

3 years ago

5.1.0

4 years ago