diff --git a/DESCRIPTION b/DESCRIPTION index 115f04bf..e4da849c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: blockr Title: A block-based framework for data manipulation and visualization -Version: 0.0.2.9031 +Version: 0.0.3.9000 Authors@R: c(person(given = "Nicolas", family = "Bennett", diff --git a/NEWS.md b/NEWS.md index f6f2e77c..4bc95d5c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,47 @@ +# blockr 0.0.3.9000 + +## Breaking changes +- `register_blocks()` and `register_block()` __input__, __output__ have been changed. If your package is composed of __data__ or __transform__ blocks, nothing has to be done, expect removing the old registration API. If you developed custom blocks, whose classes are neither __data__ or __transform__, you'll have to develop a type checker like so, for a plot block: + +```r +block_input_check.plot_block <- function(x, data, ...) { + + if (inherits(data, "data.frame")) { + return(invisible(NULL)) + } + + input_failure("Expecting data.frame input.") +} + +block_output_ptype.plot_block <- function(x, ...) ggplot() +``` + +Besides, there is no need to specify the __classes__ as this is automatically retrieved from the constructed block. +As a consequence, the new registration looks like: + +```r +# NEW +register_block( + constructor = new_ggplot_block, + name = "ggplot", + description = "Initialise a ggplot2 plot", + category = "Plot", + package = pkg +) + +# OLD +register_block( + constructor = new_ggplot_block, + name = "ggplot", + description = "Initialise a ggplot2 plot", + classes = c("ggplot_block", "plot_block"), + input = "plot", + output = "plot", + category = "Plot", + package = pkg +) +``` + # blockr 0.0.2.9031 ## Feature diff --git a/_pkgdown.yml b/_pkgdown.yml index 978229fb..cac08513 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -144,6 +144,8 @@ reference: - "`get_registry`" - "`add_block_ui`" - "`add_block_server`" + - "`block_input_check`" + - "`block_output_ptype`" - title: Server utilities desc: Shiny server elements @@ -206,6 +208,7 @@ reference: news: releases: + - text: "blockr 0.0.3.9000" - text: "blockr 0.0.2.9031" - text: "blockr 0.0.2" - text: "blockr 0.0.1.9000" diff --git a/vignettes/registry.Rmd b/vignettes/registry.Rmd index aae517b8..7354b036 100644 --- a/vignettes/registry.Rmd +++ b/vignettes/registry.Rmd @@ -369,4 +369,4 @@ knitr::include_graphics("figures/cmdk-data") ```{r cmdk-empty, echo=FALSE, fig.cap='Scoutbar with data block stack', fig.align = 'center', out.width='50%'} knitr::include_graphics("figures/cmdk-transform") -``` \ No newline at end of file +```