Commit Graph
39 Commits
Author SHA1 Message Date
Braks 39b21faa5b refactor(types)!: Remove elements prop, change EdgeTypes/NodeTypes prop to string[]
* no more elements prop - v-model instead!
* Instead of passing an object map to components just pass in an array of strings as nodeTypes/edgeTypes object
* the string name will either be resolved to a dynamic component with :is="type" or a slot with the type-name
* update all examples

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 22:10:25 +01:00
Braks 6a1571e6e3 fix: Flow not properly pre-loading state
* pass key to initFlow to possibly find a pre-existing state

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 00:40:42 +01:00
Braks 6a68292f7c feat: merge store with props
* if options are passed to useVueFlow, we want to merge them with possibly passed props
* renamed flowStore to stateStore
* fix examples
* add store prop to pass an already existing store to flow

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 23:45:39 +01:00
Braks 921d93c73e update!: Remove hooks context
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 21:13:03 +01:00
Braks 3f139dffee update: add default null value to injections
* "disables" warnings about injection not being found
* we assume that the injection can be undefined, so we don't need to be spammed about missing injections

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 13:55:42 +01:00
Braks b91d65fd3a fix: storage not properly preloading
* Add elements to store state when using addElements action

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 13:42:41 +01:00
Braks c8d3ff6a29 update: add return type to useVueFlow default export
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-18 23:42:37 +01:00
Braks 470ab3782a update: remove useHooks usage
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-18 23:17:09 +01:00
Braks 99dbd4b2cc feat!: Add hooks to store
* For easier access and to avoid context issues with injections hooks are put into the store
* hooks can be accessed and will emit events when the flow has bound its emit function to the hooks
* useHooks and useStore are not exported anymore! Instead, useVueFlow is provided, which will return an instance of the current vue flow store
* Rename NodeIdContextKey to NodeId
* Add addElements function to store to add elements without having to re-set the whole store
* use v-model for elements, re-set elements only if there's an actual change

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-18 21:24:20 +01:00
Braks a493168daf feat: Add useVueFlow composable
* Allows for use of the vue flow instance without having to listen to the onLoad event
* fix usekeypress export
* Add types for controls events

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-18 18:04:50 +01:00
Braks a58d952e9f fix: disable inherting attrs on nodes/edges to avoid warnings
* disable context warnings for non-dev environments

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-16 16:01:44 +01:00
Braks 4fb55aba68 fix: cancel keypress for input dom nodes
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-16 13:34:21 +01:00
Braks 476a5aa09b fix: type in usehooks
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-16 13:06:54 +01:00
Braks 490983bebe fix: todo in useHandle
* edge update end only emits the mouse event, not the edge

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-16 13:04:55 +01:00
Braks 7c66cf5d9b update!: Remove update node internals composable
* It's practically useless as vue doesn't need the trigger to catch a re-render
* Remove unused types

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-16 12:58:16 +01:00
Braks aaf5f608f5 feat: add path alias for src
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-06 09:38:02 +01:00
Braks 5437d48325 fix: custom node example not fitting view
* fit view can't work (for the onLoad event) for elements assigned after the host has mounted (onMounted hook) as we can't calculate a rect of elements that don't exist at flow creation
* in this case just trigger fit view __after__ elements have been created/passed to the flow

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-06 08:54:35 +01:00
Braks 3931a59524 fix(docs): dedupe and add alias for vue
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-06 08:54:35 +01:00
Braks ae0772b6d4 update(docs): fix view height 2021-11-06 08:54:35 +01:00
Braks 61779638ac update(dist): Remove rollup and use vite to build lib
* Remove custom tsconfig paths to avoid resolving issues on published package
2021-11-06 08:54:35 +01:00
Braks 64df75d405 feat(docs): Initial commit for docs in nuxt 3 2021-11-06 08:54:35 +01:00
Braks 6ec8258f33 fix: typings 2021-10-22 14:29:27 +02:00
Braks babcbd0e1f update: Flow instance provides update node internals func
* Rename onLoadParams to FlowInstance
* Pass update node internals to instance
2021-10-22 12:39:55 +02:00
Braks 3ee3843af6 fix: Edge updates not triggering properly
update(types): Add FlowEvents type
2021-10-22 10:46:12 +02:00
Braks 20e9d1d396 update: fix names 2021-10-21 17:42:33 +02:00
Braks 636eeff9fe feat: use v-html for node labels
* add span tag as wrapper for node labels

feat(examples):

* Add overview example
2021-10-21 15:29:17 +02:00
Braks ca2901bc01 fix: zoom pan helper not being initialized timely 2021-10-21 13:46:15 +02:00
Braks 2bfecf7148 update: change name to vue flow
* Add gif to readme

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-10-20 22:39:54 +02:00
Braks b2b1fe822f feat: add useStore and useHooks composables that provide default store/hooks 2021-10-20 22:39:54 +02:00
Braks 61dc9dea33 fix: edges and edge anchors not re-calculating correctly 2021-10-20 22:39:54 +02:00
Braks 7ecbcba7eb fix: edge anchor 2021-10-20 22:39:54 +02:00
Braks 9d9a90e9a7 update: Add slots to CustomConnectionLine.vue, Edge.vue, Node.vue 2021-10-20 22:39:54 +02:00
Braks b3d276bfb8 fix: clamp transform values 2021-10-20 22:39:54 +02:00
Braks c3fb3cd10a fix: zoom pan helper 2021-10-20 22:39:54 +02:00
Braks a895853b64 update: Add injection keys 2021-10-20 22:39:54 +02:00
Braks 560bdc203b update(script-setup): Refactor remaining files to script setup style 2021-10-20 22:39:54 +02:00
Braks 9b2f4b7406 fix: return transform from useZoom 2021-10-20 22:39:54 +02:00
Braks f8728f0d6e feat: script setup style
* Add Node.vue
2021-10-20 22:39:54 +02:00
Braks 9307c9066a feat: script setup style
* Replace jsx with script setup syntax
* Simplify logic and make it more "composable"
    * Move Zoom functions to useZoom composable
* Update eslint config & tsconfig
2021-10-20 22:39:54 +02:00