generated from unplugin/unplugin-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): css() not giving correct suggestion, variants default opt…
…ion not accepting correct value Fix #85
- Loading branch information
Showing
3 changed files
with
16 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,16 @@ | ||
import type { CSSProperties } from './css' | ||
import type { PinceauMediaQueries } from './theme' | ||
import type { CSSProperties } from './css'; | ||
|
||
export interface VariantOptions<T = string> { | ||
type?: string | ||
required?: boolean | ||
default?: T | { [key in PinceauMediaQueries]?: T } | ||
mediaPrefix?: boolean | ||
} | ||
export type Variant<T> = { | ||
[K in keyof T]: { | ||
[key: string]: string | (CSSProperties & { $class?: string }); | ||
} & { | ||
options?: { | ||
default?: T[K]; | ||
required?: boolean; | ||
mediaPrefix?: boolean; | ||
readonly type?: T[K]; | ||
}; | ||
}; | ||
}; | ||
|
||
export interface BooleanVariant { | ||
true?: CSSProperties | ||
false?: CSSProperties | ||
[key: string]: CSSProperties | ||
} | ||
|
||
export interface EnumVariant { | ||
[key: string]: CSSProperties | ||
} | ||
|
||
export interface ClassVariant { | ||
[key: string]: string | (CSSProperties & { $class?: string }) | ||
} | ||
|
||
export type Variant = | ||
(BooleanVariant | EnumVariant | ClassVariant) | ||
& | ||
{ | ||
options?: VariantOptions | ||
} | ||
|
||
export interface Variants { | ||
[key: string]: Variant | ||
} | ||
export type Variants<T> = T extends Record<string, any> ? Variant<T> : any; |