add to legacy wrapper

svelte-html
Simon Holthausen 1 month ago
parent c7232220ad
commit 75e1deafe0

@ -21,14 +21,15 @@ export { createClassComponent };
*/ */
export function asClassComponent(component) { export function asClassComponent(component) {
const component_constructor = as_class_component(component); const component_constructor = as_class_component(component);
/** @type {(props?: {}, opts?: { $$slots?: {}; context?: Map<any, any>; }) => { html: any; css: { code: string; map: any; }; head: string; } } */ /** @type {(props?: {}, opts?: { $$slots?: {}; context?: Map<any, any>; }) => { html: any; css: { code: string; map: any; }; head: string; htmlAttributes: string } } */
const _render = (props, { context } = {}) => { const _render = (props, { context } = {}) => {
// @ts-expect-error the typings are off, but this will work if the component is compiled in SSR mode // @ts-expect-error the typings are off, but this will work if the component is compiled in SSR mode
const result = render(component, { props, context }); const result = render(component, { props, context });
return { return {
css: { code: '', map: null }, css: { code: '', map: null },
head: result.head, head: result.head,
html: result.body html: result.body,
htmlAttributes: result.htmlAttributes
}; };
}; };
// @ts-expect-error this is present for SSR // @ts-expect-error this is present for SSR

Loading…
Cancel
Save