Commit Graph
221 Commits
Author SHA1 Message Date
Braks 1ea6e4f8da update: pass selected elements as prop to nodesselection
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 14:22:35 +01:00
Braks 5c3a1fba13 update: remove useStore from handle
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 14:22:11 +01:00
Braks 049b701580 update: use controlledComputed for edges/nodes
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 14:10:49 +01:00
Braks 2b065b4e56 update: pass store state as props to edge-renderer and edge
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 13:40:25 +01:00
Braks ebd0f9e738 update!: Remove renderer exports
* Slot remains, but default built-in renderer isn't part of the library export
* If a custom renderer is desired, a slot can be used to implement one

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 12:26:47 +01:00
Braks 6059b02e44 update: Pass down values as props instead of relying on store
* store values are passed down by main vue flow component
* store is only used to emit events or if really necessary in the component
* add keys with store id to elements
*

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 12:25:32 +01:00
Braks c35673c622 refactor: pass props to edge/nodewrapper separately
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 01:22:27 +01:00
Braks a55e33f91f feat: add draghandle prop to node
* specify a drag handle on the node

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 21:50:49 +01:00
Braks b10207021f refactor(types)!: Change ConnectionLineComponentProps to ConnectionLineProps
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 19:05:24 +01:00
Braks 3e4433c175 fix: skip dimensions check when ssr
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 18:48:24 +01:00
Braks f64ae24ee2 update: Add name to flow component
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 18:20:51 +01:00
Braks 502be52572 update: add hmr to statestore
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 18:20:03 +01:00
Braks a67e6c4430 fix: minimap prop type missing
* cant import stringfunc type (string literal and all...)

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 18:19:43 +01:00
Braks c48a0a9e2a fix: add missing click and doubleclick events to nodes/edges
* ssr bug

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 18:19:06 +01:00
Braks fd71e1e16e update: Add names to components
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 16:54:59 +01:00
Braks d24de0c0c2 update: move component related types to component-type file
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 16:54:24 +01:00
Braks 062aee45b2 update!: graphnode and node typing
* graphnode is a node containing internal Vue Flow data
* move util files to util directory
* move flow actions type into store file
* rename panel type file to zoom
* rename types file to flow
* Rename Node to NodeWrapper
* Rename Edge to EdgeWrapper

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 16:25:27 +01:00
Braks ba24f3ca62 update(edges): useAttrs on edges to use style
* remove class and style props, pass them as attrs

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 13:33:59 +01:00
Braks e4ead738c9 update(types): Correct __vf typing
* fix all uses of __vf so the actual type works properly
* correct the class and style props

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 13:33:12 +01:00
Braks 0e9f8c5fc2 refactor: rename internal data field to __vf
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 12:54:04 +01:00
Braks 71ba905348 fix: zoom values being initialized before zoom is ready
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 12:49:44 +01:00
Braks da29a613f0 feat(slots): Add node and edge renderer slots
* more flexibility by having the ability to use the node/edge-renderer and wrapper
* export renderer and wrapper from lib entry

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-21 12:34:28 +01:00
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 0a1c2d4ede update: some comments
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 20:11:33 +01:00
Braks e648e1a179 feat: make worker optional
* worker can be enabled with prop, defaults to false
* add deep unref function

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 19:56:35 +01:00
Braks 668fed1dc4 feat: Add dedicated default loading component
* add option to pass a transition name

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 18:22:30 +01:00
Braks 4e8ff6201a feat: Add loading indicator slot and prop
* While the graph is suspended we open up a loading indicator slot
* a prop option has to be passed to enable the indicator
* add some styles for a default loading text
* move loading event to after store has been initialized *and* zoom pane dimensions are present

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 17:33:27 +01:00
Braks d335944e56 feat: offload parsing elements to worker
* when we're not in ssr environment we use a web worker to parse the elements as this blocks the main thread when there's a good amount of nodes/edges to parse
* when in ssr we don't really care about the main thread blocking so we just parse them like usual
* update vite to latest

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 16:22:31 +01:00
Braks 1b6ea1e1b5 update: make types for nodes and edges a computed prop
* remove nodeTypesId (was used in react to manually trigger a nodeTypes change)

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 03:28:46 +01:00
Braks 2b87d53c10 update: dont render nodes, edges if dimensions dont return a truthy value
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 03:18:09 +01:00
Braks 68b7d99a9c fix: load hook timing
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 02:15:12 +01:00
Braks d25fa579e4 fix: suspension not working properly
* move invoke to vueflow to suspend
* await dimensions in Node/Edge-wrapper components
* await nodes/edges in renderer
* await elements in VueFlow

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 02:00:37 +01:00
Braks 990126b2b9 fix: onLoad being triggered when elements aren't ready
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-20 01:20:47 +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 37388ddf47 feat(types): Add NodeTypes and EdgeTypes
* Interface for passing an object of NodeTypes/EdgeTypes
* Object needs to be passed with components markedRaw

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 17:47:57 +01:00
Braks 8c4747a8a9 update: move watcher to onMounted hook
* remove default values for nodes edges from initial store

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 16:51:40 +01:00
Braks f92c5462bf update: a couple more perfomance related updates
* check for selected value inside Node instead of the wrapping renderer
* instead of "parsing" elements just return the current store.elements object
* use map funct to find index

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 15:41:00 +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 054e71a609 feat: Add instance to store
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 13:46:37 +01:00
Braks e93da64c70 feat: v-model for elements
* add vmodel for elements and a new modelValue prop (which should replace the elements prop further along the road to avoid confusion)
*

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 13:46:17 +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 48da1eccba update: merge props with state objects
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 02:44:48 +01:00
Braks f534572cef fix!: v-model implemented again
* fix store usage

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 02:13:47 +01:00
Braks 8605909f5d feat: export default edge and node types object
* set isReady after load-hook trigger

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 01:55:48 +01:00
Braks 70b077a1f5 fix!: props and composable not merging together properly
* Add getter for node/edge types
* change nodeTypes prop type to only Record<string, NodeType> - same for edges
* Add rgb example
* remove v-model for elements

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-19 01:43:07 +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