Compare commits

..

94 Commits

Author SHA1 Message Date
Carson
561625b270 soft-deprecate bootstrapPage() and basicPage(). Fixes #2594 2019-09-10 17:48:13 -05:00
Carson Sievert
2e0221ecfd Merge pull request #2592 from rstudio/set-min-max
Exit early if date parsing fails
2019-09-09 13:55:08 -07:00
Carson
aeded79544 yarn build 2019-09-09 15:43:41 -05:00
Carson
c0a7958e77 update news 2019-09-09 15:18:41 -05:00
Carson
431b194ec2 Exit early if date parsing fails in _setMin() and _setMax(), closes #2591 2019-09-09 13:48:18 -05:00
Joe Cheng
29d24d7e08 Merge pull request #2586 from rstudio/resourcePathChangesOption
Suppress resource path changes by default
2019-09-06 13:20:35 -07:00
Winston Chang
3b04c642ae Bump httpuv version dependency 2019-09-06 11:47:58 -05:00
Winston Chang
609fc5b0c0 Fix typo 2019-09-06 11:46:58 -05:00
Winston Chang
2a8c79b577 Merge pull request #2588 from rstudio/wch-slider-phantom
Add try-catch to ion.rangeSlider
2019-09-06 10:52:25 -05:00
Winston Chang
043316e40f Clarify comments 2019-09-06 10:52:08 -05:00
Joe Cheng
c9d8b987d4 Merge pull request #2522 from rstudio/wch-fix-reactivepoll-leak
Fix reactivePoll leak
2019-09-05 16:44:57 -07:00
Joe Cheng
33c5a5c665 Fix unit test 2019-09-05 16:12:07 -07:00
Winston Chang
29c90ba163 Code review fixes 2019-09-05 16:12:07 -07:00
Winston Chang
8c19450b10 Use safer method to remove observer 2019-09-05 16:11:47 -07:00
Winston Chang
89c97458c4 Update NEWS 2019-09-05 16:11:47 -07:00
Winston Chang
02be516902 Use safer finalizer for reactivePoll 2019-09-05 16:11:47 -07:00
Winston Chang
47ada300ea Fix reactivePoll leak 2019-09-05 16:11:19 -07:00
Carson
6f9c621774 Always suppress for now 2019-09-05 17:22:56 -05:00
Winston Chang
0310fe3b68 Automate patches for ion.rangeSlider 2019-09-05 16:00:56 -05:00
Winston Chang
7144a6e4b7 In ion.rangeSlider, wrap removeProp() in try-catch. Closes #2587 2019-09-05 15:53:37 -05:00
Carson
1c8071a96f Add shiny.resourcePathChanges option to get more information about resource path changes for a given prefix.
Closes #2584
2019-09-05 13:44:21 -05:00
Carson Sievert
ff5377da9e Merge pull request #2583 from rstudio/carson_resource_warning
Fix spacing in warning for resource paths conflicting with www/ subdirs
2019-09-04 11:27:09 -07:00
Carson
7aee84eb05 Fix spacing in warning for resource paths conflicting with www/ subdirs 2019-09-04 11:52:31 -05:00
Joe Cheng
769c32fd38 Merge pull request #2580 from hadley/shinyApp-docs
shinyApp() documentation improvements.
2019-09-04 08:12:17 -07:00
Joe Cheng
d05b89cfb3 Merge pull request #2581 from hadley/shinyApp-args
Clarify required argumented to shinyApp()
2019-09-04 08:08:44 -07:00
Hadley Wickham
f1f18a2334 Clarify required argumented to shinyApp()
This does technically change the interface as `shinyApp(server = function(input, output) ...))` would have previously worked, but it didn't generate a useful app.

Fixes #2462
2019-09-04 09:57:19 -05:00
Hadley Wickham
afc556f801 More details about server argument
Fixes #2508
2019-09-04 09:46:57 -05:00
Hadley Wickham
7f240839fc Document shiny.appobj in own file
Fixes #2458
2019-09-04 09:44:48 -05:00
Joe Cheng
8d0a6274cb Merge pull request #2579 from rstudio/wch-fix-sleep
Remove Sys.sleep in runApp()
2019-09-03 14:11:29 -07:00
Winston Chang
91cab10ff8 Remove Sys.sleep in runApp() 2019-09-03 15:09:51 -05:00
Joe Cheng
5828ea7426 Merge pull request #2577 from hadley/print-methods
Implement two missing print methods
2019-09-03 08:14:51 -07:00
Joe Cheng
80ba147168 Merge pull request #2566 from rstudio/fix-statichandler-backslash
Disallow backslash in staticHandler paths
2019-09-03 07:50:35 -07:00
Joe Cheng
f85479ba11 Merge pull request #2570 from rstudio/joe/misc/update-node-deps
Upgrade yarn dependencies
2019-09-03 07:49:51 -07:00
Joe Cheng
a23c5f151f Merge pull request #2569 from hadley/pageWithSidebar
Soft-deprecate pageWithSidebar() and headerPanel()
2019-09-03 07:49:29 -07:00
Joe Cheng
cab3601474 Merge pull request #2568 from hadley/doc-combine
Document all sidebar UI components together
2019-09-03 07:48:44 -07:00
Joe Cheng
cf330fcd58 Merge pull request #2575 from hadley/options-docs
Combine shinyOptions and shiny-options
2019-09-03 07:47:32 -07:00
Hadley Wickham
eb0162dccf Add basic print method for shiny.render.function
So at least the user isn't exposed to a bunch on internals
2019-09-03 09:17:02 -05:00
Hadley Wickham
a415aed7e6 Implement print.reactivevalues 2019-09-03 09:13:43 -05:00
Hadley Wickham
9f6014dc0b Remove from index 2019-09-02 09:14:20 -05:00
Hadley Wickham
21b0d38b57 Minor formatting tweaks 2019-09-02 09:14:15 -05:00
Hadley Wickham
1ec7f22b5f Alphabetise options 2019-09-02 09:03:46 -05:00
Hadley Wickham
346c5e4a4c Merge shinyOptions and shiny-options
Including an alias so that ?"shiny-options" will continue to work.

Fixes #2544
2019-09-02 08:59:58 -05:00
Joe Cheng
c9a0f0a713 Merge pull request #2567 from hadley/reactive-plot-size-docs
Clarify the three inputs to width/height
2019-08-29 16:24:46 -07:00
Joe Cheng
8bbc38dc8a Upgrade yarn dependencies
This prevents GitHub from complaining about a security vulnerability
in es-lint.
2019-08-29 12:27:29 -07:00
Hadley Wickham
96494a22f9 Soft-deprecate pageWithSidebar() and headerPanel()
Fixes #2452
2019-08-29 08:27:36 -05:00
Hadley Wickham
0813789e2a Cross-link tabPanel() to navbarPage() 2019-08-29 08:15:19 -05:00
Hadley Wickham
98ca820ab1 Document sidebarPanel() and mainPanel() with sidebarLayout() 2019-08-29 08:09:22 -05:00
Hadley Wickham
81ca9d9f29 Co-locate all sidebarLayout() functions 2019-08-29 08:00:40 -05:00
Hadley Wickham
16fe0019f9 Clarify the three inputs to width/height 2019-08-29 07:30:09 -05:00
Barret Schloerke
5fa650ab75 Merge pull request #2559 from rstudio/barret-trim-showcase-info
Reduce the information sent to shiny showcase
2019-08-28 17:27:16 -04:00
Winston Chang
564c2a0f16 Disallow backslash in staicHandler paths 2019-08-28 15:42:09 -05:00
Jeff Allen
99ac85f06a Merge pull request #2547 from rstudio/jeff/feature/helpers
Automatically load 'helpers' in R/ directory at runtime
2019-08-28 16:19:07 +00:00
trestletech
fc30ad0935 Fix upper-case test 2019-08-28 11:05:04 -05:00
trestletech
aadf2eb609 Merge remote-tracking branch 'origin/master' into jeff/feature/helpers 2019-08-28 10:29:32 -05:00
trestletech
68f778e423 autload 2019-08-28 10:26:31 -05:00
trestletech
0066cff652 - update NEWS
- only source global in server.R mode
- only use intermediary environment if opted-in to autoloading.
2019-08-28 10:20:42 -05:00
trestletech
f872a0c80a Only use loadSupport if opted-in to autload.r 2019-08-28 10:15:11 -05:00
Barret Schloerke
d9478142b1 Merge pull request #2561 from rstudio/barret-fix-master
Fix master docs
2019-08-27 17:38:27 -04:00
Winston Chang
5eced59961 Rebuild JS files 2019-08-27 16:31:29 -05:00
Winston Chang
3e1862cd51 Merge pull request #2526 from rstudio/setDateBounds
Set min/max date after date value when they land on the same day
2019-08-27 16:30:49 -05:00
Barret Schloerke
7271609850 ignore any node_modules-like named folder 2019-08-27 17:24:25 -04:00
Barret Schloerke
f24337bb3b add messages in htmltools script to notify about version number 2019-08-27 17:14:51 -04:00
trestletech
6167247ea2 Fix default param 2019-08-27 15:59:27 -05:00
Barret Schloerke
0332e52501 remove unneeded method roxygen tag 2019-08-27 16:50:33 -04:00
trestletech
0c23f78ab7 Make loading helpers opt-in. 2019-08-27 15:29:58 -05:00
Barret Schloerke
7624449644 add import htmltools statement 2019-08-27 16:17:20 -04:00
Barret Schloerke
97309e8c4c execute tools/updateHtmltoolsMan.R 2019-08-27 14:44:39 -04:00
Barret Schloerke
a1e78214db Create updateHtmltoolsMan.R 2019-08-27 14:34:33 -04:00
Barret Schloerke
1a57b3296b use htmltools remote 2019-08-27 14:32:25 -04:00
trestletech
7c10fc3514 Merge remote-tracking branch 'origin/master' into jeff/feature/helpers 2019-08-27 12:54:06 -05:00
Jeff Allen
494ef42aa8 Clarify docs 2019-08-27 17:46:17 +00:00
Carson
8a54d216c6 better news description 2019-08-27 10:47:10 -05:00
Carson
896a20d76d set start/end date after setting date if they land on the same day, closes #2335 2019-08-27 10:30:38 -05:00
Barret Schloerke
a26510b02f copy in latest man files from htmltools
* fix staticdocs test
* remove hasTagAttributes and getTagAttributes from man file
2019-08-26 15:30:27 -04:00
Barret Schloerke
1465f1d237 add roxygen tag to enforce s3 method for checking 2019-08-26 15:27:36 -04:00
Joe Cheng
21b18d107a Merge pull request #2166 from rstudio/unexport-knit-print
Un-export knit_print methods from htmltools
2019-08-26 14:29:16 -04:00
Joe Cheng
cc2173c587 Merge pull request #2555 from rstudio/wch-fix-invalidatelater-leak
Fix invalidateLater memory leak
2019-08-26 13:51:34 -04:00
Barret Schloerke
eb55c256c7 only send requried information across wire to browser for showcase mode 2019-08-26 10:52:27 -04:00
Winston Chang
39ee4513c6 Fix invalidateLater memory leak. Closes #2267 2019-08-19 12:21:12 -05:00
trestletech
052e783638 Update to new signature in test. 2019-08-14 14:35:19 -05:00
trestletech
d2deda238a Move global.R sourcing into an exported load function 2019-08-14 14:25:05 -05:00
trestletech
7317a8304f Only load top-level R files in R/
Ignores nested directories to better follow R package conventions. We want to align well so that this structure is portable to golem.
2019-08-12 15:03:50 -05:00
trestletech
5ea9d70fb4 Require capitalized R/ dir. 2019-08-12 14:59:16 -05:00
Jeff Allen
a73e0998bc Correct mistake around app.R in global 2019-08-09 16:22:03 +00:00
trestletech
51befe3e27 Add news
and other minor changes from self-review
2019-08-08 15:55:08 -05:00
trestletech
37569a291b Fix options test 2019-08-08 14:48:19 -05:00
trestletech
7fe973145d Test ui/server/app/global sourcing. 2019-08-08 11:44:01 -05:00
trestletech
da3fc276fd Revert "DI the source function for testing."
This reverts commit c2dfea18c4.
2019-08-08 09:35:07 -05:00
trestletech
c2dfea18c4 DI the source function for testing. 2019-08-06 14:08:25 -05:00
trestletech
4be6bbc681 Load helpers into isolated environment
And scaffold out the tests.
2019-08-06 10:49:38 -05:00
trestletech
cfc0ff9cc7 Fix expectations. 2019-08-06 09:10:18 -05:00
trestletech
b4c6ba6962 Add dynamically-generated case-sensitive test. 2019-08-06 09:05:02 -05:00
trestletech
dc3ed2f79b Support case-agnostic r/ dir loading 2019-08-05 17:33:07 -05:00
trestletech
5d95c7a9cb Load helpers in R/ on app startup
No support yet for case-sensitive file systems when loading the dir.
2019-08-05 17:25:14 -05:00
77 changed files with 1516 additions and 808 deletions

View File

@@ -65,12 +65,12 @@ Depends:
Imports:
utils,
grDevices,
httpuv (>= 1.5.0),
httpuv (>= 1.5.1.9002),
mime (>= 0.3),
jsonlite (>= 0.9.16),
xtable,
digest,
htmltools (>= 0.3.6),
htmltools (>= 0.3.6.9004),
R6 (>= 2.0),
sourcetools,
later (>= 0.7.2),
@@ -89,6 +89,9 @@ Suggests:
ggplot2,
reactlog (>= 1.0.0),
magrittr
Remotes:
rstudio/htmltools,
rstudio/httpuv
URL: http://shiny.rstudio.com
BugReports: https://github.com/rstudio/shiny/issues
Collate:
@@ -96,6 +99,7 @@ Collate:
'bookmark-state-local.R'
'stack.R'
'bookmark-state.R'
'bootstrap-deprecated.R'
'bootstrap-layout.R'
'globals.R'
'conditions.R'

View File

@@ -26,7 +26,9 @@ S3method(format,reactiveExpr)
S3method(format,reactiveVal)
S3method(names,reactivevalues)
S3method(print,reactive)
S3method(print,reactivevalues)
S3method(print,shiny.appobj)
S3method(print,shiny.render.function)
S3method(str,reactivevalues)
export("conditionStackTrace<-")
export(..stacktraceoff..)
@@ -132,6 +134,7 @@ export(isRunning)
export(isTruthy)
export(isolate)
export(key_missing)
export(loadSupport)
export(mainPanel)
export(makeReactiveBinding)
export(markRenderFunction)
@@ -249,6 +252,8 @@ export(tag)
export(tagAppendAttributes)
export(tagAppendChild)
export(tagAppendChildren)
export(tagGetAttribute)
export(tagHasAttribute)
export(tagList)
export(tagSetChildren)
export(tags)

13
NEWS.md
View File

