Comparing version 0.4.0-alpha.26 to 0.5.0
import { css, keyframes } from './css.js'; | ||
import type { Props, Style, As, StyledComponent, StyledHtmlComponent, StyledFn, StyledProxy } from './types.js'; | ||
import type { Props, Style, As, StyledFn, StyledProxy } from './types.js'; | ||
declare const styled: StyledProxy & StyledFn; | ||
export type { Props, Style, As, StyledComponent, StyledFn, StyledHtmlComponent }; | ||
export type { Props, Style, As, StyledFn }; | ||
export { styled, css, keyframes }; |
@@ -1,2 +0,2 @@ | ||
import React, { createElement, forwardRef } from 'react'; | ||
import { createElement, forwardRef } from 'react'; | ||
import { css, keyframes } from './css.js'; | ||
@@ -28,10 +28,2 @@ import { transform } from './transform.js'; | ||
export { styled, css, keyframes }; | ||
React.createElement(styled.input, { | ||
style: { | ||
background: 1, | ||
}, | ||
onChange(e) { | ||
console.log(e.target.value); | ||
}, | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -49,6 +49,2 @@ import { css, keyframes } from './css.js'; | ||
} | ||
// add some defaults | ||
if (p.onClick && !s.cursor) { | ||
s.cursor = 'pointer'; | ||
} | ||
props.style = s; | ||
@@ -55,0 +51,0 @@ return props; |
@@ -1,2 +0,2 @@ | ||
import { ComponentClass, CSSProperties, FunctionComponent, InputHTMLAttributes, ReactHTML, ReactNode } from 'react'; | ||
import { CSSProperties, FunctionComponent, ReactHTML, ReactNode, ReactSVG } from 'react'; | ||
export type Style = CSSProperties & { | ||
@@ -12,10 +12,8 @@ [key: `@media${string}`]: Style; | ||
}; | ||
export type As = string | FunctionComponent<any> | ComponentClass<any, any>; | ||
export type StyledComponent = FunctionComponent<Props>; | ||
export type StyledHtmlComponent<T> = T extends T ? FunctionComponent<InputHTMLAttributes<T>> : never; | ||
export type StyledFn = (as: As, style: Style) => StyledComponent; | ||
type Keys = keyof ReactHTML; | ||
export type As = string | FunctionComponent<any>; | ||
export type StyledFn = (as: As, style: Style) => FunctionComponent<Props>; | ||
export type StyledProxy = { | ||
[Tag in Keys]: StyledHtmlComponent<JSX.IntrinsicElements[Tag]>; | ||
[Tag in keyof (ReactHTML & ReactSVG)]: FunctionComponent<Omit<JSX.IntrinsicElements[Tag], 'style'> & { | ||
style?: Style; | ||
}>; | ||
}; | ||
export {}; |
{ | ||
"name": "inlines", | ||
"description": "When you just want to use the style prop in React", | ||
"version": "0.4.0-alpha.26", | ||
"version": "0.5.0", | ||
"main": "dist/src/index.js", | ||
@@ -54,2 +54,3 @@ "types": "dist/src/index.d.ts", | ||
"react": "*", | ||
"react-dom": "*", | ||
"typescript": "*" | ||
@@ -63,10 +64,10 @@ }, | ||
"@saulx/tsconfig": "^1.1.0", | ||
"@types/node": "18", | ||
"@types/react": "^18.0.25", | ||
"@types/react-dom": "^18.0.9", | ||
"@types/node": "^20.17.9", | ||
"@types/react": "^18.3.12", | ||
"@types/react-dom": "^18.3.1", | ||
"ava": "^6.1.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
@@ -1,14 +0,6 @@ | ||
import React, { createElement, forwardRef } from 'react' | ||
import { createElement, forwardRef } from 'react' | ||
import { css, keyframes } from './css.js' | ||
import { transform } from './transform.js' | ||
import type { | ||
Props, | ||
Style, | ||
As, | ||
StyledComponent, | ||
StyledHtmlComponent, | ||
StyledFn, | ||
StyledProxy, | ||
} from './types.js' | ||
import type { Props, Style, As, StyledFn, StyledProxy } from './types.js' | ||
@@ -58,12 +50,3 @@ const styled = new Proxy( | ||
export type { Props, Style, As, StyledComponent, StyledFn, StyledHtmlComponent } | ||
export type { Props, Style, As, StyledFn } | ||
export { styled, css, keyframes } | ||
React.createElement(styled.input, { | ||
style: { | ||
background: 1, | ||
}, | ||
onChange(e) { | ||
console.log(e.target.value) | ||
}, | ||
}) |
@@ -50,9 +50,4 @@ import { css, keyframes } from './css.js' | ||
// add some defaults | ||
if (p.onClick && !s.cursor) { | ||
s.cursor = 'pointer' | ||
} | ||
props.style = s | ||
return props | ||
} |
import { | ||
ComponentClass, | ||
CSSProperties, | ||
FunctionComponent, | ||
InputHTMLAttributes, | ||
ReactHTML, | ||
ReactNode, | ||
ReactSVG, | ||
} from 'react' | ||
@@ -17,14 +16,9 @@ | ||
export type Props = { [key: string]: any; style?: Style; children?: ReactNode } | ||
export type As = string | FunctionComponent<any> | ComponentClass<any, any> | ||
export type StyledComponent = FunctionComponent<Props> | ||
export type StyledHtmlComponent<T> = T extends T | ||
? FunctionComponent<InputHTMLAttributes<T>> | ||
: never | ||
export type As = string | FunctionComponent<any> | ||
export type StyledFn = (as: As, style: Style) => StyledComponent | ||
type Keys = keyof ReactHTML | ||
export type StyledFn = (as: As, style: Style) => FunctionComponent<Props> | ||
export type StyledProxy = { | ||
[Tag in Keys]: StyledHtmlComponent<JSX.IntrinsicElements[Tag]> | ||
[Tag in keyof (ReactHTML & ReactSVG)]: FunctionComponent< | ||
Omit<JSX.IntrinsicElements[Tag], 'style'> & { style?: Style } | ||
> | ||
} |
32111
4
841