@tokenami/css 0.0.86 → 0.0.87--canary.448.17593598259.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/dist/index.cjs CHANGED
@@ -85,7 +85,8 @@ function createCss(config, options = { escapeSpecialChars: true }) {
85
85
  }
86
86
  }
87
87
  for (const [key, variant] of selectedVariantsEntries) {
88
- const variantValue = variants?.[key]?.[variant];
88
+ const variantGroup = variants?.[key];
89
+ const variantValue = variantGroup?.[variant];
89
90
  if (variantValue) variantStyles.push(variantValue);
90
91
  }
91
92
  const result = [
package/dist/index.d.cts CHANGED
@@ -6,18 +6,22 @@ export { Config, createConfig } from '@tokenami/config';
6
6
  type TokenamiCSS = {
7
7
  [_: symbol]: TokenamiProperties;
8
8
  };
9
- type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
9
+ type VariantsConfig<T> = {
10
+ [K in keyof T]: {
11
+ [V in keyof T[K]]: TokenamiProperties;
12
+ };
13
+ };
10
14
  type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
11
15
  type Override = TokenamiProperties | TokenamiCSS | false | undefined;
12
16
  type ClassName = string | undefined | null | false;
13
17
  type Variants$1<C> = undefined extends C ? {} : {
14
18
  [V in keyof C]?: VariantValue<keyof C[V]>;
15
19
  };
16
- type TokenamiComposeInput<V, R> = TokenamiProperties & {
20
+ type TokenamiComposeInput<T> = TokenamiProperties & {
17
21
  includes?: (TokenamiComposeResult<any> | TokenamiCSS)[];
18
- variants?: V & VariantsConfig;
22
+ variants?: VariantsConfig<T>;
19
23
  };
20
- type TokenamiComposeResult<V> = (selectedVariants?: Variants$1<V>) => [cn: (...classNames: ClassName[]) => string, style: (...overrides: Override[]) => TokenamiCSS];
24
+ type TokenamiComposeResult<T> = (selectedVariants?: Variants$1<T>) => [cn: (...classNames: ClassName[]) => string, style: (...overrides: Override[]) => TokenamiCSS];
21
25
  type CreateCssOptions = {
22
26
  /**
23
27
  * When using arbitrary values, Tokenami will escape special characters. Some frameworks
@@ -30,15 +34,15 @@ type CreateCssOptions = {
30
34
  };
31
35
  declare function createCss(config: Pick<Tokenami.Config, 'aliases'>, options?: CreateCssOptions): {
32
36
  (allStyles_0: TokenamiProperties, ...allStyles_1: Override[]): TokenamiCSS;
33
- compose<V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(styleConfig: TokenamiComposeInput<V, R>): TokenamiComposeResult<V>;
37
+ compose<T>(styleConfig: TokenamiComposeInput<T>): TokenamiComposeResult<T>;
34
38
  };
35
39
  declare const css: {
36
40
  (allStyles_0: TokenamiProperties, ...allStyles_1: Override[]): TokenamiCSS;
37
- compose<V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(styleConfig: TokenamiComposeInput<V, R>): TokenamiComposeResult<V>;
41
+ compose<T>(styleConfig: TokenamiComposeInput<T>): TokenamiComposeResult<T>;
38
42
  };
39
43
 
40
- type TokenamiStyle<P> = Omit<P, 'style'> & {
41
- style?: (TokenamiProperties | TokenamiCSS) & ('style' extends keyof P ? P['style'] : {});
44
+ type TokenamiStyle<P> = P & {
45
+ style?: TokenamiProperties | TokenamiCSS;
42
46
  };
43
47
  type Variants<T extends (...args: any) => any> = Parameters<T>[0] extends undefined | null ? {} : NonNullable<Parameters<T>[0]>;
44
48
 
package/dist/index.d.ts CHANGED
@@ -6,18 +6,22 @@ export { Config, createConfig } from '@tokenami/config';
6
6
  type TokenamiCSS = {
7
7
  [_: symbol]: TokenamiProperties;
8
8
  };
9
- type VariantsConfig = Record<string, Record<string, TokenamiProperties>>;
9
+ type VariantsConfig<T> = {
10
+ [K in keyof T]: {
11
+ [V in keyof T[K]]: TokenamiProperties;
12
+ };
13
+ };
10
14
  type VariantValue<T> = T extends 'true' | 'false' ? boolean : T;
11
15
  type Override = TokenamiProperties | TokenamiCSS | false | undefined;
12
16
  type ClassName = string | undefined | null | false;
13
17
  type Variants$1<C> = undefined extends C ? {} : {
14
18
  [V in keyof C]?: VariantValue<keyof C[V]>;
15
19
  };
16
- type TokenamiComposeInput<V, R> = TokenamiProperties & {
20
+ type TokenamiComposeInput<T> = TokenamiProperties & {
17
21
  includes?: (TokenamiComposeResult<any> | TokenamiCSS)[];
18
- variants?: V & VariantsConfig;
22
+ variants?: VariantsConfig<T>;
19
23
  };
20
- type TokenamiComposeResult<V> = (selectedVariants?: Variants$1<V>) => [cn: (...classNames: ClassName[]) => string, style: (...overrides: Override[]) => TokenamiCSS];
24
+ type TokenamiComposeResult<T> = (selectedVariants?: Variants$1<T>) => [cn: (...classNames: ClassName[]) => string, style: (...overrides: Override[]) => TokenamiCSS];
21
25
  type CreateCssOptions = {
22
26
  /**
23
27
  * When using arbitrary values, Tokenami will escape special characters. Some frameworks
@@ -30,15 +34,15 @@ type CreateCssOptions = {
30
34
  };
31
35
  declare function createCss(config: Pick<Tokenami.Config, 'aliases'>, options?: CreateCssOptions): {
32
36
  (allStyles_0: TokenamiProperties, ...allStyles_1: Override[]): TokenamiCSS;
33
- compose<V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(styleConfig: TokenamiComposeInput<V, R>): TokenamiComposeResult<V>;
37
+ compose<T>(styleConfig: TokenamiComposeInput<T>): TokenamiComposeResult<T>;
34
38
  };
35
39
  declare const css: {
36
40
  (allStyles_0: TokenamiProperties, ...allStyles_1: Override[]): TokenamiCSS;
37
- compose<V extends VariantsConfig | undefined, R extends VariantsConfig | undefined>(styleConfig: TokenamiComposeInput<V, R>): TokenamiComposeResult<V>;
41
+ compose<T>(styleConfig: TokenamiComposeInput<T>): TokenamiComposeResult<T>;
38
42
  };
39
43
 
40
- type TokenamiStyle<P> = Omit<P, 'style'> & {
41
- style?: (TokenamiProperties | TokenamiCSS) & ('style' extends keyof P ? P['style'] : {});
44
+ type TokenamiStyle<P> = P & {
45
+ style?: TokenamiProperties | TokenamiCSS;
42
46
  };
43
47
  type Variants<T extends (...args: any) => any> = Parameters<T>[0] extends undefined | null ? {} : NonNullable<Parameters<T>[0]>;
44
48
 
package/dist/index.js CHANGED
@@ -64,7 +64,8 @@ function createCss(config, options = { escapeSpecialChars: true }) {
64
64
  }
65
65
  }
66
66
  for (const [key, variant] of selectedVariantsEntries) {
67
- const variantValue = variants?.[key]?.[variant];
67
+ const variantGroup = variants?.[key];
68
+ const variantValue = variantGroup?.[variant];
68
69
  if (variantValue) variantStyles.push(variantValue);
69
70
  }
70
71
  const result = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenami/css",
3
- "version": "0.0.86",
3
+ "version": "0.0.87--canary.448.17593598259.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -34,10 +34,10 @@
34
34
  "test:watch": "vitest"
35
35
  },
36
36
  "dependencies": {
37
- "@tokenami/config": "0.0.86"
37
+ "@tokenami/config": "0.0.87--canary.448.17593598259.0"
38
38
  },
39
39
  "devDependencies": {
40
- "tokenami": "0.0.86",
40
+ "tokenami": "0.0.87--canary.448.17593598259.0",
41
41
  "tsup": "^8.4.0",
42
42
  "typescript": "^5.1.3",
43
43
  "vitest": "^0.34.6"
@@ -46,5 +46,5 @@
46
46
  "tokenami": ">= 0",
47
47
  "typescript": ">= 5"
48
48
  },
49
- "gitHead": "64d6c13c0642c7cc87506fce129208a29f1167a3"
49
+ "gitHead": "0bdc08f4447cd101fd9ed3d8da7ecc7b1971152c"
50
50
  }