feat(themeCreator): add svelte theme creator

This commit is contained in:
sethburkart123
2024-09-20 10:37:26 +10:00
parent 548dcbf34e
commit 6267a77a71
12 changed files with 377 additions and 144 deletions
+15 -14
View File
@@ -1,23 +1,24 @@
import styles from './index.css?inline';
import { mount } from 'svelte';
import type { ComponentType } from 'svelte';
import styles from "./index.css?inline"
import { mount } from "svelte"
import type { ComponentType } from "svelte"
export default function renderSvelte(
Component: ComponentType | any,
mountPoint: ShadowRoot | HTMLElement,
props: Record<string, any> = {}
) {
props: Record<string, any> = {},
) {
const app = mount(Component, {
target: mountPoint,
props: {
standalone: false,
...props
}
});
...props,
},
})
const style = document.createElement("style");
style.setAttribute("type", "text/css");
style.innerHTML = styles;
mountPoint.appendChild(style);
return app;
}
const style = document.createElement("style")
style.setAttribute("type", "text/css")
style.innerHTML = styles
mountPoint.appendChild(style)
return app
}