mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Added type def for rtlcss
This commit is contained in:
80
types/rtlcss/index.d.ts
vendored
Normal file
80
types/rtlcss/index.d.ts
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// Type definitions for rtlcss 2.4
|
||||
// Project: http://rtlcss.com
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
export interface MapOptions {
|
||||
scope: string;
|
||||
ignoreCase: boolean;
|
||||
greedy?: boolean;
|
||||
}
|
||||
|
||||
export interface StringMap {
|
||||
name: string;
|
||||
priority: number;
|
||||
exclusive?: boolean;
|
||||
search: string|string[];
|
||||
replace: string|string[];
|
||||
options: MapOptions;
|
||||
}
|
||||
|
||||
export interface ConfigOptions {
|
||||
/**
|
||||
* Applies to CSS rules containing no directional properties,
|
||||
* it will update the selector by applying String Map.
|
||||
*/
|
||||
autoRename: boolean;
|
||||
/**
|
||||
* Ensures autoRename is applied only if pair exists.
|
||||
*/
|
||||
autoRenameStrict: boolean;
|
||||
/**
|
||||
* An object map of disabled plugins directives,
|
||||
* where keys are plugin names and value are object
|
||||
* hash of disabled directives. e.g. {'rtlcss':{'config':true}}.
|
||||
*/
|
||||
blacklist: object;
|
||||
/**
|
||||
* Removes directives comments from output CSS.
|
||||
*/
|
||||
clean: boolean;
|
||||
/**
|
||||
* Fallback value for String Map options.
|
||||
*/
|
||||
greedy: boolean;
|
||||
/**
|
||||
* Applies String Map to URLs. You can also target specific node types using an object literal.
|
||||
* e.g. {'atrule': true, 'decl': false}.
|
||||
*/
|
||||
processUrls: boolean|object;
|
||||
/**
|
||||
* The default array of String Map.
|
||||
*/
|
||||
stringMap: StringMap[];
|
||||
/**
|
||||
* When enabled, flips background-position expressed in length units using calc.
|
||||
*/
|
||||
useCalc: boolean;
|
||||
}
|
||||
|
||||
export interface HookOptions {
|
||||
/**
|
||||
* The function to be called before processing the CSS.
|
||||
*/
|
||||
pre: () => void;
|
||||
/**
|
||||
* The function to be called after processing the CSS.
|
||||
*/
|
||||
post: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RTLCSS instance, process the input and return its result.
|
||||
*/
|
||||
export function process(css: string, options?: object, plugins?: object|string[], hooks?: HookOptions): string;
|
||||
|
||||
/**
|
||||
* Creates a new instance of RTLCSS using the passed configuration object.
|
||||
*/
|
||||
export function configure(config: ConfigOptions): object;
|
||||
27
types/rtlcss/rtlcss-tests.ts
Normal file
27
types/rtlcss/rtlcss-tests.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as rtlcss from "rtlcss";
|
||||
|
||||
rtlcss.process("body { direction:ltr; }");
|
||||
|
||||
const config = {
|
||||
autoRename: false,
|
||||
autoRenameStrict: false,
|
||||
blacklist: {},
|
||||
clean: true,
|
||||
greedy: false,
|
||||
processUrls: false,
|
||||
stringMap: [
|
||||
{
|
||||
name : 'left-right',
|
||||
priority: 100,
|
||||
search : ['left', 'Left', 'LEFT'],
|
||||
replace : ['right', 'Right', 'RIGHT'],
|
||||
options : {
|
||||
scope : '*',
|
||||
ignoreCase : false
|
||||
}
|
||||
}
|
||||
],
|
||||
useCalc: false
|
||||
};
|
||||
|
||||
rtlcss.configure(config);
|
||||
25
types/rtlcss/tsconfig.json
Normal file
25
types/rtlcss/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rtlcss-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/rtlcss/tslint.json
Normal file
3
types/rtlcss/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user