Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shinylive #381

Merged
merged 10 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ inst/examples/**/rsconnect
.vscode
*.icloud
docs

/.quarto/
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bs4Dash
Type: Package
Title: A 'Bootstrap 4' Version of 'shinydashboard'
Version: 2.3.3
Version: 2.3.4
Authors@R: c(
person("David", "Granjon", email = "[email protected]", role = c("aut", "cre")),
person(family = "RinteRface", role = "cph"),
Expand All @@ -11,7 +11,7 @@ Maintainer: David Granjon <[email protected]>
Description: Make 'Bootstrap 4' Shiny dashboards. Use the full power
of 'AdminLTE3', a dashboard template built on top of 'Bootstrap 4'
<https://github.com/ColorlibHQ/AdminLTE>.
URL: https://rinterface.github.io/bs4Dash/index.html, https://github.com/RinteRface/bs4Dash
URL: https://rinterface.github.io/bs4Dash/index.html, https://github.com/RinteRface/bs4Dash, https://bs4dash.rinterface.com/
BugReports: https://github.com/RinteRface/bs4Dash/issues
License: GPL (>= 2) | file LICENSE
Imports:
Expand All @@ -32,7 +32,7 @@ Suggests:
DT,
thematic (>= 0.1.2)
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Collate:
'feedbacks.R'
Expand All @@ -56,3 +56,5 @@ Collate:
'skinSelector.R'
'utils.R'
RdMacros: lifecycle
Depends:
R (>= 2.10)
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# bs4Dash 2.3.4

- Added shinylive to support documentation examples.

## Minor change
- Update jquery-ui to 1.13.2. Thanks @biognosys-so.
- Fix CRAN NOTES.

# bs4Dash 2.3.3

## Breaking change (potential)
Expand Down
Binary file added R/sysdata.rda
Binary file not shown.
6 changes: 3 additions & 3 deletions R/tabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ tabsetPanel <- function(..., id = NULL, selected = NULL,



#' Insert a \link{tabPanel} in a \link{tabsetPanel}
#' Insert a \link[shiny]{tabPanel} in a \link{tabsetPanel}
#'
#' @param inputId \link{tabsetPanel} id.
#' @param tab \link{tabPanel} to insert.
#' @param target \link{tabPanel} after of before which the new tab will be inserted.
#' @param tab \link[shiny]{tabPanel} to insert.
#' @param target \link[shiny]{tabPanel} after of before which the new tab will be inserted.
#' @param position Insert before or after: \code{c("before", "after")}.
#' @param select Whether to select the newly inserted tab. FALSE by default.
#' @param session Shiny session object.
Expand Down
14 changes: 14 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,17 @@ get_parent_args <- function() {
cl <- sys.call(-3)
as.list(cl)[-1]
}

# For shinylive examples
create_link_iframe <- function(link) {
shiny::tags$iframe(
class = "html-fill-item",
src = link,
height = "800",
width = "100%",
style = "border: 1px solid rgba(0,0,0,0.175); border-radius: .375rem;",
allowfullscreen = "",
allow = "autoplay",
`data-external` = "1"
)
}
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<br>

<div class="card">
<a href="https://dgranjon.shinyapps.io/virtual_patient_v2/" target="_blank"><img src="https://community.rstudio.com/uploads/default/original/2X/e/eb1013fd09ccf10cbe13da3f0168eebfcb0eba75.gif"></a>
<img src="https://community.rstudio.com/uploads/default/original/2X/e/eb1013fd09ccf10cbe13da3f0168eebfcb0eba75.gif">
</div>

<br>
Expand Down Expand Up @@ -59,7 +59,7 @@ server <- function(input, output) {
shinyApp(ui, server)
```

Starting from v2.0.0, moving to `{bs4Dash}` is rather simple:
Moving to `{bs4Dash}` is rather simple, as we just replace `library(shinydashboard)`:

```r
library(bs4Dash)
Expand Down Expand Up @@ -92,14 +92,6 @@ server <- function(input, output) {
shinyApp(ui, server)
```


## Upgrading bs4Dash to 2.0.0
- `{bs4Dash}` is undergoing major rework to make it easier to come from `{shinydashboard}`. The current development version 2.0.0 provides a 1:1 supports, in other word moving from `{shinydashboard}` to `{bs4Dash}` is accomplished by changing `library(shinydashboard)` to `library(bs4Dash)`.

- `{bs4Dash}` v2.0.0 also provides 1:1 with `{shinydashboardPlus}` to ease compatibility.

- Apps built with `{bs4Dash}` version <= 0.5.0 are definitely not compatible with v2.0.0 due to substantial breaking changes in the API. We advise users to keep the old version for old apps and move to to the new version for newer apps.

## Installation

```r
Expand All @@ -110,8 +102,6 @@ install.packages("bs4Dash")
```

## Demo

See a working example on shinyapps.io [here](https://dgranjon.shinyapps.io/bs4DashDemo/).
You may also run:

```r
Expand Down
11 changes: 8 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
template:
bootstrap: 5

url: https://bs4dash.rinterface.com/
reference:
- title: Basic dashboard functions
desc: Dashboard skeleton functions
Expand Down Expand Up @@ -240,8 +244,7 @@ navbar:

articles:
- title: User guide
desc: ~
navbar: User Guide
navbar: ~
contents:
- '`step-by-step`'
- '`improved-boxes`'
Expand All @@ -252,7 +255,9 @@ articles:

news:
releases:
- text: "bs4Dash 2.4.0.9000"
- text: "bs4Dash 2.3.4"
- text: "bs4Dash 2.3.3"
- text: "bs4Dash 2.3.0"
- text: "bs4Dash 2.2.1"
- text: "bs4Dash 2.1.0"
- text: "bs4Dash 2.0.3"
Expand Down
12 changes: 10 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@
There were no ERRORs or WARNINGs or NOTEs.

## Note
This release will fixe the NOTES on https://cran.r-project.org/web/checks/check_results_bs4Dash.html.
Update: re-submissiom fixing issue with `omicsTools` reverse dependency.
Fix a 3 NOTES:

> Version: 2.3.3
Check: Rd cross-references
Result: NOTE
Found the following Rd file(s) with Rd \link{} targets missing package
anchors:
insertTab.Rd: tabPanel
Please provide package anchors for all Rd \link{} targets not in the
package itself and the base packages.
37 changes: 14 additions & 23 deletions index.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
output: github_document
always_allow_html: true
---

```{r setup, include=FALSE}
library(bslib)
library(bs4Dash)
knitr::opts_chunk$set(echo = TRUE)
```

Expand All @@ -11,32 +14,29 @@ knitr::opts_chunk$set(echo = TRUE)
[![R build status](https://github.com/RinteRface/bs4Dash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/bs4Dash/actions)
[![version](https://www.r-pkg.org/badges/version/bs4Dash)](https://CRAN.R-project.org/package=bs4Dash)
[![cranlogs](https://cranlogs.r-pkg.org/badges/bs4Dash)](https://CRAN.R-project.org/package=bs4Dash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/bs4Dash)](https://www.rpackages.io/package/bs4Dash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/bs4Dash)](https://CRAN.R-project.org/package=bs4Dash)
[![Codecov test coverage](https://codecov.io/gh/RinteRface/bs4Dash/branch/master/graph/badge.svg)](https://codecov.io/gh/RinteRface/bs4Dash?branch=master)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/assets/devices.min.css" type="text/css" />

> Bootstrap 4 shinydashboard using [AdminLTE3](https://github.com/ColorlibHQ/AdminLTE)

<br>

<div class="card">
<a href="https://dgranjon.shinyapps.io/virtual_patient_v2/" target="_blank"><img src="https://community.rstudio.com/uploads/default/original/2X/e/eb1013fd09ccf10cbe13da3f0168eebfcb0eba75.gif"></a>
</div>
```{r showcase-code, eval=TRUE, echo=FALSE}
card(
bs4Dash:::create_link_iframe(bs4Dash:::shinylive_links["inst/examples/showcase"]),
full_screen = TRUE,
style = "margin: 0 auto; float: none;"
)
```

<br>

<div class="card">
<a href="https://analytichealth.co.uk/pharmly-portal/" target="_blank"><img src="https://analytichealth.co.uk/wp-content/uploads/2021/10/PA-bs4Dash.gif"></a>
<a href="https://analytichealth.co.uk/pharmly-portal/" target="_blank"><img src="https://analytichealth.co.uk/wp-content/uploads/2021/10/PA-bs4Dash.gif" alt="bs4Dash usage medical dashboard"></a>
</div>

<br>

```{r, echo=FALSE}
bs4Dash:::app_container("https://dgranjon.shinyapps.io/virtual_patient_v2/", deps = TRUE)
```

## New users moving to bs4Dash v2.0.0
## From shinydashboard to bs4Dash

Taking the simple `{shinydashboard}` example:

Expand Down Expand Up @@ -73,7 +73,7 @@ server <- function(input, output) {
shinyApp(ui, server)
```

Starting from v2.0.0, moving to `{bs4Dash}` is rather simple:
Moving to `{bs4Dash}` is rather simple, as we just replace `library(shinydashboard)`:

```r
library(bs4Dash)
Expand Down Expand Up @@ -106,14 +106,6 @@ server <- function(input, output) {
shinyApp(ui, server)
```


## Upgrading bs4Dash to 2.0.0
- `{bs4Dash}` is undergoing major rework to make it easier to come from `{shinydashboard}`. The current development version 2.0.0 provides a 1:1 supports, in other word moving from `{shinydashboard}` to `{bs4Dash}` is accomplished by changing `library(shinydashboard)` to `library(bs4Dash)`.

- `{bs4Dash}` v2.0.0 also provides 1:1 with `{shinydashboardPlus}` to ease compatibility.

- Apps built with `{bs4Dash}` version <= 0.5.0 are definitely not compatible with v2.0.0 due to substantial breaking changes in the API. We advise users to keep the old version for old apps and move to to the new version for newer apps.

## Installation

```r
Expand All @@ -124,7 +116,6 @@ install.packages("bs4Dash")
```

## Demo
See a working example on shinyapps.io [here](https://dgranjon.shinyapps.io/bs4DashDemo/).
You may also run:

```r
Expand Down
73 changes: 34 additions & 39 deletions index.md

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ $(function () {
break;
default: console.warn(`${config.status} does not belong to allowed statuses!`)
}

closeButton = '';

if (config.closable) {
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions inst/shinylive/tools.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pak::pak("parmsam/r-shinylive@feat/encode-decode-url")

create_shinylive_links <- function(path) {

dirs <- list.dirs(path)[-1]

vapply(
list.dirs(path)[-1],
shinylive:::url_encode_dir,
FUN.VALUE = character(1)
)
}

create_vignettes_links <- function() {
create_shinylive_links("inst/examples/vignettes-demos")
}

shinylive_links <- create_vignettes_links()
usethis::use_data(shinylive_links, internal = TRUE, overwrite = TRUE)
8 changes: 4 additions & 4 deletions man/insertTab.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions netlify.toml

This file was deleted.

24 changes: 24 additions & 0 deletions pkgdown/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -902,3 +902,27 @@ fieldset:disabled a.btn {
-moz-transition: -moz-transform 0.3s 0.7s, opacity 0s 0.7s;
transition: transform 0.3s 0.7s, opacity 0s 0.7s;
}

/* bslib cards */
.bslib-card{overflow:auto}.bslib-card .card-body+.card-body{padding-top:0}.bslib-card .card-body{overflow:auto}.bslib-card .card-body p{margin-top:0}.bslib-card .card-body p:last-child{margin-bottom:0}.bslib-card .card-body{max-height:var(--bslib-card-body-max-height, none)}.bslib-card[data-full-screen="true"]>.card-body{max-height:var(--bslib-card-body-max-height-full-screen, none)}.bslib-card .card-header .form-group{margin-bottom:0}.bslib-card .card-header .selectize-control{margin-bottom:0}.bslib-card .card-header .selectize-control .item{margin-right:1.15rem}.bslib-card .card-footer{margin-top:auto}.bslib-card .bslib-navs-card-title{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center}.bslib-card .bslib-navs-card-title .nav{margin-left:auto}.bslib-card .bslib-sidebar-layout:not([data-bslib-sidebar-border="true"]){border:none}.bslib-card .bslib-sidebar-layout:not([data-bslib-sidebar-border-radius="true"]){border-top-left-radius:0;border-top-right-radius:0}[data-full-screen="true"]{position:fixed;inset:3.5rem 1rem 1rem;height:auto !important;max-height:none !important;width:auto !important;z-index:1070}.bslib-full-screen-enter{display:none;position:absolute;bottom:var(--bslib-full-screen-enter-bottom, 0.2rem);right:var(--bslib-full-screen-enter-right, 0);top:var(--bslib-full-screen-enter-top);left:var(--bslib-full-screen-enter-left);color:var(--bslib-color-fg, var(--bs-card-color));background-color:var(--bslib-color-bg, var(--bs-card-bg, var(--bs-body-bg)));border:var(--bs-card-border-width) solid var(--bslib-color-fg, var(--bs-card-border-color));box-shadow:0 2px 4px rgba(0,0,0,0.15);margin:0.2rem 0.4rem;padding:0.55rem !important;font-size:.8rem;cursor:pointer;opacity:0.7;z-index:1070}.bslib-full-screen-enter:hover{opacity:1}.card[data-full-screen="false"]:hover>*>.bslib-full-screen-enter{display:block}.bslib-has-full-screen .card:hover>*>.bslib-full-screen-enter{display:none}@media (max-width: 575.98px){.bslib-full-screen-enter{display:none !important}}.bslib-full-screen-exit{position:relative;top:1.35rem;font-size:0.9rem;cursor:pointer;text-decoration:none;display:flex;float:right;margin-right:2.15rem;align-items:center;color:rgba(var(--bs-body-bg-rgb), 0.8)}.bslib-full-screen-exit:hover{color:rgba(var(--bs-body-bg-rgb), 1)}.bslib-full-screen-exit svg{margin-left:0.5rem;font-size:1.5rem}#bslib-full-screen-overlay{position:fixed;inset:0;background-color:rgba(var(--bs-body-color-rgb), 0.6);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);z-index:1069;animation:bslib-full-screen-overlay-enter 400ms cubic-bezier(0.6, 0.02, 0.65, 1) forwards}@keyframes bslib-full-screen-overlay-enter{0%{opacity:0}100%{opacity:1}}

/* fill css for fullscreen cards */
.html-fill-container {
display: flex;
flex-direction: column;
/* Prevent the container from expanding vertically or horizontally beyond its
parent's constraints. */
min-height: 0;
min-width: 0;
}
.html-fill-container > .html-fill-item {
/* Fill items can grow and shrink freely within
available vertical space in fillable container */
flex: 1 1 auto;
min-height: 0;
min-width: 0;
}
.html-fill-container > :not(.html-fill-item) {
/* Prevent shrinking or growing of non-fill items */
flex: 0 0 auto;
}
18 changes: 17 additions & 1 deletion pkgdown/extra.js

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tools/jstools.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ pkg_version <- as.character(utils::packageVersion("bs4Dash"))
tmp_old_version <- list.dirs("srcjs", full.names = FALSE, recursive = FALSE)
old_version <- strsplit(tmp_old_version, "-")[[1]][2]
new_srcjs_folder_name <- sprintf("srcjs/bs4Dash-%s", pkg_version)
outputDir <- sprintf("inst/bs4Dash-%s", pkg_version)

if (old_version != pkg_version) {
file.rename(
file.path("srcjs", tmp_old_version),
new_srcjs_folder_name
)
dir.create(outputDir)
}

# Validate ----------------------------------------------------------------
Expand All @@ -26,8 +28,6 @@ bs4DashJS <- list.files(

# jshint_file(input = bs4DashJS, options = jshint_options(jquery = TRUE, globals = list("Shiny", "app")))

outputDir <- sprintf("inst/bs4Dash-%s", pkg_version)

# Concat -----------------------------------------------------------------

# This just aggregates all srcjs files into one big .js file. There is no minifications, ... See next step for terser
Expand Down
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.html
*.R

/.quarto/
Loading
Loading