@projectwallace/css-design-tokens 0.11.0 → 0.11.1

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/dist/index.d.ts CHANGED
@@ -1,18 +1,102 @@
1
- import { CubicBezierToken, DimensionToken, DurationToken, FontFamilyToken, NumberToken, UnparsedToken, ColorToken, CssAnalysis, ShadowToken } from './types.js';
2
- export { color_to_token } from './colors.js';
3
- export { EXTENSION_AUTHORED_AS, EXTENSION_USAGE_COUNT, EXTENSION_CSS_PROPERTIES, type Easing, type CubicBezierToken, type DimensionValue, type DimensionToken, type DurationToken, type DurationValue, type FontFamilyToken, type NumberToken, type UnparsedToken, type CssAnalysis, type ShadowToken, type ColorSpace, type ColorToken, type ColorValue, type ColorComponent, } from './types.js';
4
- export type { CssLength, ShadowValue } from './destructure-box-shadow.js';
5
- export declare function css_to_tokens(css: string): Tokens;
1
+ import { analyze } from "@projectwallace/css-analyzer";
2
+
3
+ //#region src/destructure-box-shadow.d.ts
4
+ type CssLength = {
5
+ value: number;
6
+ unit: string;
7
+ };
8
+ type ShadowValue = {
9
+ color: ColorValue | undefined;
10
+ offsetX: CssLength | undefined;
11
+ offsetY: CssLength | undefined;
12
+ blur: CssLength | undefined;
13
+ spread: CssLength | undefined;
14
+ inset: boolean | undefined;
15
+ };
16
+ //#endregion
17
+ //#region src/types.d.ts
18
+ type CssAnalysis = ReturnType<typeof analyze>;
19
+ declare const EXTENSION_AUTHORED_AS = "com.projectwallace.css-authored-as";
20
+ declare const EXTENSION_USAGE_COUNT = "com.projectwallace.usage-count";
21
+ declare const EXTENSION_CSS_PROPERTIES = "com.projectwallace.css-properties";
22
+ type Easing = [number, number, number, number];
23
+ type BaseToken = {
24
+ $extensions: {
25
+ [EXTENSION_AUTHORED_AS]: string;
26
+ [EXTENSION_USAGE_COUNT]: number;
27
+ };
28
+ };
29
+ type Unit = 'rem' | 'px';
30
+ type DurationValue = {
31
+ value: number;
32
+ unit: 'ms';
33
+ };
34
+ type DurationToken = BaseToken & {
35
+ $type: 'duration';
36
+ $value: DurationValue;
37
+ };
38
+ type UnparsedToken = BaseToken & {
39
+ $value: string;
40
+ $type?: never;
41
+ };
42
+ type ColorSpace = 'srgb' | 'display-p3' | 'hsl' | 'hwb' | 'lab' | 'lch' | 'oklab' | 'oklch' | 'display-p3' | 'a98-rgb' | 'prophoto-rgb' | 'rec2020' | 'xyz-d65' | 'xyz-d50';
43
+ type ColorComponent = number | 'none';
44
+ type ColorValue = {
45
+ colorSpace: ColorSpace;
46
+ components: [ColorComponent, ColorComponent, ColorComponent];
47
+ alpha: number;
48
+ hex?: string;
49
+ };
50
+ type ColorToken = BaseToken & {
51
+ $type: 'color';
52
+ $value: ColorValue;
53
+ $extensions: {
54
+ [EXTENSION_CSS_PROPERTIES]: Array<string>;
55
+ };
56
+ };
57
+ type DimensionValue = {
58
+ value: number;
59
+ unit: Unit;
60
+ };
61
+ type DimensionToken = BaseToken & {
62
+ $type: 'dimension';
63
+ $value: DimensionValue;
64
+ };
65
+ type NumberToken = BaseToken & {
66
+ $type: 'number';
67
+ $value: number;
68
+ };
69
+ type CubicBezierToken = BaseToken & {
70
+ $type: 'cubicBezier';
71
+ $value: Easing;
72
+ };
73
+ type FontFamilyValue = string[];
74
+ type FontFamilyToken = BaseToken & {
75
+ $type: 'fontFamily';
76
+ $value: FontFamilyValue;
77
+ };
78
+ type ShadowToken = BaseToken & {
79
+ $type: 'shadow';
80
+ $value: ShadowValue | ShadowValue[];
81
+ };
82
+ //#endregion
83
+ //#region src/colors.d.ts
84
+ declare function color_to_token(color: string): ColorValue | null;
85
+ //#endregion
86
+ //#region src/index.d.ts
87
+ declare function css_to_tokens(css: string): Tokens;
6
88
  type TokenID = string;
7
- export type Tokens = {
8
- color: Record<TokenID, ColorToken>;
9
- font_size: Record<TokenID, DimensionToken | UnparsedToken>;
10
- font_family: Record<TokenID, FontFamilyToken | UnparsedToken>;
11
- line_height: Record<TokenID, DimensionToken | NumberToken | UnparsedToken>;
12
- gradient: Record<TokenID, UnparsedToken>;
13
- box_shadow: Record<TokenID, ShadowToken | UnparsedToken>;
14
- radius: Record<TokenID, UnparsedToken>;
15
- duration: Record<TokenID, DurationToken | UnparsedToken>;
16
- easing: Record<TokenID, CubicBezierToken | UnparsedToken>;
17
- };
18
- export declare function analysis_to_tokens(analysis: CssAnalysis): Tokens;
89
+ type Tokens = {
90
+ color: Record<TokenID, ColorToken>;
91
+ font_size: Record<TokenID, DimensionToken | UnparsedToken>;
92
+ font_family: Record<TokenID, FontFamilyToken | UnparsedToken>;
93
+ line_height: Record<TokenID, DimensionToken | NumberToken | UnparsedToken>;
94
+ gradient: Record<TokenID, UnparsedToken>;
95
+ box_shadow: Record<TokenID, ShadowToken | UnparsedToken>;
96
+ radius: Record<TokenID, UnparsedToken>;
97
+ duration: Record<TokenID, DurationToken | UnparsedToken>;
98
+ easing: Record<TokenID, CubicBezierToken | UnparsedToken>;
99
+ };
100
+ declare function analysis_to_tokens(analysis: CssAnalysis): Tokens;
101
+ //#endregion
102
+ export { type ColorComponent, type ColorSpace, type ColorToken, type ColorValue, type CssAnalysis, type CssLength, type CubicBezierToken, type DimensionToken, type DimensionValue, type DurationToken, type DurationValue, EXTENSION_AUTHORED_AS, EXTENSION_CSS_PROPERTIES, EXTENSION_USAGE_COUNT, type Easing, type FontFamilyToken, type NumberToken, type ShadowToken, type ShadowValue, Tokens, type UnparsedToken, analysis_to_tokens, color_to_token, css_to_tokens };