diff --git a/main/coverage-report/index.html b/main/coverage-report/index.html index 5a98788..63a56b9 100644 --- a/main/coverage-report/index.html +++ b/main/coverage-report/index.html @@ -107,8 +107,8 @@

roxy.shinylive coverage - 100.00%

-
- +
+
@@ -119,7 +119,7 @@

roxy.shinylive coverage - 100.00%

1 -
#' Custom `examplesShinylive` tag.
+
#' Custom `@examplesShinylive` tag.
@@ -133,14 +133,14 @@

roxy.shinylive coverage - 100.00%

3 -
#' This function generates a new "Examples in Shinylive" section in the documentation. This section contains URL to
+
#' This function generates a new "Examples in Shinylive" section in the documentation.
4 -
#' the application in Shinylive as well as an iframe with the application.
+
#' This section contains URL to the application in Shinylive and for HTML outputs: an iframe with the application.
@@ -1575,7 +1575,7 @@

roxy.shinylive coverage - 100.00%

209 2x -
    $(\"iframe.iframe_shinylive\").css(\"width\", \"140\\%\");
+
    $(\"iframe.iframe_shinylive\").css(\"width\", \"150\\%\");
@@ -1707,7 +1707,7 @@

roxy.shinylive coverage - 100.00%

1 -
#' Creates Shinylive url for the app code.
+
#' Creates Shinylive url based on app code.
@@ -1749,144 +1749,214 @@

roxy.shinylive coverage - 100.00%

7 -
#' @return (`character(1)`) Shinylive app url.
+
#' @param mode (`character(1)`) A string with mode. One of "app" or "editor". Default is "app".
8 -
#'
+
#' @param header (`logical(1)`) A logical value indicating whether to include header.
9 -
#' @export
+
#' Ignored if `mode` is "editor".
10 -
#'
+
#' @return (`character(1)`) Shinylive app url.
11 -
#' @examples
+
#'
12 -
#' code <- "this is your app code as a string"
+
#' @export
13 -
#' create_shinylive_url(code)
+
#'
14 -
create_shinylive_url <- function(code) {
+
#' @examples
- + 15 + + +
#' code <- "this is your app code as a string"
+ + + + 16 + + +
#' create_shinylive_url(code)
+ + + + 17 + + +
#' create_shinylive_url(code, header = FALSE)
+ + + + 18 + + +
#' create_shinylive_url(code, mode = "editor")
+ + + + 19 + + +
create_shinylive_url <- function(code, mode = c("app", "editor"), header = TRUE) {
+ + + + 20 12x
  stopifnot(is.character(code) && length(code) == 1)
+ + 21 + 12x + +
  mode <- match.arg(mode)
+ + + + 22 + 12x + +
  stopifnot(is.logical(header) && length(header) == 1)
+ + - 16 + 23

                     
                   
                   
-                    17
+                    24
                     
                     
                       
  # implementation based on "Create ShinyLive Link" feature of Shiny VSCode extension
- 18 + 25
  # https://github.com/posit-dev/shiny-vscode/blob/80560bf36d516ff89dffe88bd9a28cee9edd4d43/src/shinylive.ts#L499
- 19 + 26 12x
  files <- list(
- 20 + 27 12x
    name = jsonlite::unbox("app.R"),
- 21 + 28 12x
    content = jsonlite::unbox(code)
- 22 + 29
  )
- 23 + 30 12x
  files_json <- jsonlite::toJSON(list(files))
- 24 + 31 12x
  files_lz <- lzstring::compressToEncodedURIComponent(as.character(files_json))
- 25 + 32 12x
  files_lz <- gsub("/", "-", files_lz)
+ + 33 + + +

+                    
+                  
                   
-                    26
+                    34
                     12x
                     
-                      
  sprintf("https://shinylive.io/r/app/#code=%s", files_lz)
+
  header_param <- ifelse(mode == "app" && isFALSE(header), "h=0&", "")
- 27 + 35 + + +

+                    
+                  
+                  
+                    36
+                    12x
+                    
+                      
  sprintf("https://shinylive.io/r/%s/#%scode=%s", mode, header_param, files_lz)
+ + + + 37
}