@tokenami/config 0.0.72 → 0.0.73
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 +28 -25
- package/dist/index.d.ts +28 -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,54 @@ 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 ExactTheme<T> = T extends ThemeModes ? {
|
|
29
|
+
[K in keyof T]: K extends 'root' | 'modes' ? T[K] : never;
|
|
30
|
+
} : {};
|
|
31
|
+
type ExactThemeKey<T> = ('grid' | 'number') | (T extends ThemeModes ? keyof T['modes'][keyof T['modes']] | keyof T['root'] : T extends Theme ? keyof T : string);
|
|
32
|
+
type ExactThemeModes<M> = M extends ThemeMode ? ThemeModes<UnionToIntersection<M[keyof M]>> : {};
|
|
33
|
+
type ExactProperties<P, T> = Partial<Record<keyof P, ExactThemeKey<T>[]>>;
|
|
34
|
+
interface Config<T extends ThemeConfig = ThemeConfig, P extends Properties = Properties> {
|
|
25
35
|
include: string[];
|
|
26
36
|
exclude?: string[];
|
|
27
37
|
grid?: string;
|
|
28
38
|
globalStyles?: Record<string, CSS.Properties>;
|
|
29
|
-
responsive?: {
|
|
30
|
-
[atRule: string]: string;
|
|
31
|
-
};
|
|
32
|
-
selectors?: {
|
|
33
|
-
[name: string]: Selector;
|
|
34
|
-
};
|
|
35
39
|
keyframes?: {
|
|
36
40
|
[name: string]: {
|
|
37
41
|
[step: string]: CSS.Properties;
|
|
38
42
|
};
|
|
39
43
|
};
|
|
40
|
-
aliases?: Aliases;
|
|
41
44
|
themeSelector: (mode: string) => Selector;
|
|
42
|
-
theme:
|
|
43
|
-
|
|
45
|
+
theme: T & ExactTheme<T> & ExactThemeModes<T['modes']>;
|
|
46
|
+
responsive?: Responsive;
|
|
47
|
+
selectors?: Selectors;
|
|
48
|
+
aliases?: Aliases;
|
|
49
|
+
properties?: P & ExactProperties<P, T>;
|
|
44
50
|
}
|
|
45
51
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
46
52
|
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>;
|
|
53
|
+
declare function createConfig<C extends Config, T extends ThemeConfig, P extends Properties>(config: ExactConfig<Config, C> & Config<T, P>): C;
|
|
51
54
|
|
|
52
55
|
type GridProperty = '--_grid';
|
|
53
56
|
declare const GridProperty: {
|
|
@@ -110,6 +113,6 @@ declare function parseProperty<T extends string>(str: T, options?: {
|
|
|
110
113
|
}): T;
|
|
111
114
|
declare function stringifyProperty<T extends string>(property: T): T;
|
|
112
115
|
|
|
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" | "
|
|
116
|
+
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
117
|
|
|
115
|
-
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config,
|
|
118
|
+
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,54 @@ 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 ExactTheme<T> = T extends ThemeModes ? {
|
|
29
|
+
[K in keyof T]: K extends 'root' | 'modes' ? T[K] : never;
|
|
30
|
+
} : {};
|
|
31
|
+
type ExactThemeKey<T> = ('grid' | 'number') | (T extends ThemeModes ? keyof T['modes'][keyof T['modes']] | keyof T['root'] : T extends Theme ? keyof T : string);
|
|
32
|
+
type ExactThemeModes<M> = M extends ThemeMode ? ThemeModes<UnionToIntersection<M[keyof M]>> : {};
|
|
33
|
+
type ExactProperties<P, T> = Partial<Record<keyof P, ExactThemeKey<T>[]>>;
|
|
34
|
+
interface Config<T extends ThemeConfig = ThemeConfig, P extends Properties = Properties> {
|
|
25
35
|
include: string[];
|
|
26
36
|
exclude?: string[];
|
|
27
37
|
grid?: string;
|
|
28
38
|
globalStyles?: Record<string, CSS.Properties>;
|
|
29
|
-
responsive?: {
|
|
30
|
-
[atRule: string]: string;
|
|
31
|
-
};
|
|
32
|
-
selectors?: {
|
|
33
|
-
[name: string]: Selector;
|
|
34
|
-
};
|
|
35
39
|
keyframes?: {
|
|
36
40
|
[name: string]: {
|
|
37
41
|
[step: string]: CSS.Properties;
|
|
38
42
|
};
|
|
39
43
|
};
|
|
40
|
-
aliases?: Aliases;
|
|
41
44
|
themeSelector: (mode: string) => Selector;
|
|
42
|
-
theme:
|
|
43
|
-
|
|
45
|
+
theme: T & ExactTheme<T> & ExactThemeModes<T['modes']>;
|
|
46
|
+
responsive?: Responsive;
|
|
47
|
+
selectors?: Selectors;
|
|
48
|
+
aliases?: Aliases;
|
|
49
|
+
properties?: P & ExactProperties<P, T>;
|
|
44
50
|
}
|
|
45
51
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
46
52
|
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>;
|
|
53
|
+
declare function createConfig<C extends Config, T extends ThemeConfig, P extends Properties>(config: ExactConfig<Config, C> & Config<T, P>): C;
|
|
51
54
|
|
|
52
55
|
type GridProperty = '--_grid';
|
|
53
56
|
declare const GridProperty: {
|
|
@@ -110,6 +113,6 @@ declare function parseProperty<T extends string>(str: T, options?: {
|
|
|
110
113
|
}): T;
|
|
111
114
|
declare function stringifyProperty<T extends string>(property: T): T;
|
|
112
115
|
|
|
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" | "
|
|
116
|
+
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
117
|
|
|
115
|
-
export { type Aliases, ArbitraryValue, type CSSProperties, type CSSProperty, type Config,
|
|
118
|
+
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.73",
|
|
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": "9635ef203a3075788c4736b48f84114b6752ece7"
|
|
42
42
|
}
|