mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-24 05:47:44 +08:00
fix lint etc errors
This commit is contained in:
89
types/jotform-css.js/index.d.ts
vendored
89
types/jotform-css.js/index.d.ts
vendored
@@ -1,17 +1,17 @@
|
||||
// Type definitions for jotform-css.js v1.0.1
|
||||
// Type definitions for jotform-css.js 1.0
|
||||
// Project: https://github.com/jotform/css.js
|
||||
// Definitions by: Peter van der Woude <https://github.com/pandawood>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare global {
|
||||
const cssjs: CssJsConstructor
|
||||
const cssjs: CssJsConstructor;
|
||||
}
|
||||
|
||||
export interface CssJsConstructor {
|
||||
new (): CssJs;
|
||||
}
|
||||
|
||||
export const cssjs : CssJsConstructor;
|
||||
export const cssjs: CssJsConstructor;
|
||||
export default cssjs;
|
||||
|
||||
export interface CssJs {
|
||||
@@ -19,107 +19,86 @@ export interface CssJs {
|
||||
* Parses given css string, and returns css object
|
||||
* keys as selectors and values are css rules
|
||||
* eliminates all css comments before parsing
|
||||
* @param {string} css string to be parsed
|
||||
* @returns {CssJs} css object
|
||||
* @param css string to be parsed
|
||||
* @returns css object
|
||||
*/
|
||||
parseCSS(css: string): CssJs
|
||||
parseCSS(css: string): CssJs;
|
||||
|
||||
/**
|
||||
* parses given string containing css directives
|
||||
* @param {string} rules, css directive string eg color:white; font-size:18px;
|
||||
* @returns {any[]} an array of objects containing ruleName:ruleValue pairs
|
||||
* @param rules, css directive string eg color:white; font-size:18px;
|
||||
* @returns an array of objects containing ruleName:ruleValue pairs
|
||||
*/
|
||||
parseRules(rules: string): any[]
|
||||
parseRules(rules: string): any[];
|
||||
|
||||
/**
|
||||
* returns the rule having given directive
|
||||
* @param {string} rules
|
||||
* @param {string} directive
|
||||
* @param {string} value
|
||||
*/
|
||||
findCorrespondingRule(rules: string, directive: string, value?: string): string | boolean
|
||||
findCorrespondingRule(rules: string, directive: string, value?: string): string | boolean;
|
||||
|
||||
/**
|
||||
* Finds styles that have given selector, compress them and returns them
|
||||
* @param cssObject
|
||||
* @param {string} selector
|
||||
* @param {boolean} contains
|
||||
*/
|
||||
findBySelector(cssObject: CssJs, selector: string, contains?: boolean) : CssJs
|
||||
findBySelector(cssObject: CssJs, selector: string, contains?: boolean): CssJs;
|
||||
|
||||
/**
|
||||
* deletes cssObjects having given selector, and returns new array
|
||||
* @param {CssJs} cssObject
|
||||
* @param {string} selector
|
||||
* @returns {CssJs}
|
||||
*/
|
||||
deleteBySelector(cssObject: CssJs, selector: string): CssJs
|
||||
deleteBySelector(cssObject: CssJs, selector: string): CssJs;
|
||||
|
||||
/**
|
||||
* Compresses given cssObjectArray and tries to minimize selector redundence
|
||||
* @param {CssJs} cssObject
|
||||
* @returns {CssJs}
|
||||
*/
|
||||
compressCSS(cssObject: CssJs): CssJs
|
||||
compressCSS(cssObject: CssJs): CssJs;
|
||||
|
||||
/**
|
||||
* @param {CssJs} css1
|
||||
* @param {CssJs} css2
|
||||
* @returns {boolean} diff css object contains changed values in css1 in regards to css2, false if same
|
||||
* @returns diff css object contains changed values in css1 in regards to css2, false if same
|
||||
*/
|
||||
cssDiff(css1: CssJs, css2: CssJs): boolean
|
||||
cssDiff(css1: CssJs, css2: CssJs): boolean;
|
||||
|
||||
/**
|
||||
* @param {CssJs} cssObject target css object array
|
||||
* @param {CssJs} newArray source array that will be pushed into cssObject parameter
|
||||
* @param {boolean} reverse [optional], if given true, first parameter will be traversed on reversed order
|
||||
effectively giving priority to the styles in newArray
|
||||
* @param cssObject target css object array
|
||||
* @param newArray source array that will be pushed into cssObject parameter
|
||||
* @param reverse [optional], if given true, first parameter will be traversed on reversed order
|
||||
* effectively giving priority to the styles in newArray
|
||||
*/
|
||||
intelligentMerge(cssObject: CssJs, newArray: CssJs, reverse?: boolean) : void
|
||||
intelligentMerge(cssObject: CssJs, newArray: CssJs, reverse?: boolean): void;
|
||||
|
||||
/**
|
||||
* inserts new css objects into a bigger css object with same selectors grouped together
|
||||
* @param {CssJs} cssObject array of bigger css object to be pushed into
|
||||
* @param {CssJs} minimalObject single css object
|
||||
* @param {boolean} reverse reverse [optional] default is false, if given, cssObject will be reversly traversed
|
||||
resulting more priority in minimalObject's styles
|
||||
* @param cssObject array of bigger css object to be pushed into
|
||||
* @param minimalObject single css object
|
||||
* @param reverse reverse [optional] default is false, if given, cssObject will be reversly traversed
|
||||
* resulting more priority in minimalObject's styles
|
||||
*/
|
||||
intelligentCSSPush(cssObject: CssJs, minimalObject: CssJs, reverse?: boolean) : void
|
||||
intelligentCSSPush(cssObject: CssJs, minimalObject: CssJs, reverse?: boolean): void;
|
||||
|
||||
/**
|
||||
* Filter outs rule objects whose type param equal to DELETED
|
||||
* @param {string} rules array of rules
|
||||
* @param rules array of rules
|
||||
*/
|
||||
compactRules(rules: string[]): string[]
|
||||
compactRules(rules: string[]): string[];
|
||||
|
||||
/**
|
||||
* Computes string for ace editor using this.css or given cssBase optional parameter
|
||||
* @param {CssJs} parsedCss
|
||||
* @param depth
|
||||
* @returns {string}
|
||||
*/
|
||||
getCSSForEditor(parsedCss: CssJs, depth?: number): string
|
||||
getCSSForEditor(parsedCss: CssJs, depth?: number): string;
|
||||
|
||||
/**
|
||||
* Given rules array, returns visually formatted css string to be used inside editor
|
||||
* @param {string} rules
|
||||
* @param {null} depth
|
||||
* @returns {string}
|
||||
*/
|
||||
getCSSOfRules(rules: string, depth?: null): string
|
||||
getCSSOfRules(rules: string, depth?: null): string;
|
||||
|
||||
/**
|
||||
* Given css string or objectArray, parses it and then for every selector,
|
||||
* prepends this.cssPreviewNamespace to prevent css collision issues
|
||||
* @param {CssJs} parsedCss
|
||||
* @param {string} prefix
|
||||
* @returns {CssJs} object in which this css prepended
|
||||
* @returns object in which this css prepended
|
||||
*/
|
||||
applyNamespacing(parsedCss: CssJs | string, prefix: string): CssJs
|
||||
applyNamespacing(parsedCss: CssJs | string, prefix: string): CssJs;
|
||||
|
||||
/**
|
||||
* @param {string} css the original css string to be stripped out of comments
|
||||
* @returns {string} cleaned CSS containing no css comments
|
||||
* @param css the original css string to be stripped out of comments
|
||||
* @returns cleaned CSS containing no css comments
|
||||
*/
|
||||
stripComments(css: string): string
|
||||
stripComments(css: string): string;
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// DefinitelyTyped scripts are forcing me to have this, I don't need or want this file
|
||||
function addNamespace2(cssString: string): string {
|
||||
const parser = new cssjs();
|
||||
const parsed = parser.applyNamespacing(cssString, "#id1");
|
||||
return parser.getCSSForEditor(parsed);
|
||||
}
|
||||
@@ -18,8 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jotform-css.js-tests.ts",
|
||||
"jotform-css.js-global-tests.ts",
|
||||
"jotform-css.js-module-tests.ts"
|
||||
"test/jotform-css.js-global-tests.ts",
|
||||
"test/jotform-css.js-module-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user