Skip to content

Commit

Permalink
Merge branch 'master' into shinylive
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg authored Sep 25, 2024
2 parents 19cf8a3 + 57fab6c commit a1ed22e
Show file tree
Hide file tree
Showing 18 changed files with 422 additions and 427 deletions.
92 changes: 23 additions & 69 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- master
branches: [main, master]
pull_request:
branches:
- master
branches: [main, master]

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -18,81 +20,33 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
64 changes: 34 additions & 30 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: master
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: macOS-latest
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
shell: Rscript {0}
extra-packages: any::pkgdown, local::.
needs: website

- name: Install package
run: R CMD INSTALL .
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
23 changes: 0 additions & 23 deletions .github/workflows/pkgdown.yml

This file was deleted.

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RoxygenNote: 7.3.2
URL: https://github.com/RinteRface/shiny386, https://rinterface.github.io/shiny386
BugReports: https://github.com/RinteRface/shiny386/issues
Imports:
htmltools,
htmltools (>= 0.5.2),
shiny,
httpuv
Suggests:
Expand Down
44 changes: 22 additions & 22 deletions R/deps.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
bs4_deps <- htmltools::htmlDependency(
name = "Bootstrap",
version = "4.4.1",
src = c(file = "bootstrap-4.4.1"),
package = "shiny386",
script = c(
"js/bootstrap.bundle.js",
"js/custom.js",
"js/progress_handler.js",
"js/toast_handler.js",
"js/radioButtonsBinding.js",
"js/tabsetPanelBinding.js",
"js/dropdownInputBinding.js"
),
stylesheet = c(
"css/bootstrap.min.css",
"css/custom.css"
)
)


#' Create shiny386 dependencies
#'
#' Add all necessary dependencies so that shiny386 renders well
Expand All @@ -27,5 +6,26 @@ bs4_deps <- htmltools::htmlDependency(
#' @export
#' @seealso \link{page_386}.
use_bs4_deps <- function(tag) {
tagList(tag, bs4_deps)
tagList(
tag,
htmltools::htmlDependency(
name = "Bootstrap",
version = "4.4.1",
src = c(file = "bootstrap-4.4.1"),
package = "shiny386",
script = c(
"js/bootstrap.bundle.js",
"js/custom.js",
"js/progress_handler.js",
"js/toast_handler.js",
"js/radioButtonsBinding.js",
"js/tabsetPanelBinding.js",
"js/dropdownInputBinding.js"
),
stylesheet = c(
"css/bootstrap.min.css",
"css/custom.css"
)
)
)
}
26 changes: 25 additions & 1 deletion R/inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ update_checkbox_group_input_386 <- function (session, inputId, label = NULL, cho


#' Create a Bootstrap 386 select input
#'
#' @note Incompatible with selectize. Set to FALSE
#' by default to have correct CSS rendering.
#'
#' @inheritParams shiny::selectInput
#' @export
#' @examples
Expand All @@ -627,7 +631,27 @@ update_checkbox_group_input_386 <- function (session, inputId, label = NULL, cho
#' shinyApp(ui, server)
#'
#' }
select_input_386 <- shiny::selectInput
select_input_386 <- function(
inputId, label, choices, selected = NULL, multiple = FALSE,
selectize = FALSE, width = NULL, size = NULL
) {
htmltools::tagQuery(
shiny::selectInput(
inputId,
label,
choices,
selected,
multiple,
selectize = FALSE,
width,
size
)
)$
find("select")$
addClass("custom-select")$
removeClass("form-control")$
allTags()
}



Expand Down
44 changes: 18 additions & 26 deletions R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,22 @@ tabset_panel_386 <- function(..., id = NULL, selected = NULL,
)

# Some edit below since Bootstrap 4 significantly changed the layout
nav_items <- temp_tabset$children[[1]]$children[[1]]
found_active <- FALSE
bs4_nav_items <- lapply(nav_items, function(x) {
if (!is.null(x$attribs$class)) {
if (grep(x = x$attribs$class, pattern = "active")) {
x$attribs$class <- NULL
found_active <- TRUE
htmltools::tagQuery(temp_tabset)$
find("li")$
each(
function(x, i) {
# replace text
current_tab <- x$children[[1]]$attribs$`data-value`
x$attribs$class <- "nav-item"
x$children[[1]]$attribs$class <- if (selected == current_tab) {
"nav-link active"
} else {
"nav-link"
}
x
}
}
x$attribs$class <- if (is.null(x$attribs$class)) {
"nav-item"
} else {
paste("nav-item", x$attribs$class)
}
x$children[[1]]$attribs$class <- if (found_active) {
"nav-link active"
} else {
"nav-link"
}
x
})

temp_tabset$children[[1]]$children[[1]] <- bs4_nav_items
temp_tabset
)$
allTags()
}


Expand Down Expand Up @@ -208,9 +200,9 @@ update_tabset_panel_386 <- shiny::updateTabsetPanel
#' shinyApp(ui, server)
#' }
navbar_page_386 <- function (title, ..., id = NULL, selected = NULL,
position = c("static-top", "fixed-top", "fixed-bottom"),
header = NULL, footer = NULL, inverse = FALSE,
windowTitle = title) {
position = c("static-top", "fixed-top", "fixed-bottom"),
header = NULL, footer = NULL, inverse = FALSE,
windowTitle = title) {
pageTitle <- title
navbarClass <- "navbar navbar-expand-lg navbar-dark bg-primary"
position <- match.arg(position)
Expand Down
1 change: 0 additions & 1 deletion R/shiny386-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
#' @name shiny386
#' @import htmltools
#' @import shiny
#' @docType package
"_PACKAGE"
Loading

0 comments on commit a1ed22e

Please sign in to comment.