This commit is contained in:
xingyu4j
2025-06-16 16:59:04 +08:00
parent d09b993bc8
commit 014785a1ad
71 changed files with 447 additions and 423 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { Item } from './ui/typeing';
import type { Item } from './ui/typing';
import { onMounted, onUnmounted, ref } from 'vue';

View File

@@ -0,0 +1,2 @@
export { default as Tinyflow } from './tinyflow.vue';
export * from './ui/typing';

View File

@@ -1,21 +1,21 @@
export declare type Item = {
export interface Item {
children?: Item[];
label: string;
value: number | string;
};
}
export type Position = {
export interface Position {
x: number;
y: number;
};
}
export type Viewport = {
export interface Viewport {
x: number;
y: number;
zoom: number;
};
}
export type Node = {
export interface Node {
data?: Record<string, any>;
draggable?: boolean;
height?: number;
@@ -24,23 +24,23 @@ export type Node = {
selected?: boolean;
type?: string;
width?: number;
};
}
export type Edge = {
export interface Edge {
animated?: boolean;
id: string;
label?: string;
source: string;
target: string;
type?: string;
};
}
export type TinyflowData = Partial<{
edges: Edge[];
nodes: Node[];
viewport: Viewport;
}>;
export declare type TinyflowOptions = {
export interface TinyflowOptions {
data?: TinyflowData;
element: Element | string;
provider?: {
@@ -48,7 +48,7 @@ export declare type TinyflowOptions = {
knowledge?: () => Item[] | Promise<Item[]>;
llm?: () => Item[] | Promise<Item[]>;
};
};
}
export declare class Tinyflow {
private _init;
@@ -66,5 +66,3 @@ export declare class Tinyflow {
getOptions(): TinyflowOptions;
setData(data: TinyflowData): void;
}
export {};

View File

@@ -0,0 +1,3 @@
export { default as MarkdownView } from './markdown-view.vue';
export * from './typing';

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { MarkdownViewProps } from './typing';
import { computed, onMounted, ref } from 'vue';
import { MarkdownIt } from '@vben/plugins/markmap';
@@ -10,15 +12,10 @@ import hljs from 'highlight.js';
import 'highlight.js/styles/vs2015.min.css';
//
const props = defineProps({
content: {
type: String,
required: true,
},
});
const props = defineProps<MarkdownViewProps>();
const { copy } = useClipboard(); // copy
const contentRef = ref();
const contentRef = ref<HTMLElement | null>(null);
const md = new MarkdownIt({
highlight(str, lang) {
@@ -40,7 +37,7 @@ const renderedMarkdown = computed(() => {
/** 初始化 */
onMounted(async () => {
// copy
contentRef.value.addEventListener('click', (e: any) => {
contentRef.value?.addEventListener('click', (e: any) => {
if (e.target.id === 'copy') {
copy(e.target?.dataset?.copy);
message.success('复制成功!');

View File

@@ -0,0 +1,3 @@
export type MarkdownViewProps = {
content: string;
};