@@ -9,12 +9,19 @@ shiny 1.3.2.9001
* Resolved [#2402](https://github.com/rstudio/shiny/issues/2402): An informative warning is now thrown for mis-specified (date) strings in `dateInput()`, `updateDateInput()`, `dateRangeInput()`, and `updateDateRangeInput()`. ([#2403](https://github.com/rstudio/shiny/pull/2403))
* If the `shiny.autoload.r` option is set to `TRUE`, all files ending in `.r` or `.R` contained in a directory named `R/` adjacent to your application are sourced when your app is started. This will become the default Shiny behavior in a future release ([#2547](https://github.com/rstudio/shiny/pull/2547))
* Resolved [#2442](https://github.com/rstudio/shiny/issues/2442): The `shiny:inputchanged` JavaScript event now triggers on the related input element instead of `document`. Existing event listeners bound to `document` will still detect the event due to event bubbling. ([#2446](https://github.com/rstudio/shiny/pull/2446))
* Fixed [#1393](https://github.com/rstudio/shiny/issues/1393), [#2223](https://github.com/rstudio/shiny/issues/2223): For plots with any interactions enabled, the image is no longer draggable. ([#2460](https://github.com/rstudio/shiny/pull/2460))
* Partially resolved [#2423](https://github.com/rstudio/shiny/issues/2423): Reactivity in Shiny leaked some memory, because R can leak memory whenever a new symbols is interned, which happens whenever a new name/key is used in an environment. R now uses the fastmap package, which avoids this problem. ([#2429](https://github.com/rstudio/shiny/pull/2429))
* Fixed [#2267](https://github.com/rstudio/shiny/issues/2267): Fixed a memory leak with `invalidateLater`. ([#2555](https://github.com/rstudio/shiny/pull/2555))
* Fixed [#1548](https://github.com/rstudio/shiny/issues/1548): The `reactivePoll` function leaked an observer; that is the observer would continue to exist even if the `reactivePoll` object was no longer accessible. [#2522](https://github.com/rstudio/shiny/pull/2522)
* Resolved [#2469](https://github.com/rstudio/shiny/issues/2469): `renderText` now takes a `sep` argument that is passed to `cat`. ([#2497](https://github.com/rstudio/shiny/pull/2497))
* Added `resourcePaths()` and `removeResourcePaths()` functions. ([#2459](https://github.com/rstudio/shiny/pull/2459))
@@ -23,6 +30,8 @@ shiny 1.3.2.9001
* Resolved [#2433](https://github.com/rstudio/shiny/issues/2433): An informative warning is now thrown if subdirectories of the app's `www/` directory are masked by other resource prefixes and/or the same resource prefix is mapped to different local file paths. ([#2434](https://github.com/rstudio/shiny/pull/2434))
* Resolved [#2471](https://github.com/rstudio/shiny/issues/2471): Large file uploads to a Windows computer were slow. ([#2579](https://github.com/rstudio/shiny/pull/2579))
### Bug fixes
* Fixed [#2116](https://github.com/rstudio/shiny/issues/2116): Fixed an issue where dynamic tabs could not be added when on a hosted platform. ([#2545](https://github.com/rstudio/shiny/pull/2545))
@@ -37,6 +46,10 @@ shiny 1.3.2.9001
* Fixed [#2233](https://github.com/rstudio/shiny/issues/2233): `verbatimTextOutput()` produced wrapped text on Safari, but the text should not be wrapped. ([#2353](https://github.com/rstudio/shiny/pull/2353))
* Fixed [#2335](https://github.com/rstudio/shiny/issues/2335): When `dateInput()`'s `value` was unspecified, and `max` and/or `min` was set to `Sys.Date()`, the value was not being set properly. ([#2526](https://github.com/rstudio/shiny/pull/2526))
* Fixed [#2591](https://github.com/rstudio/shiny/issues/2591): Providing malformed date-strings to `min` or `max` no longer results in JS errors for `dateInput()` and `dateRangeInput()`. ([#2592](https://github.com/rstudio/shiny/pull/2592))
* Fixed [rstudio/reactlog#36](https://github.com/rstudio/reactlog/issues/36): Changes to reactive values not displaying accurately in reactlog. ([#2424](https://github.com/rstudio/shiny/pull/2424))
* Fixed [#2329](https://github.com/rstudio/shiny/issues/2329), [#1817](https://github.com/rstudio/shiny/issues/1817): These bugs were reported as fixed in Shiny 1.3.0 but were not actually fixed because some JavaScript changes were accidentally not included in the release. The fix resolves issues that occur when `withProgressBar()` or bookmarking are combined with the [networkD3](https://christophergandrud.github.io/networkD3/) package's Sankey plot.

112
R/app.R
View File

@@ -14,7 +14,9 @@
#'
#' @param ui The UI definition of the app (for example, a call to
#' `fluidPage()` with nested controls)
#' @param server A server function
#' @param server A function with three parameters: `input`, `output`, and
#' `session`. The function is called once for each session ensuring that each
#' app is independent.
#' @param onStart A function that will be called before the app is actually run.
#' This is only needed for `shinyAppObj`, since in the `shinyAppDir`
#' case, a `global.R` file can be used for this purpose.
@@ -68,10 +70,10 @@
#' runApp(app)
#' }
#' @export
shinyApp <- function(ui=NULL, server=NULL, onStart=NULL, options=list(),
shinyApp <- function(ui, server, onStart=NULL, options=list(),
uiPattern="/", enableBookmarking=NULL) {
if (is.null(server)) {
stop("`server` missing from shinyApp")
if (!is.function(server)) {
stop("`server` must be a function", call. = FALSE)
}
# Ensure that the entire path is a match
@@ -139,10 +141,23 @@ shinyAppFile <- function(appFile, options=list()) {
# This reads in an app dir in the case that there's a server.R (and ui.R/www)
# present, and returns a shiny.appobj.
# appDir must be a normalized (absolute) path, not a relative one
shinyAppDir_serverR <- function(appDir, options=list()) {
# Most of the complexity here comes from needing to hot-reload if the .R files
# change on disk, or are created, or are removed.
# In an upcoming version of shiny, this option will go away and the new behavior will be used.
if (getOption("shiny.autoload.r", FALSE)) {
# new behavior
# Create a child env which contains all the helpers and will be the shared parent
# of the ui.R and server.R load.
sharedEnv <- new.env(parent = globalenv())
} else {
# old behavior, default
sharedEnv <- globalenv()
}
# uiHandlerSource is a function that returns an HTTP handler for serving up
# ui.R as a webpage. The "cachedFuncWithFile" call makes sure that the closure
# we're creating here only gets executed when ui.R's contents change.
@@ -153,7 +168,7 @@ shinyAppDir_serverR <- function(appDir, options=list()) {
# If not, then take the last expression that's returned from ui.R.
.globals$ui <- NULL
on.exit(.globals$ui <- NULL, add = FALSE)
ui <- sourceUTF8(uiR, envir = new.env(parent = globalenv()))
ui <- sourceUTF8(uiR, envir = new.env(parent = sharedEnv))
if (!is.null(.globals$ui)) {
ui <- .globals$ui[[1]]
}
@@ -183,7 +198,7 @@ shinyAppDir_serverR <- function(appDir, options=list()) {
# server.R.
.globals$server <- NULL
on.exit(.globals$server <- NULL, add = TRUE)
result <- sourceUTF8(serverR, envir = new.env(parent = globalenv()))
result <- sourceUTF8(serverR, envir = new.env(parent = sharedEnv))
if (!is.null(.globals$server)) {
result <- .globals$server[[1]]
}
@@ -214,8 +229,13 @@ shinyAppDir_serverR <- function(appDir, options=list()) {
oldwd <<- getwd()
setwd(appDir)
monitorHandle <<- initAutoReloadMonitor(appDir)
if (file.exists(file.path.ci(appDir, "global.R")))
sourceUTF8(file.path.ci(appDir, "global.R"))
# TODO: we should support hot reloading on global.R and R/*.R changes.
if (getOption("shiny.autoload.r", FALSE)) {
loadSupport(appDir, renv=sharedEnv, globalrenv=globalenv())
} else {
if (file.exists(file.path.ci(appDir, "global.R")))
sourceUTF8(file.path.ci(appDir, "global.R"))
}
}
onStop <- function() {
setwd(oldwd)
@@ -288,18 +308,66 @@ initAutoReloadMonitor <- function(dir) {
obs$destroy
}
#' Load an app's supporting R files
#'
#' Loads all of the supporting R files of a Shiny application. Specifically,
#' this function loads any top-level supporting `.R` files in the `R/` directory
#' adjacent to the `app.R`/`server.R`/`ui.R` files.
#'
#' At the moment, this function is "opt-in" and only called if the option
#' `shiny.autoload.r` is set to `TRUE`.
#'
#' @details The files are sourced in alphabetical order (as determined by
#' [list.files]). `global.R` is evaluated before the supporting R files in the
#' `R/` directory.
#' @param appDir The application directory
#' @param renv The environmeny in which the files in the `R/` directory should
#' be evaluated.
#' @param globalrenv The environment in which `global.R` should be evaluated. If
#' `NULL`, `global.R` will not be evaluated at all.
#' @export
loadSupport <- function(appDir, renv=new.env(parent=globalenv()), globalrenv=globalenv()){
if (!is.null(globalrenv)){
# Evaluate global.R, if it exists.
if (file.exists(file.path.ci(appDir, "global.R"))){
sourceUTF8(file.path.ci(appDir, "global.R"), envir=globalrenv)
}
}
helpersDir <- file.path(appDir, "R")
helpers <- list.files(helpersDir, pattern="\\.[rR]$", recursive=FALSE, full.names=TRUE)
lapply(helpers, sourceUTF8, envir=renv)
invisible(renv)
}
# This reads in an app dir for a single-file application (e.g. app.R), and
# returns a shiny.appobj.
# appDir must be a normalized (absolute) path, not a relative one
shinyAppDir_appR <- function(fileName, appDir, options=list())
{
fullpath <- file.path.ci(appDir, fileName)
# In an upcoming version of shiny, this option will go away and the new behavior will be used.
if (getOption("shiny.autoload.r", FALSE)) {
# new behavior
# Create a child env which contains all the helpers and will be the shared parent
# of the ui.R and server.R load.
sharedEnv <- new.env(parent = globalenv())
} else {
# old behavior, default
sharedEnv <- globalenv()
}
# This sources app.R and caches the content. When appObj() is called but
# app.R hasn't changed, it won't re-source the file. But if called and
# app.R has changed, it'll re-source the file and return the result.
appObj <- cachedFuncWithFile(appDir, fileName, case.sensitive = FALSE,
function(appR) {
result <- sourceUTF8(fullpath, envir = new.env(parent = globalenv()))
result <- sourceUTF8(fullpath, envir = new.env(parent = sharedEnv))
if (!is.shiny.appobj(result))
stop("app.R did not return a shiny.appobj object.")
@@ -342,6 +410,10 @@ shinyAppDir_appR <- function(fileName, appDir, options=list())
onStart <- function() {
oldwd <<- getwd()
setwd(appDir)
# TODO: we should support hot reloading on R/*.R changes.
if (getOption("shiny.autoload.r", FALSE)) {
loadSupport(appDir, renv=sharedEnv, globalrenv=NULL)
}
monitorHandle <<- initAutoReloadMonitor(appDir)
if (!is.null(appObj()$onStart)) appObj()$onStart()
}
@@ -376,26 +448,34 @@ shinyAppDir_appR <- function(fileName, appDir, options=list())
}
#' @rdname shinyApp
#' Shiny App object
#'
#' Internal methods for the `shiny.appobj` S3 class.
#'
#' @keywords internal
#' @name shiny.appobj
NULL
#' @rdname shiny.appobj
#' @param x Object to convert to a Shiny app.
#' @export
as.shiny.appobj <- function(x) {
UseMethod("as.shiny.appobj", x)
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @export
as.shiny.appobj.shiny.appobj <- function(x) {
x
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @export
as.shiny.appobj.list <- function(x) {
shinyApp(ui = x$ui, server = x$server)
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @export
as.shiny.appobj.character <- function(x) {
if (identical(tolower(tools::file_ext(x)), "r"))
@@ -404,13 +484,13 @@ as.shiny.appobj.character <- function(x) {
shinyAppDir(x)
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @export
is.shiny.appobj <- function(x) {
inherits(x, "shiny.appobj")
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @param ... Additional parameters to be passed to print.
#' @export
print.shiny.appobj <- function(x, ...) {
@@ -425,7 +505,7 @@ print.shiny.appobj <- function(x, ...) {
do.call("runApp", args)
}
#' @rdname shinyApp
#' @rdname shiny.appobj
#' @method as.tags shiny.appobj
#' @export
as.tags.shiny.appobj <- function(x, ...) {

91
R/bootstrap-deprecated.R Normal file
View File

@@ -0,0 +1,91 @@
#' Create a page with a sidebar
#'
#' **DEPRECATED**: use [fluidPage()] and [sidebarLayout()] instead.
#'
#' @param headerPanel The [headerPanel] with the application title
#' @param sidebarPanel The [sidebarPanel] containing input controls
#' @param mainPanel The [mainPanel] containing outputs
#' @keywords internal
#' @return A UI defintion that can be passed to the [shinyUI] function
#' @export
pageWithSidebar <- function(headerPanel,
sidebarPanel,
mainPanel) {
bootstrapPage(
# basic application container divs
div(
class="container-fluid",
div(class="row",
headerPanel
),
div(class="row",
sidebarPanel,
mainPanel
)
)
)
}
#' Create a header panel
#'
#' **DEPRECATED**: use [titlePanel()] instead.
#'
#' @param title An application title to display
#' @param windowTitle The title that should be displayed by the browser window.
#' Useful if `title` is not a string.
#' @return A headerPanel that can be passed to [pageWithSidebar]
#' @keywords internal
#' @export
headerPanel <- function(title, windowTitle=title) {
tagList(
tags$head(tags$title(windowTitle)),
div(class="col-sm-12",
h1(title)
)
)
}
#' Create a Bootstrap page
#'
#' **DEPRECATED**: use [fluidPage()] instead.
#'
#' @param ... The contents of the document body.
#' @param title The browser window title (defaults to the host URL of the page)
#' @param responsive This option is deprecated; it is no longer optional with
#' Bootstrap 3.
#' @param theme Alternative Bootstrap stylesheet (normally a css file within the
#' www directory, e.g. `www/bootstrap.css`)
#'
#' @return A UI defintion that can be passed to the [shinyUI] function.
#'
#' @keywords internal
#' @seealso [fluidPage()], [fixedPage()]
#' @export
bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL) {
if (!is.null(responsive)) {
shinyDeprecated("The 'responsive' argument is no longer used with Bootstrap 3.")
}
attachDependencies(
tagList(
if (!is.null(title)) tags$head(tags$title(title)),
if (!is.null(theme)) {
tags$head(tags$link(rel="stylesheet", type="text/css", href = theme))
},
# remainder of tags passed to the function
list(...)
),
bootstrapLib()
)
}
#' @rdname bootstrapPage
#' @export
basicPage <- function(...) {
bootstrapPage(div(class="container-fluid", list(...)))
}

View File

@@ -263,16 +263,21 @@ titlePanel <- function(title, windowTitle=title) {
#' Layout a sidebar and main area
#'
#' Create a layout with a sidebar and main area. The sidebar is displayed with a
#' distinct background color and typically contains input controls. The main
#' Create a layout (`sidebarLayout()`) with a sidebar (`sidebarPanel()`) and
#' main area (`mainPanel()`). The sidebar is displayed with a distinct
#' background color and typically contains input controls. The main
#' area occupies 2/3 of the horizontal width and typically contains outputs.
#'
#' @param sidebarPanel The [sidebarPanel] containing input controls
#' @param mainPanel The [mainPanel] containing outputs
#' @param sidebarPanel The `sidebarPanel()` containing input controls.
#' @param mainPanel The `mainPanel()` containing outputs.
#' @param position The position of the sidebar relative to the main area ("left"
#' or "right")
#' or "right").
#' @param fluid `TRUE` to use fluid layout; `FALSE` to use fixed
#' layout.
#' @param width The width of the sidebar and main panel. By default, the
#' sidebar takes up 1/3 of the width, and the main panel 2/3. The total
#' width must be 12 or less.
#' @param ... Output elements to include in the sidebar/main panel.
#'
#' @examples
#' ## Only run examples in interactive R sessions
@@ -337,6 +342,24 @@ sidebarLayout <- function(sidebarPanel,
fixedRow(firstPanel, secondPanel)
}
#' @export
#' @rdname sidebarLayout
sidebarPanel <- function(..., width = 4) {
div(class=paste0("col-sm-", width),
tags$form(class="well",
...
)
)
}
#' @export
#' @rdname sidebarLayout
mainPanel <- function(..., width = 8) {
div(class=paste0("col-sm-", width),
...
)
}
#' Lay out UI elements vertically
#'
#' Create a container that includes one or more rows of content (each element

View File

@@ -1,51 +1,6 @@
#' @include utils.R
NULL
#' Create a Bootstrap page
#'
#' Create a Shiny UI page that loads the CSS and JavaScript for
#' [Bootstrap](http://getbootstrap.com/), and has no content in the page
#' body (other than what you provide).
#'
#' This function is primarily intended for users who are proficient in HTML/CSS,
#' and know how to lay out pages in Bootstrap. Most applications should use
#' [fluidPage()] along with layout functions like
#' [fluidRow()] and [sidebarLayout()].
#'
#' @param ... The contents of the document body.
#' @param title The browser window title (defaults to the host URL of the page)
#' @param responsive This option is deprecated; it is no longer optional with
#' Bootstrap 3.
#' @param theme Alternative Bootstrap stylesheet (normally a css file within the
#' www directory, e.g. `www/bootstrap.css`)
#'
#' @return A UI defintion that can be passed to the [shinyUI] function.
#'
#' @note The `basicPage` function is deprecated, you should use the
#' [fluidPage()] function instead.
#'
#' @seealso [fluidPage()], [fixedPage()]
#' @export
bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL) {
if (!is.null(responsive)) {
shinyDeprecated("The 'responsive' argument is no longer used with Bootstrap 3.")
}
attachDependencies(
tagList(
if (!is.null(title)) tags$head(tags$title(title)),
if (!is.null(theme)) {
tags$head(tags$link(rel="stylesheet", type="text/css", href = theme))
},
# remainder of tags passed to the function
list(...)
),
bootstrapLib()
)
}
#' Bootstrap libraries
#'
#' This function returns a set of web dependencies necessary for using Bootstrap
@@ -76,12 +31,6 @@ bootstrapLib <- function(theme = NULL) {
)
}
#' @rdname bootstrapPage
#' @export
basicPage <- function(...) {
bootstrapPage(div(class="container-fluid", list(...)))
}
#' Create a page that fills the window
#'
@@ -178,61 +127,6 @@ collapseSizes <- function(padding) {
collapse = " ")
}
#' Create a page with a sidebar
#'
#' Create a Shiny UI that contains a header with the application title, a
#' sidebar for input controls, and a main area for output.
#'
#' @param headerPanel The [headerPanel] with the application title
#' @param sidebarPanel The [sidebarPanel] containing input controls
#' @param mainPanel The [mainPanel] containing outputs
#' @return A UI defintion that can be passed to the [shinyUI] function
#'
#' @note This function is deprecated. You should use [fluidPage()]
#' along with [sidebarLayout()] to implement a page with a sidebar.
#'
#' @examples
#' # Define UI
#' pageWithSidebar(
#'
#' # Application title
#' headerPanel("Hello Shiny!"),
#'
#' # Sidebar with a slider input
#' sidebarPanel(
#' sliderInput("obs",
#' "Number of observations:",
#' min = 0,
#' max = 1000,
#' value = 500)
#' ),
#'
#' # Show a plot of the generated distribution
#' mainPanel(
#' plotOutput("distPlot")
#' )
#' )
#' @export
pageWithSidebar <- function(headerPanel,
sidebarPanel,
mainPanel) {
bootstrapPage(
# basic application container divs
div(
class="container-fluid",
div(class="row",
headerPanel
),
div(class="row",
sidebarPanel,
mainPanel
)
)
)
}
#' Create a page with a top level navigation bar
#'
#' Create a page that contains a top level navigation bar that can be used to
@@ -408,27 +302,6 @@ navbarMenu <- function(title, ..., menuName = title, icon = NULL) {
class = "shiny.navbarmenu")
}
#' Create a header panel
#'
#' Create a header panel containing an application title.
#'
#' @param title An application title to display
#' @param windowTitle The title that should be displayed by the browser window.
#' Useful if `title` is not a string.
#' @return A headerPanel that can be passed to [pageWithSidebar]
#'
#' @examples
#' headerPanel("Hello Shiny!")
#' @export
headerPanel <- function(title, windowTitle=title) {
tagList(
tags$head(tags$title(windowTitle)),
div(class="col-sm-12",
h1(title)
)
)
}
#' Create a well panel
#'
#' Creates a panel with a slightly inset border and grey background. Equivalent
@@ -441,59 +314,6 @@ wellPanel <- function(...) {
div(class="well", ...)
}
#' Create a sidebar panel
#'
#' Create a sidebar panel containing input controls that can in turn be passed
#' to [sidebarLayout()].
#'
#' @param ... UI elements to include on the sidebar
#' @param width The width of the sidebar. For fluid layouts this is out of 12
#' total units; for fixed layouts it is out of whatever the width of the
#' sidebar's parent column is.
#' @return A sidebar that can be passed to [sidebarLayout()]
#'
#' @examples
#' # Sidebar with controls to select a dataset and specify
#' # the number of observations to view
#' sidebarPanel(
#' selectInput("dataset", "Choose a dataset:",
#' choices = c("rock", "pressure", "cars")),
#'
#' numericInput("obs", "Observations:", 10)
#' )
#' @export
sidebarPanel <- function(..., width = 4) {
div(class=paste0("col-sm-", width),
tags$form(class="well",
...
)
)
}
#' Create a main panel
#'
#' Create a main panel containing output elements that can in turn be passed to
#' [sidebarLayout()].
#'
#' @param ... Output elements to include in the main panel
#' @param width The width of the main panel. For fluid layouts this is out of 12
#' total units; for fixed layouts it is out of whatever the width of the main
#' panel's parent column is.
#' @return A main panel that can be passed to [sidebarLayout()].
#'
#' @examples
#' # Show the caption and plot of the requested variable against mpg
#' mainPanel(
#' h3(textOutput("caption")),
#' plotOutput("mpgPlot")
#' )
#' @export
mainPanel <- function(..., width = 8) {
div(class=paste0("col-sm-", width),
...
)
}
#' Conditional Panel
#'
#' Creates a panel that is visible or not, depending on the value of a
@@ -589,7 +409,8 @@ helpText <- function(...) {
#' Create a tab panel
#'
#' Create a tab panel that can be included within a [tabsetPanel()].
#' Create a tab panel that can be included within a [tabsetPanel()] or
#' a [navbarPage()].
#'
#' @param title Display title for tab
#' @param ... UI elements to include within the tab

View File

@@ -1,7 +1,11 @@
#' @export a br code div em h1 h2 h3 h4 h5 h6 hr HTML img p pre span strong
#' @export includeCSS includeHTML includeMarkdown includeScript includeText
#' @export is.singleton singleton
#' @export tag tagAppendAttributes tagAppendChild tagAppendChildren tagList tags tagSetChildren withTags
#' @import htmltools
#' @export tags p h1 h2 h3 h4 h5 h6 a br div span pre code img strong em hr
#' @export tag tagList tagAppendAttributes tagHasAttribute tagGetAttribute tagAppendChild tagAppendChildren tagSetChildren
#' @export HTML
#' @export includeHTML includeText includeMarkdown includeCSS includeScript
#' @export singleton is.singleton
#' @export validateCssUnit
#' @export htmlTemplate suppressDependencies
#' @export htmlTemplate
#' @export suppressDependencies
#' @export withTags
NULL

View File

@@ -199,6 +199,9 @@ staticHandler <- function(root) {
if (path == '/')
path <- '/index.html'
if (grepl('\\', path, fixed = TRUE))
return(NULL)
abs.path <- resolve(root, path)
if (is.null(abs.path))
return(NULL)

View File

@@ -590,6 +590,14 @@ checkName <- function(x) {
)
}
#' @export
print.reactivevalues <- function(x, ...) {
impl <- .subset2(x, "impl")
cat_line("<ReactiveValues>")
cat_line(" Values: ", paste0(impl$.values$keys(sort = TRUE), collapse = ", "))
cat_line(" Readonly: ", .subset2(x, "readonly"))
}
#' Checks whether an object is a reactivevalues object
#'
#' Checks whether its argument is a reactivevalues object.
@@ -1611,12 +1619,16 @@ invalidateLater <- function(millis, session = getDefaultReactiveDomain()) {
ctx <- getCurrentContext()
rLog$invalidateLater(ctx$.reactId, ctx$id, millis, session)
clear_on_ended_callback <- function() {}
timerHandle <- scheduleTask(millis, function() {
if (is.null(session)) {
ctx$invalidate()
return(invisible())
}
clear_on_ended_callback()
if (!session$isClosed()) {
session$cycleStartAction(function() {
ctx$invalidate()
@@ -1627,7 +1639,13 @@ invalidateLater <- function(millis, session = getDefaultReactiveDomain()) {
})
if (!is.null(session)) {
session$onEnded(timerHandle)
# timerHandle is a callback that clears the scheduled task. It gets
# registered with session$onEnded() each time invalidateLater() is called.
# So, to prevent these callbacks from building up and leaking memory, we
# need to deregister the onEnded(timerHandle) callback each time when the
# scheduled task executes; after the task executes, the timerHandle()
# function is essentially a no-op, so we can deregister it.
clear_on_ended_callback <- session$onEnded(timerHandle)
}
invisible()
@@ -1715,7 +1733,18 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
rv <- reactiveValues(cookie = isolate(checkFunc()))
observe({
re_finalized <- FALSE
o <- observe({
# When no one holds a reference to the reactive returned from
# reactivePoll, destroy and remove the observer so that it doesn't keep
# firing and hold onto resources.
if (re_finalized) {
o$destroy()
rm(o, envir = parent.env(environment()))
return()
}
rv$cookie <- checkFunc()
invalidateLater(intervalMillis(), session)
})
@@ -1728,6 +1757,14 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
}, label = NULL)
reg.finalizer(attr(re, "observable"), function(e) {
re_finalized <<- TRUE
})
# So that the observer and finalizer function don't (indirectly) hold onto a
# reference to `re` and thus prevent it from getting GC'd.
on.exit(rm(re))
return(re)
}

View File

@@ -22,13 +22,17 @@
#' expedite the rendering of identical plots.
#'
#' @param expr An expression that generates a plot.
#' @param width,height The width/height of the rendered plot, in pixels; or
#' `'auto'` to use the `offsetWidth`/`offsetHeight` of the HTML
#' element that is bound to this plot. You can also pass in a function that
#' returns the width/height in pixels or `'auto'`; in the body of the
#' function you may reference reactive values and functions. When rendering an
#' inline plot, you must provide numeric values (in pixels) to both
#' `width` and `height`.
#' @param width,height Height and width can be specified in three ways:
#' * `"auto"`, the default, uses the size specified by [plotOutput()]
#' (i.e. the `offsetWidth`/`offsetHeight`` of the HTML element bound to
#' this plot.)
#' * An integer, defining the width/height in pixels.
#' * A function that returns the width/height in pixels (or `"auto"`).
#' The function is executed in a reactive context so that you can refer to
#' reactive values and expression to make the width/height reactive.
#'
#' When rendering an inline plot, you must provide numeric values (in pixels)
#' to both \code{width} and \code{height}.
#' @param res Resolution of resulting plot, in pixels per inch. This value is
#' passed to [grDevices::png()]. Note that this affects the resolution of PNG
#' rendering in R; it won't change the actual ppi of the browser.

View File

@@ -85,24 +85,25 @@ addResourcePath <- function(prefix, directoryPath) {
}
)
# Often times overwriting a resource path is "what you want",
# but sometimes it can lead to difficult to diagnose issues
# (e.g. an implict dependency might set a resource path that
# conflicts with what you, the app author, are trying to register)
# Note that previous versions of shiny used to warn about this case,
# but it was eventually removed since it caused confusion (#567).
# It seems a good comprimise is to throw a more information message.
if (prefix %in% names(.globals$resourcePaths)) {
existingPath <- .globals$resourcePaths[[prefix]]$path
if (normalizedPath != existingPath) {
message(
"The resource path '", prefix, "' used to point to ",
existingPath, ", but it now points to ", normalizedPath, ". ",
"If your app doesn't work as expected, you may want to ",
"choose a different prefix name."
)
}
}
# # Often times overwriting a resource path is "what you want",
# # but sometimes it can lead to difficult to diagnose issues
# # (e.g. an implict dependency might set a resource path that
# # conflicts with what you, the app author, are trying to register)
# # Note that previous versions of shiny used to warn about this case,
# # but it was eventually removed since it caused confusion (#567).
# # It seems a good compromise is to throw a more information message.
# if (getOption("shiny.resourcePathChanges", FALSE) &&
# prefix %in% names(.globals$resourcePaths)) {
# existingPath <- .globals$resourcePaths[[prefix]]$path
# if (normalizedPath != existingPath) {
# message(
# "The resource path '", prefix, "' used to point to ",
# existingPath, ", but it now points to ", normalizedPath, ". ",
# "If your app doesn't work as expected, you may want to ",
# "choose a different prefix name."
# )
# }
# }
# If a shiny app is currently running, dynamically register this path with
# the corresponding httpuv server object.
@@ -540,7 +541,7 @@ startApp <- function(appObj, port, host, quiet) {
if (length(resourceConflicts)) {
warning(
"Found subdirectories of your app's www/ directory that ",
"conflict with other resource URL prefixes.",
"conflict with other resource URL prefixes. ",
"Consider renaming these directories: '",
paste0("www/", resourceConflicts, collapse = "', '"), "'",
call. = FALSE
@@ -986,7 +987,6 @@ runApp <- function(appDir=getwd(),
captureStackTraces({
while (!.globals$stopped) {
..stacktracefloor..(serviceApp())
Sys.sleep(0.001)
}
})
)

View File

@@ -16,20 +16,102 @@ getShinyOption <- function(name, default = NULL) {
#' Get or set Shiny options
#'
#' `getShinyOption` retrieves the value of a Shiny option.
#' `shinyOptions` sets the value of Shiny options; it can also be used to
#' return a list of all currently-set Shiny options.
#' `getShinyOption()` retrieves the value of a Shiny option. `shinyOptions()`
#' sets the value of Shiny options; it can also be used to return a list of all
#' currently-set Shiny options.
#'
#' There is a global option set, which is available by default. When a Shiny
#' application is run with [runApp()], that option set is duplicated
#' and the new option set is available for getting or setting values. If options
#' are set from global.R, app.R, ui.R, or server.R, or if they are set from
#' inside the server function, then the options will be scoped to the
#' @section Scope:
#' There is a global option set which is available by default. When a Shiny
#' application is run with [runApp()], that option set is duplicated and the
#' new option set is available for getting or setting values. If options
#' are set from `global.R`, `app.R`, `ui.R`, or `server.R`, or if they are set
#' from inside the server function, then the options will be scoped to the
#' application. When the application exits, the new option set is discarded and
#' the global option set is restored.
#'
#' @param ... Options to set, with the form `name = value`.
#' @section Options:
#' There are a number of global options that affect Shiny's behavior. These can
#' be set globally with `options()` or locally (for a single app) with
#' `shinyOptions()`.
#'
#' \describe{
#' \item{shiny.autoreload}{If `TRUE` when a Shiny app is launched, the
#' app directory will be continually monitored for changes to files that
#' have the extensions: r, htm, html, js, css, png, jpg, jpeg, gif. If any
#' changes are detected, all connected Shiny sessions are reloaded. This
#' allows for fast feedback loops when tweaking Shiny UI.
#'
#' Since monitoring for changes is expensive (we simply poll for last
#' modified times), this feature is intended only for development.
#'
#' You can customize the file patterns Shiny will monitor by setting the
#' shiny.autoreload.pattern option. For example, to monitor only ui.R:
#' `options(shiny.autoreload.pattern = glob2rx("ui.R"))`
#'
#' The default polling interval is 500 milliseconds. You can change this
#' by setting e.g. `options(shiny.autoreload.interval = 2000)` (every
#' two seconds).}
#' \item{shiny.deprecation.messages}{This controls whether messages for
#' deprecated functions in Shiny will be printed. See
#' [shinyDeprecated()] for more information.}
#' \item{shiny.error}{This can be a function which is called when an error
#' occurs. For example, `options(shiny.error=recover)` will result a
#' the debugger prompt when an error occurs.}
#' \item{shiny.fullstacktrace}{Controls whether "pretty" or full stack traces
#' are dumped to the console when errors occur during Shiny app execution.
#' The default is `FALSE` (pretty stack traces).}
#' \item{shiny.host}{The IP address that Shiny should listen on. See
#' [runApp()] for more information.}
#' \item{shiny.json.digits}{The number of digits to use when converting
#' numbers to JSON format to send to the client web browser.}
#' \item{shiny.launch.browser}{A boolean which controls the default behavior
#' when an app is run. See [runApp()] for more information.}
#' \item{shiny.maxRequestSize}{This is a number which specifies the maximum
#' web request size, which serves as a size limit for file uploads. If
#' unset, the maximum request size defaults to 5MB.}
#' \item{shiny.minified}{If this is `TRUE` or unset (the default), then
#' Shiny will use minified JavaScript (`shiny.min.js`). If
#' `FALSE`, then Shiny will use the un-minified JavaScript
#' (`shiny.js`); this can be useful during development.}
#' \item{shiny.port}{A port number that Shiny will listen on. See
#' [runApp()] for more information.}
#' \item{shiny.reactlog}{If `TRUE`, enable logging of reactive events,
#' which can be viewed later with the [reactlogShow()] function.
#' This incurs a substantial performance penalty and should not be used in
#' production.}
#' \item{shiny.sanitize.errors}{If `TRUE`, then normal errors (i.e.
#' errors not wrapped in `safeError`) won't show up in the app; a simple
#' generic error message is printed instead (the error and strack trace printed
#' to the console remain unchanged). The default is `FALSE` (unsanitized
#' errors).If you want to sanitize errors in general, but you DO want a
#' particular error `e` to get displayed to the user, then set this option
#' to `TRUE` and use `stop(safeError(e))` for errors you want the
#' user to see.}
#' \item{shiny.stacktraceoffset}{If `TRUE`, then Shiny's printed stack
#' traces will display srcrefs one line above their usual location. This is
#' an arguably more intuitive arrangement for casual R users, as the name
#' of a function appears next to the srcref where it is defined, rather than
#' where it is currently being called from.}
#' \item{shiny.suppressMissingContextError}{Normally, invoking a reactive
#' outside of a reactive context (or [isolate()]) results in
#' an error. If this is `TRUE`, don't error in these cases. This
#' should only be used for debugging or demonstrations of reactivity at the
#' console.}
#' \item{shiny.table.class}{CSS class names to use for tables.}
#' \item{shiny.testmode}{If `TRUE`, then enable features for testing Shiny
#' applications. If `FALSE` (the default), do not enable those features.}
#' \item{shiny.trace}{Print messages sent between the R server and the web
#' browser client to the R console. This is useful for debugging. Possible
#' values are `"send"` (only print messages sent to the client),
#' `"recv"` (only print messages received by the server), `TRUE`
#' (print all messages), or `FALSE` (default; don't print any of these
#' messages).}
#' \item{shiny.usecairo}{This is used to disable graphical rendering by the
#' Cairo package, if it is installed. See [plotPNG()] for more
#' information.}
#' }
#' @param ... Options to set, with the form `name = value`.
#' @aliases shiny-options
#' @examples
#' \dontrun{
#' shinyOptions(myOption = 10)

View File

@@ -28,91 +28,6 @@ NULL
#' @import methods
NULL
#' Global options for Shiny
#'
#' There are a number of global options that affect Shiny's behavior. These can
#' be set with (for example) `options(shiny.trace=TRUE)`.
#'
#' \describe{
#' \item{shiny.launch.browser}{A boolean which controls the default behavior
#' when an app is run. See [runApp()] for more information.}
#' \item{shiny.port}{A port number that Shiny will listen on. See
#' [runApp()] for more information.}
#' \item{shiny.trace}{Print messages sent between the R server and the web
#' browser client to the R console. This is useful for debugging. Possible
#' values are `"send"` (only print messages sent to the client),
#' `"recv"` (only print messages received by the server), `TRUE`
#' (print all messages), or `FALSE` (default; don't print any of these
#' messages).}
#' \item{shiny.autoreload}{If `TRUE` when a Shiny app is launched, the
#' app directory will be continually monitored for changes to files that
#' have the extensions: r, htm, html, js, css, png, jpg, jpeg, gif. If any
#' changes are detected, all connected Shiny sessions are reloaded. This
#' allows for fast feedback loops when tweaking Shiny UI.
#'
#' Since monitoring for changes is expensive (we simply poll for last
#' modified times), this feature is intended only for development.
#'
#' You can customize the file patterns Shiny will monitor by setting the
#' shiny.autoreload.pattern option. For example, to monitor only ui.R:
#' `options(shiny.autoreload.pattern = glob2rx("ui.R"))`
#'
#' The default polling interval is 500 milliseconds. You can change this
#' by setting e.g. `options(shiny.autoreload.interval = 2000)` (every
#' two seconds).}
#' \item{shiny.reactlog}{If `TRUE`, enable logging of reactive events,
#' which can be viewed later with the [reactlogShow()] function.
#' This incurs a substantial performance penalty and should not be used in
#' production.}
#' \item{shiny.usecairo}{This is used to disable graphical rendering by the
#' Cairo package, if it is installed. See [plotPNG()] for more
#' information.}
#' \item{shiny.maxRequestSize}{This is a number which specifies the maximum
#' web request size, which serves as a size limit for file uploads. If
#' unset, the maximum request size defaults to 5MB.}
#' \item{shiny.suppressMissingContextError}{Normally, invoking a reactive
#' outside of a reactive context (or [isolate()]) results in
#' an error. If this is `TRUE`, don't error in these cases. This
#' should only be used for debugging or demonstrations of reactivity at the
#' console.}
#' \item{shiny.host}{The IP address that Shiny should listen on. See
#' [runApp()] for more information.}
#' \item{shiny.json.digits}{The number of digits to use when converting
#' numbers to JSON format to send to the client web browser.}
#' \item{shiny.minified}{If this is `TRUE` or unset (the default), then
#' Shiny will use minified JavaScript (`shiny.min.js`). If
#' `FALSE`, then Shiny will use the un-minified JavaScript
#' (`shiny.js`); this can be useful during development.}
#' \item{shiny.error}{This can be a function which is called when an error
#' occurs. For example, `options(shiny.error=recover)` will result a
#' the debugger prompt when an error occurs.}
#' \item{shiny.table.class}{CSS class names to use for tables.}
#' \item{shiny.deprecation.messages}{This controls whether messages for
#' deprecated functions in Shiny will be printed. See
#' [shinyDeprecated()] for more information.}
#' \item{shiny.fullstacktrace}{Controls whether "pretty" or full stack traces
#' are dumped to the console when errors occur during Shiny app execution.
#' The default is `FALSE` (pretty stack traces).}
#' \item{shiny.stacktraceoffset}{If `TRUE`, then Shiny's printed stack
#' traces will display srcrefs one line above their usual location. This is
#' an arguably more intuitive arrangement for casual R users, as the name
#' of a function appears next to the srcref where it is defined, rather than
#' where it is currently being called from.}
#' \item{shiny.sanitize.errors}{If `TRUE`, then normal errors (i.e.
#' errors not wrapped in `safeError`) won't show up in the app; a simple
#' generic error message is printed instead (the error and strack trace printed
#' to the console remain unchanged). The default is `FALSE` (unsanitized
#' errors).If you want to sanitize errors in general, but you DO want a
#' particular error `e` to get displayed to the user, then set this option
#' to `TRUE` and use `stop(safeError(e))` for errors you want the
#' user to see.}
#' \item{shiny.testmode}{If `TRUE`, then enable features for testing Shiny
#' applications. If `FALSE` (the default), do not enable those features.
#' }
#' }
#' @name shiny-options
NULL
createUniqueId <- function(bytes, prefix = "", suffix = "") {
withPrivateSeed({
paste(
@@ -1629,8 +1544,14 @@ ShinySession <- R6Class(
reactlog = function(logEntry) {
# Use sendCustomMessage instead of sendMessage, because the handler in
# shiny-showcase.js only has access to public API of the Shiny object.
if (private$showcase)
self$sendCustomMessage("reactlog", logEntry)
if (private$showcase) {
srcref <- logEntry$srcref
srcfile <- logEntry$srcfile
if (!is.null(srcref) && !is.null(srcfile)) {
# only send needed information, not all of reactlog info.
self$sendCustomMessage("showcase-src", list(srcref = srcref, srcfile = srcfile))
}
}
},
reload = function() {
private$sendMessage(reload = TRUE)

View File

@@ -52,6 +52,11 @@ markRenderFunction <- function(uiFunc, renderFunc, outputArgs = list()) {
hasExecuted = hasExecuted)
}
#' @export
print.shiny.render.function <- function(x, ...) {
cat_line("<shiny.render.function>")
}
#' Implement render functions
#'
#' @param func A function without parameters, that returns user data. If the

View File

@@ -1800,3 +1800,8 @@ constantTimeEquals <- function(raw1, raw2) {
sum(as.integer(xor(raw1, raw2))) == 0
}
cat_line <- function(...) {
cat(paste(..., "\n", collapse = ""))
}

View File

@@ -9,15 +9,11 @@ sd_section("UI Layout",
"fillRow",
"fixedPage",
"fluidPage",
"headerPanel",
"helpText",
"icon",
"mainPanel",
"navbarPage",
"navlistPanel",
"pageWithSidebar",
"sidebarLayout",
"sidebarPanel",
"tabPanel",
"tabsetPanel",
"titlePanel",
@@ -155,7 +151,8 @@ sd_section("Running",
"runUrl",
"stopApp",
"viewer",
"isRunning"
"isRunning",
"loadSupport"
)
)
sd_section("Bookmarking state",
@@ -204,7 +201,6 @@ sd_section("Utility functions",
"repeatable",
"shinyDeprecated",
"serverInfo",
"shiny-options",
"onStop",
"diskCache",
"memoryCache",

View File

@@ -1723,7 +1723,12 @@
if (this.has_tab_index) {
this.$cache.input.prop("tabindex", -1);
} else {
this.$cache.input.removeProp("tabindex");
try {
this.$cache.input.removeProp("tabindex");
} catch(e) {
// Do nothing (PhantomJS can throw an error with the
// above, #2587)
}
}
this.has_tab_index = !this.has_tab_index;

File diff suppressed because one or more lines are too long

View File

@@ -117,7 +117,7 @@
// If this is the main Shiny window, wire up our custom message handler.
if (window.Shiny) {
Shiny.addCustomMessageHandler('reactlog', function(message) {
Shiny.addCustomMessageHandler('showcase-src', function(message) {
if (message.srcref && message.srcfile) {
highlightSrcref(message.srcref, message.srcfile);
}
@@ -267,4 +267,3 @@
if (window.hljs)
hljs.initHighlightingOnLoad();
})();

View File

@@ -4920,18 +4920,33 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
if (date === undefined) return;
if (date === null) {
$(el).bsDatepicker('setStartDate', null);
} else {
date = this._newDate(date);
date = this._UTCDateAsLocal(date);
if (!isNaN(date)) {
// Workaround for https://github.com/eternicode/bootstrap-datepicker/issues/2010
// If the start date when there's a two-digit year format, it will set
// the date value to null. So we'll save the value, set the start
// date, and the restore the value.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setStartDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
}
return;
}
date = this._newDate(date);
// If date parsing fails, do nothing
if (date === null) return;
date = this._UTCDateAsLocal(date);
if (isNaN(date)) return;
// Workaround for https://github.com/eternicode/bootstrap-datepicker/issues/2010
// If the start date when there's a two-digit year format, it will set
// the date value to null. So we'll save the value, set the start
// date, and the restore the value.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setStartDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
// Workaround for https://github.com/rstudio/shiny/issues/2335
// We only set the start date *after* the value in this special
// case so we don't effect the intended behavior of having a blank
// value when it falls outside the start date
if (typeof date.toDateString !== 'function') return;
if (typeof curValue.toDateString !== 'function') return;
if (date.toDateString() === curValue.toDateString()) {
$(el).bsDatepicker('setStartDate', null);
$(el).bsDatepicker('setUTCDate', curValue);
$(el).bsDatepicker('setStartDate', date);
}
},
// Given an unambiguous date string or a Date object, set the max (end) date
@@ -4940,15 +4955,28 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
if (date === undefined) return;
if (date === null) {
$(el).bsDatepicker('setEndDate', null);
} else {
date = this._newDate(date);
date = this._UTCDateAsLocal(date);
if (!isNaN(date)) {
// Workaround for same issue as in _setMin.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setEndDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
}
return;
}
date = this._newDate(date);
// If date parsing fails, do nothing
if (date === null) return;
date = this._UTCDateAsLocal(date);
if (isNaN(date)) return;
// Workaround for same issue as in _setMin.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setEndDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
// Workaround for same issue as in _setMin.
if (typeof date.toDateString !== 'function') return;
if (typeof curValue.toDateString !== 'function') return;
if (date.toDateString() === curValue.toDateString()) {
$(el).bsDatepicker('setEndDate', null);
$(el).bsDatepicker('setUTCDate', curValue);
$(el).bsDatepicker('setEndDate', date);
}
},
// Given a date string of format yyyy-mm-dd, return a Date object with

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -20,5 +20,5 @@ not to perform HTML escaping on it.
\examples{
el <- div(HTML("I like <u>turtles</u>"))
cat(as.character(el))
}
}

View File

@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
% Please edit documentation in R/bootstrap-deprecated.R
\name{bootstrapPage}
\alias{bootstrapPage}
\alias{basicPage}
@@ -24,20 +24,9 @@ www directory, e.g. \code{www/bootstrap.css})}
A UI defintion that can be passed to the \link{shinyUI} function.
}
\description{
Create a Shiny UI page that loads the CSS and JavaScript for
\href{http://getbootstrap.com/}{Bootstrap}, and has no content in the page
body (other than what you provide).
}
\details{
This function is primarily intended for users who are proficient in HTML/CSS,
and know how to lay out pages in Bootstrap. Most applications should use
\code{\link[=fluidPage]{fluidPage()}} along with layout functions like
\code{\link[=fluidRow]{fluidRow()}} and \code{\link[=sidebarLayout]{sidebarLayout()}}.
}
\note{
The \code{basicPage} function is deprecated, you should use the
\code{\link[=fluidPage]{fluidPage()}} function instead.
\strong{DEPRECATED}: use \code{\link[=fluidPage]{fluidPage()}} instead.
}
\seealso{
\code{\link[=fluidPage]{fluidPage()}}, \code{\link[=fixedPage]{fixedPage()}}
}
\keyword{internal}

View File

@@ -1,67 +1,73 @@
\name{builder}
\alias{a}
\alias{br}
\alias{builder}
\alias{code}
\alias{div}
\alias{em}
\alias{tags}
\alias{p}
\alias{h1}
\alias{h2}
\alias{h3}
\alias{h4}
\alias{h5}
\alias{h6}
\alias{hr}
\alias{img}
\alias{p}
\alias{pre}
\alias{a}
\alias{br}
\alias{div}
\alias{span}
\alias{pre}
\alias{code}
\alias{img}
\alias{strong}
\alias{tags}
\alias{em}
\alias{hr}
\title{HTML Builder Functions}
\usage{
tags
p(...)
p(..., .noWS = NULL)
h1(...)
h1(..., .noWS = NULL)
h2(...)
h2(..., .noWS = NULL)
h3(...)
h3(..., .noWS = NULL)
h4(...)
h4(..., .noWS = NULL)
h5(...)
h5(..., .noWS = NULL)
h6(...)
h6(..., .noWS = NULL)
a(...)
a(..., .noWS = NULL)
br(...)
br(..., .noWS = NULL)
div(...)
div(..., .noWS = NULL)
span(...)
span(..., .noWS = NULL)
pre(...)
pre(..., .noWS = NULL)
code(...)
code(..., .noWS = NULL)
img(...)
img(..., .noWS = NULL)
strong(...)
strong(..., .noWS = NULL)
em(...)
em(..., .noWS = NULL)
hr(...)
hr(..., .noWS = NULL)
}
\arguments{
\item{...}{Attributes and children of the element. Named arguments become
attributes, and positional arguments become children. Valid children are
tags, single-character character vectors (which become text nodes), and raw
HTML (see \code{\link{HTML}}). You can also pass lists that contain tags,
text nodes, and HTML.}
tags, single-character character vectors (which become text nodes), raw
HTML (see \code{\link{HTML}}), and \code{html_dependency} objects. You can
also pass lists that contain tags, text nodes, or HTML. To use boolean
attributes, use a named argument with a \code{NA} value. (see example)}
\item{.noWS}{A character vector used to omit some of the whitespace that
would normally be written around this tag. Valid options include
\code{before}, \code{after}, \code{outside}, \code{after-begin}, and
\code{before-end}. Any number of these options can be specified.}
}
\description{
Simple functions for constructing HTML documents.
@@ -75,7 +81,7 @@ Dedicated functions are available for the most common HTML tags that do not
conflict with common R functions.
The result from these functions is a tag object, which can be converted using
\code{\link[base]{as.character}()}.
\code{\link{as.character}()}.
}
\examples{
doc <- tags$html(
@@ -92,5 +98,27 @@ doc <- tags$html(
)
)
cat(as.character(doc))
}
# create an html5 audio tag with controls.
# controls is a boolean attributes
audio_tag <- tags$audio(
controls = NA,
tags$source(
src = "myfile.wav",
type = "audio/wav"
)
)
cat(as.character(audio_tag))
# suppress the whitespace between tags
oneline <- tags$span(
tags$strong("I'm strong", .noWS="outside")
)
cat(as.character(oneline))
}
\references{
\itemize{
\item W3C html specification about boolean attributes
\url{https://www.w3.org/TR/html5/infrastructure.html#sec-boolean-attributes}
}
}

View File

@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
% Please edit documentation in R/bootstrap-deprecated.R
\name{headerPanel}
\alias{headerPanel}
\title{Create a header panel}
@@ -16,8 +16,6 @@ Useful if \code{title} is not a string.}
A headerPanel that can be passed to \link{pageWithSidebar}
}
\description{
Create a header panel containing an application title.
}
\examples{
headerPanel("Hello Shiny!")
\strong{DEPRECATED}: use \code{\link[=titlePanel]{titlePanel()}} instead.
}
\keyword{internal}

View File

@@ -27,4 +27,3 @@ complete HTML document, then the returned object will also have class
\seealso{
\code{\link{renderDocument}}
}

View File

@@ -1,10 +1,10 @@
\name{include}
\alias{include}
\alias{includeCSS}
\alias{includeHTML}
\alias{includeMarkdown}
\alias{includeScript}
\alias{includeText}
\alias{includeMarkdown}
\alias{includeCSS}
\alias{includeScript}
\title{Include Content From a File}
\usage{
includeHTML(path)
@@ -19,8 +19,8 @@ includeScript(path, ...)
}
\arguments{
\item{path}{The path of the file to be included. It is highly recommended to
use a relative path (the base path being the Shiny application directory),
not an absolute path.}
use a relative path (the base path being the Shiny application directory),
not an absolute path.}
\item{...}{Any additional attributes to be applied to the generated tag.}
}
@@ -42,4 +42,3 @@ large literal R string.
The \code{includeMarkdown} function requires the \code{markdown}
package.
}

View File

@@ -1,22 +0,0 @@
\name{knit_print.html}
\alias{knit_print.html}
\alias{knit_print.shiny.tag}
\alias{knit_print.shiny.tag.list}
\title{Knitr S3 methods}
\usage{
knit_print.shiny.tag(x, ...)
knit_print.html(x, ...)
knit_print.shiny.tag.list(x, ...)
}
\arguments{
\item{x}{Object to knit_print}
\item{...}{Additional knit_print arguments}
}
\description{
These S3 methods are necessary to allow HTML tags to print themselves in
knitr/rmarkdown documents.
}

31
man/loadSupport.Rd Normal file
View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/app.R
\name{loadSupport}
\alias{loadSupport}
\title{Load an app's supporting R files}
\usage{
loadSupport(appDir, renv = new.env(parent = globalenv()),
globalrenv = globalenv())
}
\arguments{
\item{appDir}{The application directory}
\item{renv}{The environmeny in which the files in the \code{R/} directory should
be evaluated.}
\item{globalrenv}{The environment in which \code{global.R} should be evaluated. If
\code{NULL}, \code{global.R} will not be evaluated at all.}
}
\description{
Loads all of the supporting R files of a Shiny application. Specifically,
this function loads any top-level supporting \code{.R} files in the \code{R/} directory
adjacent to the \code{app.R}/\code{server.R}/\code{ui.R} files.
}
\details{
At the moment, this function is "opt-in" and only called if the option
\code{shiny.autoload.r} is set to \code{TRUE}.
The files are sourced in alphabetical order (as determined by
\link{list.files}). \code{global.R} is evaluated before the supporting R files in the
\code{R/} directory.
}

View File

@@ -1,29 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{mainPanel}
\alias{mainPanel}
\title{Create a main panel}
\usage{
mainPanel(..., width = 8)
}
\arguments{
\item{...}{Output elements to include in the main panel}
\item{width}{The width of the main panel. For fluid layouts this is out of 12
total units; for fixed layouts it is out of whatever the width of the main
panel's parent column is.}
}
\value{
A main panel that can be passed to \code{\link[=sidebarLayout]{sidebarLayout()}}.
}
\description{
Create a main panel containing output elements that can in turn be passed to
\code{\link[=sidebarLayout]{sidebarLayout()}}.
}
\examples{
# Show the caption and plot of the requested variable against mpg
mainPanel(
h3(textOutput("caption")),
plotOutput("mpgPlot")
)
}

View File

@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
% Please edit documentation in R/bootstrap-deprecated.R
\name{pageWithSidebar}
\alias{pageWithSidebar}
\title{Create a page with a sidebar}
@@ -17,32 +17,6 @@ pageWithSidebar(headerPanel, sidebarPanel, mainPanel)
A UI defintion that can be passed to the \link{shinyUI} function
}
\description{
Create a Shiny UI that contains a header with the application title, a
sidebar for input controls, and a main area for output.
}
\note{
This function is deprecated. You should use \code{\link[=fluidPage]{fluidPage()}}
along with \code{\link[=sidebarLayout]{sidebarLayout()}} to implement a page with a sidebar.
}
\examples{
# Define UI
pageWithSidebar(
# Application title
headerPanel("Hello Shiny!"),
# Sidebar with a slider input
sidebarPanel(
sliderInput("obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
\strong{DEPRECATED}: use \code{\link[=fluidPage]{fluidPage()}} and \code{\link[=sidebarLayout]{sidebarLayout()}} instead.
}
\keyword{internal}

View File

@@ -11,13 +11,19 @@ renderPlot(expr, width = "auto", height = "auto", res = 72, ...,
\arguments{
\item{expr}{An expression that generates a plot.}
\item{width, height}{The width/height of the rendered plot, in pixels; or
\code{'auto'} to use the \code{offsetWidth}/\code{offsetHeight} of the HTML
element that is bound to this plot. You can also pass in a function that
returns the width/height in pixels or \code{'auto'}; in the body of the
function you may reference reactive values and functions. When rendering an
inline plot, you must provide numeric values (in pixels) to both
\code{width} and \code{height}.}
\item{width, height}{Height and width can be specified in three ways:
\itemize{
\item \code{"auto"}, the default, uses the size specified by \code{\link[=plotOutput]{plotOutput()}}
(i.e. the \code{offsetWidth}/`offsetHeight`` of the HTML element bound to
this plot.)
\item An integer, defining the width/height in pixels.
\item A function that returns the width/height in pixels (or \code{"auto"}).
The function is executed in a reactive context so that you can refer to
reactive values and expression to make the width/height reactive.
}
When rendering an inline plot, you must provide numeric values (in pixels)
to both \code{width} and \code{height}.}
\item{res}{Resolution of resulting plot, in pixels per inch. This value is
passed to \code{\link[grDevices:png]{grDevices::png()}}. Note that this affects the resolution of PNG

View File

@@ -1,88 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny.R
\name{shiny-options}
\alias{shiny-options}
\title{Global options for Shiny}
\description{
There are a number of global options that affect Shiny's behavior. These can
be set with (for example) \code{options(shiny.trace=TRUE)}.
}
\details{
\describe{
\item{shiny.launch.browser}{A boolean which controls the default behavior
when an app is run. See \code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.port}{A port number that Shiny will listen on. See
\code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.trace}{Print messages sent between the R server and the web
browser client to the R console. This is useful for debugging. Possible
values are \code{"send"} (only print messages sent to the client),
\code{"recv"} (only print messages received by the server), \code{TRUE}
(print all messages), or \code{FALSE} (default; don't print any of these
messages).}
\item{shiny.autoreload}{If \code{TRUE} when a Shiny app is launched, the
app directory will be continually monitored for changes to files that
have the extensions: r, htm, html, js, css, png, jpg, jpeg, gif. If any
changes are detected, all connected Shiny sessions are reloaded. This
allows for fast feedback loops when tweaking Shiny UI.
Since monitoring for changes is expensive (we simply poll for last
modified times), this feature is intended only for development.
You can customize the file patterns Shiny will monitor by setting the
shiny.autoreload.pattern option. For example, to monitor only ui.R:
\code{options(shiny.autoreload.pattern = glob2rx("ui.R"))}
The default polling interval is 500 milliseconds. You can change this
by setting e.g. \code{options(shiny.autoreload.interval = 2000)} (every
two seconds).}
\item{shiny.reactlog}{If \code{TRUE}, enable logging of reactive events,
which can be viewed later with the \code{\link[=reactlogShow]{reactlogShow()}} function.
This incurs a substantial performance penalty and should not be used in
production.}
\item{shiny.usecairo}{This is used to disable graphical rendering by the
Cairo package, if it is installed. See \code{\link[=plotPNG]{plotPNG()}} for more
information.}
\item{shiny.maxRequestSize}{This is a number which specifies the maximum
web request size, which serves as a size limit for file uploads. If
unset, the maximum request size defaults to 5MB.}
\item{shiny.suppressMissingContextError}{Normally, invoking a reactive
outside of a reactive context (or \code{\link[=isolate]{isolate()}}) results in
an error. If this is \code{TRUE}, don't error in these cases. This
should only be used for debugging or demonstrations of reactivity at the
console.}
\item{shiny.host}{The IP address that Shiny should listen on. See
\code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.json.digits}{The number of digits to use when converting
numbers to JSON format to send to the client web browser.}
\item{shiny.minified}{If this is \code{TRUE} or unset (the default), then
Shiny will use minified JavaScript (\code{shiny.min.js}). If
\code{FALSE}, then Shiny will use the un-minified JavaScript
(\code{shiny.js}); this can be useful during development.}
\item{shiny.error}{This can be a function which is called when an error
occurs. For example, \code{options(shiny.error=recover)} will result a
the debugger prompt when an error occurs.}
\item{shiny.table.class}{CSS class names to use for tables.}
\item{shiny.deprecation.messages}{This controls whether messages for
deprecated functions in Shiny will be printed. See
\code{\link[=shinyDeprecated]{shinyDeprecated()}} for more information.}
\item{shiny.fullstacktrace}{Controls whether "pretty" or full stack traces
are dumped to the console when errors occur during Shiny app execution.
The default is \code{FALSE} (pretty stack traces).}
\item{shiny.stacktraceoffset}{If \code{TRUE}, then Shiny's printed stack
traces will display srcrefs one line above their usual location. This is
an arguably more intuitive arrangement for casual R users, as the name
of a function appears next to the srcref where it is defined, rather than
where it is currently being called from.}
\item{shiny.sanitize.errors}{If \code{TRUE}, then normal errors (i.e.
errors not wrapped in \code{safeError}) won't show up in the app; a simple
generic error message is printed instead (the error and strack trace printed
to the console remain unchanged). The default is \code{FALSE} (unsanitized
errors).If you want to sanitize errors in general, but you DO want a
particular error \code{e} to get displayed to the user, then set this option
to \code{TRUE} and use \code{stop(safeError(e))} for errors you want the
user to see.}
\item{shiny.testmode}{If \code{TRUE}, then enable features for testing Shiny
applications. If \code{FALSE} (the default), do not enable those features.
}
}
}

36
man/shiny.appobj.Rd Normal file
View File

@@ -0,0 +1,36 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/app.R
\name{shiny.appobj}
\alias{shiny.appobj}
\alias{as.shiny.appobj}
\alias{as.shiny.appobj.shiny.appobj}
\alias{as.shiny.appobj.list}
\alias{as.shiny.appobj.character}
\alias{is.shiny.appobj}
\alias{print.shiny.appobj}
\alias{as.tags.shiny.appobj}
\title{Shiny App object}
\usage{
as.shiny.appobj(x)
\method{as.shiny.appobj}{shiny.appobj}(x)
\method{as.shiny.appobj}{list}(x)
\method{as.shiny.appobj}{character}(x)
is.shiny.appobj(x)
\method{print}{shiny.appobj}(x, ...)
\method{as.tags}{shiny.appobj}(x, ...)
}
\arguments{
\item{x}{Object to convert to a Shiny app.}
\item{...}{Additional parameters to be passed to print.}
}
\description{
Internal methods for the \code{shiny.appobj} S3 class.
}
\keyword{internal}

View File

@@ -4,41 +4,22 @@
\alias{shinyApp}
\alias{shinyAppDir}
\alias{shinyAppFile}
\alias{as.shiny.appobj}
\alias{as.shiny.appobj.shiny.appobj}
\alias{as.shiny.appobj.list}
\alias{as.shiny.appobj.character}
\alias{is.shiny.appobj}
\alias{print.shiny.appobj}
\alias{as.tags.shiny.appobj}
\title{Create a Shiny app object}
\usage{
shinyApp(ui = NULL, server = NULL, onStart = NULL,
options = list(), uiPattern = "/", enableBookmarking = NULL)
shinyApp(ui, server, onStart = NULL, options = list(),
uiPattern = "/", enableBookmarking = NULL)
shinyAppDir(appDir, options = list())
shinyAppFile(appFile, options = list())
as.shiny.appobj(x)
\method{as.shiny.appobj}{shiny.appobj}(x)
\method{as.shiny.appobj}{list}(x)
\method{as.shiny.appobj}{character}(x)
is.shiny.appobj(x)
\method{print}{shiny.appobj}(x, ...)
\method{as.tags}{shiny.appobj}(x, ...)
}
\arguments{
\item{ui}{The UI definition of the app (for example, a call to
\code{fluidPage()} with nested controls)}
\item{server}{A server function}
\item{server}{A function with three parameters: \code{input}, \code{output}, and
\code{session}. The function is called once for each session ensuring that each
app is independent.}
\item{onStart}{A function that will be called before the app is actually run.
This is only needed for \code{shinyAppObj}, since in the \code{shinyAppDir}
@@ -66,10 +47,6 @@ See \code{\link[=enableBookmarking]{enableBookmarking()}} for more information.}
file and either ui.R or www/index.html)}
\item{appFile}{Path to a .R file containing a Shiny application}
\item{x}{Object to convert to a Shiny app.}
\item{...}{Additional parameters to be passed to print.}
}
\value{
An object that represents the app. Printing the object or passing it

View File

@@ -3,6 +3,7 @@
\name{getShinyOption}
\alias{getShinyOption}
\alias{shinyOptions}
\alias{shiny-options}
\title{Get or set Shiny options}
\usage{
getShinyOption(name, default = NULL)
@@ -17,19 +18,105 @@ shinyOptions(...)
\item{...}{Options to set, with the form \code{name = value}.}
}
\description{
\code{getShinyOption} retrieves the value of a Shiny option.
\code{shinyOptions} sets the value of Shiny options; it can also be used to
return a list of all currently-set Shiny options.
\code{getShinyOption()} retrieves the value of a Shiny option. \code{shinyOptions()}
sets the value of Shiny options; it can also be used to return a list of all
currently-set Shiny options.
}
\details{
There is a global option set, which is available by default. When a Shiny
application is run with \code{\link[=runApp]{runApp()}}, that option set is duplicated
and the new option set is available for getting or setting values. If options
are set from global.R, app.R, ui.R, or server.R, or if they are set from
inside the server function, then the options will be scoped to the
\section{Scope}{
There is a global option set which is available by default. When a Shiny
application is run with \code{\link[=runApp]{runApp()}}, that option set is duplicated and the
new option set is available for getting or setting values. If options
are set from \code{global.R}, \code{app.R}, \code{ui.R}, or \code{server.R}, or if they are set
from inside the server function, then the options will be scoped to the
application. When the application exits, the new option set is discarded and
the global option set is restored.
}
\section{Options}{
There are a number of global options that affect Shiny's behavior. These can
be set globally with \code{options()} or locally (for a single app) with
\code{shinyOptions()}.
\describe{
\item{shiny.autoreload}{If \code{TRUE} when a Shiny app is launched, the
app directory will be continually monitored for changes to files that
have the extensions: r, htm, html, js, css, png, jpg, jpeg, gif. If any
changes are detected, all connected Shiny sessions are reloaded. This
allows for fast feedback loops when tweaking Shiny UI.\preformatted{Since monitoring for changes is expensive (we simply poll for last
modified times), this feature is intended only for development.
You can customize the file patterns Shiny will monitor by setting the
shiny.autoreload.pattern option. For example, to monitor only ui.R:
`options(shiny.autoreload.pattern = glob2rx("ui.R"))`
The default polling interval is 500 milliseconds. You can change this
by setting e.g. `options(shiny.autoreload.interval = 2000)` (every
two seconds).}
}
\item{shiny.deprecation.messages}{This controls whether messages for
deprecated functions in Shiny will be printed. See
\code{\link[=shinyDeprecated]{shinyDeprecated()}} for more information.}
\item{shiny.error}{This can be a function which is called when an error
occurs. For example, \code{options(shiny.error=recover)} will result a
the debugger prompt when an error occurs.}
\item{shiny.fullstacktrace}{Controls whether "pretty" or full stack traces
are dumped to the console when errors occur during Shiny app execution.
The default is \code{FALSE} (pretty stack traces).}
\item{shiny.host}{The IP address that Shiny should listen on. See
\code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.json.digits}{The number of digits to use when converting
numbers to JSON format to send to the client web browser.}
\item{shiny.launch.browser}{A boolean which controls the default behavior
when an app is run. See \code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.maxRequestSize}{This is a number which specifies the maximum
web request size, which serves as a size limit for file uploads. If
unset, the maximum request size defaults to 5MB.}
\item{shiny.minified}{If this is \code{TRUE} or unset (the default), then
Shiny will use minified JavaScript (\code{shiny.min.js}). If
\code{FALSE}, then Shiny will use the un-minified JavaScript
(\code{shiny.js}); this can be useful during development.}
\item{shiny.port}{A port number that Shiny will listen on. See
\code{\link[=runApp]{runApp()}} for more information.}
\item{shiny.reactlog}{If \code{TRUE}, enable logging of reactive events,
which can be viewed later with the \code{\link[=reactlogShow]{reactlogShow()}} function.
This incurs a substantial performance penalty and should not be used in
production.}
\item{shiny.sanitize.errors}{If \code{TRUE}, then normal errors (i.e.
errors not wrapped in \code{safeError}) won't show up in the app; a simple
generic error message is printed instead (the error and strack trace printed
to the console remain unchanged). The default is \code{FALSE} (unsanitized
errors).If you want to sanitize errors in general, but you DO want a
particular error \code{e} to get displayed to the user, then set this option
to \code{TRUE} and use \code{stop(safeError(e))} for errors you want the
user to see.}
\item{shiny.stacktraceoffset}{If \code{TRUE}, then Shiny's printed stack
traces will display srcrefs one line above their usual location. This is
an arguably more intuitive arrangement for casual R users, as the name
of a function appears next to the srcref where it is defined, rather than
where it is currently being called from.}
\item{shiny.suppressMissingContextError}{Normally, invoking a reactive
outside of a reactive context (or \code{\link[=isolate]{isolate()}}) results in
an error. If this is \code{TRUE}, don't error in these cases. This
should only be used for debugging or demonstrations of reactivity at the
console.}
\item{shiny.table.class}{CSS class names to use for tables.}
\item{shiny.testmode}{If \code{TRUE}, then enable features for testing Shiny
applications. If \code{FALSE} (the default), do not enable those features.}
\item{shiny.trace}{Print messages sent between the R server and the web
browser client to the R console. This is useful for debugging. Possible
values are \code{"send"} (only print messages sent to the client),
\code{"recv"} (only print messages received by the server), \code{TRUE}
(print all messages), or \code{FALSE} (default; don't print any of these
messages).}
\item{shiny.usecairo}{This is used to disable graphical rendering by the
Cairo package, if it is installed. See \code{\link[=plotPNG]{plotPNG()}} for more
information.}
}
}
\examples{
\dontrun{
shinyOptions(myOption = 10)

View File

@@ -2,25 +2,38 @@
% Please edit documentation in R/bootstrap-layout.R
\name{sidebarLayout}
\alias{sidebarLayout}
\alias{sidebarPanel}
\alias{mainPanel}
\title{Layout a sidebar and main area}
\usage{
sidebarLayout(sidebarPanel, mainPanel, position = c("left", "right"),
fluid = TRUE)
sidebarPanel(..., width = 4)
mainPanel(..., width = 8)
}
\arguments{
\item{sidebarPanel}{The \link{sidebarPanel} containing input controls}
\item{sidebarPanel}{The \code{sidebarPanel()} containing input controls.}
\item{mainPanel}{The \link{mainPanel} containing outputs}
\item{mainPanel}{The \code{mainPanel()} containing outputs.}
\item{position}{The position of the sidebar relative to the main area ("left"
or "right")}
or "right").}
\item{fluid}{\code{TRUE} to use fluid layout; \code{FALSE} to use fixed
layout.}
\item{...}{Output elements to include in the sidebar/main panel.}
\item{width}{The width of the sidebar and main panel. By default, the
sidebar takes up 1/3 of the width, and the main panel 2/3. The total
width must be 12 or less.}
}
\description{
Create a layout with a sidebar and main area. The sidebar is displayed with a
distinct background color and typically contains input controls. The main
Create a layout (\code{sidebarLayout()}) with a sidebar (\code{sidebarPanel()}) and
main area (\code{mainPanel()}). The sidebar is displayed with a distinct
background color and typically contains input controls. The main
area occupies 2/3 of the horizontal width and typically contains outputs.
}
\examples{

View File

@@ -1,32 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{sidebarPanel}
\alias{sidebarPanel}
\title{Create a sidebar panel}
\usage{
sidebarPanel(..., width = 4)
}
\arguments{
\item{...}{UI elements to include on the sidebar}
\item{width}{The width of the sidebar. For fluid layouts this is out of 12
total units; for fixed layouts it is out of whatever the width of the
sidebar's parent column is.}
}
\value{
A sidebar that can be passed to \code{\link[=sidebarLayout]{sidebarLayout()}}
}
\description{
Create a sidebar panel containing input controls that can in turn be passed
to \code{\link[=sidebarLayout]{sidebarLayout()}}.
}
\examples{
# Sidebar with controls to select a dataset and specify
# the number of observations to view
sidebarPanel(
selectInput("dataset", "Choose a dataset:",
choices = c("rock", "pressure", "cars")),
numericInput("obs", "Observations:", 10)
)
}

View File

@@ -1,6 +1,6 @@
\name{singleton}
\alias{is.singleton}
\alias{singleton}
\alias{is.singleton}
\title{Include content only once}
\usage{
singleton(x, value = TRUE)
@@ -18,4 +18,3 @@ be included in the generated document only once, yet may appear in the
document-generating code more than once. Only the first appearance of the
content (in document order) will be used.
}

View File

@@ -19,4 +19,3 @@ HTML template.
\code{\link[htmltools]{htmlDependency}}
}

View File

@@ -22,7 +22,8 @@ valid when using a \code{tabPanel} within a \code{\link[=navbarPage]{navbarPage(
A tab that can be passed to \code{\link[=tabsetPanel]{tabsetPanel()}}
}
\description{
Create a tab panel that can be included within a \code{\link[=tabsetPanel]{tabsetPanel()}}.
Create a tab panel that can be included within a \code{\link[=tabsetPanel]{tabsetPanel()}} or
a \code{\link[=navbarPage]{navbarPage()}}.
}
\examples{
# Show a tabset that includes a plot, summary, and

View File

@@ -1,9 +1,11 @@
\name{tag}
\alias{tag}
\alias{tagList}
\alias{tagAppendAttributes}
\alias{tagHasAttribute}
\alias{tagGetAttribute}
\alias{tagAppendChild}
\alias{tagAppendChildren}
\alias{tagList}
\alias{tagSetChildren}
\title{HTML Tag Object}
\usage{
@@ -11,15 +13,30 @@ tagList(...)
tagAppendAttributes(tag, ...)
tagHasAttribute(tag, attr)
tagGetAttribute(tag, attr)
tagAppendChild(tag, child)
tagAppendChildren(tag, ..., list = NULL)
tagSetChildren(tag, ..., list = NULL)
tag(`_tag_name`, varArgs)
tag(`_tag_name`, varArgs, .noWS = NULL)
}
\arguments{
\item{...}{Unnamed items that comprise this list of tags.}
\item{tag}{A tag to append child elements to.}
\item{attr}{The name of an attribute.}
\item{child}{A child element to append to a parent tag.}
\item{list}{An optional list of elements. Can be used with or instead of the
\code{...} items.}
\item{_tag_name}{HTML tag name}
\item{varArgs}{List of attributes and children of the element. Named list
@@ -28,18 +45,14 @@ children are tags, single-character character vectors (which become text
nodes), and raw HTML (see \code{\link{HTML}}). You can also pass lists that
contain tags, text nodes, and HTML.}
\item{tag}{A tag to append child elements to.}
\item{child}{A child element to append to a parent tag.}
\item{...}{Unnamed items that comprise this list of tags.}
\item{list}{An optional list of elements. Can be used with or instead of the
\code{...} items.}
\item{.noWS}{Character vector used to omit some of the whitespace that would
normally be written around this tag. Valid options include \code{before},
\code{after}, \code{outside}, \code{after-begin}, and \code{before-end}.
Any number of these options can be specified.}
}
\value{
An HTML tag object that can be rendered as HTML using
\code{\link[base]{as.character}()}.
\code{\link{as.character}()}.
}
\description{
\code{tag()} creates an HTML tag definition. Note that all of the valid HTML5
@@ -60,5 +73,10 @@ x <- list(tags$h1("Title"),
tags$h2("Header text"),
tags$p("Text here"))
tagList(x)
}
# suppress the whitespace between tags
oneline <- tag("span",
tag("strong", "Super strong", .noWS="outside")
)
cat(as.character(oneline))
}

View File

@@ -22,10 +22,12 @@ Single element numeric vectors are returned as a character vector with the
number plus a suffix of \code{"px"}.
Single element character vectors must be \code{"auto"} or \code{"inherit"},
or a number. If the number has a suffix, it must be valid: \code{px},
\code{\%}, \code{em}, \code{pt}, \code{in}, \code{cm}, \code{mm}, \code{ex},
or \code{pc}. If the number has no suffix, the suffix \code{"px"} is
appended.
a number, or a length calculated by the \code{"calc"} CSS function.
If the number has a suffix, it must be valid: \code{px},
\code{\%}, \code{ch}, \code{em}, \code{rem}, \code{pt}, \code{in}, \code{cm},
\code{mm}, \code{ex}, \code{pc}, \code{vh}, \code{vw}, \code{vmin}, or
\code{vmax}.
If the number has no suffix, the suffix \code{"px"} is appended.
Any other value will cause an error to be thrown.
}
@@ -33,4 +35,3 @@ Any other value will cause an error to be thrown.
validateCssUnit("10\%")
validateCssUnit(400) #treated as '400px'
}

View File

@@ -34,5 +34,6 @@ withTags(
p("text")
)
)
}
}

View File

@@ -139,19 +139,35 @@ $.extend(dateInputBinding, {
return;
if (date === null) {
$(el).bsDatepicker('setStartDate', null);
return;
}
} else {
date = this._newDate(date);
date = this._UTCDateAsLocal(date);
if (!isNaN(date)) {
// Workaround for https://github.com/eternicode/bootstrap-datepicker/issues/2010
// If the start date when there's a two-digit year format, it will set
// the date value to null. So we'll save the value, set the start
// date, and the restore the value.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setStartDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
}
date = this._newDate(date);
// If date parsing fails, do nothing
if (date === null)
return;
date = this._UTCDateAsLocal(date);
if (isNaN(date))
return;
// Workaround for https://github.com/eternicode/bootstrap-datepicker/issues/2010
// If the start date when there's a two-digit year format, it will set
// the date value to null. So we'll save the value, set the start
// date, and the restore the value.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setStartDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
// Workaround for https://github.com/rstudio/shiny/issues/2335
// We only set the start date *after* the value in this special
// case so we don't effect the intended behavior of having a blank
// value when it falls outside the start date
if (typeof date.toDateString !== 'function') return;
if (typeof curValue.toDateString !== 'function') return;
if (date.toDateString() === curValue.toDateString()) {
$(el).bsDatepicker('setStartDate', null);
$(el).bsDatepicker('setUTCDate', curValue);
$(el).bsDatepicker('setStartDate', date);
}
},
// Given an unambiguous date string or a Date object, set the max (end) date
@@ -161,16 +177,30 @@ $.extend(dateInputBinding, {
return;
if (date === null) {
$(el).bsDatepicker('setEndDate', null);
return;
}
} else {
date = this._newDate(date);
date = this._UTCDateAsLocal(date);
if (!isNaN(date)) {
// Workaround for same issue as in _setMin.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setEndDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
}
date = this._newDate(date);
// If date parsing fails, do nothing
if (date === null)
return;
date = this._UTCDateAsLocal(date);
if (isNaN(date))
return;
// Workaround for same issue as in _setMin.
var curValue = $(el).bsDatepicker('getUTCDate');
$(el).bsDatepicker('setEndDate', date);
$(el).bsDatepicker('setUTCDate', curValue);
// Workaround for same issue as in _setMin.
if (typeof date.toDateString !== 'function') return;
if (typeof curValue.toDateString !== 'function') return;
if (date.toDateString() === curValue.toDateString()) {
$(el).bsDatepicker('setEndDate', null);
$(el).bsDatepicker('setUTCDate', curValue);
$(el).bsDatepicker('setEndDate', date);
}
},
// Given a date string of format yyyy-mm-dd, return a Date object with

View File

@@ -0,0 +1,2 @@
helper1 <- 123

View File

@@ -0,0 +1,2 @@
helper2 <- "abc"

View File

@@ -0,0 +1 @@
global <- "ABC"

View File

View File

@@ -0,0 +1,2 @@
helper1 <- 456

View File

@@ -0,0 +1,2 @@
helper2 <- "def"

View File

@@ -0,0 +1,8 @@
library(shiny)
ui <- fluidPage()
server <- function(input, output) {}
shinyApp(ui = ui, server = server)

View File

@@ -0,0 +1 @@
stop("global.R should never be sourced alongside app.R")

View File

@@ -0,0 +1,2 @@
helper1 <- 456

View File

@@ -0,0 +1,2 @@
stop("I wasn't supposed to be sourced")

View File

View File

@@ -0,0 +1 @@
lowerHelper <- 123

View File

@@ -0,0 +1,2 @@
stop("Imma crash")

View File

@@ -0,0 +1,2 @@
happy <- TRUE

View File

@@ -49,8 +49,21 @@ contents_identical <- function(a, b) {
TRUE
}
# Don't print out stack traces (which go to stderr)
suppress_stacktrace <- function(expr) {
capture.output(force(expr), type = "message")
}
# Rewire copies the given function, f, and replaces any named
# provided arguments in its execution.
# Note #1: this only substitutes variables at the top-level function
# call. Recursive calls back into this function will not have the
# substitutions.
# Note #2: this function won't work if the call includes the namespace.
# i.e. `rewire(f, ls=function(x))` will not rewire a call to `base::ls()`.
rewire <- function(f, ...) {
orig_env <- environment(f)
new_env <- list2env(list(...), parent = orig_env)
environment(f) <- new_env
f
}

View File

@@ -0,0 +1,6 @@
> x <- reactiveValues(x = 1, y = 2, z = 3)
> x
<ReactiveValues>
Values: x, y, z
Readonly: FALSE

166
tests/testthat/test-app.R Normal file
View File

@@ -0,0 +1,166 @@
context("app")
test_that("files are loaded into the right env", {
renv <- new.env(parent=environment())
genv <- new.env(parent=environment())
loadSupport("../test-helpers/app1-standard", renv=renv, globalrenv=genv)
expect_equal(get("helper1", renv, inherits=FALSE), 123)
expect_equal(get("helper2", renv, inherits=FALSE), "abc")
expect_equal(get("global", genv, inherits=FALSE), "ABC")
})
test_that("Can suppress sourcing global.R", {
# Confirm that things blow up if we source global.R
expect_error(loadSupport(test_path("../test-helpers/app3-badglobal")))
# Shouldn't see an error now that we're suppressing global sourcing.
renv <- loadSupport(test_path("../test-helpers/app3-badglobal"), globalrenv=NULL)
# But other helpers are still sourced
expect_true(exists("helper1", envir=renv))
})
test_that("nested helpers are not loaded", {
loadSupport("../test-helpers/app2-nested", renv=environment(), globalrenv=NULL)
expect_equal(helper1, 456)
expect_false(exists("helper2"))
})
test_that("app with both r/ and R/ prefers R/", {
## App 4 already has a lower-case r/ directory. Try to create an upper.
tryCatch(dir.create("../test-helpers/app4-both/R"),
warning=function(w){testthat::skip("File system is not case-sensitive")})
writeLines("upperHelper <- 'abc'", file.path("../test-helpers/app4-both/R", "upper.R"))
renv <- loadSupport("../test-helpers/app4-both")
expect_false(exists("lowerHelper", envir=renv))
expect_equal(get("upperHelper", envir=renv), "abc")
})
test_that("With ui/server.R, global.R is loaded before R/ helpers and into the right envs", {
calls <- list()
sourceStub <- function(...){
calls[[length(calls)+1]] <<- list(...)
NULL
}
# Temporarily opt-in to R/ file autoloading
orig <- getOption("shiny.autoload.r", NULL)
options(shiny.autoload.r=TRUE)
on.exit({options(shiny.autoload.r=orig)}, add=TRUE)
# + shinyAppDir_serverR
# +--- sourceUTF8
# +--+ loadSupport
# | +--- sourceUTF8
loadSpy <- rewire(loadSupport, sourceUTF8 = sourceStub)
sad <- rewire(shinyAppDir_serverR, sourceUTF8 = sourceStub, loadSupport = loadSpy)
sa <- sad(normalizePath("../test-helpers/app1-standard"))
sa$onStart()
sa$onStop() # Close down to free up resources
# Should have seen three calls -- first to global then to the helpers
expect_length(calls, 3)
expect_match(calls[[1]][[1]], "/global\\.R$", perl=TRUE)
expect_match(calls[[2]][[1]], "/helperCap\\.R$", perl=TRUE)
expect_match(calls[[3]][[1]], "/helperLower\\.r$", perl=TRUE)
# Check environments
# global.R loaded into the global env
gEnv <- calls[[1]]$envir
expect_identical(gEnv, globalenv())
# helpers are loaded into a child of the global env
helperEnv1 <- calls[[2]]$envir
helperEnv2 <- calls[[3]]$envir
expect_identical(helperEnv1, helperEnv2)
expect_identical(parent.env(helperEnv1), globalenv())
calls <- NULL
# Source the server
sa$serverFuncSource()
expect_length(calls, 1)
# server.R is sourced into a child environment of the helpers
expect_match(calls[[1]][[1]], "/server\\.R$")
expect_identical(parent.env(calls[[1]]$envir), helperEnv1)
calls <- NULL
# Invoke the UI by simulating a request
sa$httpHandler(list())
expect_length(calls, 1)
# ui.R is sourced into a child environment of the helpers
expect_match(calls[[1]][[1]], "/ui\\.R$")
expect_identical(parent.env(calls[[1]]$envir), helperEnv1)
})
test_that("Loading supporting R fils is opt-in", {
calls <- list()
sourceStub <- function(...){
calls[[length(calls)+1]] <<- list(...)
NULL
}
# Temporarily unset autoloading option
orig <- getOption("shiny.autoload.r", NULL)
options(shiny.autoload.r=NULL)
on.exit({options(shiny.autoload.r=orig)}, add=TRUE)
# + shinyAppDir_serverR
# +--- sourceUTF8
# +--+ loadSupport
# | +--- sourceUTF8
loadSpy <- rewire(loadSupport, sourceUTF8 = sourceStub)
sad <- rewire(shinyAppDir_serverR, sourceUTF8 = sourceStub, loadSupport = loadSpy)
sa <- sad(normalizePath("../test-helpers/app1-standard"))
sa$onStart()
sa$onStop() # Close down to free up resources
# Should have seen one call from global.R -- helpers are disabled
expect_length(calls, 1)
expect_match(calls[[1]][[1]], "/global\\.R$", perl=TRUE)
})
test_that("app.R is loaded after R/ helpers and into the right envs", {
calls <- list()
sourceSpy <- function(...){
calls[[length(calls)+1]] <<- list(...)
do.call(sourceUTF8, list(...))
}
# Temporarily opt-in to R/ file autoloading
orig <- getOption("shiny.autoload.r", FALSE)
options(shiny.autoload.r=TRUE)
on.exit({options(shiny.autoload.r=orig)}, add=TRUE)
# + shinyAppDir_serverR
# +--- sourceUTF8
# +--+ loadSupport
# | +--- sourceUTF8
loadSpy <- rewire(loadSupport, sourceUTF8 = sourceSpy)
sad <- rewire(shinyAppDir_appR, sourceUTF8 = sourceSpy, loadSupport = loadSpy)
sa <- sad("app.R", normalizePath("../test-helpers/app2-nested"))
sa$onStart()
sa$onStop() # Close down to free up resources
# Should have seen three calls -- first to two helpers then to app.R
expect_length(calls, 2)
expect_match(calls[[1]][[1]], "/helper\\.R$", perl=TRUE)
expect_match(calls[[2]][[1]], "/app\\.R$", perl=TRUE)
# Check environments
# helpers are loaded into a child of the global env
helperEnv1 <- calls[[1]]$envir
expect_identical(parent.env(helperEnv1), globalenv())
# app.R is sourced into a child environment of the helpers
expect_identical(parent.env(calls[[2]]$envir), helperEnv1)
})

View File

@@ -1,6 +1,9 @@
context("options")
test_that("Local options", {
# Clear out any options so we know we're starting fresh
.globals$options <- list()
# Basic options
shinyOptions(a = 1, b = 2)

View File

@@ -122,6 +122,12 @@ test_that("ReactiveValues", {
expect_error(values$a <- 1)
})
test_that("reactiveValues() has useful print method", {
verify_output(test_path("print-reactiveValues.txt"), {
x <- reactiveValues(x = 1, y = 2, z = 3)
x
})
})
# Test for overreactivity. funcB has an indirect dependency on valueA (via
# funcA) and also a direct dependency on valueA. When valueA changes, funcB
@@ -1320,3 +1326,43 @@ test_that("Reactive contexts are not GC'd too early", {
expect_identical(execCount(r), 3L)
expect_false(r_finalized)
})
test_that("reactivePoll doesn't leak observer (#1548)", {
i <- 0
count <- reactivePoll(50, NULL,
checkFunc = function() {
i <<- i + 1
i
},
valueFunc = function() i
)
observe({
count()
})
while (i < 3) {
Sys.sleep(0.05)
shiny:::timerCallbacks$executeElapsed()
shiny:::flushReact()
}
# Removing the reference to count means that no one can use it anymore, and so
# the finalizer should run. The finalizer sets a flag which will allow the
# observer (which calls `checkFunc`) to run one more time; in that run, it
# will remove itself.
rm(count)
gc()
# If the reactivePoll was cleaned up, then the first run of this loop will
# increment i (bringing its value to 4), but in that run, the observer will
# remove itself so subsequent runs will no longer run `checkFunc`.
for (n in 1:3) {
Sys.sleep(0.05)
shiny:::timerCallbacks$executeElapsed()
shiny:::flushReact()
}
expect_equal(i, 3L)
})

View File

@@ -14,7 +14,8 @@ test_that("All man pages have an entry in staticdocs/index.r", {
# Known not to be indexed
known_unindexed <- c("shiny-package", "stacktrace", "knitr_methods",
"knitr_methods_htmltools", "deprecatedReactives")
"pageWithSidebar", "headerPanel", "shiny.appobj",
"deprecatedReactives")
# Read in topics from a staticdocs/index.r file
get_indexed_topics <- function(index_path) {

2
tools/.gitignore vendored
View File

@@ -1,2 +1,4 @@
node_modules
node_modules/
node_modules*/
temp_concat/

View File

@@ -93,6 +93,7 @@ Updating web libraries
======================
## babel-polyfill
To update the version of babel-polyfill:
* Check if there is a newer version available by running `yarn outdated babel-polyfill`. (If there's no output, then you have the latest version.)
@@ -100,9 +101,9 @@ To update the version of babel-polyfill:
* Edit R/shinyui.R. The `renderPage` function has an `htmlDependency` for
`babel-polyfill`. Update this to the new version number.
# Updating and patching `bootstrap-datepicker`
## Updating and patching `bootstrap-datepicker`
## Updating
### Updating
[bootstrap-datepicker](https://github.com/uxsolutions/bootstrap-datepicker) can be updated with the script `updateBootstrapDatepicker.R`.
@@ -110,16 +111,36 @@ After updating, our patches to `bootstrap-datepicker` must be applied using the
After updating and applying patches, `yarn grunt` should be run per the instructions above in order to generate a minified JavaScript file.
## Making a new patch
### Making a new patch
To create a new patch:
1. Make any necessary changes to files in `inst/www/shared/datepicker`
1. **Do not commit your changes.**
1. Instead, create a patch with a command like `git diff > tools/datepicker-patches/012-a-description.patch`. Patches are applied in alphabetic order (per `list.files`), so you should name your patch based on the last one in `tools/datepicker-patches` so that it's applied last.
1. Add the new `.patch` file to the repo with a descriptive commit message
1. Revert `bootstrap-datepicker` to its unpatched state by running `updateBootstrapDatepicker.R`
1. Apply all patches, including the one you just made, by running `applyDatepickerPatches.R`
1. Run `yarn grunt`
1. Test your changes
1. `git add` the new `.patch` and any resulting changes
## Updating and patching ion.rangeSlider
### Updating
[ion.rangeSlider](https://github.com/IonDen/ion.rangeSlider) can be updated with the script `updateBootstrapDatepicker.R`. That script downloads a specific version of ion.rangeSlider and applies our patches in tools/ion.rangeSlider-patches.
After updating and applying patches, `yarn grunt` should be run per the instructions above in order to generate a minified JavaScript file.
### Making a new patch
To create a new patch:
1. Make any necessary changes to files in `inst/www/shared/ion.rangeSlider`
1. **Do not commit your changes.**
1. Instead, create a patch with a command like `git diff > tools/ion.rangeSlider-patches/0004-a-description.patch`. Patches are applied in alphabetic order (per `list.files`), so you should name your patch based on the last one in `tools/ion.rangeSlider-patches` so that it's applied last.
1. Run `updateIonRangeSlider.R` to download the library and apply patches.
1. Run `yarn grunt`
1. Test your changes
1. `git add` the new `.patch` and any resulting changes

View File

@@ -0,0 +1,134 @@
diff --git a/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinShiny.css b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinShiny.css
new file mode 100644
index 0000000..3b96e6b
--- /dev/null
+++ b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinShiny.css
@@ -0,0 +1,128 @@
+/* Ion.RangeSlider, Shiny Skin
+
+// This skin has been modified for use with Shiny.
+// It's based on the HTML5 skin, which doesn't require any sprites, but
+// has been modified to have no gradients, and to have dimensions similar to
+// the skinNice theme.
+
+// css version 2.0.0
+// © RStudio, Inc, 2014
+// © Denis Ineshin, 2014 https://github.com/IonDen
+// © guybowden, 2014 https://github.com/guybowden
+// ===================================================================================================================*/
+
+/* =====================================================================================================================
+// Skin details */
+
+.irs {
+ height: 40px;
+}
+.irs-with-grid {
+ height: 60px;
+}
+.irs-line {
+ height: 8px; top: 25px;
+ background: #EEE;
+ background: linear-gradient(to bottom, #DDD -50%, #FFF 150%); /* W3C */
+ border: 1px solid #CCC;
+ border-radius: 16px;
+ -moz-border-radius: 16px;
+}
+ .irs-line-left {
+ height: 8px;
+ }
+ .irs-line-mid {
+ height: 8px;
+ }
+ .irs-line-right {
+ height: 8px;
+ }
+
+.irs-bar {
+ height: 8px; top: 25px;
+ border-top: 1px solid #428bca;
+ border-bottom: 1px solid #428bca;
+ background: #428bca;
+}
+ .irs-bar-edge {
+ height: 8px; top: 25px;
+ width: 14px;
+ border: 1px solid #428bca;
+ border-right: 0;
+ background: #428bca;
+ border-radius: 16px 0 0 16px;
+ -moz-border-radius: 16px 0 0 16px;
+ }
+
+.irs-shadow {
+ height: 2px; top: 38px;
+ background: #000;
+ opacity: 0.3;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+}
+.lt-ie9 .irs-shadow {
+ filter: alpha(opacity=30);
+}
+
+.irs-slider {
+ top: 17px;
+ width: 22px; height: 22px;
+ border: 1px solid #AAA;
+ background: #DDD;
+ border-radius: 27px;
+ -moz-border-radius: 27px;
+ box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
+ cursor: pointer;
+}
+
+#irs-active-slider, .irs-slider:hover {
+ background: #FFF;
+}
+
+.irs-min, .irs-max {
+ color: #333;
+ font-size: 10px; line-height: 1.333;
+ text-shadow: none;
+ top: 0;
+ padding: 1px 3px;
+ background: rgba(0,0,0,0.1);
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+}
+
+.lt-ie9 .irs-min, .lt-ie9 .irs-max {
+ background: #ccc;
+}
+
+.irs-from, .irs-to, .irs-single {
+ color: #fff;
+ font-size: 11px; line-height: 1.333;
+ text-shadow: none;
+ padding: 1px 3px;
+ background: #428bca;
+ border-radius: 3px;
+ -moz-border-radius: 3px;
+}
+.lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {
+ background: #999;
+}
+
+.irs-grid {
+ height: 27px;
+}
+.irs-grid-pol {
+ opacity: 0.5;
+ background: #428bca;
+}
+.irs-grid-pol.small {
+ background: #999;
+}
+
+.irs-grid-text {
+ bottom: 5px;
+ color: #99a4ac;
+}
+
+.irs-disabled {
+}

View File

@@ -0,0 +1,20 @@
diff --git a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
index 2fe2c8d..89d204e 100644
--- a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
+++ b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
@@ -816,6 +816,7 @@
*/
pointerDown: function (target, e) {
e.preventDefault();
+ e.stopPropagation();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
@@ -859,6 +860,7 @@
*/
pointerClick: function (target, e) {
e.preventDefault();
+ e.stopPropagation();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;

View File

@@ -0,0 +1,18 @@
diff --git a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
index 89d204ed..ae467f10 100644
--- a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
+++ b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js
@@ -1723,7 +1723,12 @@
if (this.has_tab_index) {
this.$cache.input.prop("tabindex", -1);
} else {
- this.$cache.input.removeProp("tabindex");
+ try {
+ this.$cache.input.removeProp("tabindex");
+ } catch(e) {
+ // Do nothing (PhantomJS can throw an error with the
+ // above, #2587)
+ }
}
this.has_tab_index = !this.has_tab_index;

View File

@@ -0,0 +1,88 @@
# source("tools/updateHtmltoolsMan.R")
# Will update all man files that are re-exported from htmltools
# Will save all aliases to `./R/htmltools.R` and document to enforce all re-exports
local({
`%>%` <- magrittr::`%>%`
# pre document
devtools::document()
namespace_line_count <- length(readLines(rprojroot::find_package_root_file("NAMESPACE")))
htmltools_github_man_location <- "https://raw.githubusercontent.com/rstudio/htmltools/master/man/"
local_man_folder <- rprojroot::find_package_root_file("man")
local_htmltools_r_file <- rprojroot::find_package_root_file("R/htmltools.R")
alias_list <- list()
update_htmltools_man_file <- function(man_file, ignore = NULL) {
lines <- paste0(htmltools_github_man_location, man_file) %>%
readLines() %>%
{ .[-(1:2)] } # remove first two roxygen2 comments
man_file_path <- file.path(local_man_folder, man_file)
lines %>%
paste0(collapse = "\n") %>%
writeLines(man_file_path)
message("Updated: ", man_file_path)
alias_list[[man_file]] <<-
lines[grepl("\\alias{", lines, fixed = TRUE)] %>%
sub("\\alias{", "", ., fixed = TRUE) %>%
sub("}$", "", .) %>%
setdiff(ignore)
}
update_htmltools_man_file("builder.Rd", "builder")
update_htmltools_man_file("tag.Rd")
update_htmltools_man_file("HTML.Rd")
update_htmltools_man_file("include.Rd", "include")
update_htmltools_man_file("singleton.Rd")
update_htmltools_man_file("validateCssUnit.Rd")
update_htmltools_man_file("htmlTemplate.Rd")
update_htmltools_man_file("suppressDependencies.Rd")
update_htmltools_man_file("withTags.Rd")
alias_list %>%
vapply(paste0, collapse = " ", character(1), USE.NAMES = FALSE) %>%
paste0("#' @export ", .) %>%
paste0(collapse = "\n") %>%
paste0("#' @import htmltools\n", ., "\nNULL") %>%
writeLines(local_htmltools_r_file)
message("Updated: ", local_htmltools_r_file)
# document new functions
devtools::document()
namespace_line_count_new <- length(readLines(rprojroot::find_package_root_file("NAMESPACE")))
new_version <-
"https://raw.githubusercontent.com/rstudio/htmltools/master/DESCRIPTION" %>%
url() %>%
read.dcf() %>%
as.data.frame() %>%
{.$Version[1]} %>%
as.character()
message("\n")
if (namespace_line_count_new == namespace_line_count) {
message("The NAMESPACE exports did NOT change by copying in the `htmltools` man files")
message()
message("Possible `htmltools` version requirement to add to DESCRIPTION file:\nImports:\n htmltools (>= ", new_version, ")")
} else {
message("The NAMESPACE exports CHANGED by copying in the `htmltools` man files")
message()
message("`htmltools` version requirement to add to DESCRIPTION file:\nImports:\n htmltools (>= ", new_version, ")")
message()
message("Possible remote to add to the DESCRIPTION file:\nRemotes:\n rstudio/htmltools")
}
})

View File

@@ -1,35 +1,58 @@
#!/usr/bin/env Rscript
# This script copies resources from ion.RangeSlider to shiny's inst
# directory. The ion.rangeSlider/ project directory should be on the same level
# as the shiny/ project directory.
# The version of ion.rangeSlider that we use is modified from the base version
# in two ways:
# * In our version, mouse events on the slider are not propagated to lower
# layers (#711, #1630).
# * We include a custom skin for Shiny.
# Retrieves a particular version of ion.rangeSlider:
# https://github.com/IonDen/ion.rangeSlider
# Then applies patches from tools/ion.rangeSlider-patches.
# This script can be sourced from RStudio, or run with Rscript.
# Returns the file currently being sourced or run with Rscript
thisFile <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
return(normalizePath(sys.frames()[[1]]$ofile))
}
# =============================================================================
# Download library
# =============================================================================
# TODO: In the future, use a tag instead of a bare commit hash. See
# updateBootstrapDatepicker.R for an example. This commit happened to be the
# tip of the development tree when we used it.
version <- "f0e1116b065c3d091a9c5f04477aaf8894974e2a"
dest_dir <- rprojroot::find_package_root_file("inst/www/shared/ionrangeslider")
dest_file <- file.path(tempdir(), paste0("ionrangeslider-", version, ".zip"))
url <- sprintf("https://github.com/IonDen/ion.rangeSlider/archive/%s.zip", version)
download.file(url, dest_file)
unzip(dest_file, exdir = tempdir())
unzip_dir <- file.path(tempdir(), paste0("ion.rangeSlider-", version))
unlink(dest_dir, recursive = TRUE)
dir.create(file.path(dest_dir, "js"), recursive = TRUE)
dir.create(file.path(dest_dir, "css"), recursive = TRUE)
dir.create(file.path(dest_dir, "img"), recursive = TRUE)
file.copy(file.path(unzip_dir, "js/ion.rangeSlider.js"), file.path(dest_dir, "js"),
overwrite = TRUE)
file.copy(file.path(unzip_dir, "css"), dest_dir, recursive = TRUE)
file.copy(file.path(unzip_dir, "img"), dest_dir, recursive = TRUE)
# =============================================================================
# Apply patches
# =============================================================================
# The version of ion.rangeSlider that we use is modified from the base version
# in the following ways:
# * In our version, mouse events on the slider are not propagated to lower
# layers (#711, #1630).
# * We include a custom skin for Shiny.
# * When .update() is called, the `.removeProp("tabindex")` is wrapped in
# try-catch. This is because this line results in an error with jQuery 3 and
# PhantomJS. (#2587)
patch_dir <- rprojroot::find_package_root_file("tools/ion.rangeSlider-patches")
for (patch in list.files(patch_dir, full.names = TRUE)) {
tryCatch({
message(sprintf("Applying %s", basename(patch)))
system(sprintf("git apply '%s'", patch))
},
error = function(e) {
quit(save = "no", status = 1)
}
)
}
srcdir <- file.path(dirname(thisFile()), "../../ion.rangeSlider")
destdir <- file.path(dirname(thisFile()), "../inst/www/shared/ionrangeslider")
file.copy(file.path(srcdir, "js/ion.rangeSlider.js"), file.path(destdir, "js"),
overwrite = TRUE)
file.copy(file.path(srcdir, "css"), destdir, recursive = TRUE)
file.copy(file.path(srcdir, "img"), destdir, recursive = TRUE)

View File

@@ -96,14 +96,14 @@ abbrev@1:
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
acorn-jsx@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e"
integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==
version "5.0.2"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f"
integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==
acorn@^6.0.7:
version "6.2.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.1.tgz#3ed8422d6dec09e6121cc7a843ca86a330a86b51"
integrity sha512-JD0xT5FCRDNyjDda3Lrg/IxFscp9q4tiYtxE1/nOzlKCk7hIRuYjhq1kCNkbPjMRMZuFq20HNQn1I9k8Oj0E+Q==
version "6.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e"
integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==
ajv@^6.10.2, ajv@^6.9.1:
version "6.10.2"
@@ -230,16 +230,16 @@ babel-core@^6.0.12, babel-core@^6.26.0:
source-map "^0.5.7"
babel-eslint@^10.0.1:
version "10.0.2"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456"
integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q==
version "10.0.3"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a"
integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/parser" "^7.0.0"
"@babel/traverse" "^7.0.0"
"@babel/types" "^7.0.0"
eslint-scope "3.7.1"
eslint-visitor-keys "^1.0.0"
resolve "^1.12.0"
babel-generator@^6.26.0:
version "6.26.1"
@@ -922,14 +922,6 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-scope@3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-scope@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
@@ -948,16 +940,16 @@ eslint-stylish-mapped@^1.0.0:
text-table "^0.2.0"
eslint-utils@^1.3.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c"
integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ==
version "1.4.2"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab"
integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==
dependencies:
eslint-visitor-keys "^1.0.0"
eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==
eslint@^5.16.0:
version "5.16.0"
@@ -1030,14 +1022,14 @@ esrecurse@^4.1.0:
estraverse "^4.1.0"
estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=
version "4.3.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=
version "2.0.3"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
eventemitter2@~0.4.13:
version "0.4.14"
@@ -1218,9 +1210,9 @@ globule@^1.0.0:
minimatch "~3.0.2"
graceful-fs@^4.1.2:
version "4.2.0"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b"
integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==
version "4.2.2"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02"
integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==
grunt-babel@^6.0.0:
version "6.0.0"
@@ -1401,9 +1393,9 @@ hooker@~0.2.3:
integrity sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=
hosted-git-info@^2.1.4:
version "2.7.1"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==
version "2.8.4"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546"
integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==
"http-parser-js@>=0.4.0 <0.4.11":
version "0.4.10"
@@ -1456,9 +1448,9 @@ inherits@2, inherits@^2.0.3, inherits@~2.0.3:
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
inquirer@^6.2.2:
version "6.5.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42"
integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA==
version "6.5.2"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca"
integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==
dependencies:
ansi-escapes "^3.2.0"
chalk "^2.4.2"
@@ -1886,9 +1878,9 @@ punycode@^2.1.0:
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
qs@^6.4.0:
version "6.7.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
version "6.8.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.8.0.tgz#87b763f0d37ca54200334cd57bb2ef8f68a1d081"
integrity sha512-tPSkj8y92PfZVbinY1n84i1Qdx75lZjMQYx9WZhnkofyxzw2r7Ho39G3/aEvSUdebxpnnM4LZJCtvE/Aq3+s9w==
raw-body@~1.1.0:
version "1.1.7"
@@ -1998,10 +1990,10 @@ resolve-from@^4.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
resolve@^1.10.0:
version "1.11.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e"
integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==
resolve@^1.10.0, resolve@^1.12.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6"
integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==
dependencies:
path-parse "^1.0.6"
@@ -2025,13 +2017,20 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"
rimraf@2.6.3, rimraf@^2.5.1, rimraf@^2.5.2, rimraf@~2.6.2:
rimraf@2.6.3, rimraf@~2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
rimraf@^2.5.1, rimraf@^2.5.2:
version "2.7.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
dependencies:
glob "^7.1.3"
run-async@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
@@ -2067,9 +2066,9 @@ safe-json-parse@~1.0.1:
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
"semver@2 || 3 || 4 || 5", semver@^5.5.0, semver@^5.5.1:
version "5.7.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
shebang-command@^1.2.0:
version "1.2.0"
@@ -2244,9 +2243,9 @@ supports-color@^5.3.0:
has-flag "^3.0.0"
table@^5.2.3:
version "5.4.4"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.4.tgz#6e0f88fdae3692793d1077fd172a4667afe986a6"
integrity sha512-IIfEAUx5QlODLblLrGTTLJA7Tk0iLSGBvgY8essPRVNGHAzThujww1YqHLs6h3HfTg55h++RzLHH5Xw/rfv+mg==
version "5.4.6"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==
dependencies:
ajv "^6.10.2"
lodash "^4.17.14"