css-typed-vars 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -5
- package/dist/chunk-6YWE4A6S.js +691 -0
- package/dist/chunk-HBUSLYYB.js +127 -0
- package/dist/chunk-PLO2JWR7.js +88 -0
- package/dist/cli.cjs +480 -57
- package/dist/cli.js +51 -9
- package/dist/esbuild.cjs +433 -60
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +2 -2
- package/dist/generator-C1iVNsry.d.cts +49 -0
- package/dist/generator-C1iVNsry.d.ts +49 -0
- package/dist/index.cjs +452 -47
- package/dist/index.d.cts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +14 -2
- package/dist/rollup.cjs +433 -60
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/unplugin.cjs +433 -60
- package/dist/unplugin.d.cts +17 -1
- package/dist/unplugin.d.ts +17 -1
- package/dist/unplugin.js +2 -2
- package/dist/vite.cjs +433 -60
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +433 -60
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +6 -2
- package/dist/chunk-H3T6RMQQ.js +0 -51
- package/dist/chunk-JDZAH2YQ.js +0 -320
- package/dist/chunk-YBZGHG2G.js +0 -91
- package/dist/generator-t6h8Ic7V.d.cts +0 -6
- package/dist/generator-t6h8Ic7V.d.ts +0 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
import { N as NamingConvention } from './generator-
|
|
2
|
-
export { g as generateCode, a as generateDeclaration, b as generateJs } from './generator-
|
|
3
|
-
|
|
4
|
-
declare function parseVarNames(css: string, selectors?: string[]): string[];
|
|
5
|
-
declare function parseVarDeclarations(css: string, selectors?: string[]): Map<string, string>;
|
|
1
|
+
import { P as PropertyRule, N as NamingConvention } from './generator-C1iVNsry.cjs';
|
|
2
|
+
export { G as GeneratorOptions, T as ThemedDeclarations, g as generateCode, a as generateDeclaration, b as generateJs, c as generateTokens, p as parsePropertyRules, d as parseThemedDeclarations, e as parseVarDeclarations, f as parseVarNames } from './generator-C1iVNsry.cjs';
|
|
6
3
|
|
|
4
|
+
interface ScannedCss {
|
|
5
|
+
declarations: Map<string, string>;
|
|
6
|
+
properties: Map<string, PropertyRule>;
|
|
7
|
+
/** Per theme name (from the `themes` option), the values declared for it. Empty without `themes`. */
|
|
8
|
+
themes: Map<string, Map<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
declare function scanCss(patterns: string | string[], exclude?: string | string[], selectors?: string[], themes?: Record<string, string>): Promise<ScannedCss>;
|
|
7
11
|
declare function scanVarDeclarations(patterns: string | string[], exclude?: string | string[], selectors?: string[]): Promise<Map<string, string>>;
|
|
8
12
|
declare function scanVarNames(patterns: string | string[], exclude?: string | string[], selectors?: string[]): Promise<string[]>;
|
|
13
|
+
declare function scanUsedKeys(patterns: string | string[], exclude?: string | string[]): Promise<Set<string>>;
|
|
9
14
|
|
|
10
15
|
interface GenerateOptions {
|
|
11
16
|
input: string | string[];
|
|
17
|
+
/** `.ts`, `.js`/`.mjs`/`.cjs` (plus a `.d.ts`), or `.json` for a W3C design tokens (DTCG) file. */
|
|
12
18
|
output: string;
|
|
13
19
|
exclude?: string | string[];
|
|
14
20
|
prefix?: string;
|
|
15
21
|
naming?: NamingConvention;
|
|
16
22
|
selectors?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Theme name -> selector (`'[data-theme="dark"]'`) or `@media` prelude
|
|
25
|
+
* (`'@media (prefers-color-scheme: dark)'`). Each theme's values are emitted as
|
|
26
|
+
* `@theme <name> <value>` JSDoc tags, and kept out of the default value.
|
|
27
|
+
*/
|
|
28
|
+
themes?: Record<string, string>;
|
|
29
|
+
group?: boolean;
|
|
30
|
+
/** Prune generated vars with no detected `cssVars.<key>` (or `cssVars.<group>.<key>`) usage. Requires `usage`. */
|
|
31
|
+
prune?: boolean;
|
|
32
|
+
/** Glob(s) of source files to scan for `cssVars` usage. Required when `prune` is true, or when calling `findUnusedVars`. */
|
|
33
|
+
usage?: string | string[];
|
|
34
|
+
usageExclude?: string | string[];
|
|
35
|
+
/** Also emit the `CssVarRef` type and `getCssVar`/`setCssVar` runtime helpers. */
|
|
36
|
+
helpers?: boolean;
|
|
17
37
|
}
|
|
38
|
+
declare function findUnusedVars(options: Pick<GenerateOptions, 'input' | 'exclude' | 'selectors' | 'themes' | 'prefix' | 'naming' | 'group' | 'usage' | 'usageExclude'>): Promise<string[]>;
|
|
18
39
|
declare function generate(options: GenerateOptions): Promise<void>;
|
|
19
40
|
declare function checkGenerated(options: GenerateOptions): Promise<boolean>;
|
|
20
41
|
|
|
21
|
-
export { type GenerateOptions, NamingConvention, checkGenerated, generate,
|
|
42
|
+
export { type GenerateOptions, NamingConvention, PropertyRule, checkGenerated, findUnusedVars, generate, scanCss, scanUsedKeys, scanVarDeclarations, scanVarNames };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
import { N as NamingConvention } from './generator-
|
|
2
|
-
export { g as generateCode, a as generateDeclaration, b as generateJs } from './generator-
|
|
3
|
-
|
|
4
|
-
declare function parseVarNames(css: string, selectors?: string[]): string[];
|
|
5
|
-
declare function parseVarDeclarations(css: string, selectors?: string[]): Map<string, string>;
|
|
1
|
+
import { P as PropertyRule, N as NamingConvention } from './generator-C1iVNsry.js';
|
|
2
|
+
export { G as GeneratorOptions, T as ThemedDeclarations, g as generateCode, a as generateDeclaration, b as generateJs, c as generateTokens, p as parsePropertyRules, d as parseThemedDeclarations, e as parseVarDeclarations, f as parseVarNames } from './generator-C1iVNsry.js';
|
|
6
3
|
|
|
4
|
+
interface ScannedCss {
|
|
5
|
+
declarations: Map<string, string>;
|
|
6
|
+
properties: Map<string, PropertyRule>;
|
|
7
|
+
/** Per theme name (from the `themes` option), the values declared for it. Empty without `themes`. */
|
|
8
|
+
themes: Map<string, Map<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
declare function scanCss(patterns: string | string[], exclude?: string | string[], selectors?: string[], themes?: Record<string, string>): Promise<ScannedCss>;
|
|
7
11
|
declare function scanVarDeclarations(patterns: string | string[], exclude?: string | string[], selectors?: string[]): Promise<Map<string, string>>;
|
|
8
12
|
declare function scanVarNames(patterns: string | string[], exclude?: string | string[], selectors?: string[]): Promise<string[]>;
|
|
13
|
+
declare function scanUsedKeys(patterns: string | string[], exclude?: string | string[]): Promise<Set<string>>;
|
|
9
14
|
|
|
10
15
|
interface GenerateOptions {
|
|
11
16
|
input: string | string[];
|
|
17
|
+
/** `.ts`, `.js`/`.mjs`/`.cjs` (plus a `.d.ts`), or `.json` for a W3C design tokens (DTCG) file. */
|
|
12
18
|
output: string;
|
|
13
19
|
exclude?: string | string[];
|
|
14
20
|
prefix?: string;
|
|
15
21
|
naming?: NamingConvention;
|
|
16
22
|
selectors?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Theme name -> selector (`'[data-theme="dark"]'`) or `@media` prelude
|
|
25
|
+
* (`'@media (prefers-color-scheme: dark)'`). Each theme's values are emitted as
|
|
26
|
+
* `@theme <name> <value>` JSDoc tags, and kept out of the default value.
|
|
27
|
+
*/
|
|
28
|
+
themes?: Record<string, string>;
|
|
29
|
+
group?: boolean;
|
|
30
|
+
/** Prune generated vars with no detected `cssVars.<key>` (or `cssVars.<group>.<key>`) usage. Requires `usage`. */
|
|
31
|
+
prune?: boolean;
|
|
32
|
+
/** Glob(s) of source files to scan for `cssVars` usage. Required when `prune` is true, or when calling `findUnusedVars`. */
|
|
33
|
+
usage?: string | string[];
|
|
34
|
+
usageExclude?: string | string[];
|
|
35
|
+
/** Also emit the `CssVarRef` type and `getCssVar`/`setCssVar` runtime helpers. */
|
|
36
|
+
helpers?: boolean;
|
|
17
37
|
}
|
|
38
|
+
declare function findUnusedVars(options: Pick<GenerateOptions, 'input' | 'exclude' | 'selectors' | 'themes' | 'prefix' | 'naming' | 'group' | 'usage' | 'usageExclude'>): Promise<string[]>;
|
|
18
39
|
declare function generate(options: GenerateOptions): Promise<void>;
|
|
19
40
|
declare function checkGenerated(options: GenerateOptions): Promise<boolean>;
|
|
20
41
|
|
|
21
|
-
export { type GenerateOptions, NamingConvention, checkGenerated, generate,
|
|
42
|
+
export { type GenerateOptions, NamingConvention, PropertyRule, checkGenerated, findUnusedVars, generate, scanCss, scanUsedKeys, scanVarDeclarations, scanVarNames };
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checkGenerated,
|
|
3
|
+
findUnusedVars,
|
|
3
4
|
generate
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PLO2JWR7.js";
|
|
5
6
|
import {
|
|
6
7
|
generateCode,
|
|
7
8
|
generateDeclaration,
|
|
8
9
|
generateJs,
|
|
10
|
+
generateTokens,
|
|
11
|
+
parsePropertyRules,
|
|
12
|
+
parseThemedDeclarations,
|
|
9
13
|
parseVarDeclarations,
|
|
10
14
|
parseVarNames,
|
|
15
|
+
scanCss,
|
|
16
|
+
scanUsedKeys,
|
|
11
17
|
scanVarDeclarations,
|
|
12
18
|
scanVarNames
|
|
13
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6YWE4A6S.js";
|
|
14
20
|
export {
|
|
15
21
|
checkGenerated,
|
|
22
|
+
findUnusedVars,
|
|
16
23
|
generate,
|
|
17
24
|
generateCode,
|
|
18
25
|
generateDeclaration,
|
|
19
26
|
generateJs,
|
|
27
|
+
generateTokens,
|
|
28
|
+
parsePropertyRules,
|
|
29
|
+
parseThemedDeclarations,
|
|
20
30
|
parseVarDeclarations,
|
|
21
31
|
parseVarNames,
|
|
32
|
+
scanCss,
|
|
33
|
+
scanUsedKeys,
|
|
22
34
|
scanVarDeclarations,
|
|
23
35
|
scanVarNames
|
|
24
36
|
};
|