mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
24 lines
547 B
TypeScript
24 lines
547 B
TypeScript
import { mount } from "svelte";
|
|
import type { SvelteComponent } from "svelte";
|
|
import style from "./index.css?inline";
|
|
|
|
export default function renderSvelte(
|
|
Component: SvelteComponent | any,
|
|
mountPoint: ShadowRoot | HTMLElement,
|
|
props: Record<string, any> = {},
|
|
) {
|
|
const app = mount(Component, {
|
|
target: mountPoint,
|
|
props: {
|
|
standalone: false,
|
|
...props,
|
|
},
|
|
});
|
|
|
|
const styleElement = document.createElement("style");
|
|
styleElement.textContent = style;
|
|
mountPoint.appendChild(styleElement);
|
|
|
|
return app;
|
|
}
|