mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: add ReactAdaptor.svelte
This commit is contained in:
@@ -38,6 +38,8 @@
|
|||||||
"@bedframe/cli": "^0.0.91",
|
"@bedframe/cli": "^0.0.91",
|
||||||
"@crxjs/vite-plugin": "2.0.0-beta.25",
|
"@crxjs/vite-plugin": "2.0.0-beta.25",
|
||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
|
"@types/react": "^19.0.10",
|
||||||
|
"@types/react-dom": "^19.0.4",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dependency-cruiser": "^16.10.0",
|
"dependency-cruiser": "^16.10.0",
|
||||||
"eslint": "9.22.0",
|
"eslint": "9.22.0",
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import React from "react";
|
||||||
|
import ReactDOM from "react-dom";
|
||||||
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
|
||||||
|
const e = React.createElement;
|
||||||
|
let container: HTMLDivElement;
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const { el, children, class: _, ...props } = $$props;
|
||||||
|
try {
|
||||||
|
ReactDOM.render(e(el, props, children), container);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`react-adapter failed to mount.`, { err });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
try {
|
||||||
|
ReactDOM.unmountComponentAtNode(container);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`react-adapter failed to unmount.`, { err });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div bind:this={container} class={$$props.class}></div>
|
||||||
Reference in New Issue
Block a user