@terrazzo/token-tools 0.0.3 → 0.0.4
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/css/color.js +6 -4
- package/dist/css/color.js.map +1 -1
- package/dist/css/index.d.ts +5 -3
- package/package.json +6 -6
- package/src/css/color.ts +10 -4
package/dist/css/color.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { displayable, formatCss,
|
|
2
|
+
// @ts-expect-error: types missing
|
|
3
|
+
toGamut, } from 'culori';
|
|
2
4
|
import { CSS_TO_CULORI, parseColor } from '../color.js';
|
|
3
5
|
import { defaultAliasTransform } from './lib.js';
|
|
4
6
|
/** Convert color value to CSS string */
|
|
@@ -64,9 +66,9 @@ export function transformColorValue(value, { aliasOf, transformAlias = defaultAl
|
|
|
64
66
|
? formatCss(color)
|
|
65
67
|
: {
|
|
66
68
|
'.': formatCss(color),
|
|
67
|
-
srgb: (typeof value === 'object' && value.hex) || formatCss(
|
|
68
|
-
p3: formatCss(
|
|
69
|
-
rec2020: formatCss(
|
|
69
|
+
srgb: (typeof value === 'object' && value.hex) || formatCss(toGamut('rgb')(color)),
|
|
70
|
+
p3: formatCss(toGamut('p3')(color)),
|
|
71
|
+
rec2020: formatCss(toGamut('rec2020')(color)),
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
//# sourceMappingURL=color.js.map
|
package/dist/css/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/css/color.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/css/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,SAAS;AACT,kCAAkC;AAClC,OAAO,GACR,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CA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ACvB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;QAClB,CAAC,CAAC;YACE,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC;YACrB,IAAI,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAU,CAAC;YAC3F,EAAE,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAU,CAAC;YAC5C,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAU,CAAC;SACvD,CAAC;AACR,CAAC"}
|
package/dist/css/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TokenNormalized } from '../types.js';
|
|
2
2
|
import type { IDGenerator } from './lib.js';
|
|
3
|
+
import { transformCubicBezierValue } from './cubic-bezier.js';
|
|
4
|
+
import { transformDurationValue } from './duration.js';
|
|
3
5
|
export * from './boolean.js';
|
|
4
6
|
export * from './border.js';
|
|
5
7
|
export * from './color.js';
|
|
@@ -23,7 +25,7 @@ export interface TransformCSSValueOptions {
|
|
|
23
25
|
}
|
|
24
26
|
/** Main CSS Transform */
|
|
25
27
|
export declare function transformCSSValue<T extends TokenNormalized>(token: T, { mode, transformAlias }: TransformCSSValueOptions): string | Record<string, string> | import("./color.js").WideGamutColorValue | {
|
|
26
|
-
duration:
|
|
27
|
-
delay:
|
|
28
|
-
'timing-function':
|
|
28
|
+
duration: ReturnType<typeof transformDurationValue>;
|
|
29
|
+
delay: ReturnType<typeof transformDurationValue>;
|
|
30
|
+
'timing-function': ReturnType<typeof transformCubicBezierValue>;
|
|
29
31
|
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrazzo/token-tools",
|
|
3
3
|
"description": "Various utilities for token types",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Drew Powers",
|
|
7
7
|
"email": "drew@pow.rs"
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"./*": "./*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@humanwhocodes/momoa": "^3.0",
|
|
36
|
-
"culori": "^4.0",
|
|
37
|
-
"scule": "^1.3",
|
|
38
|
-
"wildcard-match": "^5.1"
|
|
35
|
+
"@humanwhocodes/momoa": "^3.0.6",
|
|
36
|
+
"culori": "^4.0.1",
|
|
37
|
+
"scule": "^1.3.0",
|
|
38
|
+
"wildcard-match": "^5.1.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/culori": "^2.1"
|
|
41
|
+
"@types/culori": "^2.1.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "pnpm run build:clean && pnpm run build:ts && pnpm run build:license",
|
package/src/css/color.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Color,
|
|
3
|
+
displayable,
|
|
4
|
+
formatCss,
|
|
5
|
+
// @ts-expect-error: types missing
|
|
6
|
+
toGamut,
|
|
7
|
+
} from 'culori';
|
|
2
8
|
import { CSS_TO_CULORI, parseColor } from '../color.js';
|
|
3
9
|
import type { ColorValue } from '../types.js';
|
|
4
10
|
import { type IDGenerator, defaultAliasTransform } from './lib.js';
|
|
@@ -73,8 +79,8 @@ export function transformColorValue(
|
|
|
73
79
|
? formatCss(color)
|
|
74
80
|
: {
|
|
75
81
|
'.': formatCss(color),
|
|
76
|
-
srgb: (typeof value === 'object' && value.hex) || formatCss(
|
|
77
|
-
p3: formatCss(
|
|
78
|
-
rec2020: formatCss(
|
|
82
|
+
srgb: (typeof value === 'object' && value.hex) || formatCss(toGamut('rgb')(color) as Color),
|
|
83
|
+
p3: formatCss(toGamut('p3')(color) as Color),
|
|
84
|
+
rec2020: formatCss(toGamut('rec2020')(color) as Color),
|
|
79
85
|
};
|
|
80
86
|
}
|