Skip to content

Commit

Permalink
use roxy.shinylive (#775)
Browse files Browse the repository at this point in the history
test with insightsengineering/roxy.shinylive#1

Implementation of `roxy.shinylive`.

Please run `pkgdown::build_site()` to see the difference.

![image](https://github.com/user-attachments/assets/96283a55-5c2a-493f-a855-5ef17425ac34)


Extra:
- for a few examples: remove dependency on `teal.widgets` so that the
example code is simpler
- for a few examples: replace `@examples` with `@examplesIf`. This is
for our incorrect implementation of soft dependencies
- add a new "Playground" section in the README with links to the
shinylive
- include shinylive iframe in the vignettes

---------

Signed-off-by: Pawel Rucki <[email protected]>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
  • Loading branch information
pawelru and dependabot-preview[bot] authored Oct 1, 2024
1 parent 56dc3d6 commit 05aeb65
Show file tree
Hide file tree
Showing 45 changed files with 663 additions and 291 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ vignettes/*.R
coverage.*
tests/testthat/_snaps/**/*.new.md
tests/testthat/_snaps/**/*.new.svg
/doc/
/Meta/
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Suggests:
pkgload,
rlang (>= 1.0.0),
rmarkdown (>= 2.23),
roxy.shinylive,
rtables (>= 0.6.8),
rvest,
shinytest2,
Expand All @@ -92,12 +93,12 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel, baddstats/goftest,
ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr, daroczig/logger,
deepayan/lattice, insightsengineering/nestcolor, r-lib/pkgload,
r-lib/rlang, rstudio/rmarkdown, insightsengineering/rtables,
r-lib/rlang, rstudio/rmarkdown, insightsengineering/roxy.shinylive, insightsengineering/rtables,
tidyverse/rvest, htmlwidgets/sparkline, rstudio/shinytest2,
r-lib/testthat, r-lib/withr
Config/Needs/website: insightsengineering/nesttemplate
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
Roxygen: list(markdown = TRUE, packages = c("roxy.shinylive"))
RoxygenNote: 7.3.2
17 changes: 9 additions & 8 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' library(teal.widgets)
#'
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
Expand All @@ -45,9 +47,6 @@
#' multiple = TRUE
#' ),
#' filter = NULL
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by PCA Module")
#' )
#' )
#' )
Expand All @@ -56,6 +55,11 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
Expand All @@ -80,9 +84,6 @@
#' multiple = TRUE
#' ),
#' filter = NULL
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by PCA Module")
#' )
#' )
#' )
Expand Down
19 changes: 9 additions & 10 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # general data example
#' library(teal.widgets)
#'
#' data <- teal_data()
#' data <- within(data, {
#' require(nestcolor)
Expand Down Expand Up @@ -77,9 +79,6 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Regression Module")
#' )
#' )
#' )
Expand All @@ -88,9 +87,12 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' library(teal.widgets)
#'
#' data <- teal_data()
#' data <- within(data, {
#' require(nestcolor)
Expand Down Expand Up @@ -123,9 +125,6 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Regression Module")
#' )
#' )
#' )
Expand Down
9 changes: 9 additions & 0 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # general data example
#' data <- teal_data()
Expand All @@ -53,6 +57,11 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down
4 changes: 4 additions & 0 deletions R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' data <- teal_data()
#' data <- within(data, {
Expand Down
4 changes: 4 additions & 0 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' data <- teal_data()
#' data <- within(data, {
Expand Down
17 changes: 9 additions & 8 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' library(teal.widgets)
#'
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down Expand Up @@ -60,9 +62,6 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Association Module")
#' )
#' )
#' )
Expand All @@ -71,6 +70,11 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down Expand Up @@ -108,9 +112,6 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Association Module")
#' )
#' )
#' )
Expand Down
18 changes: 9 additions & 9 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
#'
#' @inherit shared_params return
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' library(teal.widgets)
#'
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down Expand Up @@ -96,17 +98,18 @@
#' selected = "Treatment",
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Bivariate Module")
#' )
#' )
#' )
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
#'
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down Expand Up @@ -155,9 +158,6 @@
#' selected = "COUNTRY",
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Bivariate Module")
#' )
#' )
#' )
Expand Down
23 changes: 14 additions & 9 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
#'
#' @inherit shared_params return
#'
#' @examples
#' library(teal.widgets)
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
# nolint start: line_length_linter.
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)
# nolint end: line_length_linter.
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
Expand All @@ -44,9 +48,6 @@
#' dist_var = data_extract_spec(
#' dataname = "iris",
#' select = select_spec(variable_choices("iris"), "Petal.Length")
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Distribution Module")
#' )
#' )
#' )
Expand All @@ -55,6 +56,13 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
# nolint start: line_length_linter.
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)
# nolint end: line_length_linter.
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
Expand Down Expand Up @@ -94,9 +102,6 @@
#' vars = vars1,
#' multiple = TRUE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Distribution Module")
#' )
#' )
#' )
Expand Down
19 changes: 9 additions & 10 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
#' @note For more examples, please see the vignette "Using response plot" via
#' `vignette("using-response-plot", package = "teal.modules.general")`.
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # general data example
#' library(teal.widgets)
#'
#' data <- teal_data()
#' data <- within(data, {
#' require(nestcolor)
Expand Down Expand Up @@ -77,9 +79,6 @@
#' multiple = FALSE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Response Module")
#' )
#' )
#' )
Expand All @@ -88,9 +87,12 @@
#' shinyApp(app$ui, app$server)
#' }
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#' # CDISC data example
#' library(teal.widgets)
#'
#' data <- teal_data()
#' data <- within(data, {
#' require(nestcolor)
Expand Down Expand Up @@ -123,9 +125,6 @@
#' multiple = FALSE,
#' fixed = FALSE
#' )
#' ),
#' ggplot2_args = ggplot2_args(
#' labs = list(subtitle = "Plot generated by Response Module")
#' )
#' )
#' )
Expand Down
Loading

0 comments on commit 05aeb65

Please sign in to comment.