mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
added definitions for icss-utils (#36052)
This commit is contained in:
parent
576fe4a44d
commit
a6cda8a2df
21
types/icss-utils/icss-utils-tests.ts
Normal file
21
types/icss-utils/icss-utils-tests.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { replaceValueSymbols, replaceSymbols, extractICSS, createICSSRules } from "icss-utils";
|
||||
import postcss = require("postcss");
|
||||
|
||||
const root = postcss.parse("a#css.string { color: red }");
|
||||
|
||||
const replacements = {
|
||||
quick: "slow",
|
||||
lazy: "energetic",
|
||||
};
|
||||
|
||||
const s: string = replaceValueSymbols("The quick brown fox jumps over the lazy dog.", replacements);
|
||||
|
||||
replaceSymbols(root, replacements);
|
||||
|
||||
const { icssImports, icssExports } = extractICSS(root);
|
||||
const s2: string = icssImports.monkey.bagel;
|
||||
const s3: string = icssExports.foo;
|
||||
|
||||
extractICSS(root, false);
|
||||
|
||||
const rules: postcss.Rule[] = createICSSRules(icssImports, icssExports);
|
||||
32
types/icss-utils/index.d.ts
vendored
Normal file
32
types/icss-utils/index.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
// Type definitions for icss-utils 4.1
|
||||
// Project: https://github.com/css-modules/icss-utils#readme
|
||||
// Definitions by: Bob Matcuk <https://github.com/bmatcuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Container, Rule } from "postcss";
|
||||
|
||||
export interface Replacements {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface CSSImports {
|
||||
[key: string]: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface CSSExports {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface ExtractedICSS {
|
||||
icssImports: CSSImports;
|
||||
icssExports: CSSExports;
|
||||
}
|
||||
|
||||
export function replaceValueSymbols(value: string, replacements: Replacements): string;
|
||||
|
||||
export function replaceSymbols(css: Container, replacements: Replacements): void;
|
||||
|
||||
export function extractICSS(css: Container, removeRules?: boolean): ExtractedICSS;
|
||||
|
||||
export function createICSSRules(imports: CSSImports, exports: CSSExports): Rule[];
|
||||
6
types/icss-utils/package.json
Normal file
6
types/icss-utils/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"postcss": "^7.0.0"
|
||||
}
|
||||
}
|
||||
23
types/icss-utils/tsconfig.json
Normal file
23
types/icss-utils/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"icss-utils-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/icss-utils/tslint.json
Normal file
1
types/icss-utils/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user