added whole system from ola4doc

This commit is contained in:
Bachir Soussi Chiadmi
2017-12-14 17:06:06 +01:00
parent 9646c74be1
commit 0611418f7a
8725 changed files with 817688 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
import Container from './container';
import * as postcss from './postcss';
export default class AtRule extends Container implements postcss.AtRule {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* Contains information to generate byte-to-byte equal node string as it
* was in origin input.
*/
raws: postcss.AtRuleRaws;
/**
* The identifier that immediately follows the @.
*/
name: string;
/**
* These are the values that follow the at-rule's name, but precede any {}
* block. The spec refers to this area as the at-rule's "prelude".
*/
params: string;
/**
* Represents an at-rule. If it's followed in the CSS by a {} block, this
* node will have a nodes property representing its children.
*/
constructor(defaults?: postcss.AtRuleNewProps);
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): AtRule;
toJSON(): postcss.JsonAtRule;
append(...children: any[]): this;
prepend(...children: any[]): this;
afterName: string;
_params: string;
}
+28
View File
@@ -0,0 +1,28 @@
import * as postcss from './postcss';
import Node from './node';
export default class Comment extends Node implements postcss.Comment {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* The comment's text.
*/
text: string;
/**
* Represents a comment between declarations or statements (rule and at-rules).
* Comments inside selectors, at-rule parameters, or declaration values will
* be stored in the Node#raws properties.
*/
constructor(defaults?: postcss.CommentNewProps);
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): any;
toJSON(): postcss.JsonComment;
left: string;
right: string;
}
+224
View File
@@ -0,0 +1,224 @@
import Comment from './comment';
import * as postcss from './postcss';
import AtRule from './at-rule';
import Node from './node';
import Rule from './rule';
/**
* Containers can store any content. If you write a rule inside a rule,
* PostCSS will parse it.
*/
export default class Container extends Node implements postcss.Container {
private indexes;
private lastEach;
/**
* Contains the container's children.
*/
nodes: Node[];
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): any;
toJSON(): postcss.JsonContainer;
push(child: any): this;
/**
* Iterates through the container's immediate children, calling the
* callback function for each child. If you need to recursively iterate
* through all the container's descendant nodes, use container.walk().
* Unlike the for {} -cycle or Array#forEach() this iterator is safe if you
* are mutating the array of child nodes during iteration.
* @param callback Iterator. Returning false will break iteration. Safe
* if you are mutating the array of child nodes during iteration. PostCSS
* will adjust the current index to match the mutations.
*/
each(callback: (node: Node, index: number) => any): boolean | void;
/**
* Traverses the container's descendant nodes, calling `callback` for each
* node. Like container.each(), this method is safe to use if you are
* mutating arrays during iteration. If you only need to iterate through
* the container's immediate children, use container.each().
* @param callback Iterator.
*/
walk(callback: (node: Node, index: number) => any): boolean | void;
/**
* Traverses the container's descendant nodes, calling `callback` for each
* declaration. Like container.each(), this method is safe to use if you
* are mutating arrays during iteration.
* @param propFilter Filters declarations by property name. Only those
* declarations whose property matches propFilter will be iterated over.
* @param callback Called for each declaration node within the container.
*/
walkDecls(propFilter: string | RegExp, callback?: (decl: postcss.Declaration, index: number) => any): boolean | void;
walkDecls(callback: (decl: postcss.Declaration, index: number) => any): boolean | void;
/**
* Traverses the container's descendant nodes, calling `callback` for each
* rule. Like container.each(), this method is safe to use if you are
* mutating arrays during iteration.
* @param selectorFilter Filters rules by selector. If provided, iteration
* will only happen over rules that have matching names.
* @param callback Iterator called for each rule node within the
* container.
*/
walkRules(selectorFilter: string | RegExp, callback: (atRule: Rule, index: number) => any): boolean | void;
walkRules(callback: (atRule: Rule, index: number) => any): boolean | void;
/**
* Traverses the container's descendant nodes, calling `callback` for each
* at-rule. Like container.each(), this method is safe to use if you are
* mutating arrays during iteration.
* @param nameFilter Filters at-rules by name. If provided, iteration will
* only happen over at-rules that have matching names.
* @param callback Iterator called for each at-rule node within the
* container.
*/
walkAtRules(nameFilter: string | RegExp, callback: (atRule: AtRule, index: number) => any): boolean | void;
walkAtRules(callback: (atRule: AtRule, index: number) => any): boolean | void;
/**
* Traverses the container's descendant nodes, calling `callback` for each
* commennt. Like container.each(), this method is safe to use if you are
* mutating arrays during iteration.
* @param callback Iterator called for each comment node within the container.
*/
walkComments(callback: (comment: Comment, indexed: number) => any): void | boolean;
/**
* Inserts new nodes to the end of the container.
* Because each node class is identifiable by unique properties, use the
* following shortcuts to create nodes in insert methods:
* root.append({ name: '@charset', params: '"UTF-8"' }); // at-rule
* root.append({ selector: 'a' }); // rule
* rule.append({ prop: 'color', value: 'black' }); // declaration
* rule.append({ text: 'Comment' }) // comment
* A string containing the CSS of the new element can also be used. This
* approach is slower than the above shortcuts.
* root.append('a {}');
* root.first.append('color: black; z-index: 1');
* @param nodes New nodes.
* @returns This container for chaining.
*/
append(...nodes: (Node | Object | string)[]): this;
/**
* Inserts new nodes to the beginning of the container.
* Because each node class is identifiable by unique properties, use the
* following shortcuts to create nodes in insert methods:
* root.prepend({ name: 'charset', params: '"UTF-8"' }); // at-rule
* root.prepend({ selector: 'a' }); // rule
* rule.prepend({ prop: 'color', value: 'black' }); // declaration
* rule.prepend({ text: 'Comment' }) // comment
* A string containing the CSS of the new element can also be used. This
* approach is slower than the above shortcuts.
* root.prepend('a {}');
* root.first.prepend('color: black; z-index: 1');
* @param nodes New nodes.
* @returns This container for chaining.
*/
prepend(...nodes: (Node | Object | string)[]): this;
cleanRaws(keepBetween?: boolean): void;
/**
* Insert newNode before oldNode within the container.
* @param oldNode Child or child's index.
* @returns This container for chaining.
*/
insertBefore(oldNode: Node | number, newNode: Node | Object | string): this;
/**
* Insert newNode after oldNode within the container.
* @param oldNode Child or child's index.
* @returns This container for chaining.
*/
insertAfter(oldNode: Node | number, newNode: Node | Object | string): this;
/**
* Removes the container from its parent and cleans the parent property in the
* container and its children.
* @returns This container for chaining.
*/
remove(): any;
/**
* Removes child from the container and clean the parent properties from the
* node and its children.
* @param child Child or child's index.
* @returns This container for chaining.
*/
removeChild(child: Node | number): this;
/**
* Removes all children from the container and cleans their parent
* properties.
* @returns This container for chaining.
*/
removeAll(): this;
/**
* Passes all declaration values within the container that match pattern
* through the callback, replacing those values with the returned result of
* callback. This method is useful if you are using a custom unit or
* function and need to iterate through all values.
* @param pattern Pattern that we need to replace.
* @param options Options to speed up the search.
* @param callbackOrReplaceValue String to replace pattern or callback
* that will return a new value. The callback will receive the same
* arguments as those passed to a function parameter of String#replace.
*/
replaceValues(pattern: string | RegExp, options: {
/**
* Property names. The method will only search for values that match
* regexp within declarations of listed properties.
*/
props?: string[];
/**
* Used to narrow down values and speed up the regexp search. Searching
* every single value with a regexp can be slow. If you pass a fast
* string, PostCSS will first check whether the value contains the fast
* string; and only if it does will PostCSS check that value against
* regexp. For example, instead of just checking for /\d+rem/ on all
* values, set fast: 'rem' to first check whether a value has the rem
* unit, and only if it does perform the regexp check.
*/
fast?: string;
}, callbackOrReplaceValue: string | {
(substring: string, ...args: any[]): string;
}): Container;
replaceValues(pattern: string | RegExp, callbackOrReplaceValue: string | {
(substring: string, ...args: any[]): string;
}): Container;
/**
* Determines whether all child nodes satisfy the specified test.
* @param callback A function that accepts up to three arguments. The
* every method calls the callback function for each node until the
* callback returns false, or until the end of the array.
* @returns True if the callback returns true for all of the container's
* children.
*/
every(callback: (node: Node, index: number, nodes: Node[]) => any, thisArg?: any): boolean;
/**
* Determines whether the specified callback returns true for any child node.
* @param callback A function that accepts up to three arguments. The some
* method calls the callback for each node until the callback returns true,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the
* callback function. If thisArg is omitted, undefined is used as the
* this value.
* @returns True if callback returns true for (at least) one of the
* container's children.
*/
some(callback: (node: Node, index: number, nodes: Node[]) => boolean, thisArg?: any): boolean;
/**
* @param child Child of the current container.
* @returns The child's index within the container's "nodes" array.
*/
index(child: Node | number): number;
/**
* @returns The container's first child.
*/
first: Node;
/**
* @returns The container's last child.
*/
last: Node;
protected normalize(node: Node | string, sample?: Node, type?: string | boolean): Node[];
protected normalize(props: postcss.AtRuleNewProps | postcss.RuleNewProps | postcss.DeclarationNewProps | postcss.CommentNewProps, sample?: Node, type?: string | boolean): Node[];
rebuild(node: Node, parent?: Container): any;
eachInside(callback: any): any;
eachDecl(propFilter: any, callback?: any): any;
eachRule(selectorFilter: any, callback?: any): any;
eachAtRule(nameFilter: any, callback?: any): any;
eachComment(selectorFilter: any, callback?: any): any;
semicolon: boolean;
after: string;
}
+125
View File
@@ -0,0 +1,125 @@
import * as postcss from './postcss';
export default class CssSyntaxError implements postcss.CssSyntaxError, SyntaxError {
/**
* Contains full error text in the GNU error format.
*/
message: string;
/**
* Contains the source line of the error. PostCSS will use the input
* source map to detect the original error location. If you wrote a
* Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you need
* position in PostCSS input (e.g., to debug previous compiler), use
* error.generated.line.
*/
line: number;
/**
* Contains the source column of the error. PostCSS will use the input
* source map to detect the original error location. If you wrote a
* Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you
* need position in PostCSS input (e.g., to debug previous compiler),
* use error.generated.column.
*/
column: number;
/**
* Contains the source code of the broken file. PostCSS will use the
* input source map to detect the original error location. If you wrote
* a Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you
* need position in PostCSS input (e.g., to debug previous compiler),
* use error.generated.source.
*/
source: string;
/**
* If parser's from option is set, contains the absolute path to the
* broken file. PostCSS will use the input source map to detect the
* original error location. If you wrote a Sass file, compiled it
* to CSS and then parsed it with PostCSS, PostCSS will show the
* original position in the Sass file. If you need the position in
* PostCSS input (e.g., to debug previous compiler), use
* error.generated.file.
*/
file: string;
/**
* Contains the PostCSS plugin name if the error didn't come from the
* CSS parser.
*/
plugin: string;
name: string;
/**
* Contains only the error description.
*/
reason: string;
private columnNumber;
private description;
private lineNumber;
private fileName;
input: postcss.InputOrigin;
/**
* The CSS parser throws this error for broken CSS.
*/
constructor(
/**
* Contains full error text in the GNU error format.
*/
message: string,
/**
* Contains the source line of the error. PostCSS will use the input
* source map to detect the original error location. If you wrote a
* Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you need
* position in PostCSS input (e.g., to debug previous compiler), use
* error.generated.line.
*/
line?: number,
/**
* Contains the source column of the error. PostCSS will use the input
* source map to detect the original error location. If you wrote a
* Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you
* need position in PostCSS input (e.g., to debug previous compiler),
* use error.generated.column.
*/
column?: number,
/**
* Contains the source code of the broken file. PostCSS will use the
* input source map to detect the original error location. If you wrote
* a Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file. If you
* need position in PostCSS input (e.g., to debug previous compiler),
* use error.generated.source.
*/
source?: string,
/**
* If parser's from option is set, contains the absolute path to the
* broken file. PostCSS will use the input source map to detect the
* original error location. If you wrote a Sass file, compiled it
* to CSS and then parsed it with PostCSS, PostCSS will show the
* original position in the Sass file. If you need the position in
* PostCSS input (e.g., to debug previous compiler), use
* error.generated.file.
*/
file?: string,
/**
* Contains the PostCSS plugin name if the error didn't come from the
* CSS parser.
*/
plugin?: string);
private setMessage();
/**
* @param color Whether arrow should be colored red by terminal color codes.
* By default, PostCSS will use process.stdout.isTTY and
* process.env.NODE_DISABLE_COLORS.
* @returns A few lines of CSS source that caused the error. If CSS has
* input source map without sourceContent this method will return an empty
* string.
*/
showSourceCode(color?: boolean): string;
/**
*
* @returns Error position, message and source code of broken part.
*/
toString(): string;
generated: postcss.InputOrigin;
}
+42
View File
@@ -0,0 +1,42 @@
import * as postcss from './postcss';
import Node from './node';
export default class Declaration extends Node implements postcss.Declaration {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* Contains information to generate byte-to-byte equal node string as it
* was in origin input.
*/
raws: postcss.DeclarationRaws;
/**
* The declaration's property name.
*/
prop: string;
/**
* The declaration's value. This value will be cleaned of comments. If the
* source value contained comments, those comments will be available in the
* _value.raws property. If you have not changed the value, the result of
* decl.toString() will include the original raws value (comments and all).
*/
value: string;
/**
* True if the declaration has an !important annotation.
*/
important: boolean;
/**
* Represents a CSS declaration.
*/
constructor(defaults?: postcss.DeclarationNewProps);
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): any;
toJSON(): postcss.JsonDeclaration;
_value: string;
_important: string;
}
+46
View File
@@ -0,0 +1,46 @@
import CssSyntaxError from './css-syntax-error';
import PreviousMap from './previous-map';
import LazyResult from './lazy-result';
import * as postcss from './postcss';
import Result from './result';
export default class Input implements postcss.Input {
/**
* The absolute path to the CSS source file defined with the "from" option.
*/
file: string;
/**
* The unique ID of the CSS source. Used if "from" option is not provided
* (because PostCSS does not know the file path).
*/
id: string;
/**
* Represents the input source map passed from a compilation step before
* PostCSS (e.g., from the Sass compiler).
*/
map: PreviousMap;
css: string;
/**
* Represents the source CSS.
*/
constructor(css: string | {
toString(): string;
} | LazyResult | Result, opts?: {
safe?: boolean | any;
from?: string;
});
/**
* The CSS source identifier. Contains input.file if the user set the "from"
* option, or input.id if they did not.
*/
from: string;
error(message: string, line: number, column: number, opts?: {
plugin?: string;
}): CssSyntaxError;
/**
* Reads the input source map.
* @returns A symbol position in the input source (e.g., in a Sass file
* that was compiled to CSS before being passed to PostCSS):
*/
origin(line: number, column: number): postcss.InputOrigin;
private mapResolve(file);
}
+92
View File
@@ -0,0 +1,92 @@
import Processor from './processor';
import * as postcss from './postcss';
import Result from './result';
import Root from './root';
export default class LazyResult implements postcss.LazyResult {
private stringified;
private processed;
private result;
private error;
private plugin;
private processing;
/**
* A promise proxy for the result of PostCSS transformations.
*/
constructor(processor: Processor,
/**
* String with input CSS or any object with toString() method, like a Buffer.
* Optionally, send Result instance and the processor will take the existing
* [Root] parser from it.
*/
css: string | {
toString(): string;
} | LazyResult | Result, opts?: postcss.ProcessOptions);
/**
* @returns A processor used for CSS transformations.
*/
processor: Processor;
/**
* @returns Options from the Processor#process(css, opts) call that produced
* this Result instance.
*/
opts: postcss.ResultOptions;
/**
* Processes input CSS through synchronous plugins and converts Root to a
* CSS string. This property will only work with synchronous plugins. If
* the processor contains any asynchronous plugins it will throw an error.
* In this case, you should use LazyResult#then() instead.
*/
css: string;
/**
* Alias for css property to use when syntaxes generate non-CSS output.
*/
content: string;
/**
* Processes input CSS through synchronous plugins. This property will
* only work with synchronous plugins. If the processor contains any
* asynchronous plugins it will throw an error. In this case, you should
* use LazyResult#then() instead.
*/
map: postcss.ResultMap;
/**
* Processes input CSS through synchronous plugins. This property will only
* work with synchronous plugins. If the processor contains any asynchronous
* plugins it will throw an error. In this case, you should use
* LazyResult#then() instead.
*/
root: Root;
/**
* Processes input CSS through synchronous plugins. This property will only
* work with synchronous plugins. If the processor contains any asynchronous
* plugins it will throw an error. In this case, you should use
* LazyResult#then() instead.
*/
messages: postcss.ResultMessage[];
/**
* Processes input CSS through synchronous plugins and calls Result#warnings().
* This property will only work with synchronous plugins. If the processor
* contains any asynchronous plugins it will throw an error. In this case, you
* You should use LazyResult#then() instead.
*/
warnings(): postcss.ResultMessage[];
/**
* Alias for css property.
*/
toString(): string;
/**
* Processes input CSS through synchronous and asynchronous plugins.
* @param onRejected Called if any plugin throws an error.
*/
then(onFulfilled: (result: Result) => void, onRejected?: (error: Error) => void): Function | any;
/**
* Processes input CSS through synchronous and asynchronous plugins.
* @param onRejected Called if any plugin throws an error.
*/
catch(onRejected: (error: Error) => void): Function | any;
private handleError(error, plugin);
private asyncTick(resolve, reject);
private async();
sync(): Result;
private run(plugin);
stringify(): Result;
}
+17
View File
@@ -0,0 +1,17 @@
/**
* Contains helpers for safely splitting lists of CSS values, preserving
* parentheses and quotes.
*/
declare module List {
/**
* Safely splits space-separated values (such as those for background,
* border-radius and other shorthand properties).
*/
function space(str: string): string[];
/**
* Safely splits comma-separated values (such as those for transition-* and
* background properties).
*/
function comma(str: string): string[];
}
export default List;
+26
View File
@@ -0,0 +1,26 @@
import Root from './root';
export default class MapGenerator {
private stringify;
private root;
private opts;
private mapOpts;
private previousMaps;
private map;
private css;
constructor(stringify: any, root: Root, opts: any);
isMap(): boolean;
previous(): any;
isInline(): any;
isSourcesContent(): any;
clearAnnotation(): void;
setSourcesContent(): void;
applyPrevMaps(): void;
isAnnotation(): any;
addAnnotation(): void;
outputFile(): any;
generateMap(): any[];
relative(file: any): any;
sourcePath(node: any): any;
generateString(): void;
generate(): any[];
}
+160
View File
@@ -0,0 +1,160 @@
import Container from './container';
import CssSyntaxError from './css-syntax-error';
import * as postcss from './postcss';
import Result from './result';
export default class Node implements postcss.Node {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* Unique node ID
*/
id: string;
/**
* Contains information to generate byte-to-byte equal node string as it
* was in origin input.
*/
raws: postcss.NodeRaws;
/**
* Returns the node's parent node.
*/
parent: Container;
/**
* Returns the input source of the node. The property is used in source map
* generation. If you create a node manually (e.g., with postcss.decl() ),
* that node will not have a source property and will be absent from the
* source map. For this reason, the plugin developer should consider cloning
* nodes to create new ones (in which case the new node's source will
* reference the original, cloned node) or setting the source property
* manually.
*/
source: postcss.NodeSource;
constructor(defaults?: Object);
/**
* This method produces very useful error messages. If present, an input
* source map will be used to get the original position of the source, even
* from a previous compilation step (e.g., from Sass compilation).
* @returns The original position of the node in the source, showing line
* and column numbers and also a small excerpt to facilitate debugging.
*/
error(
/**
* Error description.
*/
message: string, options?: postcss.NodeErrorOptions): CssSyntaxError;
/**
* Creates an instance of Warning and adds it to messages. This method is
* provided as a convenience wrapper for Result#warn.
* Note that `opts.node` is automatically passed to Result#warn for you.
* @param result The result that will receive the warning.
* @param text Warning message. It will be used in the `text` property of
* the message object.
* @param opts Properties to assign to the message object.
*/
warn(result: Result, text: string, opts?: postcss.WarningOptions): void;
/**
* Removes the node from its parent and cleans the parent property in the
* node and its children.
* @returns This node for chaining.
*/
remove(): this;
/**
* @returns A CSS string representing the node.
*/
toString(stringifier?: any): string;
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): Node;
/**
* Shortcut to clone the node and insert the resulting cloned node before
* the current node.
* @param overrides New Properties to override in the clone.
* @returns The cloned node.
*/
cloneBefore(overrides?: Object): Node;
/**
* Shortcut to clone the node and insert the resulting cloned node after
* the current node.
* @param overrides New Properties to override in the clone.
* @returns The cloned node.
*/
cloneAfter(overrides?: Object): Node;
/**
* Inserts node(s) before the current node and removes the current node.
* @returns This node for chaining.
*/
replaceWith(...nodes: (Node | Object)[]): this;
/**
* Removes the node from its current parent and inserts it at the end of
* newParent. This will clean the before and after code style properties
* from the node and replace them with the indentation style of newParent.
* It will also clean the between property if newParent is in another Root.
* @param newParent Where the current node will be moved.
* @returns This node for chaining.
*/
moveTo(newParent: Container): this;
/**
* Removes the node from its current parent and inserts it into a new
* parent before otherNode. This will also clean the node's code style
* properties just as it would in node.moveTo(newParent).
* @param otherNode Will be after the current node after moving.
* @returns This node for chaining.
*/
moveBefore(otherNode: Node): this;
/**
* Removes the node from its current parent and inserts it into a new
* parent after otherNode. This will also clean the node's code style
* properties just as it would in node.moveTo(newParent).
* @param otherNode Will be before the current node after moving.
* @returns This node for chaining.
*/
moveAfter(otherNode: Node): this;
/**
* @returns The next child of the node's parent; or, returns undefined if
* the current node is the last child.
*/
next(): Node;
/**
* @returns The previous child of the node's parent; or, returns undefined
* if the current node is the first child.
*/
prev(): Node;
toJSON(): postcss.JsonNode;
/**
* @param prop Name or code style property.
* @param defaultType Name of default value. It can be easily missed if the
* value is the same as prop.
* @returns A code style property value. If the node is missing the code
* style property (because the node was manually built or cloned), PostCSS
* will try to autodetect the code style property by looking at other nodes
* in the tree.
*/
raw(prop: string, defaultType?: string): any;
/**
* @returns The Root instance of the node's tree.
*/
root(): any;
cleanRaws(keepBetween?: boolean): void;
positionInside(index: number): {
line: number;
column: number;
};
positionBy(options: any): {
column: number;
line: number;
};
/**
* Deprecated. Use Node#remove.
*/
removeSelf(): void;
replace(nodes: any): this;
style(prop: string, defaultType?: string): any;
cleanStyles(keepBetween?: boolean): void;
before: string;
between: string;
}
+20
View File
@@ -0,0 +1,20 @@
import LazyResult from './lazy-result';
import * as postcss from './postcss';
import Result from './result';
import Root from './root';
/**
* Parses source CSS.
* @param css The CSS to parse.
* @param options
* @returns {} A new Root node, which contains the source CSS nodes.
*/
declare function parse(css: string | {
toString(): string;
} | LazyResult | Result, options?: {
from?: string;
map?: postcss.SourceMapOptions;
}): Root;
declare module parse {
var parse: postcss.Syntax | postcss.Parse;
}
export default parse;
+37
View File
@@ -0,0 +1,37 @@
import Input from './input';
import Node from './node';
import Root from './root';
export default class Parser {
input: Input;
pos: number;
root: Root;
spaces: string;
semicolon: boolean;
private current;
private tokens;
constructor(input: Input);
tokenize(): void;
loop(): void;
comment(token: any): void;
emptyRule(token: any): void;
word(): void;
rule(tokens: any): void;
decl(tokens: any): void;
atrule(token: any): void;
end(token: any): void;
endFile(): void;
init(node: Node, line?: number, column?: number): void;
raw(node: any, prop: any, tokens: any): void;
spacesFromEnd(tokens: any): string;
spacesFromStart(tokens: any): string;
stringFrom(tokens: any, from: any): string;
colon(tokens: any): number | boolean;
unclosedBracket(bracket: any): void;
unknownWord(start: any): void;
unexpectedClose(token: any): void;
unclosedBlock(): void;
doubleColon(token: any): void;
unnamedAtrule(node: any, token: any): void;
precheckMissedSemicolon(tokens: any): void;
checkMissedSemicolon(tokens: any): void;
}
+1250
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
export default class PreviousMap {
private inline;
annotation: string;
root: string;
private consumerCache;
text: string;
file: string;
constructor(css: any, opts: any);
consumer(): any;
withContent(): boolean;
startWith(string: any, start: any): boolean;
loadAnnotation(css: any): void;
decodeInline(text: any): any;
loadMap(file: any, prev: any): any;
isMap(map: any): boolean;
}
+31
View File
@@ -0,0 +1,31 @@
import LazyResult from './lazy-result';
import * as postcss from './postcss';
import Result from './result';
export default class Processor implements postcss.Processor {
/**
* Contains the current version of PostCSS (e.g., "5.0.19").
*/
version: '5.0.19';
/**
* Contains plugins added to this processor.
*/
plugins: postcss.Plugin<any>[];
constructor(plugins?: (typeof postcss.acceptedPlugin)[]);
/**
* Adds a plugin to be used as a CSS processor. Plugins can also be
* added by passing them as arguments when creating a postcss instance.
*/
use(plugin: typeof postcss.acceptedPlugin): this;
/**
* Parses source CSS. Because some plugins can be asynchronous it doesn't
* make any transformations. Transformations will be applied in LazyResult's
* methods.
* @param css Input CSS or any object with toString() method, like a file
* stream. If a Result instance is passed the processor will take the
* existing Root parser from it.
*/
process(css: string | {
toString(): string;
} | Result, options?: postcss.ProcessOptions): LazyResult;
private normalize(plugins);
}
+75
View File
@@ -0,0 +1,75 @@
import Processor from './processor';
import * as postcss from './postcss';
import Root from './root';
export default class Result implements postcss.Result {
/**
* The Processor instance used for this transformation.
*/
processor: Processor;
/**
* Contains the Root node after all transformations.
*/
root: Root;
/**
* Options from the Processor#process(css, opts) or Root#toResult(opts) call
* that produced this Result instance.
*/
opts: postcss.ResultOptions;
/**
* A CSS string representing this Result's Root instance.
*/
css: string;
/**
* An instance of the SourceMapGenerator class from the source-map library,
* representing changes to the Result's Root instance.
* This property will have a value only if the user does not want an inline
* source map. By default, PostCSS generates inline source maps, written
* directly into the processed CSS. The map property will be empty by default.
* An external source map will be generated — and assigned to map — only if
* the user has set the map.inline option to false, or if PostCSS was passed
* an external input source map.
*/
map: postcss.ResultMap;
/**
* Contains messages from plugins (e.g., warnings or custom messages).
* Add a warning using Result#warn() and get all warnings
* using the Result#warnings() method.
*/
messages: postcss.ResultMessage[];
lastPlugin: postcss.Transformer;
/**
* Provides the result of the PostCSS transformations.
*/
constructor(
/**
* The Processor instance used for this transformation.
*/
processor?: Processor,
/**
* Contains the Root node after all transformations.
*/
root?: Root,
/**
* Options from the Processor#process(css, opts) or Root#toResult(opts) call
* that produced this Result instance.
*/
opts?: postcss.ResultOptions);
/**
* Alias for css property.
*/
toString(): string;
/**
* Creates an instance of Warning and adds it to messages.
* @param message Used in the text property of the message object.
* @param options Properties for Message object.
*/
warn(message: string, options?: postcss.WarningOptions): void;
/**
* @returns Warnings from plugins, filtered from messages.
*/
warnings(): postcss.ResultMessage[];
/**
* Alias for css property to use with syntaxes that generate non-CSS output.
*/
content: string;
}
+54
View File
@@ -0,0 +1,54 @@
import PreviousMap from './previous-map';
import Container from './container';
import * as postcss from './postcss';
import Result from './result';
import Node from './node';
export default class Root extends Container implements postcss.Root {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
rawCache: {
[key: string]: any;
};
/**
* Represents a CSS file and contains all its parsed nodes.
*/
constructor(defaults?: postcss.RootNewProps);
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): Root;
toJSON(): postcss.JsonRoot;
/**
* Removes child from the root node, and the parent properties of node and
* its children.
* @param child Child or child's index.
* @returns This root node for chaining.
*/
removeChild(child: Node | number): this;
protected normalize(node: Node | string, sample: Node, type?: string): Node[];
protected normalize(props: postcss.AtRuleNewProps | postcss.RuleNewProps | postcss.DeclarationNewProps | postcss.CommentNewProps, sample: Node, type?: string): Node[];
/**
* @returns A Result instance representing the root's CSS.
*/
toResult(options?: {
/**
* The path where you'll put the output CSS file. You should always
* set "to" to generate correct source maps.
*/
to?: string;
map?: postcss.SourceMapOptions;
}): Result;
/**
* Deprecated. Use Root#removeChild.
*/
remove(child?: Node | number): Root;
/**
* Deprecated. Use Root#source.input.map.
*/
prevMap(): PreviousMap;
}
+36
View File
@@ -0,0 +1,36 @@
import Container from './container';
import * as postcss from './postcss';
export default class Rule extends Container implements postcss.Rule {
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* Contains information to generate byte-to-byte equal node string as it
* was in origin input.
*/
raws: postcss.RuleRaws;
/**
* The rule's full selector. If there are multiple comma-separated selectors,
* the entire group will be included.
*/
selector: string;
/**
* Represents a CSS rule: a selector followed by a declaration block.
*/
constructor(defaults?: postcss.RuleNewProps);
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): Rule;
toJSON(): postcss.JsonRule;
/**
* @returns An array containing the rule's individual selectors.
* Groups of selectors are split at commas.
*/
selectors: string[];
_selector: string;
}
+31
View File
@@ -0,0 +1,31 @@
import Node from './node';
declare class Stringifier {
builder: Stringifier.Builder;
constructor(builder?: Stringifier.Builder);
stringify(node: Node, semicolon?: boolean): void;
root(node: any): void;
comment(node: any): void;
decl(node: any, semicolon: any): void;
rule(node: any): void;
atrule(node: any, semicolon: any): void;
body(node: any): void;
block(node: any, start: any): void;
raw(node: Node, own: string, detect?: string): any;
rawSemicolon(root: any): any;
rawEmptyBody(root: any): any;
rawIndent(root: any): any;
rawBeforeComment(root: any, node: any): any;
rawBeforeDecl(root: any, node: any): any;
rawBeforeRule(root: any): any;
rawBeforeClose(root: any): any;
rawBeforeOpen(root: any): any;
rawColon(root: any): any;
beforeAfter(node: any, detect: any): any;
rawValue(node: any, prop: any): any;
}
declare module Stringifier {
interface Builder {
(str: string, node?: Node, str2?: string): void;
}
}
export default Stringifier;
+11
View File
@@ -0,0 +1,11 @@
import Stringifier from './stringifier';
import * as postcss from './postcss';
import Node from './node';
/**
* Default function to convert a node tree into a CSS string.
*/
declare function stringify(node: Node, builder: Stringifier.Builder): void;
declare module stringify {
var stringify: postcss.Syntax | postcss.Stringify;
}
export default stringify;
+1
View File
@@ -0,0 +1 @@
export default function tokenize(input: any): any[];
+14
View File
@@ -0,0 +1,14 @@
/**
* Contains helpers for working with vendor prefixes.
*/
declare module Vendor {
/**
* @returns The vendor prefix extracted from the input string.
*/
function prefix(prop: string): string;
/**
* @returns The input string stripped of its vendor prefix.
*/
function unprefixed(prop: string): string;
}
export default Vendor;
+2
View File
@@ -0,0 +1,2 @@
declare var _default: (message: string) => void;
export default _default;
+42
View File
@@ -0,0 +1,42 @@
import * as postcss from './postcss';
import Node from './node';
export default class Warning implements postcss.Warning {
/**
* Contains the warning message.
*/
text: string;
/**
* Returns a string representing the node's type. Possible values are
* root, atrule, rule, decl or comment.
*/
type: string;
/**
* Contains the name of the plugin that created this warning. When you
* call Node#warn(), it will fill this property automatically.
*/
plugin: string;
/**
* The CSS node that caused the warning.
*/
node: Node;
/**
* The line in the input file with this warning's source.
*/
line: number;
/**
* Column in the input file with this warning's source.
*/
column: number;
/**
* Represents a plugin warning. It can be created using Node#warn().
*/
constructor(
/**
* Contains the warning message.
*/
text: string, options?: postcss.WarningOptions);
/**
* @returns Error position, message.
*/
toString(): string;
}