mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
remove extra react component wrapper, upgrade to v2 of @lit-labs/react (#1531)
* remove extra react wrapper, upgrade to v2 of @lit-labs/react, call define in module. * add changelog entry * prettier
This commit is contained in:
@@ -51,18 +51,11 @@ components.map(component => {
|
||||
${eventImports}
|
||||
${eventExports}
|
||||
|
||||
export type ForwardComponent<
|
||||
Element extends HTMLElement,
|
||||
ReactComponent extends React.ElementType
|
||||
> = React.JSXElementConstructor<
|
||||
React.ComponentPropsWithoutRef<ReactComponent> & {
|
||||
ref?: React.ForwardedRef<Element>;
|
||||
}
|
||||
> & { displayName?: string }
|
||||
|
||||
const tagName = '${component.tagName}'
|
||||
Component.define('${component.tagName}')
|
||||
|
||||
const component = createComponent({
|
||||
${jsDoc}
|
||||
const reactWrapper = createComponent({
|
||||
tagName,
|
||||
elementClass: Component,
|
||||
react: React,
|
||||
@@ -72,20 +65,7 @@ components.map(component => {
|
||||
displayName: "${component.name}"
|
||||
})
|
||||
|
||||
${jsDoc}
|
||||
class SlComponent extends React.Component<Parameters<typeof component>[0]> {
|
||||
constructor (...args: Parameters<typeof component>) {
|
||||
super(...args)
|
||||
Component.define(tagName)
|
||||
}
|
||||
|
||||
render () {
|
||||
const { children, ...props } = this.props
|
||||
return React.createElement(component, props, children)
|
||||
}
|
||||
}
|
||||
|
||||
export default SlComponent as ForwardComponent<Component, typeof SlComponent>;
|
||||
export default reactWrapper
|
||||
`,
|
||||
Object.assign(prettierConfig, {
|
||||
parser: 'babel-ts'
|
||||
|
||||
Reference in New Issue
Block a user