@windi-ui/core 0.7.1 → 0.8.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/README.md +229 -0
- package/dist/badge-B-3Z5qKd.mjs +54 -0
- package/dist/badge-DP_7SF0i.cjs +71 -0
- package/dist/components.cjs +5 -58
- package/dist/components.d.cts +3 -9
- package/dist/components.d.mts +3 -9
- package/dist/components.mjs +1 -54
- package/dist/index.cjs +1136 -656
- package/dist/index.d.cts +12 -45
- package/dist/index.d.mts +12 -45
- package/dist/index.mjs +1133 -655
- package/dist/nuxt-ui-CvNwRMiY.cjs +104 -0
- package/dist/nuxt-ui-S3tspIeQ.mjs +93 -0
- package/dist/presets.cjs +4 -0
- package/dist/presets.d.cts +4 -0
- package/dist/presets.d.mts +4 -0
- package/dist/presets.mjs +1 -0
- package/dist/types-7pMUZGLb.d.mts +415 -0
- package/dist/vars-D-T56h9H.d.cts +415 -0
- package/package.json +14 -12
- package/dist/components.d.ts +0 -11
- package/dist/index.d.ts +0 -46
- package/dist/shared/core.BBBw5V2R.d.cts +0 -182
- package/dist/shared/core.BBBw5V2R.d.mts +0 -182
- package/dist/shared/core.BBBw5V2R.d.ts +0 -182
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Properties as Properties$1, Pseudos, AdvancedPseudos, AtRule, AtRules, DataType, Property, PropertyValue, SimplePseudos } from 'csstype';
|
|
2
|
-
|
|
3
|
-
type Expand<T, TKey extends string | number | symbol = string, TValue = any> = T & Record<TKey, TValue>;
|
|
4
|
-
declare module 'csstype' {
|
|
5
|
-
interface Properties<TLength, TTime> {
|
|
6
|
-
[key: string]: string | number | Properties<TLength, TTime>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
type Properties = Properties$1<string>;
|
|
10
|
-
type Rules = Record<string, Properties>;
|
|
11
|
-
type ExpandedPseudos = Expand<Partial<Record<Pseudos, Properties>>, string, Properties>;
|
|
12
|
-
|
|
13
|
-
declare const css_AdvancedPseudos: typeof AdvancedPseudos;
|
|
14
|
-
declare const css_AtRule: typeof AtRule;
|
|
15
|
-
declare const css_AtRules: typeof AtRules;
|
|
16
|
-
declare const css_DataType: typeof DataType;
|
|
17
|
-
type css_ExpandedPseudos = ExpandedPseudos;
|
|
18
|
-
type css_Properties = Properties;
|
|
19
|
-
declare const css_Property: typeof Property;
|
|
20
|
-
declare const css_PropertyValue: typeof PropertyValue;
|
|
21
|
-
declare const css_Pseudos: typeof Pseudos;
|
|
22
|
-
type css_Rules = Rules;
|
|
23
|
-
declare const css_SimplePseudos: typeof SimplePseudos;
|
|
24
|
-
declare namespace css {
|
|
25
|
-
export { css_AdvancedPseudos as AdvancedPseudos, css_AtRule as AtRule, css_AtRules as AtRules, css_DataType as DataType, css_Property as Property, css_PropertyValue as PropertyValue, css_Pseudos as Pseudos, css_SimplePseudos as SimplePseudos };
|
|
26
|
-
export type { css_ExpandedPseudos as ExpandedPseudos, css_Properties as Properties, css_Rules as Rules };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type FontSize = string | [
|
|
30
|
-
string,
|
|
31
|
-
string | {
|
|
32
|
-
lineHeight?: string;
|
|
33
|
-
letterSpacing?: string;
|
|
34
|
-
fontWeight?: string;
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
interface ThemeProvider {
|
|
38
|
-
colors(): Record<string, string>;
|
|
39
|
-
colors(name: string): string | Record<string, string>;
|
|
40
|
-
spacing(name: string): string;
|
|
41
|
-
fontSize(name: string): FontSize;
|
|
42
|
-
applyTextColor(value: string, target: Properties, alpha?: string): void;
|
|
43
|
-
applyBackgroundColor(value: string, target: Properties, alpha?: string): void;
|
|
44
|
-
applyBorderColor(value: string, target: Properties, alpha?: string): void;
|
|
45
|
-
colorValue(value: string, alpha?: number | string): string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface BuilderContext {
|
|
49
|
-
readonly vars: VarsProvider;
|
|
50
|
-
readonly theme: ThemeProvider;
|
|
51
|
-
}
|
|
52
|
-
declare abstract class BuilderBase<T, TContext extends BuilderContext> {
|
|
53
|
-
protected readonly ctx: TContext;
|
|
54
|
-
protected readonly abstract items: Map<string, T>;
|
|
55
|
-
constructor(ctx: TContext);
|
|
56
|
-
protected get vars(): VarsProvider;
|
|
57
|
-
protected get theme(): ThemeProvider;
|
|
58
|
-
names(): string[];
|
|
59
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
60
|
-
update(name: string, builder: (element: T, ctx: TContext) => T | void): void;
|
|
61
|
-
remove(name: string): void;
|
|
62
|
-
}
|
|
63
|
-
declare abstract class VarsGeneratorBase<T, TVars, TContext extends BuilderContext = BuilderContext> extends BuilderBase<T, TContext> {
|
|
64
|
-
constructor(ctx: TContext);
|
|
65
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
66
|
-
remove(name: string): void;
|
|
67
|
-
abstract cssVars(name: string): TVars;
|
|
68
|
-
rootVars(): TVars;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type ColorShade = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
|
|
72
|
-
type ExColorShade = ColorShade | `default-${ColorShade}` | `accent-${ColorShade}` | 'black' | 'white';
|
|
73
|
-
type ColorVars = Record<CSSVarName<'c'>, string>;
|
|
74
|
-
interface ColorContext {
|
|
75
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
76
|
-
}
|
|
77
|
-
declare class ColorsGenerator extends VarsGeneratorBase<Map<ColorShade, string>, ColorVars> implements ColorContext {
|
|
78
|
-
private readonly colors;
|
|
79
|
-
protected readonly items: Map<string, Map<ColorShade, string>>;
|
|
80
|
-
constructor(ctx: BuilderContext);
|
|
81
|
-
names(): string[];
|
|
82
|
-
cssVars(name: string): Record<`--${string}-c-${string}`, string>;
|
|
83
|
-
rootVars(): ColorVars;
|
|
84
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
type SizeVars = Record<CSSVarName<'s'>, string>;
|
|
88
|
-
type SizeProperty = 'text' | `spacing-${keyof Size['spacing']}` | 'line-height';
|
|
89
|
-
type Size = {
|
|
90
|
-
spacing: {
|
|
91
|
-
'1': string;
|
|
92
|
-
'1.5': string;
|
|
93
|
-
'2': string;
|
|
94
|
-
'3': string;
|
|
95
|
-
'4': string;
|
|
96
|
-
};
|
|
97
|
-
text: FontSize;
|
|
98
|
-
};
|
|
99
|
-
declare class SizesGenerator extends VarsGeneratorBase<Size, SizeVars> {
|
|
100
|
-
protected readonly items: Map<string, Size>;
|
|
101
|
-
constructor(ctx: BuilderContext);
|
|
102
|
-
cssVars(name: string): SizeVars;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type VariantVars = Record<CSSVarName<'v'>, string>;
|
|
106
|
-
type VariantPropValue = CSSVarValue<'c'> | CSSVarValue<'v'>;
|
|
107
|
-
type OpacityValue = '1' | '0' | `0.${number}`;
|
|
108
|
-
interface VariantProperties {
|
|
109
|
-
'bg': VariantPropValue;
|
|
110
|
-
'bg-soft'?: VariantPropValue;
|
|
111
|
-
'bg-muted'?: VariantPropValue;
|
|
112
|
-
'bg-accent'?: VariantPropValue;
|
|
113
|
-
'bg-opacity'?: OpacityValue;
|
|
114
|
-
'border': VariantPropValue;
|
|
115
|
-
'border-soft'?: VariantPropValue;
|
|
116
|
-
'border-muted'?: VariantPropValue;
|
|
117
|
-
'border-accent'?: VariantPropValue;
|
|
118
|
-
'border-opacity'?: OpacityValue;
|
|
119
|
-
'fg': VariantPropValue;
|
|
120
|
-
'fg-soft'?: VariantPropValue;
|
|
121
|
-
'fg-muted'?: VariantPropValue;
|
|
122
|
-
'fg-accent'?: VariantPropValue;
|
|
123
|
-
'fg-opacity'?: OpacityValue;
|
|
124
|
-
}
|
|
125
|
-
type VariantPseudos = Partial<Record<SimplePseudos, Partial<VariantProperties>>>;
|
|
126
|
-
interface Variant extends VariantProperties {
|
|
127
|
-
pseudos?: VariantPseudos;
|
|
128
|
-
dark?: Omit<Partial<Variant>, 'dark'>;
|
|
129
|
-
}
|
|
130
|
-
type VariantProperty = keyof VariantProperties | `${keyof VariantProperties}-${SimplePseudos}`;
|
|
131
|
-
type ApplyVariantMainProp = 'bg' | 'border' | 'text';
|
|
132
|
-
type ApplyVariantSubProp = 'soft' | 'muted' | 'accent' | 'default';
|
|
133
|
-
type ApplyVariantProp = ApplyVariantMainProp | `${ApplyVariantMainProp}-${Exclude<ApplyVariantSubProp, 'default'>}`;
|
|
134
|
-
type ApplyVariant = boolean | ApplyVariantProp[];
|
|
135
|
-
type ApplyVariantPseudos = Partial<Record<SimplePseudos, ApplyVariant>> | SimplePseudos[] | false;
|
|
136
|
-
interface VariantCssVars extends VariantVars {
|
|
137
|
-
'@dark'?: VariantVars;
|
|
138
|
-
}
|
|
139
|
-
interface VariantContext {
|
|
140
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
141
|
-
}
|
|
142
|
-
declare class VariantsGenerator extends VarsGeneratorBase<Variant, VariantCssVars> implements VariantContext {
|
|
143
|
-
protected readonly items: Map<string, Variant>;
|
|
144
|
-
constructor(ctx: BuilderContext);
|
|
145
|
-
cssVars(name: string): VariantCssVars;
|
|
146
|
-
utilCss(v: ApplyVariantMainProp, prop?: ApplyVariantSubProp, alpha?: string): Properties;
|
|
147
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
148
|
-
private vApplyProp;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type VarType = 'c' | 'v' | 's';
|
|
152
|
-
type VarName<T extends VarType = VarType> = `${T}-${string}`;
|
|
153
|
-
type CSSVarName<T extends VarType = VarType> = `--${string}-${VarName<T>}`;
|
|
154
|
-
type CSSVarValue<T extends VarType = VarType> = `var(${CSSVarName<T>})`;
|
|
155
|
-
interface VarsProvider {
|
|
156
|
-
c(n: string): CSSVarName<'c'>;
|
|
157
|
-
v(n: string): CSSVarName<'v'>;
|
|
158
|
-
s(n: string): CSSVarName<'s'>;
|
|
159
|
-
color: {
|
|
160
|
-
(name: ExColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
161
|
-
default(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
162
|
-
accent(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
163
|
-
};
|
|
164
|
-
size(name: SizeProperty, fallback?: string): CSSVarValue<'s'>;
|
|
165
|
-
variant(name: VariantProperty, fallback?: string): CSSVarValue<'v'>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
interface ComponentBuilderContext extends BuilderContext {
|
|
169
|
-
readonly colors: ColorContext;
|
|
170
|
-
readonly variants: VariantContext;
|
|
171
|
-
}
|
|
172
|
-
type ComponentBuilder = (context: ComponentBuilderContext) => IComponent;
|
|
173
|
-
interface IComponent {
|
|
174
|
-
name: string;
|
|
175
|
-
style: Properties;
|
|
176
|
-
pseudos?: ExpandedPseudos;
|
|
177
|
-
applyVariant?: ApplyVariant;
|
|
178
|
-
applyVariantPseudos?: ApplyVariantPseudos;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export { BuilderBase as B, SizesGenerator as S, VariantsGenerator as V, ColorsGenerator as a, css as i };
|
|
182
|
-
export type { ApplyVariant as A, ComponentBuilderContext as C, ExColorShade as E, FontSize as F, IComponent as I, Rules as R, ThemeProvider as T, VarsProvider as b, ColorShade as c, Variant as d, VariantProperties as e, ApplyVariantMainProp as f, ApplyVariantSubProp as g, ApplyVariantProp as h, ComponentBuilder as j };
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Properties as Properties$1, Pseudos, AdvancedPseudos, AtRule, AtRules, DataType, Property, PropertyValue, SimplePseudos } from 'csstype';
|
|
2
|
-
|
|
3
|
-
type Expand<T, TKey extends string | number | symbol = string, TValue = any> = T & Record<TKey, TValue>;
|
|
4
|
-
declare module 'csstype' {
|
|
5
|
-
interface Properties<TLength, TTime> {
|
|
6
|
-
[key: string]: string | number | Properties<TLength, TTime>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
type Properties = Properties$1<string>;
|
|
10
|
-
type Rules = Record<string, Properties>;
|
|
11
|
-
type ExpandedPseudos = Expand<Partial<Record<Pseudos, Properties>>, string, Properties>;
|
|
12
|
-
|
|
13
|
-
declare const css_AdvancedPseudos: typeof AdvancedPseudos;
|
|
14
|
-
declare const css_AtRule: typeof AtRule;
|
|
15
|
-
declare const css_AtRules: typeof AtRules;
|
|
16
|
-
declare const css_DataType: typeof DataType;
|
|
17
|
-
type css_ExpandedPseudos = ExpandedPseudos;
|
|
18
|
-
type css_Properties = Properties;
|
|
19
|
-
declare const css_Property: typeof Property;
|
|
20
|
-
declare const css_PropertyValue: typeof PropertyValue;
|
|
21
|
-
declare const css_Pseudos: typeof Pseudos;
|
|
22
|
-
type css_Rules = Rules;
|
|
23
|
-
declare const css_SimplePseudos: typeof SimplePseudos;
|
|
24
|
-
declare namespace css {
|
|
25
|
-
export { css_AdvancedPseudos as AdvancedPseudos, css_AtRule as AtRule, css_AtRules as AtRules, css_DataType as DataType, css_Property as Property, css_PropertyValue as PropertyValue, css_Pseudos as Pseudos, css_SimplePseudos as SimplePseudos };
|
|
26
|
-
export type { css_ExpandedPseudos as ExpandedPseudos, css_Properties as Properties, css_Rules as Rules };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type FontSize = string | [
|
|
30
|
-
string,
|
|
31
|
-
string | {
|
|
32
|
-
lineHeight?: string;
|
|
33
|
-
letterSpacing?: string;
|
|
34
|
-
fontWeight?: string;
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
interface ThemeProvider {
|
|
38
|
-
colors(): Record<string, string>;
|
|
39
|
-
colors(name: string): string | Record<string, string>;
|
|
40
|
-
spacing(name: string): string;
|
|
41
|
-
fontSize(name: string): FontSize;
|
|
42
|
-
applyTextColor(value: string, target: Properties, alpha?: string): void;
|
|
43
|
-
applyBackgroundColor(value: string, target: Properties, alpha?: string): void;
|
|
44
|
-
applyBorderColor(value: string, target: Properties, alpha?: string): void;
|
|
45
|
-
colorValue(value: string, alpha?: number | string): string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface BuilderContext {
|
|
49
|
-
readonly vars: VarsProvider;
|
|
50
|
-
readonly theme: ThemeProvider;
|
|
51
|
-
}
|
|
52
|
-
declare abstract class BuilderBase<T, TContext extends BuilderContext> {
|
|
53
|
-
protected readonly ctx: TContext;
|
|
54
|
-
protected readonly abstract items: Map<string, T>;
|
|
55
|
-
constructor(ctx: TContext);
|
|
56
|
-
protected get vars(): VarsProvider;
|
|
57
|
-
protected get theme(): ThemeProvider;
|
|
58
|
-
names(): string[];
|
|
59
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
60
|
-
update(name: string, builder: (element: T, ctx: TContext) => T | void): void;
|
|
61
|
-
remove(name: string): void;
|
|
62
|
-
}
|
|
63
|
-
declare abstract class VarsGeneratorBase<T, TVars, TContext extends BuilderContext = BuilderContext> extends BuilderBase<T, TContext> {
|
|
64
|
-
constructor(ctx: TContext);
|
|
65
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
66
|
-
remove(name: string): void;
|
|
67
|
-
abstract cssVars(name: string): TVars;
|
|
68
|
-
rootVars(): TVars;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type ColorShade = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
|
|
72
|
-
type ExColorShade = ColorShade | `default-${ColorShade}` | `accent-${ColorShade}` | 'black' | 'white';
|
|
73
|
-
type ColorVars = Record<CSSVarName<'c'>, string>;
|
|
74
|
-
interface ColorContext {
|
|
75
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
76
|
-
}
|
|
77
|
-
declare class ColorsGenerator extends VarsGeneratorBase<Map<ColorShade, string>, ColorVars> implements ColorContext {
|
|
78
|
-
private readonly colors;
|
|
79
|
-
protected readonly items: Map<string, Map<ColorShade, string>>;
|
|
80
|
-
constructor(ctx: BuilderContext);
|
|
81
|
-
names(): string[];
|
|
82
|
-
cssVars(name: string): Record<`--${string}-c-${string}`, string>;
|
|
83
|
-
rootVars(): ColorVars;
|
|
84
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
type SizeVars = Record<CSSVarName<'s'>, string>;
|
|
88
|
-
type SizeProperty = 'text' | `spacing-${keyof Size['spacing']}` | 'line-height';
|
|
89
|
-
type Size = {
|
|
90
|
-
spacing: {
|
|
91
|
-
'1': string;
|
|
92
|
-
'1.5': string;
|
|
93
|
-
'2': string;
|
|
94
|
-
'3': string;
|
|
95
|
-
'4': string;
|
|
96
|
-
};
|
|
97
|
-
text: FontSize;
|
|
98
|
-
};
|
|
99
|
-
declare class SizesGenerator extends VarsGeneratorBase<Size, SizeVars> {
|
|
100
|
-
protected readonly items: Map<string, Size>;
|
|
101
|
-
constructor(ctx: BuilderContext);
|
|
102
|
-
cssVars(name: string): SizeVars;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type VariantVars = Record<CSSVarName<'v'>, string>;
|
|
106
|
-
type VariantPropValue = CSSVarValue<'c'> | CSSVarValue<'v'>;
|
|
107
|
-
type OpacityValue = '1' | '0' | `0.${number}`;
|
|
108
|
-
interface VariantProperties {
|
|
109
|
-
'bg': VariantPropValue;
|
|
110
|
-
'bg-soft'?: VariantPropValue;
|
|
111
|
-
'bg-muted'?: VariantPropValue;
|
|
112
|
-
'bg-accent'?: VariantPropValue;
|
|
113
|
-
'bg-opacity'?: OpacityValue;
|
|
114
|
-
'border': VariantPropValue;
|
|
115
|
-
'border-soft'?: VariantPropValue;
|
|
116
|
-
'border-muted'?: VariantPropValue;
|
|
117
|
-
'border-accent'?: VariantPropValue;
|
|
118
|
-
'border-opacity'?: OpacityValue;
|
|
119
|
-
'fg': VariantPropValue;
|
|
120
|
-
'fg-soft'?: VariantPropValue;
|
|
121
|
-
'fg-muted'?: VariantPropValue;
|
|
122
|
-
'fg-accent'?: VariantPropValue;
|
|
123
|
-
'fg-opacity'?: OpacityValue;
|
|
124
|
-
}
|
|
125
|
-
type VariantPseudos = Partial<Record<SimplePseudos, Partial<VariantProperties>>>;
|
|
126
|
-
interface Variant extends VariantProperties {
|
|
127
|
-
pseudos?: VariantPseudos;
|
|
128
|
-
dark?: Omit<Partial<Variant>, 'dark'>;
|
|
129
|
-
}
|
|
130
|
-
type VariantProperty = keyof VariantProperties | `${keyof VariantProperties}-${SimplePseudos}`;
|
|
131
|
-
type ApplyVariantMainProp = 'bg' | 'border' | 'text';
|
|
132
|
-
type ApplyVariantSubProp = 'soft' | 'muted' | 'accent' | 'default';
|
|
133
|
-
type ApplyVariantProp = ApplyVariantMainProp | `${ApplyVariantMainProp}-${Exclude<ApplyVariantSubProp, 'default'>}`;
|
|
134
|
-
type ApplyVariant = boolean | ApplyVariantProp[];
|
|
135
|
-
type ApplyVariantPseudos = Partial<Record<SimplePseudos, ApplyVariant>> | SimplePseudos[] | false;
|
|
136
|
-
interface VariantCssVars extends VariantVars {
|
|
137
|
-
'@dark'?: VariantVars;
|
|
138
|
-
}
|
|
139
|
-
interface VariantContext {
|
|
140
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
141
|
-
}
|
|
142
|
-
declare class VariantsGenerator extends VarsGeneratorBase<Variant, VariantCssVars> implements VariantContext {
|
|
143
|
-
protected readonly items: Map<string, Variant>;
|
|
144
|
-
constructor(ctx: BuilderContext);
|
|
145
|
-
cssVars(name: string): VariantCssVars;
|
|
146
|
-
utilCss(v: ApplyVariantMainProp, prop?: ApplyVariantSubProp, alpha?: string): Properties;
|
|
147
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
148
|
-
private vApplyProp;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type VarType = 'c' | 'v' | 's';
|
|
152
|
-
type VarName<T extends VarType = VarType> = `${T}-${string}`;
|
|
153
|
-
type CSSVarName<T extends VarType = VarType> = `--${string}-${VarName<T>}`;
|
|
154
|
-
type CSSVarValue<T extends VarType = VarType> = `var(${CSSVarName<T>})`;
|
|
155
|
-
interface VarsProvider {
|
|
156
|
-
c(n: string): CSSVarName<'c'>;
|
|
157
|
-
v(n: string): CSSVarName<'v'>;
|
|
158
|
-
s(n: string): CSSVarName<'s'>;
|
|
159
|
-
color: {
|
|
160
|
-
(name: ExColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
161
|
-
default(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
162
|
-
accent(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
163
|
-
};
|
|
164
|
-
size(name: SizeProperty, fallback?: string): CSSVarValue<'s'>;
|
|
165
|
-
variant(name: VariantProperty, fallback?: string): CSSVarValue<'v'>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
interface ComponentBuilderContext extends BuilderContext {
|
|
169
|
-
readonly colors: ColorContext;
|
|
170
|
-
readonly variants: VariantContext;
|
|
171
|
-
}
|
|
172
|
-
type ComponentBuilder = (context: ComponentBuilderContext) => IComponent;
|
|
173
|
-
interface IComponent {
|
|
174
|
-
name: string;
|
|
175
|
-
style: Properties;
|
|
176
|
-
pseudos?: ExpandedPseudos;
|
|
177
|
-
applyVariant?: ApplyVariant;
|
|
178
|
-
applyVariantPseudos?: ApplyVariantPseudos;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export { BuilderBase as B, SizesGenerator as S, VariantsGenerator as V, ColorsGenerator as a, css as i };
|
|
182
|
-
export type { ApplyVariant as A, ComponentBuilderContext as C, ExColorShade as E, FontSize as F, IComponent as I, Rules as R, ThemeProvider as T, VarsProvider as b, ColorShade as c, Variant as d, VariantProperties as e, ApplyVariantMainProp as f, ApplyVariantSubProp as g, ApplyVariantProp as h, ComponentBuilder as j };
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Properties as Properties$1, Pseudos, AdvancedPseudos, AtRule, AtRules, DataType, Property, PropertyValue, SimplePseudos } from 'csstype';
|
|
2
|
-
|
|
3
|
-
type Expand<T, TKey extends string | number | symbol = string, TValue = any> = T & Record<TKey, TValue>;
|
|
4
|
-
declare module 'csstype' {
|
|
5
|
-
interface Properties<TLength, TTime> {
|
|
6
|
-
[key: string]: string | number | Properties<TLength, TTime>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
type Properties = Properties$1<string>;
|
|
10
|
-
type Rules = Record<string, Properties>;
|
|
11
|
-
type ExpandedPseudos = Expand<Partial<Record<Pseudos, Properties>>, string, Properties>;
|
|
12
|
-
|
|
13
|
-
declare const css_AdvancedPseudos: typeof AdvancedPseudos;
|
|
14
|
-
declare const css_AtRule: typeof AtRule;
|
|
15
|
-
declare const css_AtRules: typeof AtRules;
|
|
16
|
-
declare const css_DataType: typeof DataType;
|
|
17
|
-
type css_ExpandedPseudos = ExpandedPseudos;
|
|
18
|
-
type css_Properties = Properties;
|
|
19
|
-
declare const css_Property: typeof Property;
|
|
20
|
-
declare const css_PropertyValue: typeof PropertyValue;
|
|
21
|
-
declare const css_Pseudos: typeof Pseudos;
|
|
22
|
-
type css_Rules = Rules;
|
|
23
|
-
declare const css_SimplePseudos: typeof SimplePseudos;
|
|
24
|
-
declare namespace css {
|
|
25
|
-
export { css_AdvancedPseudos as AdvancedPseudos, css_AtRule as AtRule, css_AtRules as AtRules, css_DataType as DataType, css_Property as Property, css_PropertyValue as PropertyValue, css_Pseudos as Pseudos, css_SimplePseudos as SimplePseudos };
|
|
26
|
-
export type { css_ExpandedPseudos as ExpandedPseudos, css_Properties as Properties, css_Rules as Rules };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type FontSize = string | [
|
|
30
|
-
string,
|
|
31
|
-
string | {
|
|
32
|
-
lineHeight?: string;
|
|
33
|
-
letterSpacing?: string;
|
|
34
|
-
fontWeight?: string;
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
interface ThemeProvider {
|
|
38
|
-
colors(): Record<string, string>;
|
|
39
|
-
colors(name: string): string | Record<string, string>;
|
|
40
|
-
spacing(name: string): string;
|
|
41
|
-
fontSize(name: string): FontSize;
|
|
42
|
-
applyTextColor(value: string, target: Properties, alpha?: string): void;
|
|
43
|
-
applyBackgroundColor(value: string, target: Properties, alpha?: string): void;
|
|
44
|
-
applyBorderColor(value: string, target: Properties, alpha?: string): void;
|
|
45
|
-
colorValue(value: string, alpha?: number | string): string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface BuilderContext {
|
|
49
|
-
readonly vars: VarsProvider;
|
|
50
|
-
readonly theme: ThemeProvider;
|
|
51
|
-
}
|
|
52
|
-
declare abstract class BuilderBase<T, TContext extends BuilderContext> {
|
|
53
|
-
protected readonly ctx: TContext;
|
|
54
|
-
protected readonly abstract items: Map<string, T>;
|
|
55
|
-
constructor(ctx: TContext);
|
|
56
|
-
protected get vars(): VarsProvider;
|
|
57
|
-
protected get theme(): ThemeProvider;
|
|
58
|
-
names(): string[];
|
|
59
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
60
|
-
update(name: string, builder: (element: T, ctx: TContext) => T | void): void;
|
|
61
|
-
remove(name: string): void;
|
|
62
|
-
}
|
|
63
|
-
declare abstract class VarsGeneratorBase<T, TVars, TContext extends BuilderContext = BuilderContext> extends BuilderBase<T, TContext> {
|
|
64
|
-
constructor(ctx: TContext);
|
|
65
|
-
add(name: string, builder: (ctx: TContext) => T): void;
|
|
66
|
-
remove(name: string): void;
|
|
67
|
-
abstract cssVars(name: string): TVars;
|
|
68
|
-
rootVars(): TVars;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type ColorShade = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
|
|
72
|
-
type ExColorShade = ColorShade | `default-${ColorShade}` | `accent-${ColorShade}` | 'black' | 'white';
|
|
73
|
-
type ColorVars = Record<CSSVarName<'c'>, string>;
|
|
74
|
-
interface ColorContext {
|
|
75
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
76
|
-
}
|
|
77
|
-
declare class ColorsGenerator extends VarsGeneratorBase<Map<ColorShade, string>, ColorVars> implements ColorContext {
|
|
78
|
-
private readonly colors;
|
|
79
|
-
protected readonly items: Map<string, Map<ColorShade, string>>;
|
|
80
|
-
constructor(ctx: BuilderContext);
|
|
81
|
-
names(): string[];
|
|
82
|
-
cssVars(name: string): Record<`--${string}-c-${string}`, string>;
|
|
83
|
-
rootVars(): ColorVars;
|
|
84
|
-
toValue(name: ExColorShade | (string & {}), alpha?: number | string): string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
type SizeVars = Record<CSSVarName<'s'>, string>;
|
|
88
|
-
type SizeProperty = 'text' | `spacing-${keyof Size['spacing']}` | 'line-height';
|
|
89
|
-
type Size = {
|
|
90
|
-
spacing: {
|
|
91
|
-
'1': string;
|
|
92
|
-
'1.5': string;
|
|
93
|
-
'2': string;
|
|
94
|
-
'3': string;
|
|
95
|
-
'4': string;
|
|
96
|
-
};
|
|
97
|
-
text: FontSize;
|
|
98
|
-
};
|
|
99
|
-
declare class SizesGenerator extends VarsGeneratorBase<Size, SizeVars> {
|
|
100
|
-
protected readonly items: Map<string, Size>;
|
|
101
|
-
constructor(ctx: BuilderContext);
|
|
102
|
-
cssVars(name: string): SizeVars;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type VariantVars = Record<CSSVarName<'v'>, string>;
|
|
106
|
-
type VariantPropValue = CSSVarValue<'c'> | CSSVarValue<'v'>;
|
|
107
|
-
type OpacityValue = '1' | '0' | `0.${number}`;
|
|
108
|
-
interface VariantProperties {
|
|
109
|
-
'bg': VariantPropValue;
|
|
110
|
-
'bg-soft'?: VariantPropValue;
|
|
111
|
-
'bg-muted'?: VariantPropValue;
|
|
112
|
-
'bg-accent'?: VariantPropValue;
|
|
113
|
-
'bg-opacity'?: OpacityValue;
|
|
114
|
-
'border': VariantPropValue;
|
|
115
|
-
'border-soft'?: VariantPropValue;
|
|
116
|
-
'border-muted'?: VariantPropValue;
|
|
117
|
-
'border-accent'?: VariantPropValue;
|
|
118
|
-
'border-opacity'?: OpacityValue;
|
|
119
|
-
'fg': VariantPropValue;
|
|
120
|
-
'fg-soft'?: VariantPropValue;
|
|
121
|
-
'fg-muted'?: VariantPropValue;
|
|
122
|
-
'fg-accent'?: VariantPropValue;
|
|
123
|
-
'fg-opacity'?: OpacityValue;
|
|
124
|
-
}
|
|
125
|
-
type VariantPseudos = Partial<Record<SimplePseudos, Partial<VariantProperties>>>;
|
|
126
|
-
interface Variant extends VariantProperties {
|
|
127
|
-
pseudos?: VariantPseudos;
|
|
128
|
-
dark?: Omit<Partial<Variant>, 'dark'>;
|
|
129
|
-
}
|
|
130
|
-
type VariantProperty = keyof VariantProperties | `${keyof VariantProperties}-${SimplePseudos}`;
|
|
131
|
-
type ApplyVariantMainProp = 'bg' | 'border' | 'text';
|
|
132
|
-
type ApplyVariantSubProp = 'soft' | 'muted' | 'accent' | 'default';
|
|
133
|
-
type ApplyVariantProp = ApplyVariantMainProp | `${ApplyVariantMainProp}-${Exclude<ApplyVariantSubProp, 'default'>}`;
|
|
134
|
-
type ApplyVariant = boolean | ApplyVariantProp[];
|
|
135
|
-
type ApplyVariantPseudos = Partial<Record<SimplePseudos, ApplyVariant>> | SimplePseudos[] | false;
|
|
136
|
-
interface VariantCssVars extends VariantVars {
|
|
137
|
-
'@dark'?: VariantVars;
|
|
138
|
-
}
|
|
139
|
-
interface VariantContext {
|
|
140
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
141
|
-
}
|
|
142
|
-
declare class VariantsGenerator extends VarsGeneratorBase<Variant, VariantCssVars> implements VariantContext {
|
|
143
|
-
protected readonly items: Map<string, Variant>;
|
|
144
|
-
constructor(ctx: BuilderContext);
|
|
145
|
-
cssVars(name: string): VariantCssVars;
|
|
146
|
-
utilCss(v: ApplyVariantMainProp, prop?: ApplyVariantSubProp, alpha?: string): Properties;
|
|
147
|
-
apply(v?: ApplyVariant, pseudos?: ApplyVariantPseudos, target?: Properties): Properties;
|
|
148
|
-
private vApplyProp;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type VarType = 'c' | 'v' | 's';
|
|
152
|
-
type VarName<T extends VarType = VarType> = `${T}-${string}`;
|
|
153
|
-
type CSSVarName<T extends VarType = VarType> = `--${string}-${VarName<T>}`;
|
|
154
|
-
type CSSVarValue<T extends VarType = VarType> = `var(${CSSVarName<T>})`;
|
|
155
|
-
interface VarsProvider {
|
|
156
|
-
c(n: string): CSSVarName<'c'>;
|
|
157
|
-
v(n: string): CSSVarName<'v'>;
|
|
158
|
-
s(n: string): CSSVarName<'s'>;
|
|
159
|
-
color: {
|
|
160
|
-
(name: ExColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
161
|
-
default(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
162
|
-
accent(name: ColorShade, fallback?: string): CSSVarValue<'c'>;
|
|
163
|
-
};
|
|
164
|
-
size(name: SizeProperty, fallback?: string): CSSVarValue<'s'>;
|
|
165
|
-
variant(name: VariantProperty, fallback?: string): CSSVarValue<'v'>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
interface ComponentBuilderContext extends BuilderContext {
|
|
169
|
-
readonly colors: ColorContext;
|
|
170
|
-
readonly variants: VariantContext;
|
|
171
|
-
}
|
|
172
|
-
type ComponentBuilder = (context: ComponentBuilderContext) => IComponent;
|
|
173
|
-
interface IComponent {
|
|
174
|
-
name: string;
|
|
175
|
-
style: Properties;
|
|
176
|
-
pseudos?: ExpandedPseudos;
|
|
177
|
-
applyVariant?: ApplyVariant;
|
|
178
|
-
applyVariantPseudos?: ApplyVariantPseudos;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export { BuilderBase as B, SizesGenerator as S, VariantsGenerator as V, ColorsGenerator as a, css as i };
|
|
182
|
-
export type { ApplyVariant as A, ComponentBuilderContext as C, ExColorShade as E, FontSize as F, IComponent as I, Rules as R, ThemeProvider as T, VarsProvider as b, ColorShade as c, Variant as d, VariantProperties as e, ApplyVariantMainProp as f, ApplyVariantSubProp as g, ApplyVariantProp as h, ComponentBuilder as j };
|