@terrazzo/token-tools 0.4.0 → 0.6.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/CHANGELOG.md +44 -0
- package/dist/color.d.ts +1 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/css/boolean.d.ts +4 -5
- package/dist/css/boolean.d.ts.map +1 -0
- package/dist/css/boolean.js +4 -7
- package/dist/css/boolean.js.map +1 -1
- package/dist/css/border.d.ts +4 -10
- package/dist/css/border.d.ts.map +1 -0
- package/dist/css/border.js +16 -15
- package/dist/css/border.js.map +1 -1
- package/dist/css/color.d.ts +4 -9
- package/dist/css/color.d.ts.map +1 -0
- package/dist/css/color.js +9 -7
- package/dist/css/color.js.map +1 -1
- package/dist/css/css-types.d.ts +13 -0
- package/dist/css/css-types.d.ts.map +1 -0
- package/dist/css/css-types.js +2 -0
- package/dist/css/css-types.js.map +1 -0
- package/dist/css/cubic-bezier.d.ts +4 -7
- package/dist/css/cubic-bezier.d.ts.map +1 -0
- package/dist/css/cubic-bezier.js +6 -5
- package/dist/css/cubic-bezier.js.map +1 -1
- package/dist/css/dimension.d.ts +4 -6
- package/dist/css/dimension.d.ts.map +1 -0
- package/dist/css/dimension.js +5 -7
- package/dist/css/dimension.js.map +1 -1
- package/dist/css/duration.d.ts +4 -6
- package/dist/css/duration.d.ts.map +1 -0
- package/dist/css/duration.js +5 -8
- package/dist/css/duration.js.map +1 -1
- package/dist/css/font-family.d.ts +4 -7
- package/dist/css/font-family.d.ts.map +1 -0
- package/dist/css/font-family.js +6 -18
- package/dist/css/font-family.js.map +1 -1
- package/dist/css/font-weight.d.ts +4 -5
- package/dist/css/font-weight.d.ts.map +1 -0
- package/dist/css/font-weight.js +5 -4
- package/dist/css/font-weight.js.map +1 -1
- package/dist/css/gradient.d.ts +4 -10
- package/dist/css/gradient.d.ts.map +1 -0
- package/dist/css/gradient.js +29 -18
- package/dist/css/gradient.js.map +1 -1
- package/dist/css/index.d.ts +5 -17
- package/dist/css/index.d.ts.map +1 -0
- package/dist/css/index.js +58 -83
- package/dist/css/index.js.map +1 -1
- package/dist/css/lib.d.ts +4 -7
- package/dist/css/lib.d.ts.map +1 -0
- package/dist/css/lib.js +9 -10
- package/dist/css/lib.js.map +1 -1
- package/dist/css/link.d.ts +4 -5
- package/dist/css/link.d.ts.map +1 -0
- package/dist/css/link.js +5 -4
- package/dist/css/link.js.map +1 -1
- package/dist/css/number.d.ts +4 -5
- package/dist/css/number.d.ts.map +1 -0
- package/dist/css/number.js +6 -2
- package/dist/css/number.js.map +1 -1
- package/dist/css/shadow.d.ts +6 -10
- package/dist/css/shadow.d.ts.map +1 -0
- package/dist/css/shadow.js +30 -22
- package/dist/css/shadow.js.map +1 -1
- package/dist/css/string.d.ts +4 -5
- package/dist/css/string.d.ts.map +1 -0
- package/dist/css/string.js +6 -2
- package/dist/css/string.js.map +1 -1
- package/dist/css/stroke-style.d.ts +4 -6
- package/dist/css/stroke-style.d.ts.map +1 -0
- package/dist/css/stroke-style.js +5 -4
- package/dist/css/stroke-style.js.map +1 -1
- package/dist/css/transition.d.ts +5 -14
- package/dist/css/transition.d.ts.map +1 -0
- package/dist/css/transition.js +18 -18
- package/dist/css/transition.js.map +1 -1
- package/dist/css/typography.d.ts +4 -7
- package/dist/css/typography.d.ts.map +1 -0
- package/dist/css/typography.js +21 -19
- package/dist/css/typography.js.map +1 -1
- package/dist/id.d.ts +3 -5
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +6 -7
- package/dist/id.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/js/index.d.ts +1 -0
- package/dist/js/index.d.ts.map +1 -0
- package/dist/string.d.ts +1 -0
- package/dist/string.d.ts.map +1 -0
- package/dist/transform.d.ts +1 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/types.d.ts +34 -19
- package/dist/types.d.ts.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @terrazzo/token-tools
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - feat: ⚠️ Breaking change: aliasing to specific modes (`#` character) is deprecated. It was an experimental feature in Cobalt 1.0 with unpredictable behavior. In some upcoming spec changes it will be incompatible with advanced usecases.
|
|
8
|
+
|
|
9
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - fix: Improvements to mode aliasing and mode overrides. `typography` tokens only have to partially-declare overrides for modes, while keeping their core set. While this has been supported, behavior was buggy and sometimes was inconsistent.
|
|
10
|
+
|
|
11
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ Breaking change: cubicBezier tokens no longer support aliases as values, in line with the spec.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - fix: Improved handling of modes partially overriding object tokens (e.g. typography modes modifying a single value). In plugin-css, for instance, you may notice more output, but it’s done for safer style generation.
|
|
16
|
+
|
|
17
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - feat: Further improved reverse alias lookups to be more accurate and more complete
|
|
18
|
+
|
|
19
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - fix: Better error messages on alias mismatches
|
|
20
|
+
|
|
21
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - fix: [plugin-css] Font Family names without spaces no longer get quotes.
|
|
22
|
+
|
|
23
|
+
fix: Font Family tokens are always normalized to an array internally for easier parsing.
|
|
24
|
+
|
|
25
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - feat: @terrazzo/plugin-css now returns entire token for `variableName`. This is a minor breaking change from `variableName(name: string)` → `variableName(token: Token)`, but current users can just use `token.id` to get the same value as before.
|
|
26
|
+
|
|
27
|
+
⚠️ Minor internal breaking change as a result: `transformCSSValue()` in @terrazzo/token-tools now requires entire token️ to make this possible.
|
|
28
|
+
|
|
29
|
+
- [#425](https://github.com/terrazzoapp/terrazzo/pull/425) [`9a98ab0`](https://github.com/terrazzoapp/terrazzo/commit/9a98ab0441b518fa4bb0e5a40f6f5cde58764af4) Thanks [@drwpow](https://github.com/drwpow)! - fix: ⚠️ [plugin-css] Minor breaking change: transition tokens no longer generate variables for sub-parts. This is a change done in service to better protect “allowed” token usage. If you want consumers to be able to “break apart” tokens, then they must also exist as individual tokens that get aliased.
|
|
30
|
+
|
|
31
|
+
## 0.5.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [#420](https://github.com/terrazzoapp/terrazzo/pull/420) [`ff3d9d1`](https://github.com/terrazzoapp/terrazzo/commit/ff3d9d199dc53102110f8403c6832f8bdeeee45a) Thanks [@drwpow](https://github.com/drwpow)! - fix: ⚠️ Breaking change: CSS aliases will revert to original 1.0 behavior and be “shallow,” meaning they’ll be preserved as-written. Terrazzo 2.0 (beta) attempted to simplify aliases to only be single-depth, but that results in unintentional behavior.
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- [#420](https://github.com/terrazzoapp/terrazzo/pull/420) [`ff3d9d1`](https://github.com/terrazzoapp/terrazzo/commit/ff3d9d199dc53102110f8403c6832f8bdeeee45a) Thanks [@drwpow](https://github.com/drwpow)! - fix: Improve reverse alias lookups (needed for plugin-css, where redeclared base tokens need downstream aliases to be redeclared too, so the values aren’t stale)
|
|
40
|
+
|
|
41
|
+
- [#419](https://github.com/terrazzoapp/terrazzo/pull/419) [`3962918`](https://github.com/terrazzoapp/terrazzo/commit/3962918b25af69fad7833d0399aee5bae0033d4f) Thanks [@drwpow](https://github.com/drwpow)! - Improve CLI logging and debugging for performance testing
|
|
42
|
+
|
|
43
|
+
- [#420](https://github.com/terrazzoapp/terrazzo/pull/420) [`ff3d9d1`](https://github.com/terrazzoapp/terrazzo/commit/ff3d9d199dc53102110f8403c6832f8bdeeee45a) Thanks [@drwpow](https://github.com/drwpow)! - fix: Minor performance improvements and cleanup
|
|
44
|
+
|
|
45
|
+
- [#420](https://github.com/terrazzoapp/terrazzo/pull/420) [`ff3d9d1`](https://github.com/terrazzoapp/terrazzo/commit/ff3d9d199dc53102110f8403c6832f8bdeeee45a) Thanks [@drwpow](https://github.com/drwpow)! - fix: CSS utilities alphabetize declarations to produce more consistent output. Reordering tokens should be a plugin-level concern; parser will preserve token authoring order.
|
|
46
|
+
|
|
3
47
|
## 0.4.0
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
package/dist/color.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export declare const CSS_TO_CULORI: {
|
|
|
23
23
|
export declare function parseColor(color: string): ColorValueNormalized;
|
|
24
24
|
/** Convert a color token to a Culori color */
|
|
25
25
|
export declare function tokenToCulori(value: ColorValueNormalized): Color | undefined;
|
|
26
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,KAAK,EAAoB,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAInE,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,OAAO,CACL,KAAK,CAAC,MAAM,CAAC,EACX,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,OAAO,GACP,KAAK,GACL,KAAK,GACL,KAAK,GACL,MAAM,GACN,IAAI,GACJ,UAAU,GACV,SAAS,GACT,KAAK,GACL,OAAO,GACP,OAAO,CACV,EACD,UAAU,CAiBX,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAgBzB,CAAC;AAEF,sBAAsB;AACtB,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CA2D9D;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK,GAAG,SAAS,CAgD5E"}
|
package/dist/css/boolean.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BooleanTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
2
3
|
/** Convert boolean value to CSS string */
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
transformAlias?: IDGenerator;
|
|
6
|
-
}): string;
|
|
4
|
+
export declare function transformBoolean(token: BooleanTokenNormalized, { tokensSet, transformAlias }: TransformCSSValueOptions): string;
|
|
5
|
+
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/css/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,0CAA0C;AAC1C,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,sBAAsB,EAC7B,EAAE,SAAS,EAAE,cAAsC,EAAE,EAAE,wBAAwB,GAC9E,MAAM,CAKR"}
|
package/dist/css/boolean.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
2
|
/** Convert boolean value to CSS string */
|
|
3
|
-
export function
|
|
4
|
-
if (
|
|
5
|
-
return transformAlias(
|
|
3
|
+
export function transformBoolean(token, { tokensSet, transformAlias = defaultAliasTransform }) {
|
|
4
|
+
if (token.aliasChain?.[0]) {
|
|
5
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
throw new Error(`Expected boolean, received ${typeof value} "${value}"`);
|
|
9
|
-
}
|
|
10
|
-
return value ? '1' : '0';
|
|
7
|
+
return token.$value === true ? '1' : '0';
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=boolean.js.map
|
package/dist/css/boolean.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/css/boolean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/css/boolean.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB,CAC9B,KAA6B,EAC7B,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAA4B;IAE/E,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3C,CAAC"}
|
package/dist/css/border.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { BorderTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
3
|
/** Convert border value to multiple CSS values */
|
|
4
|
-
export declare function
|
|
5
|
-
aliasOf?: string;
|
|
6
|
-
partialAliasOf?: Partial<Record<keyof typeof value, string>>;
|
|
7
|
-
transformAlias: IDGenerator;
|
|
8
|
-
color?: {
|
|
9
|
-
legacyHex?: boolean;
|
|
10
|
-
};
|
|
11
|
-
}): string | {
|
|
4
|
+
export declare function transformBorder(token: BorderTokenNormalized, options: TransformCSSValueOptions): string | {
|
|
12
5
|
'.': string;
|
|
13
6
|
srgb: string;
|
|
14
7
|
p3: string;
|
|
15
8
|
rec2020: string;
|
|
16
9
|
};
|
|
10
|
+
//# sourceMappingURL=border.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/css/border.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAItB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAK/D,kDAAkD;AAClD,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,wBAAwB;;;;;EA2B9F"}
|
package/dist/css/border.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { displayable } from 'culori';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { transformColor } from './color.js';
|
|
3
|
+
import { transformDimension } from './dimension.js';
|
|
4
4
|
import { defaultAliasTransform } from './lib.js';
|
|
5
|
-
import {
|
|
5
|
+
import { transformStrokeStyle } from './stroke-style.js';
|
|
6
6
|
/** Convert border value to multiple CSS values */
|
|
7
|
-
export function
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export function transformBorder(token, options) {
|
|
8
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
9
|
+
if (token.aliasChain?.[0]) {
|
|
10
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
10
11
|
}
|
|
11
|
-
const width = partialAliasOf?.width
|
|
12
|
-
? transformAlias(partialAliasOf.width)
|
|
13
|
-
:
|
|
14
|
-
const color = partialAliasOf?.color
|
|
15
|
-
? transformAlias(partialAliasOf.color)
|
|
16
|
-
:
|
|
17
|
-
const style = partialAliasOf?.style
|
|
18
|
-
? transformAlias(partialAliasOf.style)
|
|
19
|
-
:
|
|
12
|
+
const width = token.partialAliasOf?.width
|
|
13
|
+
? transformAlias(tokensSet[token.partialAliasOf.width])
|
|
14
|
+
: transformDimension({ $value: token.$value.width }, options);
|
|
15
|
+
const color = token.partialAliasOf?.color
|
|
16
|
+
? transformAlias(tokensSet[token.partialAliasOf.color])
|
|
17
|
+
: transformColor({ $value: token.$value.color }, options);
|
|
18
|
+
const style = token.partialAliasOf?.style
|
|
19
|
+
? transformAlias(tokensSet[token.partialAliasOf.style])
|
|
20
|
+
: transformStrokeStyle({ $value: token.$value.style }, options);
|
|
20
21
|
const formatBorder = (colorKey) => [width, style, typeof color === 'string' ? color : color[colorKey]].join(' ');
|
|
21
22
|
return typeof color === 'string' || displayable(color.p3)
|
|
22
23
|
? formatBorder('.')
|
package/dist/css/border.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../src/css/border.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../src/css/border.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAOrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,kDAAkD;AAClD,MAAM,UAAU,eAAe,CAAC,KAA4B,EAAE,OAAiC;IAC7F,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,EAAE,KAAK;QACvC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAE,CAAC;QACxD,CAAC,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAA8B,EAAE,OAAO,CAAC,CAAC;IAC5F,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,EAAE,KAAK;QACvC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAE,CAAC;QACxD,CAAC,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAA0B,EAAE,OAAO,CAAC,CAAC;IACpF,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,EAAE,KAAK;QACvC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAE,CAAC;QACxD,CAAC,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAgC,EAAE,OAAO,CAAC,CAAC;IAEhG,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,EAAE,CACxC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtG,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC;QACnB,CAAC,CAAC;YACE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC;YACtB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC;YAC1B,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC;YACtB,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC;SACjC,CAAC;AACR,CAAC"}
|
package/dist/css/color.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { ColorTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
3
|
export type WideGamutColorValue = {
|
|
4
4
|
'.': string;
|
|
5
5
|
srgb: string;
|
|
@@ -7,10 +7,5 @@ export type WideGamutColorValue = {
|
|
|
7
7
|
rec2020: string;
|
|
8
8
|
};
|
|
9
9
|
/** Convert color value to CSS string */
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
transformAlias?: IDGenerator;
|
|
13
|
-
color?: {
|
|
14
|
-
legacyHex?: boolean;
|
|
15
|
-
};
|
|
16
|
-
}): string | WideGamutColorValue;
|
|
10
|
+
export declare function transformColor(token: ColorTokenNormalized, options: TransformCSSValueOptions): string | WideGamutColorValue;
|
|
11
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/css/color.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,MAAM,MAAM,mBAAmB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F,wCAAwC;AACxC,wBAAgB,cAAc,CAC5B,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,wBAAwB,GAChC,MAAM,GAAG,mBAAmB,CAgC9B"}
|
package/dist/css/color.js
CHANGED
|
@@ -2,24 +2,26 @@ import { displayable, formatCss, formatHex, formatHex8, toGamut } from 'culori/f
|
|
|
2
2
|
import { parseColor, tokenToCulori } from '../color.js';
|
|
3
3
|
import { defaultAliasTransform } from './lib.js';
|
|
4
4
|
/** Convert color value to CSS string */
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export function transformColor(token, options) {
|
|
6
|
+
const { transformAlias = defaultAliasTransform, tokensSet } = options;
|
|
7
|
+
if (token.aliasChain?.[0]) {
|
|
8
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
8
9
|
}
|
|
9
|
-
const { colorSpace, channels, alpha = 1 } = typeof value === 'string' ? parseColor(value) : value;
|
|
10
|
+
const { colorSpace, channels, alpha = 1, } = typeof token.$value === 'string' ? parseColor(token.$value) : token.$value;
|
|
10
11
|
const color = tokenToCulori({ colorSpace, channels, alpha });
|
|
11
12
|
if (!color) {
|
|
12
|
-
throw new Error(`Can’t convert color ${JSON.stringify(value)} to Culori color`);
|
|
13
|
+
throw new Error(`Can’t convert color ${JSON.stringify(token.$value)} to Culori color`);
|
|
13
14
|
}
|
|
14
15
|
let formatColor = formatCss;
|
|
15
|
-
if (
|
|
16
|
+
if (options.color?.legacyHex) {
|
|
16
17
|
formatColor = color.alpha !== 1 ? formatHex8 : formatHex;
|
|
17
18
|
}
|
|
18
19
|
return displayable(color)
|
|
19
20
|
? formatColor(color)
|
|
20
21
|
: {
|
|
21
22
|
'.': formatColor(color),
|
|
22
|
-
srgb: (typeof value === 'object' && value.hex) ||
|
|
23
|
+
srgb: (typeof token.$value === 'object' && token.$value.hex) ||
|
|
24
|
+
formatColor(toGamut('rgb', 'oklch')(color)),
|
|
23
25
|
p3: formatColor(toGamut('p3', 'oklch')(color)),
|
|
24
26
|
rec2020: formatColor(toGamut('rec2020', 'oklch')(color)),
|
|
25
27
|
};
|
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,EAAc,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/css/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD,wCAAwC;AACxC,MAAM,UAAU,cAAc,CAC5B,KAA2B,EAC3B,OAAiC;IAEjC,MAAM,EAAE,cAAc,GAAG,qBAAqB,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,KAAK,GAAG,CAAC,GACV,GAAG,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAC/E,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAE7D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,WAAW,GAA6B,SAAS,CAAC;IACtD,IAAI,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;QAC7B,WAAW,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,CAAC;IAED,OAAO,WAAW,CAAC,KAAK,CAAC;QACvB,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC;YACE,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC;YACvB,IAAI,EACF,CAAC,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAU,CAAC;YACtD,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAU,CAAC;YACvD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,KAAK,CAAU,CAAC;SAClE,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TokenNormalizedSet } from '../types.js';
|
|
2
|
+
import type { IDGenerator } from './lib.js';
|
|
3
|
+
export interface TransformCSSValueOptions {
|
|
4
|
+
/** Complete set of tokens (needed to resolve full and partial aliases) */
|
|
5
|
+
tokensSet: TokenNormalizedSet;
|
|
6
|
+
transformAlias?: IDGenerator;
|
|
7
|
+
/** Options for color tokens */
|
|
8
|
+
color?: {
|
|
9
|
+
/** Output legacy hex-6 and hex-8 */
|
|
10
|
+
legacyHex?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=css-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-types.d.ts","sourceRoot":"","sources":["../../src/css/css-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,SAAS,EAAE,kBAAkB,CAAC;IAC9B,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,+BAA+B;IAC/B,KAAK,CAAC,EAAE;QACN,oCAAoC;QACpC,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-types.js","sourceRoot":"","sources":["../../src/css/css-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { CubicBezierTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
3
|
/** Convert cubicBezier value to CSS */
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
partialAliasOf?: [string | undefined, string | undefined, string | undefined, string | undefined];
|
|
7
|
-
transformAlias?: IDGenerator;
|
|
8
|
-
}): string;
|
|
4
|
+
export declare function transformCubicBezier(token: CubicBezierTokenNormalized, options: TransformCSSValueOptions): string;
|
|
5
|
+
//# sourceMappingURL=cubic-bezier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cubic-bezier.d.ts","sourceRoot":"","sources":["../../src/css/cubic-bezier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,uCAAuC;AACvC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAQjH"}
|
package/dist/css/cubic-bezier.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
2
|
/** Convert cubicBezier value to CSS */
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export function transformCubicBezier(token, options) {
|
|
4
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
5
|
+
if (token.aliasChain?.[0]) {
|
|
6
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
6
7
|
}
|
|
7
|
-
return `cubic-bezier(${value
|
|
8
|
-
.map((v, i) => (partialAliasOf?.[i] ? transformAlias(partialAliasOf[i]) : v))
|
|
8
|
+
return `cubic-bezier(${token.$value
|
|
9
|
+
.map((v, i) => (token.partialAliasOf?.[i] ? transformAlias(tokensSet[token.partialAliasOf[i]]) : v))
|
|
9
10
|
.join(', ')})`;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=cubic-bezier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cubic-bezier.js","sourceRoot":"","sources":["../../src/css/cubic-bezier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cubic-bezier.js","sourceRoot":"","sources":["../../src/css/cubic-bezier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,uCAAuC;AACvC,MAAM,UAAU,oBAAoB,CAAC,KAAiC,EAAE,OAAiC;IACvG,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,gBAAgB,KAAK,CAAC,MAAM;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACnB,CAAC"}
|
package/dist/css/dimension.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { DimensionTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
3
|
/** Convert dimension value to CSS */
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
transformAlias?: IDGenerator;
|
|
7
|
-
}): string;
|
|
4
|
+
export declare function transformDimension(token: DimensionTokenNormalized, options: TransformCSSValueOptions): string;
|
|
5
|
+
//# sourceMappingURL=dimension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimension.d.ts","sourceRoot":"","sources":["../../src/css/dimension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,qCAAqC;AACrC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAO7G"}
|
package/dist/css/dimension.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
2
|
/** Convert dimension value to CSS */
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export function transformDimension(token, options) {
|
|
4
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
5
|
+
if (token.aliasChain?.[0]) {
|
|
6
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
throw new Error(`Could not resolve alias ${value}`);
|
|
9
|
-
}
|
|
10
|
-
return value.value === 0 ? '0' : `${value.value}${value.unit}`;
|
|
8
|
+
return token.$value.value === 0 ? '0' : `${token.$value.value}${token.$value.unit}`;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=dimension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimension.js","sourceRoot":"","sources":["../../src/css/dimension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dimension.js","sourceRoot":"","sources":["../../src/css/dimension.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,qCAAqC;AACrC,MAAM,UAAU,kBAAkB,CAAC,KAA+B,EAAE,OAAiC;IACnG,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACtF,CAAC"}
|
package/dist/css/duration.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { DurationTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
3
|
/** Convert duration value to CSS */
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
transformAlias?: IDGenerator;
|
|
7
|
-
}): string;
|
|
4
|
+
export declare function transformDuration(token: DurationTokenNormalized, options: TransformCSSValueOptions): string;
|
|
5
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/css/duration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,oCAAoC;AACpC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAO3G"}
|
package/dist/css/duration.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
2
|
/** Convert duration value to CSS */
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export function transformDuration(token, options) {
|
|
4
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
5
|
+
if (token.aliasChain?.[0]) {
|
|
6
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
throw new Error(`Could not resolve alias ${value}`);
|
|
9
|
-
}
|
|
10
|
-
// Note: always return unit, even if `0`
|
|
11
|
-
return `${value.value}${value.unit}`;
|
|
8
|
+
return `${token.$value.value}${token.$value.unit}`;
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=duration.js.map
|
package/dist/css/duration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/css/duration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/css/duration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,oCAAoC;AACpC,MAAM,UAAU,iBAAiB,CAAC,KAA8B,EAAE,OAAiC;IACjG,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
partialAliasOf?: string[];
|
|
6
|
-
transformAlias?: IDGenerator;
|
|
7
|
-
}): string;
|
|
1
|
+
import type { FontFamilyTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
3
|
+
export declare function transformFontFamily(token: FontFamilyTokenNormalized, options: TransformCSSValueOptions): string;
|
|
4
|
+
//# sourceMappingURL=font-family.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-family.d.ts","sourceRoot":"","sources":["../../src/css/font-family.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAK/D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAM/G"}
|
package/dist/css/font-family.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'ui-monospace',
|
|
8
|
-
'-apple-system',
|
|
9
|
-
]);
|
|
10
|
-
export function transformFontFamilyValue(value, { aliasOf, partialAliasOf, transformAlias = defaultAliasTransform, } = {}) {
|
|
11
|
-
if (aliasOf) {
|
|
12
|
-
return transformAlias(aliasOf);
|
|
2
|
+
const FONT_NAME_KEYWORD = /^[a-z-]+$/;
|
|
3
|
+
export function transformFontFamily(token, options) {
|
|
4
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
5
|
+
if (token.aliasChain?.[0]) {
|
|
6
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
13
7
|
}
|
|
14
|
-
return (
|
|
15
|
-
.map((fontName, i) => partialAliasOf?.[i]
|
|
16
|
-
? transformAlias(partialAliasOf[i])
|
|
17
|
-
: FONT_FAMILY_KEYWORDS.has(fontName)
|
|
18
|
-
? fontName
|
|
19
|
-
: `"${fontName}"`)
|
|
20
|
-
.join(', ');
|
|
8
|
+
return token.$value.map((fontName) => (FONT_NAME_KEYWORD.test(fontName) ? fontName : `"${fontName}"`)).join(', ');
|
|
21
9
|
}
|
|
22
10
|
//# sourceMappingURL=font-family.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-family.js","sourceRoot":"","sources":["../../src/css/font-family.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-family.js","sourceRoot":"","sources":["../../src/css/font-family.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,MAAM,UAAU,mBAAmB,CAAC,KAAgC,EAAE,OAAiC;IACrG,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FontWeightTokenNormalized } from '../types.js';
|
|
2
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
2
3
|
/** Convert fontWeight value to CSS */
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
transformAlias?: IDGenerator;
|
|
6
|
-
}): string;
|
|
4
|
+
export declare function transformFontWeight(token: FontWeightTokenNormalized, options: TransformCSSValueOptions): string;
|
|
5
|
+
//# sourceMappingURL=font-weight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-weight.d.ts","sourceRoot":"","sources":["../../src/css/font-weight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,sCAAsC;AACtC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,EAAE,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAM/G"}
|
package/dist/css/font-weight.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { defaultAliasTransform } from './lib.js';
|
|
2
2
|
/** Convert fontWeight value to CSS */
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export function transformFontWeight(token, options) {
|
|
4
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
5
|
+
if (token.aliasChain?.[0]) {
|
|
6
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
6
7
|
}
|
|
7
|
-
return String(value);
|
|
8
|
+
return String(token.$value);
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=font-weight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-weight.js","sourceRoot":"","sources":["../../src/css/font-weight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-weight.js","sourceRoot":"","sources":["../../src/css/font-weight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,sCAAsC;AACtC,MAAM,UAAU,mBAAmB,CAAC,KAAgC,EAAE,OAAiC;IACrG,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAC;IACtE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/css/gradient.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GradientTokenNormalized } from '../types.js';
|
|
2
2
|
import { type WideGamutColorValue } from './color.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { TransformCSSValueOptions } from './css-types.js';
|
|
4
4
|
/** Convert gradient value to CSS */
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
7
|
-
partialAliasOf?: Partial<Record<keyof GradientStopNormalized, string>>[];
|
|
8
|
-
transformAlias?: IDGenerator;
|
|
9
|
-
color?: {
|
|
10
|
-
legacyHex?: boolean;
|
|
11
|
-
};
|
|
12
|
-
}): string | WideGamutColorValue;
|
|
5
|
+
export declare function transformGradient(token: GradientTokenNormalized, options: TransformCSSValueOptions): string | WideGamutColorValue;
|
|
6
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/css/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,oCAAoC;AACpC,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,wBAAwB,GAChC,MAAM,GAAG,mBAAmB,CAuC9B"}
|
package/dist/css/gradient.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { transformColor } from './color.js';
|
|
2
2
|
import { defaultAliasTransform } from './lib.js';
|
|
3
3
|
/** Convert gradient value to CSS */
|
|
4
|
-
export function
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export function transformGradient(token, options) {
|
|
5
|
+
const { tokensSet, transformAlias = defaultAliasTransform } = options;
|
|
6
|
+
if (token.aliasChain?.[0]) {
|
|
7
|
+
return transformAlias(tokensSet[token.aliasChain[0]]);
|
|
8
|
+
}
|
|
9
|
+
let isHDR = false;
|
|
10
|
+
const colors = [];
|
|
11
|
+
const positions = [];
|
|
12
|
+
for (let i = 0; i < token.$value.length; i++) {
|
|
13
|
+
const { color, position } = token.$value[i];
|
|
14
|
+
const colorValue = token.partialAliasOf?.[i]?.color
|
|
15
|
+
? transformAlias(tokensSet[token.partialAliasOf[i].color])
|
|
16
|
+
: transformColor({ $value: color }, options);
|
|
17
|
+
if (typeof colorValue !== 'string') {
|
|
18
|
+
isHDR = true;
|
|
19
|
+
}
|
|
20
|
+
colors.push(colorValue);
|
|
21
|
+
positions.push(token.partialAliasOf?.[i]?.position
|
|
22
|
+
? transformAlias(tokensSet[token.partialAliasOf[i].position])
|
|
23
|
+
: `${100 * position}%`);
|
|
24
|
+
}
|
|
25
|
+
function formatStop(i, colorKey = '.') {
|
|
26
|
+
return `${typeof colors[i] === 'string' ? colors[i] : colors[i][colorKey]} ${positions[i]}`;
|
|
7
27
|
}
|
|
8
|
-
const colors = value.map(({ color }, i) => partialAliasOf?.[i]?.color
|
|
9
|
-
? transformAlias(partialAliasOf[i].color)
|
|
10
|
-
: transformColorValue(color, { color: colorOptions }));
|
|
11
|
-
const positions = value.map(({ position }, i) => partialAliasOf?.[i]?.position ? transformAlias(String(partialAliasOf[i].position)) : `${100 * position}%`);
|
|
12
|
-
const isHDR = colors.some((c) => typeof c === 'object');
|
|
13
|
-
const formatStop = (index, colorKey = '.') => [
|
|
14
|
-
typeof colors[index] === 'string' ? colors[index] : colors[index][colorKey],
|
|
15
|
-
positions[index],
|
|
16
|
-
].join(' ');
|
|
17
28
|
return !isHDR
|
|
18
|
-
? value.map((_, i) => formatStop(i, positions[i])).join(', ')
|
|
29
|
+
? token.$value.map((_, i) => formatStop(i, positions[i])).join(', ')
|
|
19
30
|
: {
|
|
20
|
-
'.': value.map((_, i) => formatStop(i, '.')).join(', '),
|
|
21
|
-
srgb: value.map((_, i) => formatStop(i, 'srgb')).join(', '),
|
|
22
|
-
p3: value.map((_, i) => formatStop(i, 'p3')).join(', '),
|
|
23
|
-
rec2020: value.map((_, i) => formatStop(i, 'rec2020')).join(', '),
|
|
31
|
+
'.': token.$value.map((_, i) => formatStop(i, '.')).join(', '),
|
|
32
|
+
srgb: token.$value.map((_, i) => formatStop(i, 'srgb')).join(', '),
|
|
33
|
+
p3: token.$value.map((_, i) => formatStop(i, 'p3')).join(', '),
|
|
34
|
+
rec2020: token.$value.map((_, i) => formatStop(i, 'rec2020')).join(', '),
|
|
24
35
|
};
|
|
25
36
|
}
|
|
26
37
|
//# sourceMappingURL=gradient.js.map
|