From 52c23e97707afcb57687e5cc46eab319c744d740 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 9 Dec 2022 18:22:08 +0100 Subject: [PATCH] docs: add toolbar example Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- docs/components/examples/index.ts | 5 ++ docs/components/examples/node-toolbar/App.vue | 62 +++++++++++++++++++ .../examples/node-toolbar/ToolbarNode.vue | 25 ++++++++ .../components/examples/node-toolbar/index.ts | 2 + docs/src/.vitepress/config.ts | 1 + docs/src/.vitepress/plugins/copy.ts | 4 ++ docs/src/examples/nodes/node-toolbar.md | 10 +++ 7 files changed, 109 insertions(+) create mode 100644 docs/components/examples/node-toolbar/App.vue create mode 100644 docs/components/examples/node-toolbar/ToolbarNode.vue create mode 100644 docs/components/examples/node-toolbar/index.ts create mode 100644 docs/src/examples/nodes/node-toolbar.md diff --git a/docs/components/examples/index.ts b/docs/components/examples/index.ts index 7887b8a9..d2b85aac 100644 --- a/docs/components/examples/index.ts +++ b/docs/components/examples/index.ts @@ -18,6 +18,7 @@ import { TeleportApp, TeleportCSS, TeleportSidebar, TeleportableNode, Teleportab import { TransitionApp, TransitionCSS, TransitionEdge } from './transition' import { IntersectionApp, IntersectionCSS, IntersectionElements } from './intersection' import { SnapToHandleApp, SnappableConnectionLine } from './snap-to-handle' +import { ToolbarApp, ToolbarNode } from './node-toolbar' export const exampleImports = { basic: { @@ -119,4 +120,8 @@ export const exampleImports = { 'App.vue': SnapToHandleApp, 'SnappableConnectionLine.vue': SnappableConnectionLine, }, + toolbar: { + 'App.vue': ToolbarApp, + 'ToolbarNode.vue': ToolbarNode, + }, } diff --git a/docs/components/examples/node-toolbar/App.vue b/docs/components/examples/node-toolbar/App.vue new file mode 100644 index 00000000..cf2637a1 --- /dev/null +++ b/docs/components/examples/node-toolbar/App.vue @@ -0,0 +1,62 @@ + + + diff --git a/docs/components/examples/node-toolbar/ToolbarNode.vue b/docs/components/examples/node-toolbar/ToolbarNode.vue new file mode 100644 index 00000000..abaedddb --- /dev/null +++ b/docs/components/examples/node-toolbar/ToolbarNode.vue @@ -0,0 +1,25 @@ + + + diff --git a/docs/components/examples/node-toolbar/index.ts b/docs/components/examples/node-toolbar/index.ts new file mode 100644 index 00000000..c97b0ae5 --- /dev/null +++ b/docs/components/examples/node-toolbar/index.ts @@ -0,0 +1,2 @@ +export { default as ToolbarApp } from './App.vue?raw' +export { default as ToolbarNode } from './ToolbarNode.vue?raw' diff --git a/docs/src/.vitepress/config.ts b/docs/src/.vitepress/config.ts index 84024f52..baae04b0 100644 --- a/docs/src/.vitepress/config.ts +++ b/docs/src/.vitepress/config.ts @@ -211,6 +211,7 @@ export default defineConfigWithTheme({ { text: 'Custom Node', link: '/examples/nodes/' }, { text: 'Update Node', link: '/examples/nodes/update-node' }, { text: 'Nested Nodes', link: '/examples/nodes/nesting' }, + { text: 'Node Toolbar', link: '/examples/nodes/node-toolbar' }, ], }, { diff --git a/docs/src/.vitepress/plugins/copy.ts b/docs/src/.vitepress/plugins/copy.ts index bfab4ee7..4c64c0b1 100644 --- a/docs/src/.vitepress/plugins/copy.ts +++ b/docs/src/.vitepress/plugins/copy.ts @@ -12,6 +12,10 @@ export function copyVueFlowPlugin(): Plugin { path: '../../../node_modules/@vue-flow/additional-components/dist/', pkgName: 'vue-flow-additional-components.mjs', }, + { + path: '../../../node_modules/@vue-flow/node-toolbar/dist/', + pkgName: 'vue-flow-node-toolbar.mjs', + }, ].forEach(({ path, pkgName }) => { const filePath = resolve(__dirname, `${path}/${pkgName}`) if (!existsSync(filePath)) { diff --git a/docs/src/examples/nodes/node-toolbar.md b/docs/src/examples/nodes/node-toolbar.md new file mode 100644 index 00000000..fd3319ce --- /dev/null +++ b/docs/src/examples/nodes/node-toolbar.md @@ -0,0 +1,10 @@ +# Node Toolbar + +This is a toolbar component for Vue Flow. +It can be used to create a floating Toolbar next to your nodes. +You can either display the Toolbar by setting the visibility prop or automatically showing the Toolbar +on selected nodes. + +
+ +