Skip to content

Commit

Permalink
minor jsx-runtime cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rvion committed Dec 2, 2023
1 parent a6e72fe commit 472295a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/utils/custom-jsx/jsx-dev-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ export const joinCls = (tw /*: ClassLike[]*/) /*: string[]*/ => {
}

export function jsxDEV(type, props, key, isStaticChildren, source, self) {
if (
!hasOwnProperty.call(props, 'tw') // && //
// !hasOwnProperty.call(props, 'x')
)
return jsxDEV_(type, props, key, isStaticChildren, source, self)
if (!hasOwnProperty.call(props, 'tw')) return jsxDEV_(type, props, key, isStaticChildren, source, self)
let className = props.className ?? ''
if (props.tw) className += ' ' + joinCls(props.tw)
// if (props.x) className += ' ' + joinCls(props.x)
Expand Down
14 changes: 2 additions & 12 deletions src/utils/custom-jsx/jsx-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,18 @@ export const joinCls = (tw /*: ClassLike[]*/) /*: string[]*/ => {
}

export function jsx(type, props, key) {
if (
!hasOwnProperty.call(props, 'tw') // && //
// !hasOwnProperty.call(props, 'x')
)
return jsx_(type, props, key)
if (!hasOwnProperty.call(props, 'tw')) return jsx_(type, props, key)
let className = props.className ?? ''
if (props.tw) className += ' ' + joinCls(props.tw)
// if (props.x) className += ' ' + joinCls(props.x)

const newProps = { ...props, className, tw: undefined }
return jsx_(type, newProps, key)
}

export function jsxs(type, props, key) {
if (
!hasOwnProperty.call(props, 'tw') // && //
// !hasOwnProperty.call(props, 'x')
)
return jsxs_(type, props, key)
if (!hasOwnProperty.call(props, 'tw')) return jsxs_(type, props, key)
let className = props.className ?? ''
if (props.tw) className += ' ' + joinCls(props.tw)
// if (props.x) className += ' ' + joinCls(props.x)

const newProps = { ...props, className, tw: undefined }
return jsxs_(type, newProps, key)
Expand Down

0 comments on commit 472295a

Please sign in to comment.