Commit Graph
98 Commits
Author SHA1 Message Date
Braks 4740a2c8fe update(hooks): add elementsProcessed event hook
* triggered after elements have been processed and updated in store
* add missing selection change trigger to store

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-26 13:54:49 +01:00
Braks 4630f3efc1 refactor(edges): Make edge updating optional
* add an option to enable edge updating globally
* pass an option to an edge to enable updating for a single edge

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-26 11:08:12 +01:00
Braks 0b2764028f update(nodes): watch nodes width for dimension update
* add force param to setElements, if set we clear the elements arr (default true)
* wait for store watcher until store is ready (i.e. a state has been set)
* move renderer css class to Renderer.vue

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 19:29:13 +01:00
Braks 4408ca1eb7 refactor(graph): async process elements
* process elements in chunks of 50 per ms to avoid blocking main thread

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>

refactor(flow): deferr initial loading to Renderer.vue component
2021-11-25 19:29:13 +01:00
Braks bd140f1549 update(flow): remove store, worker props
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks f2e38ca7ac update(nodes): add __vf to node props
* move edge/node component-types to components file

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 233e915376 update(store): remove promise from setState
* add default values for nodeTypes/edgeTypes - empty array for customs

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 9e941966a4 feat(nodes): add option to pass a valid target pos / valid source pos func to nodes
* edge updater cannot discern a valid connection by itself so we allow an option to pass a valid connection func to nodes which will then be used to determine if updating connection is valid
* it is optional, by default all connections are valid

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 9c7c2368a0 update(types): remove promise from addelements
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>

update(store): remove promise from setElements

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 929a6e637b update(edges): Add edge as param to edgeupdateend event
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 7916b20a99 fix(types): edge-text typing
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 96d54c59dc refactor(store): check if state variables have to be re-set
* instead of just pasting over the state constantly check what needs to be re-set

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 1ce41ccd40 refactor: move init function to store as setState
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks cf2ded4fc8 update: types in SelectionPane.vue
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 8b0ddc9be9 refactor(types): Remove SourceTargetNode-type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 708fa1f970 refactor(options)!: remove worker and store option
* either unnecessary, broken or needs more work

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 725dc8acb7 refactor(store): remove nodes/edges field
* nodes/edges are accessed via getter - that retains reactivity on elements

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks fa63dee37a refactor: remove node-pos actions
* add getSelectedNodes getter

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks 84bad861ea refactor(nodes): remove __vf.position
* duplicate position values as __vf.position and position save the same values

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-25 15:21:36 +01:00
Braks da4fd4f7ce feat(nodes): Allow nodes to pass all draggable options
* omits scale, grid, enableuserselecthack and enabletransformfix as valid options for draggable
* remove event interface and emits from nodewrapper

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-24 00:02:30 +01:00
Braks 71a10b2536 feat(nodes): Allow nodes to have their own snapGrid option
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 23:58:11 +01:00
Braks 1eac951055 feat(types): add DefaultEdgeTypes-type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>

feat(types): Add DefaultNodeTypes-type

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>

feat(types): Add DefaultNodeTypes and DefaultEdgeTypes to the exports object

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 23:58:11 +01:00
Braks 073b25ec60 feat(zoom): Add offset to fitview-params
* Allow for offsetting fit view by x or y values

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 23:58:11 +01:00
Braks db70409337 fix(types): hooks to return a graph-node type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 23:20:49 +01:00
Braks d22e21041d fix(edges): edges not reacting to hidden nodes
* Change getEdges to parse edges with source & target nodes and filter if one of them is missing
* add new type for Edges w sourceTargetNode called GraphEdge which is the return type of getEdges
*

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 18:25:08 +01:00
Braks cddf875b6d feat(types): Add GraphEdge type
* GraphEdges are edges that have been parsed and have a sourceTargetNode property

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 17:46:55 +01:00
Braks 091f3f82c2 update(types): export flowprops and custom connection line props type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 17:46:28 +01:00
Braks 67634fd72e feat(connection): Extend connection line props for more advanced usage
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 14:38:49 +01:00
Braks 46ecec5366 feat(options): add preventScrolling option
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-23 14:12:43 +01:00
Braks 0dd5ed7836 fix(types): edge text type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 21:38:31 +01:00
Braks b9bb3cfb1a update(types): remove null types and use undefined
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-22 17:14:57 +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 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 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 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 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 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 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 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 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 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 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 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