Comparing version 0.1.2 to 0.2.0
@@ -1,6 +0,6 @@ | ||
import { createElement } from 'react'; | ||
import { createElement, forwardRef } from 'react'; | ||
import { css, keyframes } from 'goober'; | ||
import { transform } from './transform.js'; | ||
const styled = new Proxy((as, style) => { | ||
const Styled = (props) => createElement(as, transform(props, props.style | ||
const Styled = forwardRef((props, ref) => createElement(as, transform(props, props.style | ||
? { | ||
@@ -10,3 +10,3 @@ ...style, | ||
} | ||
: style), props.children); | ||
: style, ref), props.children)); | ||
return Styled; | ||
@@ -21,3 +21,3 @@ }, { | ||
const as = p.toLowerCase(); | ||
const Styled = (props) => createElement(as, props.style ? transform(props, props.style) : props, props.children); | ||
const Styled = forwardRef((props, ref) => createElement(as, transform(props, props.style, ref), props.children)); | ||
t[p] = Styled; | ||
@@ -24,0 +24,0 @@ } |
@@ -14,4 +14,4 @@ import { css, keyframes } from 'goober'; | ||
}; | ||
export const transform = (p, style) => { | ||
const props = { ...p }; | ||
export const transform = (p, style, ref) => { | ||
const props = { ...p, ref }; | ||
const s = {}; | ||
@@ -18,0 +18,0 @@ for (const key in style) { |
{ | ||
"name": "inlines", | ||
"description": "When you just want to use the style prop in React", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "src/index.ts", |
@@ -1,2 +0,2 @@ | ||
import { createElement } from 'react' | ||
import { createElement, forwardRef } from 'react' | ||
import { css, keyframes } from 'goober' | ||
@@ -8,3 +8,3 @@ import { transform } from './transform.js' | ||
(as: As, style: Style) => { | ||
const Styled = (props: Props) => | ||
const Styled = forwardRef((props: Props, ref) => | ||
createElement( | ||
@@ -19,6 +19,8 @@ as, | ||
} | ||
: style | ||
: style, | ||
ref | ||
), | ||
props.children | ||
) | ||
) | ||
@@ -34,8 +36,9 @@ return Styled | ||
const as = p.toLowerCase() | ||
const Styled = (props: Props) => | ||
const Styled = forwardRef((props: Props, ref) => | ||
createElement( | ||
as, | ||
props.style ? transform(props, props.style) : props, | ||
transform(props, props.style, ref), | ||
props.children | ||
) | ||
) | ||
t[p] = Styled | ||
@@ -42,0 +45,0 @@ } |
@@ -16,4 +16,4 @@ import { css, keyframes } from 'goober' | ||
export const transform = (p: Props, style: Style) => { | ||
const props = { ...p } | ||
export const transform = (p: Props, style: Style, ref: any) => { | ||
const props = { ...p, ref } | ||
const s = {} as Style | ||
@@ -20,0 +20,0 @@ for (const key in style) { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8960
170
1