dreamRs / shinyWidgets
Showing 1 of 5 files from the diff.
Other files ignored by Codecov

@@ -200,15 +200,61 @@
Loading
200 200
#' @export
201 201
#' @rdname html-dependencies
202 202
html_dependency_bttn <- function() {
203 -
  htmlDependency(
203 +
  bslib::bs_dependency_defer(bttnDependencyCSS)
204 +
}
205 +
206 +
207 +
#' @importFrom sass sass_file
208 +
#' @importFrom bslib bs_dependency is_bs_theme theme_version bs_get_variables bs_add_variables
209 +
bttnDependencyCSS <- function(theme) {
210 +
  if (!bslib::is_bs_theme(theme)) {
211 +
    return(htmlDependency(
212 +
      name = "bttn",
213 +
      version = "0.2.4",
214 +
      src = c(href = "shinyWidgets/bttn", file = "assets/bttn"),
215 +
      package = "shinyWidgets",
216 +
      stylesheet = "bttn.min.css"
217 +
    ))
218 +
  }
219 +
220 +
  if (is.na(bslib::bs_get_variables(theme, "royal"))) {
221 +
    theme <- bslib::bs_add_variables(theme, royal = "#bd2df5")
222 +
  }
223 +
224 +
  if (identical(bslib::theme_version(theme), "3")) {
225 +
    sass_vars <- list(
226 +
      "bttn--color-primary" = "$brand-primary",
227 +
      "bttn--color-success" = "$brand-success",
228 +
      "bttn--color-warning" = "$brand-warning",
229 +
      "bttn--color-danger" = "$brand-danger",
230 +
      "bttn--color-royal" = "$royal"
231 +
    )
232 +
  } else {
233 +
    sass_vars <- list(
234 +
      "bttn--color-primary" = "$primary",
235 +
      "bttn--color-success" = "$success",
236 +
      "bttn--color-warning" = "$warning",
237 +
      "bttn--color-danger" = "$danger",
238 +
      "bttn--color-royal" = "$royal"
239 +
    )
240 +
  }
241 +
  sass_input <- list(
242 +
    sass_vars,
243 +
    sass::sass_file(
244 +
      system.file(package = "shinyWidgets", "assets/bttn/bttn.scss")
245 +
    )
246 +
  )
247 +
248 +
  bslib::bs_dependency(
249 +
    input = sass_input,
250 +
    theme = theme,
204 251
    name = "bttn",
205 252
    version = "0.2.4",
206 -
    src = c(href = "shinyWidgets/bttn", file = "assets/bttn"),
207 -
    package = "shinyWidgets",
208 -
    stylesheet = "bttn.min.css"
253 +
    cache_key_extra = packageVersion("shinyWidgets")
209 254
  )
210 255
}
211 256
257 +
212 258
#' @export
213 259
#' @rdname html-dependencies
214 260
#' @importFrom bslib bs_dependency_defer
Files Coverage
R 74.03%
Project Totals (51 files) 74.03%
Notifications are pending CI completion. Periodically Codecov will check the CI state, when complete notifications will be submitted. Push notifications now.
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading