-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
155 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,3 +81,7 @@ amb_button <- \(..., class = "rounded-1", type = "button") { | |
... | ||
) | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' @keywords components | ||
#' @rdname components | ||
#' @param widget htmlwidget to convert as a shiny.tag | ||
#' @param ... attributes to add to the container | ||
#' @param width to customeize the width of the container | ||
#' @param height to customeize the width of the container | ||
#' @export | ||
amb_htmlwidget <- \(widget, ..., width = "100%", height = "400px") { | ||
temp_widget_file <- NULL | ||
widget_chr <- withr::with_tempfile("temp_widget_file", fileext = ".html", { | ||
htmlwidgets::saveWidget(widget, temp_widget_file, selfcontained = TRUE) | ||
lines_read <- readLines(temp_widget_file) | ||
full_html <- paste0(lines_read, "\n", collapse = "") | ||
full_html |> | ||
stringr::str_replace_all("<!DOCTYPE html>", "") |> | ||
stringr::str_replace_all('<meta charset="utf-8" />', "") |> | ||
stringr::str_replace_all("<title>.*</title>", "") |> | ||
stringr::str_replace_all("<html.*>", "") |> | ||
stringr::str_replace_all("</html>", "") |> | ||
stringr::str_replace_all("<head>", "") |> | ||
stringr::str_replace_all("</head>", "") |> | ||
stringr::str_replace_all("<body.*>", "") |> | ||
stringr::str_replace_all("</body>", "") | ||
}) | ||
widget_html <- htmltools::HTML(widget_chr) | ||
widget_tags <- htmltools::tags$div(widget_html, width = width, height = height, ...) | ||
widget_tags | ||
} | ||
|
||
# #'@noRd | ||
# amb_htmlwidget_data <- \(widget, ..., width = "100%", height = "400px") { | ||
# widget_chr <- withr::with_tempfile("temp_widget_file", fileext = ".html", { | ||
# htmlwidgets::saveWidget(widget, temp_widget_file, selfcontained = TRUE) | ||
# readLines(temp_widget_file) |> | ||
# paste0("\n", collapse = "") | ||
# }) | ||
# start_pattern <- '<script type="application/json" data-for="' | ||
# stringr::str_extract(widget_chr, glue::glue('{start_pattern}.*</script>')) | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=https://jrosell.github.io/ambhtmx/reference/components.html" /> | ||
<meta name="robots" content="noindex"> | ||
<link rel="canonical" href="https://jrosell.github.io/ambhtmx/reference/components.html"> | ||
</head> | ||
</html> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.