Skip to content

Commit 7c951a0

Browse files
committed
feat: draft workflow elements
1 parent 8417043 commit 7c951a0

File tree

12 files changed

+169
-0
lines changed

12 files changed

+169
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Workflow
3+
description:
4+
icon: lucide:workflow
5+
---
6+
7+
:::ComponentLoader{label="Workflow" componentName="Workflow"}
8+
:::

apps/www/nuxt.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ export default defineNuxtConfig({
4848
sourcemap: false,
4949
chunkSizeWarningLimit: 1500,
5050
},
51+
optimizeDeps: {
52+
include: [
53+
'dayjs',
54+
'@braintree/sanitize-url',
55+
'mermaid',
56+
],
57+
esbuildOptions: {
58+
target: 'esnext',
59+
},
60+
},
61+
resolve: {
62+
dedupe: ['dayjs'],
63+
},
5164
},
5265

5366
nitro: {

apps/www/plugins/ai-elements.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
Suggestion,
2929
SuggestionAiInput,
3030
Task,
31+
Workflow,
3132
} from '@repo/examples'
3233

3334
import ComponentLoader from '@/components/ComponentLoader.vue'
@@ -68,4 +69,5 @@ export default defineNuxtPlugin((nuxtApp) => {
6869
vueApp.component('InlineCitation', InlineCitation)
6970
vueApp.component('CodeBlock', CodeBlock)
7071
vueApp.component('CodeBlockDark', CodeBlockDark)
72+
vueApp.component('Workflow', Workflow)
7173
})

packages/elements/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
},
99
"dependencies": {
1010
"@repo/shadcn-vue": "workspace:*",
11+
"@vue-flow/background": "^1.3.2",
12+
"@vue-flow/controls": "^1.1.3",
13+
"@vue-flow/core": "^1.47.0",
1114
"@vueuse/core": "^13.9.0",
1215
"ai": "^5.0.60",
1316
"lucide-vue-next": "^0.544.0",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup lang="ts">
2+
import type { FlowEmits, FlowProps } from '@vue-flow/core'
3+
import { Background } from '@vue-flow/background'
4+
import { VueFlow } from '@vue-flow/core'
5+
import { useForwardPropsEmits } from 'reka-ui'
6+
import { Controls } from '../controls'
7+
import '@vue-flow/core/dist/style.css'
8+
import '@vue-flow/core/dist/theme-default.css'
9+
10+
const props = withDefaults(defineProps<FlowProps>(), {
11+
deleteKeyCode: () => ['Backspace', 'Delete'],
12+
fitViewOnInit: true,
13+
panOnDrag: false,
14+
panOnScroll: true,
15+
selectNodesOnDrag: true,
16+
zoomOnDoubleClick: false,
17+
})
18+
19+
const emits = defineEmits<FlowEmits>()
20+
21+
const forwarded = useForwardPropsEmits(props, emits)
22+
</script>
23+
24+
<template>
25+
<VueFlow data-slot="canvas" v-bind="forwarded">
26+
<Background />
27+
<Controls />
28+
<slot />
29+
</VueFlow>
30+
</template>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Canvas } from './Canvas.vue'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from 'vue'
3+
import { cn } from '@repo/shadcn-vue/lib/utils'
4+
import { Controls as ControlsPrimitive } from '@vue-flow/controls'
5+
import { reactiveOmit } from '@vueuse/core'
6+
import '@vue-flow/controls/dist/style.css'
7+
8+
const props = defineProps<{
9+
class?: HTMLAttributes['class']
10+
}>()
11+
12+
const delegatedProps = reactiveOmit(props, 'class')
13+
</script>
14+
15+
<template>
16+
<ControlsPrimitive
17+
data-slot="controls"
18+
v-bind="delegatedProps"
19+
:class="cn('gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none! [&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!', props.class)"
20+
/>
21+
</template>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Controls } from './Controls.vue'

packages/examples/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"dependencies": {
1111
"@repo/elements": "workspace:*",
12+
"@vue-flow/core": "^1.47.0",
1213
"ai": "^5.0.60",
1314
"lucide-vue-next": "^0.544.0",
1415
"nanoid": "^5.1.6",

packages/examples/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ export { default as Sources } from './sources.vue'
2727
export { default as SuggestionAiInput } from './suggestion-ai-input.vue'
2828
export { default as Suggestion } from './suggestion.vue'
2929
export { default as Task } from './task.vue'
30+
export { default as Workflow } from './workflow.vue'

0 commit comments

Comments
 (0)