docs: move examples dir out of components dir

This commit is contained in:
braks
2023-12-12 22:33:47 +01:00
committed by Braks
parent 7ba258c53b
commit bb2bf72012
89 changed files with 20 additions and 34 deletions
+63
View File
@@ -0,0 +1,63 @@
<script setup>
import { Position, VueFlow } from '@vue-flow/core'
import { ref } from 'vue'
import ToolbarNode from './ToolbarNode.vue'
const defaultNodeStyle = {
border: '1px solid #10b981',
background: '#ef467e',
color: 'white',
borderRadius: '99px',
}
const elements = ref([
{
id: '1',
type: 'toolbar',
label: 'toolbar top',
data: { toolbarPosition: Position.Top },
position: { x: 200, y: 0 },
style: defaultNodeStyle,
},
{
id: '2',
type: 'toolbar',
label: 'toolbar right',
data: { toolbarPosition: Position.Right },
position: { x: -50, y: 100 },
style: defaultNodeStyle,
},
{
id: '3',
type: 'toolbar',
label: 'toolbar bottom',
data: { toolbarPosition: Position.Bottom },
position: { x: 0, y: 200 },
style: defaultNodeStyle,
},
{
id: '4',
type: 'toolbar',
label: 'toolbar left',
data: { toolbarPosition: Position.Left },
position: { x: 200, y: 300 },
style: defaultNodeStyle,
},
{
id: '5',
type: 'toolbar',
label: 'toolbar always open',
data: { toolbarPosition: Position.Top, toolbarVisible: true },
position: { x: 0, y: -100 },
style: defaultNodeStyle,
},
])
</script>
<template>
<VueFlow v-model="elements" fit-view-on-init class="vue-flow-basic-example">
<template #node-toolbar="nodeProps">
<ToolbarNode :data="nodeProps.data" :label="nodeProps.label" />
</template>
</VueFlow>
</template>
@@ -0,0 +1,25 @@
<script setup>
import { Handle, Position } from '@vue-flow/core'
import { NodeToolbar } from '@vue-flow/node-toolbar'
defineProps(['data', 'label'])
</script>
<template>
<NodeToolbar
style="display: flex; gap: 0.5rem; align-items: center"
:is-visible="data.toolbarVisible"
:position="data.toolbarPosition"
>
<button>Action1</button>
<button>Action2</button>
<button>Action3</button>
</NodeToolbar>
<div :style="{ padding: '10px 20px' }">
{{ label }}
</div>
<Handle type="target" :position="Position.Left" />
<Handle type="source" :position="Position.Right" />
</template>
+2
View File
@@ -0,0 +1,2 @@
export { default as ToolbarApp } from './App.vue?raw'
export { default as ToolbarNode } from './ToolbarNode.vue?raw'