-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
81 lines (56 loc) · 1.98 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# reactflow
An experimental R package to use [`@xyflow/react`](https://reactflow.dev) in R and shiny. Barely working at the moment!
# ToDos
[s] add MiniMap, Controls, Background functionality,
[ ] also ViewportLogger, NodeInspector, ChangeLogger, BaseEdge, ControlButton, EdgeLabelRenderer, EdgeText, Handle, NodeResizer, NodeResizeControl, NodeToolbar, Panel, ViewportPanel: https://reactflow.dev/api-reference/components
[ ] allow custom functions for onNodesChange, onEdgesChange, onConnect
[s] allow get ID from shiny (click function)
[s] fix reactive values to redraw layout https://reactflow.dev/api-reference/hooks/use-update-node-internals
[ ] setNodes/setEdges from R? also Getters?
[ ] examples, eg https://reactflow.dev/examples/interaction/interaction-props
[ ] edge label at end
Layout Examples
## Examples
```{r}
nodes <- list(
list(id = "s", type = "input", data = list(label = "Start"),
className = "startNode", position = list(x = 0, y = 0)),
list(id = "m", data = list(label = "Mid"), position = list(
x = 0, y = 100)),
list(id = "e", data = list(label = "End"),
className = "endNode", position = list(x = 50, y = 200),
type = "output")
)
edges <- list(
list(id = "s-m", source = "s", target = "m", type = "smoothstep", animated = TRUE),
list(id = "m-e", source = "m", target = "e", type = "smoothstep", animated = TRUE)
)
reactflow::reactflow(
nodes,
edges
)
```
## Development
Clone the repository
```r
system("yarn install")
system("yarn run webpack")
devtools::document()
devtools::install(quick = TRUE)
# or in one go:
# system("yarn install && yarn run webpack"); devtools::document(); devtools::install(quick=TRUE)
# start a shiny app that should display a flow
shiny::runApp()
```