@salty-css/core 0.0.1-alpha.93 → 0.0.1-alpha.96
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/package.json +1 -1
- package/types/index.d.ts +20 -10
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { ReactNode } from 'react';
|
2
2
|
import { StyleComponentGenerator } from '../generator';
|
3
3
|
import { OrAny, OrString } from './util-types';
|
4
|
+
import type * as CSS from 'csstype';
|
4
5
|
export type CreateElementProps = {
|
5
6
|
extend?: Tag<any>;
|
6
7
|
children?: ReactNode;
|
@@ -16,17 +17,20 @@ type FnComponent<PROPS extends StyledComponentProps> = {
|
|
16
17
|
(props: OrAny | PROPS): ReactNode;
|
17
18
|
generator?: StyleComponentGenerator;
|
18
19
|
};
|
19
|
-
export type Tag<PROPS extends StyledComponentProps> = OrString | keyof
|
20
|
-
|
21
|
-
[key
|
22
|
-
css: CssStyles;
|
20
|
+
export type Tag<PROPS extends StyledComponentProps> = OrString | keyof HTMLElementTagNameMap | FnComponent<PROPS>;
|
21
|
+
type CssProperties = {
|
22
|
+
[key in keyof CSS.Properties]: CSS.Properties[key] | PropertyValueToken;
|
23
23
|
};
|
24
|
-
type
|
25
|
-
type
|
26
|
-
|
24
|
+
type CssPropertyKeys = keyof CssProperties;
|
25
|
+
export type StyleValue<K extends string> = K extends CssPropertyKeys ? CssProperties[K] : never;
|
26
|
+
type InvalidVariantKeys = '';
|
27
27
|
type VariantOptions = {
|
28
28
|
[key in InvalidVariantKeys]?: never;
|
29
29
|
};
|
30
|
+
export type CompoundVariant = {
|
31
|
+
[key: PropertyKey]: any;
|
32
|
+
css: CssStyles;
|
33
|
+
};
|
30
34
|
type Variants = {
|
31
35
|
variants?: VariantOptions & {
|
32
36
|
[key: PropertyKey]: {
|
@@ -50,7 +54,7 @@ export type ValueProps = {
|
|
50
54
|
export type ParentComponentProps<TAG extends Tag<any>> = TAG extends (props: infer P) => ReactNode ? P : unknown;
|
51
55
|
type StylePropertyValue = Record<never, never> & unknown;
|
52
56
|
export type CssStyles = {
|
53
|
-
[key in
|
57
|
+
[key in OrString]?: CssProperties | StylePropertyValue | PropertyValueToken | CssStyles;
|
54
58
|
};
|
55
59
|
export type Styles = CssStyles & Variants;
|
56
60
|
export interface GeneratorOptions {
|
@@ -58,7 +62,13 @@ export interface GeneratorOptions {
|
|
58
62
|
displayName?: string;
|
59
63
|
element?: string;
|
60
64
|
}
|
65
|
+
interface Base extends CssProperties, CssStyles, CssPseudos {
|
66
|
+
}
|
67
|
+
type Pseudos = CSS.Pseudos | `&${CSS.Pseudos}`;
|
68
|
+
type CssPseudos = {
|
69
|
+
[P in Pseudos]?: Base;
|
70
|
+
};
|
61
71
|
export interface StyledParams extends GeneratorOptions, Variants {
|
62
|
-
base?:
|
72
|
+
base?: Base;
|
63
73
|
}
|
64
74
|
export {};
|