From b257b05b42c470bc1313641d5fe898abffe90793 Mon Sep 17 00:00:00 2001 From: macdonst Date: Wed, 21 Sep 2022 10:43:09 -0400 Subject: [PATCH] Treat Enhance SFC like HTML + CSS Signed-off-by: macdonst --- packages/gui/src/lib/codegen/enhance-sfc.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/gui/src/lib/codegen/enhance-sfc.ts b/packages/gui/src/lib/codegen/enhance-sfc.ts index 28e242ff..95712c59 100644 --- a/packages/gui/src/lib/codegen/enhance-sfc.ts +++ b/packages/gui/src/lib/codegen/enhance-sfc.ts @@ -8,6 +8,7 @@ import { format } from './format' import { getAttrSyntax } from './util' import { CodegenOptions } from './types' import { Theme } from '../../types/theme' +import { html } from './html' const h = (theme: Theme) => (tagName: string, props: any, children?: any[]) => { const newProps = toReactProps(props) @@ -24,12 +25,13 @@ const h = (theme: Theme) => (tagName: string, props: any, children?: any[]) => { export const enhanceSFC = async (node: HtmlNode, options: CodegenOptions) => { const root = editorSchemaToHast(node, { addSlotTagSyntax: true }) const functionBody = stringifyHastNode(toH(h(options?.theme), root)) + const htmlTxt = await html(node, options) const output = ` export default function Component({ html, state = {} }) { ${getAttrSyntax(node)} return html\` - ${functionBody} + ${htmlTxt} \` } `