postcss-value-parser

  • Version 4.2.0
  • Published
  • 27.2 kB
  • No dependencies
  • MIT license

Install

npm i postcss-value-parser
yarn add postcss-value-parser
pnpm add postcss-value-parser

Overview

Transforms css values and at-rule params into the tree

Index

Variables

variable postcssValueParser

const postcssValueParser: postcssValueParser.ValueParser;

    Interfaces

    interface AdjacentAwareNode

    interface AdjacentAwareNode {}

      property after

      after: string;
      • The token at the end of the node

      property before

      before: string;
      • The token at the start of the node

      interface BaseNode

      interface BaseNode {}

        property sourceEndIndex

        sourceEndIndex: number;
        • The offset, exclusive, inside the CSS value at which the node ends.

        property sourceIndex

        sourceIndex: number;
        • The offset, inclusive, inside the CSS value at which the node starts.

        property value

        value: string;
        • The node's characteristic value

        interface ClosableNode

        interface ClosableNode {}

          property unclosed

          unclosed?: true;
          • Whether the parsed CSS value ended before the node was properly closed

          interface CommentNode

          interface CommentNode extends BaseNode, ClosableNode {}

            property type

            type: 'comment';

              interface CustomStringifierCallback

              interface CustomStringifierCallback {}

                call signature

                (nodes: Node): string | undefined;
                • Parameter node

                  The node to stringify

                  Returns

                  The serialized CSS representation of the node

                interface Dimension

                interface Dimension {}
                • A CSS dimension, decomposed into its numeric and unit parts

                property number

                number: string;

                  property unit

                  unit: string;

                    interface DivNode

                    interface DivNode extends BaseNode, AdjacentAwareNode {}

                      property type

                      type: 'div';

                        interface FunctionNode

                        interface FunctionNode extends BaseNode, ClosableNode, AdjacentAwareNode {}

                          property nodes

                          nodes: Node[];
                          • Nodes inside the function

                          property type

                          type: 'function';

                            interface ParsedValue

                            interface ParsedValue {}
                            • A wrapper around a parsed CSS value that allows for inspecting and walking nodes

                            property nodes

                            nodes: Node[];
                            • The series of parsed nodes

                            method walk

                            walk: (callback: WalkCallback, bubble?: boolean) => this;
                            • Walk all parsed nodes, applying a callback

                              Parameter callback

                              A visitor callback that will be executed for each node

                              Parameter bubble

                              When set to true, walking will be done inside-out instead of outside-in

                            interface SpaceNode

                            interface SpaceNode extends BaseNode {}

                              property type

                              type: 'space';

                                interface StringNode

                                interface StringNode extends BaseNode, ClosableNode {}

                                  property quote

                                  quote: '"' | "'";
                                  • The quote type delimiting the string

                                  property type

                                  type: 'string';

                                    interface UnicodeRangeNode

                                    interface UnicodeRangeNode extends BaseNode {}

                                      property type

                                      type: 'unicode-range';

                                        interface ValueParser

                                        interface ValueParser {}

                                          method stringify

                                          stringify: (nodes: Node | Node[], custom?: CustomStringifierCallback) => string;
                                          • Serialize a series of nodes into a CSS value

                                            Parameter nodes

                                            The nodes to stringify

                                            Parameter custom

                                            A custom stringifier callback

                                            Returns

                                            The generated CSS value

                                          method unit

                                          unit: (value: string) => Dimension | false;
                                          • Decompose a CSS dimension into its numeric and unit part

                                            Parameter value

                                            The dimension to decompose

                                            Returns

                                            An object representing number and unit part of the dimension or false if the decomposing fails

                                          method walk

                                          walk: (nodes: Node[], callback: WalkCallback, bubble?: boolean) => void;
                                          • Walk a series of nodes, applying a callback

                                            Parameter nodes

                                            The nodes to walk

                                            Parameter callback

                                            A visitor callback that will be executed for each node

                                            Parameter bubble

                                            When set to true, walking will be done inside-out instead of outside-in

                                          construct signature

                                          new (value: string): ParsedValue;
                                          • Parse a CSS value into a series of nodes to operate on

                                            Parameter value

                                            The value to parse

                                          call signature

                                          (value: string): ParsedValue;
                                          • Parse a CSS value into a series of nodes to operate on

                                            Parameter value

                                            The value to parse

                                          interface WalkCallback

                                          interface WalkCallback {}

                                            call signature

                                            (node: Node, index: number, nodes: Node[]): void | boolean;
                                            • Parameter node

                                              The currently visited node

                                              Parameter index

                                              The index of the node in the series of parsed nodes

                                              Parameter nodes

                                              The series of parsed nodes

                                              Returns

                                              Returning false will prevent traversal of descendant nodes (only applies if bubble was set to true in the walk() call)

                                            interface WordNode

                                            interface WordNode extends BaseNode {}

                                              property type

                                              type: 'word';

                                                Type Aliases

                                                type Node

                                                type Node =
                                                | CommentNode
                                                | DivNode
                                                | FunctionNode
                                                | SpaceNode
                                                | StringNode
                                                | UnicodeRangeNode
                                                | WordNode;
                                                • Any node parsed from a CSS value

                                                Package Files (1)

                                                Dependencies (0)

                                                No dependencies.

                                                Dev Dependencies (6)

                                                Peer Dependencies (0)

                                                No peer dependencies.

                                                Badge

                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/postcss-value-parser.

                                                • Markdown
                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/postcss-value-parser)
                                                • HTML
                                                  <a href="https://www.jsdocs.io/package/postcss-value-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>