11<script setup lang="ts">
22import type { EdgeTypesObject , NodeTypesObject } from ' @vue-flow/core'
33import { Canvas } from ' @repo/elements/canvas'
4- import { Connection } from ' @repo/elements/connection'
5- import { Controls } from ' @repo/elements/controls'
64import { Animated , Temporary } from ' @repo/elements/edge'
7- import { Panel } from ' @repo/elements/panel'
8- import { Button } from ' @repo/shadcn-vue/components/ui/button'
95import { nanoid } from ' nanoid'
106import { markRaw , ref } from ' vue'
117import CustomNode from ' ./custom-node.vue'
128
139const nodeIds = {
1410 start: nanoid (),
1511 process1: nanoid (),
12+ process2: nanoid (),
13+ decision: nanoid (),
14+ output1: nanoid (),
15+ output2: nanoid (),
1616}
1717
1818const nodes = ref ([
1919 {
2020 id: nodeIds .start ,
2121 type: ' custom' ,
22- position: { x: 80 , y: 80 },
22+ position: { x: 0 , y: 0 },
2323 data: {
24- label: ' start ' ,
25- description: ' test ' ,
24+ label: ' Start ' ,
25+ description: ' Initialize workflow ' ,
2626 content: ' test' ,
2727 footer: ' test' ,
2828 handles: { target: false , source: true },
@@ -31,15 +31,63 @@ const nodes = ref([
3131 {
3232 id: nodeIds .process1 ,
3333 type: ' custom' ,
34- position: { x: 320 , y: 260 },
34+ position: { x: 500 , y: 0 },
3535 data: {
36- label: ' process1 ' ,
37- description: ' test ' ,
36+ label: ' Process Data ' ,
37+ description: ' Transform input ' ,
3838 content: ' test' ,
3939 footer: ' test' ,
4040 handles: { target: true , source: true },
4141 },
4242 },
43+ {
44+ id: nodeIds .decision ,
45+ type: ' custom' ,
46+ position: { x: 1000 , y: 0 },
47+ data: {
48+ label: ' Decision Point' ,
49+ description: ' Route based on conditions' ,
50+ content: ' test' ,
51+ footer: ' test' ,
52+ handles: { target: true , source: true },
53+ },
54+ },
55+ {
56+ id: nodeIds .output1 ,
57+ type: ' custom' ,
58+ position: { x: 1500 , y: - 100 },
59+ data: {
60+ label: ' Success Path' ,
61+ description: ' Handle success case' ,
62+ content: ' test' ,
63+ footer: ' test' ,
64+ handles: { target: true , source: true },
65+ },
66+ },
67+ {
68+ id: nodeIds .output2 ,
69+ type: ' custom' ,
70+ position: { x: 1500 , y: 100 },
71+ data: {
72+ label: ' Error Path' ,
73+ description: ' Handle error case' ,
74+ content: ' test' ,
75+ footer: ' test' ,
76+ handles: { target: true , source: true },
77+ },
78+ },
79+ {
80+ id: nodeIds .process2 ,
81+ type: ' custom' ,
82+ position: { x: 2000 , y: 0 },
83+ data: {
84+ label: ' Complete' ,
85+ description: ' Finalize workflow' ,
86+ content: ' test' ,
87+ footer: ' test' ,
88+ handles: { target: true , source: false },
89+ },
90+ },
4391])
4492
4593const edges = ref ([
@@ -49,6 +97,36 @@ const edges = ref([
4997 target: nodeIds .process1 ,
5098 type: ' animated' ,
5199 },
100+ {
101+ id: nanoid (),
102+ source: nodeIds .process1 ,
103+ target: nodeIds .decision ,
104+ type: ' animated' ,
105+ },
106+ {
107+ id: nanoid (),
108+ source: nodeIds .decision ,
109+ target: nodeIds .output1 ,
110+ type: ' animated' ,
111+ },
112+ {
113+ id: nanoid (),
114+ source: nodeIds .decision ,
115+ target: nodeIds .output2 ,
116+ type: ' temporary' ,
117+ },
118+ {
119+ id: nanoid (),
120+ source: nodeIds .output1 ,
121+ target: nodeIds .process2 ,
122+ type: ' animated' ,
123+ },
124+ {
125+ id: nanoid (),
126+ source: nodeIds .output2 ,
127+ target: nodeIds .process2 ,
128+ type: ' temporary' ,
129+ },
52130])
53131
54132const nodeTypes: NodeTypesObject = {
@@ -68,17 +146,6 @@ const edgeTypes: EdgeTypesObject = {
68146 :edges =" edges"
69147 :node-types =" nodeTypes"
70148 :edge-types =" edgeTypes"
71- >
72- <template #connection-line =" connectionLineProps " >
73- <Connection v-bind =" connectionLineProps" />
74- </template >
75-
76- <Controls />
77- <Panel position =" top-right" >
78- <Button size =" sm" variant =" secondary" >
79- Export
80- </Button >
81- </Panel >
82- </Canvas >
149+ />
83150 </div >
84151</template >
0 commit comments