css-typed-vars 0.6.0 → 0.8.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 +189 -9
- package/dist/{chunk-TD7SYMDA.js → chunk-32V3V6WT.js} +46 -29
- package/dist/chunk-5HPTHW7S.js +820 -0
- package/dist/{chunk-VZ2BHHXD.js → chunk-YDXCJQPL.js} +42 -29
- package/dist/cli.cjs +542 -151
- package/dist/cli.js +142 -73
- package/dist/esbuild.cjs +358 -87
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +2 -2
- package/dist/generator-DJ9uOYBP.d.cts +69 -0
- package/dist/generator-DJ9uOYBP.d.ts +69 -0
- package/dist/index.cjs +423 -77
- package/dist/index.d.cts +29 -6
- package/dist/index.d.ts +29 -6
- package/dist/index.js +14 -2
- package/dist/rollup.cjs +358 -87
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/unplugin.cjs +358 -87
- package/dist/unplugin.d.cts +12 -2
- package/dist/unplugin.d.ts +12 -2
- package/dist/unplugin.js +2 -2
- package/dist/vite.cjs +358 -87
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +358 -87
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-LH53WYFF.js +0 -487
- package/dist/generator-C2AppeJL.d.cts +0 -15
- package/dist/generator-C2AppeJL.d.ts +0 -15
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare function parseVarNames(css: string, selectors?: string[]): string[];
|
|
2
|
+
declare function parseVarDeclarations(css: string, selectors?: string[]): Map<string, string>;
|
|
3
|
+
interface VarDoc {
|
|
4
|
+
/** Free text of the comment, before any tag. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** `true` for a bare `@deprecated`, or its reason text. */
|
|
7
|
+
deprecated?: string | true;
|
|
8
|
+
}
|
|
9
|
+
interface ThemedDeclarations {
|
|
10
|
+
/** Base values, from `:root`/`@theme`/`selectors` blocks outside any theme block. */
|
|
11
|
+
declarations: Map<string, string>;
|
|
12
|
+
/** Per theme name, the values declared inside that theme's blocks. */
|
|
13
|
+
themes: Map<string, Map<string, string>>;
|
|
14
|
+
/** `/** ... *\/` doc comments placed directly before a declaration — from a base block, else from a theme block. */
|
|
15
|
+
docs: Map<string, VarDoc>;
|
|
16
|
+
}
|
|
17
|
+
declare function parseThemedDeclarations(css: string, selectors: string[] | undefined, themes: Record<string, string>): ThemedDeclarations;
|
|
18
|
+
interface PropertyRule {
|
|
19
|
+
syntax?: string;
|
|
20
|
+
inherits?: string;
|
|
21
|
+
initialValue?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function parsePropertyRules(css: string): Map<string, PropertyRule>;
|
|
24
|
+
interface VarReference {
|
|
25
|
+
name: string;
|
|
26
|
+
/** Whether the reference has a fallback, e.g. `var(--x, red)`. */
|
|
27
|
+
hasFallback: boolean;
|
|
28
|
+
/** 1-based line and column of `var(` in the original css. */
|
|
29
|
+
line: number;
|
|
30
|
+
column: number;
|
|
31
|
+
}
|
|
32
|
+
declare function parseVarReferences(css: string): VarReference[];
|
|
33
|
+
declare function parseDeclaredNames(css: string): Set<string>;
|
|
34
|
+
|
|
35
|
+
type NamingConvention = 'camelCase' | 'snake' | 'kebab' | 'constant' | 'pascal';
|
|
36
|
+
interface GeneratorOptions {
|
|
37
|
+
prefix?: string;
|
|
38
|
+
naming?: NamingConvention;
|
|
39
|
+
/** Declared value per var name, emitted as a `@default` JSDoc tag. */
|
|
40
|
+
declarations?: Map<string, string>;
|
|
41
|
+
group?: boolean;
|
|
42
|
+
/** `@property` rules per var name, emitted as `@syntax` JSDoc tags and enum union types. */
|
|
43
|
+
properties?: Map<string, PropertyRule>;
|
|
44
|
+
/** Also emit the `CssVarRef` type and `getCssVar`/`setCssVar` runtime helpers. */
|
|
45
|
+
helpers?: boolean;
|
|
46
|
+
/** Per theme name, the values declared for it, emitted as `@theme <name> <value>` JSDoc tags. */
|
|
47
|
+
themes?: Map<string, Map<string, string>>;
|
|
48
|
+
/** CSS doc comments per var name, emitted as the JSDoc description and `@deprecated` tag. */
|
|
49
|
+
docs?: Map<string, VarDoc>;
|
|
50
|
+
}
|
|
51
|
+
type LegacyArgs = [
|
|
52
|
+
prefix?: string,
|
|
53
|
+
naming?: NamingConvention,
|
|
54
|
+
declarations?: Map<string, string>,
|
|
55
|
+
group?: boolean,
|
|
56
|
+
properties?: Map<string, PropertyRule>
|
|
57
|
+
];
|
|
58
|
+
declare function generateCode(varNames: string[], options?: GeneratorOptions): string;
|
|
59
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
60
|
+
declare function generateCode(varNames: string[], ...args: LegacyArgs): string;
|
|
61
|
+
declare function generateJs(varNames: string[], options?: GeneratorOptions): string;
|
|
62
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
63
|
+
declare function generateJs(varNames: string[], ...args: LegacyArgs): string;
|
|
64
|
+
declare function generateDeclaration(varNames: string[], options?: GeneratorOptions): string;
|
|
65
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
66
|
+
declare function generateDeclaration(varNames: string[], ...args: LegacyArgs): string;
|
|
67
|
+
declare function generateTokens(varNames: string[], options?: GeneratorOptions): string;
|
|
68
|
+
|
|
69
|
+
export { type GeneratorOptions as G, type NamingConvention as N, type PropertyRule as P, type ThemedDeclarations as T, type VarReference as V, type VarDoc as a, generateDeclaration as b, generateJs as c, generateTokens as d, parsePropertyRules as e, parseThemedDeclarations as f, generateCode as g, parseVarDeclarations as h, parseVarNames as i, parseVarReferences as j, parseDeclaredNames as p };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare function parseVarNames(css: string, selectors?: string[]): string[];
|
|
2
|
+
declare function parseVarDeclarations(css: string, selectors?: string[]): Map<string, string>;
|
|
3
|
+
interface VarDoc {
|
|
4
|
+
/** Free text of the comment, before any tag. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** `true` for a bare `@deprecated`, or its reason text. */
|
|
7
|
+
deprecated?: string | true;
|
|
8
|
+
}
|
|
9
|
+
interface ThemedDeclarations {
|
|
10
|
+
/** Base values, from `:root`/`@theme`/`selectors` blocks outside any theme block. */
|
|
11
|
+
declarations: Map<string, string>;
|
|
12
|
+
/** Per theme name, the values declared inside that theme's blocks. */
|
|
13
|
+
themes: Map<string, Map<string, string>>;
|
|
14
|
+
/** `/** ... *\/` doc comments placed directly before a declaration — from a base block, else from a theme block. */
|
|
15
|
+
docs: Map<string, VarDoc>;
|
|
16
|
+
}
|
|
17
|
+
declare function parseThemedDeclarations(css: string, selectors: string[] | undefined, themes: Record<string, string>): ThemedDeclarations;
|
|
18
|
+
interface PropertyRule {
|
|
19
|
+
syntax?: string;
|
|
20
|
+
inherits?: string;
|
|
21
|
+
initialValue?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function parsePropertyRules(css: string): Map<string, PropertyRule>;
|
|
24
|
+
interface VarReference {
|
|
25
|
+
name: string;
|
|
26
|
+
/** Whether the reference has a fallback, e.g. `var(--x, red)`. */
|
|
27
|
+
hasFallback: boolean;
|
|
28
|
+
/** 1-based line and column of `var(` in the original css. */
|
|
29
|
+
line: number;
|
|
30
|
+
column: number;
|
|
31
|
+
}
|
|
32
|
+
declare function parseVarReferences(css: string): VarReference[];
|
|
33
|
+
declare function parseDeclaredNames(css: string): Set<string>;
|
|
34
|
+
|
|
35
|
+
type NamingConvention = 'camelCase' | 'snake' | 'kebab' | 'constant' | 'pascal';
|
|
36
|
+
interface GeneratorOptions {
|
|
37
|
+
prefix?: string;
|
|
38
|
+
naming?: NamingConvention;
|
|
39
|
+
/** Declared value per var name, emitted as a `@default` JSDoc tag. */
|
|
40
|
+
declarations?: Map<string, string>;
|
|
41
|
+
group?: boolean;
|
|
42
|
+
/** `@property` rules per var name, emitted as `@syntax` JSDoc tags and enum union types. */
|
|
43
|
+
properties?: Map<string, PropertyRule>;
|
|
44
|
+
/** Also emit the `CssVarRef` type and `getCssVar`/`setCssVar` runtime helpers. */
|
|
45
|
+
helpers?: boolean;
|
|
46
|
+
/** Per theme name, the values declared for it, emitted as `@theme <name> <value>` JSDoc tags. */
|
|
47
|
+
themes?: Map<string, Map<string, string>>;
|
|
48
|
+
/** CSS doc comments per var name, emitted as the JSDoc description and `@deprecated` tag. */
|
|
49
|
+
docs?: Map<string, VarDoc>;
|
|
50
|
+
}
|
|
51
|
+
type LegacyArgs = [
|
|
52
|
+
prefix?: string,
|
|
53
|
+
naming?: NamingConvention,
|
|
54
|
+
declarations?: Map<string, string>,
|
|
55
|
+
group?: boolean,
|
|
56
|
+
properties?: Map<string, PropertyRule>
|
|
57
|
+
];
|
|
58
|
+
declare function generateCode(varNames: string[], options?: GeneratorOptions): string;
|
|
59
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
60
|
+
declare function generateCode(varNames: string[], ...args: LegacyArgs): string;
|
|
61
|
+
declare function generateJs(varNames: string[], options?: GeneratorOptions): string;
|
|
62
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
63
|
+
declare function generateJs(varNames: string[], ...args: LegacyArgs): string;
|
|
64
|
+
declare function generateDeclaration(varNames: string[], options?: GeneratorOptions): string;
|
|
65
|
+
/** @deprecated Pass a `GeneratorOptions` object as the second argument instead. */
|
|
66
|
+
declare function generateDeclaration(varNames: string[], ...args: LegacyArgs): string;
|
|
67
|
+
declare function generateTokens(varNames: string[], options?: GeneratorOptions): string;
|
|
68
|
+
|
|
69
|
+
export { type GeneratorOptions as G, type NamingConvention as N, type PropertyRule as P, type ThemedDeclarations as T, type VarReference as V, type VarDoc as a, generateDeclaration as b, generateJs as c, generateTokens as d, parsePropertyRules as e, parseThemedDeclarations as f, generateCode as g, parseVarDeclarations as h, parseVarNames as i, parseVarReferences as j, parseDeclaredNames as p };
|