@projectwallace/css-design-tokens 0.10.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 +101 -17
- package/dist/index.js +618 -0
- package/package.json +35 -27
- package/readme.md +223 -242
- package/dist/colors.d.ts +0 -2
- package/dist/css-design-tokens.js +0 -486
- package/dist/destructure-box-shadow.d.ts +0 -14
- package/dist/destructure-box-shadow.test.d.ts +0 -1
- package/dist/destructure-easing.d.ts +0 -2
- package/dist/destructure-easing.test.d.ts +0 -1
- package/dist/destructure-font-family.d.ts +0 -2
- package/dist/destructure-font-family.test.d.ts +0 -1
- package/dist/destructure-line-height.d.ts +0 -10
- package/dist/destructure-line-height.test.d.ts +0 -1
- package/dist/group-colors.d.ts +0 -4
- package/dist/hash.d.ts +0 -1
- package/dist/hash.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/parse-length.d.ts +0 -13
- package/dist/parse-length.test.d.ts +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/unquote.d.ts +0 -1
- package/dist/unquote.test.d.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
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 };
|