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
Interfaces
Type Aliases
Variables
variable postcssValueParser
const postcssValueParser: postcssValueParser.ValueParser;
Interfaces
interface AdjacentAwareNode
interface AdjacentAwareNode {}
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
interface FunctionNode
interface FunctionNode extends BaseNode, ClosableNode, AdjacentAwareNode {}
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 StringNode
interface StringNode extends BaseNode, ClosableNode {}
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
andunit
part of the dimension orfalse
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 ifbubble
was set totrue
in thewalk()
call)
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 oneto 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[](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>
- Updated .
Package analyzed in 1161 ms. - Missing or incorrect documentation? Open an issue for this package.