@tokenami/config 0.0.72 → 0.0.74
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 +2 -2
- package/dist/index.d.cts +30 -25
- package/dist/index.d.ts +30 -25
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -3,51 +3,56 @@ import * as CSS from 'csstype';
|
|
|
3
3
|
interface CSSProperties<TLength = (string & {}) | 0, TTime = string & {}> extends CSS.StandardPropertiesHyphen<TLength, TTime>, CSS.SvgPropertiesHyphen<TLength, TTime> {
|
|
4
4
|
}
|
|
5
5
|
type CSSProperty = keyof CSSProperties;
|
|
6
|
-
type DeepReadonly<T> = T extends Function | any[] ? T : {
|
|
7
|
-
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
8
|
-
};
|
|
9
|
-
type ThemeKey = 'alpha' | 'border' | 'color' | 'ease' | 'font-size' | 'leading' | 'line-style' | 'radii' | 'size' | 'shadow' | 'tracking' | 'transition' | 'weight' | 'z' | (string & {});
|
|
10
|
-
type ThemeValues = Record<string, string | number>;
|
|
11
6
|
type Theme = {
|
|
12
|
-
[themeKey
|
|
7
|
+
[themeKey: string]: {
|
|
8
|
+
[themeToken: string]: string | number;
|
|
9
|
+
};
|
|
13
10
|
};
|
|
14
11
|
type ThemeMode<T = Theme> = {
|
|
15
12
|
[mode: string]: T;
|
|
16
13
|
};
|
|
17
14
|
type ThemeModes<T = Theme> = {
|
|
18
|
-
|
|
15
|
+
root: Theme;
|
|
16
|
+
modes: ThemeMode<T>;
|
|
19
17
|
};
|
|
20
18
|
type ThemeConfig = Theme | ThemeModes;
|
|
21
|
-
type
|
|
22
|
-
|
|
19
|
+
type Responsive = {
|
|
20
|
+
[atRule: string]: string;
|
|
21
|
+
};
|
|
23
22
|
type Selector = string | string[];
|
|
24
|
-
|
|
23
|
+
type Selectors = {
|
|
24
|
+
[name: string]: Selector;
|
|
25
|
+
};
|
|
26
|
+
type Aliases = Record<string, CSSProperty[]>;
|
|
27
|
+
type Properties = Partial<Record<CSSProperty | (string & {}), string[]>>;
|
|
28
|
+
type CustomProperties = Record<string, string[]>;
|
|
29
|
+
type ExactTheme<T> = T extends ThemeModes ? {
|
|
30
|
+
[K in keyof T]: K extends 'root' | 'modes' ? T[K] : never;
|
|
31
|
+
} : {};
|
|
32
|
+
type ExactThemeKey<T> = ('grid' | 'number') | (T extends ThemeModes ? keyof T['modes'][keyof T['modes']] | keyof T['root'] : T extends Theme ? keyof T : string);
|
|
33
|
+
type ExactThemeModes<M> = M extends ThemeMode ? ThemeModes<UnionToIntersection<M[keyof M]>> : {};
|
|
34
|
+
type ExactProperties<P, T> = Partial<Record<keyof P, ExactThemeKey<T>[]>>;
|
|
35
|
+
interface Config<T extends ThemeConfig = ThemeConfig, P extends Properties = Properties, C extends CustomProperties = CustomProperties> {
|
|
25
36
|
include: string[];
|
|
26
37
|
exclude?: string[];
|
|
27
38
|
grid?: string;
|
|
28
39
|
globalStyles?: Record<string, CSS.Properties>;
|
|
29
|
-
responsive?: {
|
|
30
|
-
[atRule: string]: string;
|
|
31
|
-
};
|
|
32
|
-
selectors?: {
|
|
33
|
-
[name: string]: Selector;
|
|
34
|
-
};
|
|
35
40
|
keyframes?: {
|
|
36
41
|
[name: string]: {
|
|
37
42
|
[step: string]: CSS.Properties;
|
|
38
43
|
};
|
|
39
44
|
};
|
|
40
|
-
aliases?: Aliases;
|
|
41
45
|
themeSelector: (mode: string) => Selector;
|
|
42
|
-
theme:
|
|
43
|
-
|
|
46
|
+
theme: T & ExactTheme<T> & ExactThemeModes<T['modes']>;
|
|
47
|
+
responsive?: Responsive;
|
|
48
|
+
selectors?: Selectors;
|
|
49
|
+
aliases?: Aliases;
|
|
50
|
+
properties?: P & ExactProperties<P, T>;
|
|
51
|
+
customProperties?: C & ExactProperties<C, T>;
|
|
44
52
|
}
|
|
45
53
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
46
54
|
type ExactConfig<Shape, T> = T extends Shape ? keyof T extends keyof Shape ? keyof Shape extends keyof T ? T : Shape : Shape : Shape;
|
|
47
|
-
|
|
48
|
-
theme: ThemeModes<UnionToIntersection<M[keyof M]>>;
|
|
49
|
-
} : {};
|
|
50
|
-
declare function createConfig<T>(obj: ExactConfig<Config, T> & (T extends Config ? MatchingThemeModes<T['theme']['modes']> : {})): DeepReadonly<T>;
|
|
55
|
+
declare function createConfig<C extends Config, T extends ThemeConfig, P extends Properties>(config: ExactConfig<Config, C> & Config<T, P>): C;
|
|
51
56
|
|
|
52
57
|
type GridProperty = '--_grid';
|
|
53
58
|
declare const GridProperty: {
|
|
@@ -110,6 +115,6 @@ declare function parseProperty<T extends string>(str: T, options?: {
|
|
|
110
115
|
}): T;
|
|
111
116
|
declare function stringifyProperty<T extends string>(property: T): T;
|
|
112
117
|
|
|
113
|
-
declare const mapShorthandToLonghands: Map<"flex" | "grid" | "all" | "border-block-color" | "border-block-style" | "border-block-width" | "border-inline-color" | "border-inline-style" | "border-inline-width" | "
|
|
118
|
+
declare const mapShorthandToLonghands: Map<"flex" | "grid" | "all" | "border-block-color" | "border-block-style" | "border-block-width" | "border-inline-color" | "border-inline-style" | "border-inline-width" | "font-variant" | "animation" | "background" | "background-position" | "border" | "border-block" | "border-block-end" | "border-block-start" | "border-bottom" | "border-color" | "border-image" | "border-inline" | "border-inline-end" | "border-inline-start" | "border-left" | "border-radius" | "border-right" | "border-style" | "border-top" | "border-width" | "column-rule" | "columns" | "contain-intrinsic-size" | "container" | "flex-flow" | "font" | "gap" | "grid-area" | "grid-column" | "grid-row" | "grid-template" | "inset" | "inset-block" | "inset-inline" | "list-style" | "margin" | "margin-block" | "margin-inline" | "mask" | "mask-border" | "offset" | "outline" | "overflow" | "overscroll-behavior" | "padding" | "padding-block" | "padding-inline" | "place-content" | "place-items" | "place-self" | "scroll-margin" | "scroll-margin-block" | "scroll-margin-inline" | "scroll-padding" | "scroll-padding-block" | "scroll-padding-inline" | "scroll-timeline" | "text-decoration" | "text-emphasis" | "transition", string[]>;
|
|
114
119
|
|
|
115
|
-
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config,
|
|
120
|
+
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config, GridProperty, GridValue, type Theme, type ThemeModes, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, getArbitrarySelector, getCSSPropertiesForAlias, getTokenPropertyName, getTokenPropertyParts, getTokenPropertySplit, getTokenValueParts, gridProperty, mapShorthandToLonghands, parseProperty, parsedTokenProperty, parsedVariantProperty, stringifyProperty, tokenProperty, tokenValue, variantProperty };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,51 +3,56 @@ import * as CSS from 'csstype';
|
|
|
3
3
|
interface CSSProperties<TLength = (string & {}) | 0, TTime = string & {}> extends CSS.StandardPropertiesHyphen<TLength, TTime>, CSS.SvgPropertiesHyphen<TLength, TTime> {
|
|
4
4
|
}
|
|
5
5
|
type CSSProperty = keyof CSSProperties;
|
|
6
|
-
type DeepReadonly<T> = T extends Function | any[] ? T : {
|
|
7
|
-
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
8
|
-
};
|
|
9
|
-
type ThemeKey = 'alpha' | 'border' | 'color' | 'ease' | 'font-size' | 'leading' | 'line-style' | 'radii' | 'size' | 'shadow' | 'tracking' | 'transition' | 'weight' | 'z' | (string & {});
|
|
10
|
-
type ThemeValues = Record<string, string | number>;
|
|
11
6
|
type Theme = {
|
|
12
|
-
[themeKey
|
|
7
|
+
[themeKey: string]: {
|
|
8
|
+
[themeToken: string]: string | number;
|
|
9
|
+
};
|
|
13
10
|
};
|
|
14
11
|
type ThemeMode<T = Theme> = {
|
|
15
12
|
[mode: string]: T;
|
|
16
13
|
};
|
|
17
14
|
type ThemeModes<T = Theme> = {
|
|
18
|
-
|
|
15
|
+
root: Theme;
|
|
16
|
+
modes: ThemeMode<T>;
|
|
19
17
|
};
|
|
20
18
|
type ThemeConfig = Theme | ThemeModes;
|
|
21
|
-
type
|
|
22
|
-
|
|
19
|
+
type Responsive = {
|
|
20
|
+
[atRule: string]: string;
|
|
21
|
+
};
|
|
23
22
|
type Selector = string | string[];
|
|
24
|
-
|
|
23
|
+
type Selectors = {
|
|
24
|
+
[name: string]: Selector;
|
|
25
|
+
};
|
|
26
|
+
type Aliases = Record<string, CSSProperty[]>;
|
|
27
|
+
type Properties = Partial<Record<CSSProperty | (string & {}), string[]>>;
|
|
28
|
+
type CustomProperties = Record<string, string[]>;
|
|
29
|
+
type ExactTheme<T> = T extends ThemeModes ? {
|
|
30
|
+
[K in keyof T]: K extends 'root' | 'modes' ? T[K] : never;
|
|
31
|
+
} : {};
|
|
32
|
+
type ExactThemeKey<T> = ('grid' | 'number') | (T extends ThemeModes ? keyof T['modes'][keyof T['modes']] | keyof T['root'] : T extends Theme ? keyof T : string);
|
|
33
|
+
type ExactThemeModes<M> = M extends ThemeMode ? ThemeModes<UnionToIntersection<M[keyof M]>> : {};
|
|
34
|
+
type ExactProperties<P, T> = Partial<Record<keyof P, ExactThemeKey<T>[]>>;
|
|
35
|
+
interface Config<T extends ThemeConfig = ThemeConfig, P extends Properties = Properties, C extends CustomProperties = CustomProperties> {
|
|
25
36
|
include: string[];
|
|
26
37
|
exclude?: string[];
|
|
27
38
|
grid?: string;
|
|
28
39
|
globalStyles?: Record<string, CSS.Properties>;
|
|
29
|
-
responsive?: {
|
|
30
|
-
[atRule: string]: string;
|
|
31
|
-
};
|
|
32
|
-
selectors?: {
|
|
33
|
-
[name: string]: Selector;
|
|
34
|
-
};
|
|
35
40
|
keyframes?: {
|
|
36
41
|
[name: string]: {
|
|
37
42
|
[step: string]: CSS.Properties;
|
|
38
43
|
};
|
|
39
44
|
};
|
|
40
|
-
aliases?: Aliases;
|
|
41
45
|
themeSelector: (mode: string) => Selector;
|
|
42
|
-
theme:
|
|
43
|
-
|
|
46
|
+
theme: T & ExactTheme<T> & ExactThemeModes<T['modes']>;
|
|
47
|
+
responsive?: Responsive;
|
|
48
|
+
selectors?: Selectors;
|
|
49
|
+
aliases?: Aliases;
|
|
50
|
+
properties?: P & ExactProperties<P, T>;
|
|
51
|
+
customProperties?: C & ExactProperties<C, T>;
|
|
44
52
|
}
|
|
45
53
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
46
54
|
type ExactConfig<Shape, T> = T extends Shape ? keyof T extends keyof Shape ? keyof Shape extends keyof T ? T : Shape : Shape : Shape;
|
|
47
|
-
|
|
48
|
-
theme: ThemeModes<UnionToIntersection<M[keyof M]>>;
|
|
49
|
-
} : {};
|
|
50
|
-
declare function createConfig<T>(obj: ExactConfig<Config, T> & (T extends Config ? MatchingThemeModes<T['theme']['modes']> : {})): DeepReadonly<T>;
|
|
55
|
+
declare function createConfig<C extends Config, T extends ThemeConfig, P extends Properties>(config: ExactConfig<Config, C> & Config<T, P>): C;
|
|
51
56
|
|
|
52
57
|
type GridProperty = '--_grid';
|
|
53
58
|
declare const GridProperty: {
|
|
@@ -110,6 +115,6 @@ declare function parseProperty<T extends string>(str: T, options?: {
|
|
|
110
115
|
}): T;
|
|
111
116
|
declare function stringifyProperty<T extends string>(property: T): T;
|
|
112
117
|
|
|
113
|
-
declare const mapShorthandToLonghands: Map<"flex" | "grid" | "all" | "border-block-color" | "border-block-style" | "border-block-width" | "border-inline-color" | "border-inline-style" | "border-inline-width" | "
|
|
118
|
+
declare const mapShorthandToLonghands: Map<"flex" | "grid" | "all" | "border-block-color" | "border-block-style" | "border-block-width" | "border-inline-color" | "border-inline-style" | "border-inline-width" | "font-variant" | "animation" | "background" | "background-position" | "border" | "border-block" | "border-block-end" | "border-block-start" | "border-bottom" | "border-color" | "border-image" | "border-inline" | "border-inline-end" | "border-inline-start" | "border-left" | "border-radius" | "border-right" | "border-style" | "border-top" | "border-width" | "column-rule" | "columns" | "contain-intrinsic-size" | "container" | "flex-flow" | "font" | "gap" | "grid-area" | "grid-column" | "grid-row" | "grid-template" | "inset" | "inset-block" | "inset-inline" | "list-style" | "margin" | "margin-block" | "margin-inline" | "mask" | "mask-border" | "offset" | "outline" | "overflow" | "overscroll-behavior" | "padding" | "padding-block" | "padding-inline" | "place-content" | "place-items" | "place-self" | "scroll-margin" | "scroll-margin-block" | "scroll-margin-inline" | "scroll-padding" | "scroll-padding-block" | "scroll-padding-inline" | "scroll-timeline" | "text-decoration" | "text-emphasis" | "transition", string[]>;
|
|
114
119
|
|
|
115
|
-
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config,
|
|
120
|
+
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config, GridProperty, GridValue, type Theme, type ThemeModes, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, getArbitrarySelector, getCSSPropertiesForAlias, getTokenPropertyName, getTokenPropertyParts, getTokenPropertySplit, getTokenValueParts, gridProperty, mapShorthandToLonghands, parseProperty, parsedTokenProperty, parsedVariantProperty, stringifyProperty, tokenProperty, tokenValue, variantProperty };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"tsup": "^7.0.0",
|
|
39
39
|
"typescript": "^5.1.3"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "eab35bee7eb2892db9a5ada8fe8fd8ee0fa16708"
|
|
42
42
|
}
|