@tokenami/css 0.0.29 → 0.0.31
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.cjs +4 -7
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +4 -7
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -48,10 +48,9 @@ var css = (baseStyles, ...overrides) => {
|
|
|
48
48
|
const cached = cache[cacheId];
|
|
49
49
|
if (cached)
|
|
50
50
|
return cached;
|
|
51
|
-
[baseStyles, ...overrides].forEach((
|
|
52
|
-
if (!
|
|
51
|
+
[baseStyles, ...overrides].forEach((overrideStyle) => {
|
|
52
|
+
if (!overrideStyle)
|
|
53
53
|
return;
|
|
54
|
-
let overrideStyle = Object.assign({}, originalOverrideStyle);
|
|
55
54
|
Object.entries(overrideStyle).forEach(([key, value]) => {
|
|
56
55
|
if (!Tokenami.TokenProperty.safeParse(key).success)
|
|
57
56
|
return;
|
|
@@ -60,17 +59,15 @@ var css = (baseStyles, ...overrides) => {
|
|
|
60
59
|
const cssProperties = Tokenami.getCSSPropertiesForAlias(parts.alias, css[_ALIASES]);
|
|
61
60
|
cssProperties.forEach((cssProperty) => {
|
|
62
61
|
const tokenPropertyLong = createTokenProperty(tokenProperty2, cssProperty);
|
|
63
|
-
delete overrideStyle[tokenProperty2];
|
|
64
62
|
overrideLonghands(overriddenStyles, tokenPropertyLong);
|
|
65
63
|
if (typeof value === "number" && value > 0) {
|
|
66
64
|
const gridVar = Tokenami.gridProperty();
|
|
67
|
-
|
|
65
|
+
overriddenStyles[tokenPropertyLong] = `calc(var(${gridVar}) * ${value})`;
|
|
68
66
|
} else {
|
|
69
|
-
|
|
67
|
+
overriddenStyles[tokenPropertyLong] = value;
|
|
70
68
|
}
|
|
71
69
|
});
|
|
72
70
|
});
|
|
73
|
-
Object.assign(overriddenStyles, overrideStyle);
|
|
74
71
|
});
|
|
75
72
|
cache[cacheId] = overriddenStyles;
|
|
76
73
|
return overriddenStyles;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { TokenamiProperties, TokenamiFinalConfig } from '@tokenami/dev';
|
|
1
2
|
import * as Tokenami from '@tokenami/config';
|
|
2
3
|
export { createConfig, defaultConfig } from '@tokenami/config';
|
|
3
|
-
import { TokenamiProperties, TokenamiFinalConfig } from '@tokenami/dev';
|
|
4
4
|
|
|
5
5
|
declare const _ALIASES: unique symbol;
|
|
6
|
+
type TokenamiCSS = {
|
|
7
|
+
[_: symbol]: 'TokenamiCSS';
|
|
8
|
+
};
|
|
6
9
|
type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
|
|
7
10
|
type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
|
|
8
11
|
type ReponsiveKey = Extract<keyof TokenamiFinalConfig['responsive'], string>;
|
|
9
12
|
type ResponsiveValue<T> = T extends string ? `${ReponsiveKey}_${T}` : never;
|
|
10
|
-
type Override = TokenamiProperties | false | undefined;
|
|
13
|
+
type Override = TokenamiProperties | TokenamiCSS | false | undefined;
|
|
11
14
|
type Variants$1<C> = undefined extends C ? {} : {
|
|
12
15
|
[V in keyof C]?: VariantValue<keyof C[V]>;
|
|
13
16
|
};
|
|
@@ -22,12 +25,15 @@ type ComposeCSS<V, R> = TokenamiProperties & {
|
|
|
22
25
|
};
|
|
23
26
|
interface CSS {
|
|
24
27
|
[_ALIASES]?: Tokenami.Aliases;
|
|
25
|
-
(baseStyles: TokenamiProperties, ...overrides: Override[]):
|
|
26
|
-
compose: <V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(config: ComposeCSS<V, R>) => (selectedVariants?: Variants$1<V> & Variants$1<R> & ResponsiveVariants<R>, ...overrides: Override[]) =>
|
|
28
|
+
(baseStyles: TokenamiProperties, ...overrides: Override[]): TokenamiCSS;
|
|
29
|
+
compose: <V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(config: ComposeCSS<V, R>) => (selectedVariants?: Variants$1<V> & Variants$1<R> & ResponsiveVariants<R>, ...overrides: Override[]) => TokenamiCSS;
|
|
27
30
|
}
|
|
28
31
|
declare const css: CSS;
|
|
29
32
|
declare function createCss(config: Tokenami.Config): CSS;
|
|
30
33
|
|
|
34
|
+
type TokenamiStyle<P> = {
|
|
35
|
+
[K in keyof P]: K extends 'style' ? TokenamiCSS & P[K] : P[K];
|
|
36
|
+
};
|
|
31
37
|
type Variants<T extends () => {}> = Parameters<T>[0] extends undefined | null ? {} : NonNullable<Parameters<T>[0]>;
|
|
32
38
|
|
|
33
|
-
export { type Variants, createCss, css };
|
|
39
|
+
export { type TokenamiStyle, type Variants, createCss, css };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { TokenamiProperties, TokenamiFinalConfig } from '@tokenami/dev';
|
|
1
2
|
import * as Tokenami from '@tokenami/config';
|
|
2
3
|
export { createConfig, defaultConfig } from '@tokenami/config';
|
|
3
|
-
import { TokenamiProperties, TokenamiFinalConfig } from '@tokenami/dev';
|
|
4
4
|
|
|
5
5
|
declare const _ALIASES: unique symbol;
|
|
6
|
+
type TokenamiCSS = {
|
|
7
|
+
[_: symbol]: 'TokenamiCSS';
|
|
8
|
+
};
|
|
6
9
|
type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
|
|
7
10
|
type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
|
|
8
11
|
type ReponsiveKey = Extract<keyof TokenamiFinalConfig['responsive'], string>;
|
|
9
12
|
type ResponsiveValue<T> = T extends string ? `${ReponsiveKey}_${T}` : never;
|
|
10
|
-
type Override = TokenamiProperties | false | undefined;
|
|
13
|
+
type Override = TokenamiProperties | TokenamiCSS | false | undefined;
|
|
11
14
|
type Variants$1<C> = undefined extends C ? {} : {
|
|
12
15
|
[V in keyof C]?: VariantValue<keyof C[V]>;
|
|
13
16
|
};
|
|
@@ -22,12 +25,15 @@ type ComposeCSS<V, R> = TokenamiProperties & {
|
|
|
22
25
|
};
|
|
23
26
|
interface CSS {
|
|
24
27
|
[_ALIASES]?: Tokenami.Aliases;
|
|
25
|
-
(baseStyles: TokenamiProperties, ...overrides: Override[]):
|
|
26
|
-
compose: <V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(config: ComposeCSS<V, R>) => (selectedVariants?: Variants$1<V> & Variants$1<R> & ResponsiveVariants<R>, ...overrides: Override[]) =>
|
|
28
|
+
(baseStyles: TokenamiProperties, ...overrides: Override[]): TokenamiCSS;
|
|
29
|
+
compose: <V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(config: ComposeCSS<V, R>) => (selectedVariants?: Variants$1<V> & Variants$1<R> & ResponsiveVariants<R>, ...overrides: Override[]) => TokenamiCSS;
|
|
27
30
|
}
|
|
28
31
|
declare const css: CSS;
|
|
29
32
|
declare function createCss(config: Tokenami.Config): CSS;
|
|
30
33
|
|
|
34
|
+
type TokenamiStyle<P> = {
|
|
35
|
+
[K in keyof P]: K extends 'style' ? TokenamiCSS & P[K] : P[K];
|
|
36
|
+
};
|
|
31
37
|
type Variants<T extends () => {}> = Parameters<T>[0] extends undefined | null ? {} : NonNullable<Parameters<T>[0]>;
|
|
32
38
|
|
|
33
|
-
export { type Variants, createCss, css };
|
|
39
|
+
export { type TokenamiStyle, type Variants, createCss, css };
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,9 @@ var css = (baseStyles, ...overrides) => {
|
|
|
11
11
|
const cached = cache[cacheId];
|
|
12
12
|
if (cached)
|
|
13
13
|
return cached;
|
|
14
|
-
[baseStyles, ...overrides].forEach((
|
|
15
|
-
if (!
|
|
14
|
+
[baseStyles, ...overrides].forEach((overrideStyle) => {
|
|
15
|
+
if (!overrideStyle)
|
|
16
16
|
return;
|
|
17
|
-
let overrideStyle = Object.assign({}, originalOverrideStyle);
|
|
18
17
|
Object.entries(overrideStyle).forEach(([key, value]) => {
|
|
19
18
|
if (!Tokenami.TokenProperty.safeParse(key).success)
|
|
20
19
|
return;
|
|
@@ -23,17 +22,15 @@ var css = (baseStyles, ...overrides) => {
|
|
|
23
22
|
const cssProperties = Tokenami.getCSSPropertiesForAlias(parts.alias, css[_ALIASES]);
|
|
24
23
|
cssProperties.forEach((cssProperty) => {
|
|
25
24
|
const tokenPropertyLong = createTokenProperty(tokenProperty2, cssProperty);
|
|
26
|
-
delete overrideStyle[tokenProperty2];
|
|
27
25
|
overrideLonghands(overriddenStyles, tokenPropertyLong);
|
|
28
26
|
if (typeof value === "number" && value > 0) {
|
|
29
27
|
const gridVar = Tokenami.gridProperty();
|
|
30
|
-
|
|
28
|
+
overriddenStyles[tokenPropertyLong] = `calc(var(${gridVar}) * ${value})`;
|
|
31
29
|
} else {
|
|
32
|
-
|
|
30
|
+
overriddenStyles[tokenPropertyLong] = value;
|
|
33
31
|
}
|
|
34
32
|
});
|
|
35
33
|
});
|
|
36
|
-
Object.assign(overriddenStyles, overrideStyle);
|
|
37
34
|
});
|
|
38
35
|
cache[cacheId] = overriddenStyles;
|
|
39
36
|
return overriddenStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@tokenami/config": "0.0.
|
|
15
|
+
"@tokenami/config": "0.0.31"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tsup": "^7.0.0",
|
|
19
19
|
"typescript": "^5.1.3",
|
|
20
20
|
"vitest": "^0.34.6",
|
|
21
|
-
"@tokenami/dev": "0.0.
|
|
21
|
+
"@tokenami/dev": "0.0.31"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typescript": ">= 5",
|
|
25
|
-
"@tokenami/dev": "0.0.
|
|
25
|
+
"@tokenami/dev": "0.0.31"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|