workflow底层UI库整合至项目,优化构建逻辑

This commit is contained in:
2026-02-24 11:20:18 +08:00
parent 094b185c49
commit 12accb2575
91 changed files with 6820 additions and 115 deletions

View File

@@ -0,0 +1,38 @@
<svelte:options customElement={{
tag: "tinyflow-component",
shadow: "none",
// props: {
// options: { reflect: true, type: 'Object', attribute: 'options' },
// onInit: { reflect: true, type: 'Object', attribute: 'onInit' }
// },
}} />
<script lang="ts">
import {SvelteFlowProvider, type useSvelteFlow} from '@xyflow/svelte';
import TinyflowCore from './TinyflowCore.svelte';
import {store} from '#store/stores.svelte';
import type {TinyflowData, TinyflowOptions} from '#types';
import {setContext} from 'svelte';
const { options, onInit }: {
options: TinyflowOptions,
onInit: (svelteFlow: ReturnType<typeof useSvelteFlow>) => void,
} = $props();
let { data } = options;
if (typeof data === 'string') {
try {
data = JSON.parse(data.trim());
} catch (e) {
console.error('Invalid JSON data:', data);
}
}
store.init((data as TinyflowData)?.nodes || [], (data as TinyflowData)?.edges || []);
setContext('tinyflow_options', options);
</script>
<SvelteFlowProvider>
<TinyflowCore {onInit} />
</SvelteFlowProvider>