jsxstyle-utils
Version:
Utilities used by jsxstyle and tooling built for jsxstyle
72 lines (67 loc) • 2.66 kB
TypeScript
import { Properties } from 'csstype';
/**
* Make all properties in `T` potentially `null` or `false`.
*
* Note: `Falsey` is not the best name, as jsxstyle considers zero to be truthy.
*/
export declare type Falsey<T> = {
[P in keyof T]?: T[P] | false | null;
};
declare type BaseCSSProperties = Properties<string | number>;
interface JsxstyleAnimation {
[key: string]: BaseCSSProperties;
}
interface CSSPropsInternal extends Omit<BaseCSSProperties, 'animation'> {
animation?: BaseCSSProperties['animation'] | JsxstyleAnimation;
marginH?: BaseCSSProperties['margin'];
marginV?: BaseCSSProperties['margin'];
paddingH?: BaseCSSProperties['padding'];
paddingV?: BaseCSSProperties['padding'];
activeOpacity?: BaseCSSProperties['opacity'];
disabledOpacity?: BaseCSSProperties['opacity'];
focusOpacity?: BaseCSSProperties['opacity'];
hoverOpacity?: BaseCSSProperties['opacity'];
activeColor?: BaseCSSProperties['color'];
hoverColor?: BaseCSSProperties['color'];
activeBackgroundColor?: BaseCSSProperties['backgroundColor'];
focusBackgroundColor?: BaseCSSProperties['backgroundColor'];
hoverBackgroundColor?: BaseCSSProperties['backgroundColor'];
hoverTextDecoration?: BaseCSSProperties['textDecoration'];
hoverTextDecorationColor?: BaseCSSProperties['textDecorationColor'];
activeBoxShadow?: BaseCSSProperties['boxShadow'];
focusBoxShadow?: BaseCSSProperties['boxShadow'];
hoverBoxShadow?: BaseCSSProperties['boxShadow'];
placeholderColor?: BaseCSSProperties['color'];
disabledPlaceholderColor?: BaseCSSProperties['color'];
focusPlaceholderColor?: BaseCSSProperties['color'];
selectionColor?: BaseCSSProperties['color'];
selectionBackgroundColor?: BaseCSSProperties['backgroundColor'];
}
/**
* jsxstyle-compatible CSS properties interface provided by `csstype`.
*
* Note: this interface does not support prefixed style props (media query or pseudoclass/pseudoelement).
* Support for these props can be added as needed with module augmentation. Example:
*
```typescript
import { CSSProperties } from 'jsxstyle';
declare module 'jsxstyle' {
interface CSSProperties {
hoverBackgroundColor: CSSProperties['backgroundColor'];
}
}
```
* or if you’re feeling adventurous:
```typescript
import { CSSProperties } from 'jsxstyle';
declare module 'jsxstyle' {
interface CSSProperties {
[key: string]: any;
}
}
```
* For further reading, see the TypeScript docs: https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
*/
export interface CSSProperties extends Falsey<CSSPropsInternal> {}
export {};
//# sourceMappingURL=types.d.ts.map