diff --git a/doc/components/Header.vue b/doc/components/Header.vue index 90bda5e..463939b 100644 --- a/doc/components/Header.vue +++ b/doc/components/Header.vue @@ -4,8 +4,7 @@
Guides - StoryBook - REPL playground + StoryBook forks diff --git a/doc/components/Repl.vue b/doc/components/Repl.vue index 9a783e5..de6779d 100644 --- a/doc/components/Repl.vue +++ b/doc/components/Repl.vue @@ -22,7 +22,7 @@ const store = new ReplStore({ const files: Record = {} -const imports = exampleImports[props.example] +const imports = exampleImports[props.example].files const additionalImports: Object = ('additionalImports' in imports ? imports.additionalImports : {}) as Object; for (const example of Object.keys(imports).filter((i) => i !== 'additionalImports')) { @@ -56,9 +56,9 @@ watch(() => props.example, async (newExample) => { // You may want to update the REPL environment or take other actions // For example, update the files and imports based on the new example - let newImports = exampleImports[newExample]; + let newImports = exampleImports[newExample].files; const newFiles: Record = {}; - let newCss = ''; + let newCss = `@import url('https://unpkg.com/vue-diagrams@latest/dist/style.css')`; for (const example of Object.keys(newImports).filter((i) => i !== 'additionalImports')) { if (example.includes('css')) { diff --git a/doc/examples/customNodes/App.vue b/doc/examples/customNodes/App.vue new file mode 100644 index 0000000..2693b3c --- /dev/null +++ b/doc/examples/customNodes/App.vue @@ -0,0 +1,37 @@ + + + + diff --git a/doc/examples/customNodes/CustomNode.vue b/doc/examples/customNodes/CustomNode.vue new file mode 100644 index 0000000..13c2b61 --- /dev/null +++ b/doc/examples/customNodes/CustomNode.vue @@ -0,0 +1,40 @@ + + diff --git a/doc/examples/customNodes/index.ts b/doc/examples/customNodes/index.ts new file mode 100644 index 0000000..4eb3f6c --- /dev/null +++ b/doc/examples/customNodes/index.ts @@ -0,0 +1,10 @@ +import App from './App.vue?raw' +import CustomNode from './CustomNode.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + 'CustomNode.vue': CustomNode, + } +}; diff --git a/doc/examples/customPortPosition/App.vue b/doc/examples/customPortPosition/App.vue new file mode 100644 index 0000000..dfa02cb --- /dev/null +++ b/doc/examples/customPortPosition/App.vue @@ -0,0 +1,30 @@ + + + diff --git a/doc/examples/customPortPosition/index.ts b/doc/examples/customPortPosition/index.ts new file mode 100644 index 0000000..25f47e8 --- /dev/null +++ b/doc/examples/customPortPosition/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Simple usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/dropToCreateNodes/App.vue b/doc/examples/dropToCreateNodes/App.vue new file mode 100644 index 0000000..c08ace3 --- /dev/null +++ b/doc/examples/dropToCreateNodes/App.vue @@ -0,0 +1,46 @@ + + + + diff --git a/doc/examples/dropToCreateNodes/index.ts b/doc/examples/dropToCreateNodes/index.ts new file mode 100644 index 0000000..8a128c6 --- /dev/null +++ b/doc/examples/dropToCreateNodes/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/editModes/App.vue b/doc/examples/editModes/App.vue new file mode 100644 index 0000000..31ffebf --- /dev/null +++ b/doc/examples/editModes/App.vue @@ -0,0 +1,70 @@ + + + + diff --git a/doc/examples/editModes/index.ts b/doc/examples/editModes/index.ts new file mode 100644 index 0000000..8a128c6 --- /dev/null +++ b/doc/examples/editModes/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/editableTitles/images/App.vue b/doc/examples/editableTitles/images/App.vue new file mode 100644 index 0000000..1c4f3c0 --- /dev/null +++ b/doc/examples/editableTitles/images/App.vue @@ -0,0 +1,34 @@ + + + diff --git a/doc/examples/editableTitles/images/index.ts b/doc/examples/editableTitles/images/index.ts new file mode 100644 index 0000000..d0e66a0 --- /dev/null +++ b/doc/examples/editableTitles/images/index.ts @@ -0,0 +1 @@ +export { default as App } from './App.vue?raw' diff --git a/doc/examples/editableTitles/index.ts b/doc/examples/editableTitles/index.ts index d0e66a0..25f47e8 100644 --- a/doc/examples/editableTitles/index.ts +++ b/doc/examples/editableTitles/index.ts @@ -1 +1,8 @@ -export { default as App } from './App.vue?raw' +import App from './App.vue?raw' + +export default { + section: 'Simple usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/gridSnap/App.vue b/doc/examples/gridSnap/App.vue new file mode 100644 index 0000000..7fd5083 --- /dev/null +++ b/doc/examples/gridSnap/App.vue @@ -0,0 +1,36 @@ + + + diff --git a/doc/examples/gridSnap/index.ts b/doc/examples/gridSnap/index.ts new file mode 100644 index 0000000..25f47e8 --- /dev/null +++ b/doc/examples/gridSnap/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Simple usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/images/App.vue b/doc/examples/images/App.vue new file mode 100644 index 0000000..1c4f3c0 --- /dev/null +++ b/doc/examples/images/App.vue @@ -0,0 +1,34 @@ + + + diff --git a/doc/examples/images/index.ts b/doc/examples/images/index.ts new file mode 100644 index 0000000..a479c6d --- /dev/null +++ b/doc/examples/images/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Simple usage', + files: { + 'App.vue': App, + } +} diff --git a/doc/examples/index.ts b/doc/examples/index.ts index 96f4913..61b583e 100644 --- a/doc/examples/index.ts +++ b/doc/examples/index.ts @@ -1,23 +1,39 @@ -import { PlaygroundApp } from './playground'; -import { ShaderApp } from './shader'; -import { InfrastructureSchemaApp } from './infrastructureSchema'; -import { App as EditableTitlesApp } from './editableTitles'; -import { App as MenuApp } from './menu'; +import playground from './playground'; +import shader from './shader'; +import infrastructureSchema from './infrastructureSchema'; +import editableTitles from './editableTitles'; +import menu from './menu'; +import images from './images'; +import customPortPosition from './customPortPosition'; +import resizeNodes from './resize'; +import layouts from './layouts'; +import thumbnail from './thumbnail'; +import gridSnap from './gridSnap'; +import customNodes from './customNodes'; -export const exampleImports = { - playground: { - 'App.vue': PlaygroundApp, - }, - shader: { - 'App.vue': ShaderApp, - }, - infrastructureSchema: { - 'App.vue': InfrastructureSchemaApp, - }, - editableTitles: { - 'App.vue': EditableTitlesApp, - }, - Menu: { - 'App.vue': MenuApp, - }, +import dropToCreateNodes from './dropToCreateNodes'; +import editModes from './editModes'; +import serializationDeserialization from './serializationDeserialization'; + +type ExampleImports = { + [key: string]: any; +} + + +export const exampleImports: Record = { + playground, + shader, + infrastructureSchema, + editableTitles, + menu, + images, + customPortPosition, + resizeNodes, + layouts, + thumbnail, + gridSnap, + customNodes, + dropToCreateNodes, + editModes, + serializationDeserialization, }; diff --git a/doc/examples/infrastructureSchema/index.ts b/doc/examples/infrastructureSchema/index.ts index a9658e6..982a53e 100644 --- a/doc/examples/infrastructureSchema/index.ts +++ b/doc/examples/infrastructureSchema/index.ts @@ -1 +1,8 @@ -export { default as InfrastructureSchemaApp } from './App.vue?raw' +import InfrastructureSchemaApp from './App.vue?raw' + +export default { + section: 'Demo', + files: { + 'App.vue': InfrastructureSchemaApp, + } +}; diff --git a/doc/examples/layouts/App.vue b/doc/examples/layouts/App.vue new file mode 100644 index 0000000..7e419d4 --- /dev/null +++ b/doc/examples/layouts/App.vue @@ -0,0 +1,244 @@ + + + diff --git a/doc/examples/layouts/index.ts b/doc/examples/layouts/index.ts new file mode 100644 index 0000000..8a128c6 --- /dev/null +++ b/doc/examples/layouts/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/menu/App.vue b/doc/examples/menu/App.vue index f7519d1..9535a84 100644 --- a/doc/examples/menu/App.vue +++ b/doc/examples/menu/App.vue @@ -7,6 +7,7 @@ diff --git a/doc/examples/playground/index.ts b/doc/examples/playground/index.ts index 3cee550..d095683 100644 --- a/doc/examples/playground/index.ts +++ b/doc/examples/playground/index.ts @@ -1 +1,8 @@ -export { default as PlaygroundApp } from './App.vue?raw' +import PlaygroundApp from './App.vue?raw' + +export default { + section: 'Demo', + files: { + 'App.vue': PlaygroundApp, + }, +}; diff --git a/doc/examples/resize/App.vue b/doc/examples/resize/App.vue new file mode 100644 index 0000000..9098b53 --- /dev/null +++ b/doc/examples/resize/App.vue @@ -0,0 +1,39 @@ + + + diff --git a/doc/examples/resize/index.ts b/doc/examples/resize/index.ts new file mode 100644 index 0000000..6fb9c83 --- /dev/null +++ b/doc/examples/resize/index.ts @@ -0,0 +1,7 @@ +import App from './App.vue?raw' +export default { + section: 'Simple usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/serializationDeserialization/App.vue b/doc/examples/serializationDeserialization/App.vue new file mode 100644 index 0000000..7deff63 --- /dev/null +++ b/doc/examples/serializationDeserialization/App.vue @@ -0,0 +1,38 @@ + + diff --git a/doc/examples/serializationDeserialization/index.ts b/doc/examples/serializationDeserialization/index.ts new file mode 100644 index 0000000..8a128c6 --- /dev/null +++ b/doc/examples/serializationDeserialization/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + } +}; diff --git a/doc/examples/shader/index.ts b/doc/examples/shader/index.ts index 24ef1a5..0e3f00a 100644 --- a/doc/examples/shader/index.ts +++ b/doc/examples/shader/index.ts @@ -1 +1,8 @@ -export { default as ShaderApp } from './App.vue?raw' +import ShaderApp from './App.vue?raw' + +export default { + section: 'Demo', + files: { + 'App.vue': ShaderApp, + } +}; diff --git a/doc/examples/thumbnail/App.vue b/doc/examples/thumbnail/App.vue new file mode 100644 index 0000000..2d4ca5b --- /dev/null +++ b/doc/examples/thumbnail/App.vue @@ -0,0 +1,52 @@ + + + diff --git a/doc/examples/thumbnail/index.ts b/doc/examples/thumbnail/index.ts new file mode 100644 index 0000000..8eb2cc9 --- /dev/null +++ b/doc/examples/thumbnail/index.ts @@ -0,0 +1,8 @@ +import App from './App.vue?raw' + +export default { + section: 'Advanced usage', + files: { + 'App.vue': App, + }, +}; diff --git a/doc/pages/index.vue b/doc/pages/index.vue index 14ede11..4fb356e 100644 --- a/doc/pages/index.vue +++ b/doc/pages/index.vue @@ -6,7 +6,7 @@

An easy to use diagram editor component

Diagram component for vue.js, inspired by react-diagrams

For Vue 2 & 3!

- +
@@ -52,6 +52,7 @@