Compare commits

...

24 Commits

Author SHA1 Message Date
Winston Chang
f5b395485e shiny v1.7.4.1
Remove use of as.numeric_version()
Closes #3849
2023-07-07 09:33:14 -04:00
Carson Sievert
6176f03ad0 v1.7.4 release candidate (#3749)
* Start release candidate

* Get rid of warnings about qplot() usage in tests

* Clean up news

* `yarn build` (GitHub Actions)

* Sync package version (GitHub Actions)

* Remote remotes (htmltools is now in CRAN)

* Change header syntax in NEWS.md (to match what usethis does)

Co-authored-by: cpsievert <cpsievert@users.noreply.github.com>
2022-12-15 11:12:19 -06:00
Carson Sievert
f12334e839 Properly check for NaN values upon resizing a brushable image. (#3754)
Regression introduced by https://github.com/rstudio/shiny/pull/3644/files#diff-9aad79e444091956075dc1e1dc5ab9202b5e998f5d441e69f040319b6c00d100L228-L230

JS error discovered by 104-plot-interaction-select (with showcase mode)
2022-12-08 14:32:27 -06:00
Winston Chang
ffb6736f11 Don't add "use strict" to external libraries (#3746)
* Add missing var in loop

* `yarn build` (GitHub Actions)

Co-authored-by: wch <wch@users.noreply.github.com>
2022-12-06 14:17:36 -06:00
Winston Chang
f084d3a34f Merge pull request #3747 from rstudio/eslint-newline-after-var
Remove eslint `newline-after-var rule`
2022-12-06 13:07:43 -06:00
Winston Chang
0fe7cad876 Remove eslint newline-after-var rule 2022-12-05 16:34:23 -06:00
Carson Sievert
ecff638920 Don't supply width/height to the device if they aren't defined (#3740)
* Close #1409: don't supply width/height to the device if they aren't defined

* Update news

* Update unit tests to reflect that plotPNG()/startPNG() now handles NULL dimensions

* Add a note about NULL dimensions on plotPNG() help page

* Update news
2022-12-02 20:27:07 -06:00
Carson Sievert
ed6022e3f2 Have renderPlot() error early if height/width of a plot aren't yet defined (#3739)
* Close #3704. Close #3735. Close #1409. Throw informative error in renderPlot() early if height/width of a plot aren't yet defined

* `devtools::document()` (GitHub Actions)

* Add unit tests

* Use consistent filename; add intentional failure (to get artifact uploads)

* Make output id argument name more unique

* Update news

* plotPNG() test isn't worth it

* Don't try to provide a suggestion on how to fix the issue (it's no worse than what we currently have, and we probably should be defaulting to an 'arbitrary' size anyway

* update news

* minimize diff

Co-authored-by: cpsievert <cpsievert@users.noreply.github.com>
2022-11-22 17:23:19 -06:00
Carson Sievert
20cc8e26b5 Use getBoundingClientRect() over offsetHeight/offsetWidth to get more precise sizing (#3720)
* Use getBoundingClientRect() over offsetHeight/offsetWidth to get more precise sizing

* Update news
2022-10-28 15:55:24 -05:00
Carson Sievert
e48e9c6904 Add fill arguments to plotOutput(), imageOutput(), and uiOutput() (#3715)
* Add fill arguments to plotOutput(), imageOutput(), and uiOutput()

* Update news

* Code review

* `devtools::document()` (GitHub Actions)

* `yarn build` (GitHub Actions)

* Sync package version (GitHub Actions)

* Update news

* Update to use bindFillRole()

Co-authored-by: cpsievert <cpsievert@users.noreply.github.com>
2022-10-26 11:52:26 -05:00
Joe Cheng
87c673f283 Bump version to v1.7.3.9000 2022-10-25 18:01:14 -07:00
Joe Cheng
dfaefa8905 Merge tag 'v1.7.3' 2022-10-25 17:59:18 -07:00
Joe Cheng
cd4f406234 Squelch R CMD check message
"Package has help file(s) containing install/render-stage \Sexpr{} expressions but no prebuilt PDF manual."
2022-10-24 18:37:15 -07:00
Joe Cheng
190b542613 Use v1.7.3 instead
Something in our yarn build toolchain doesn't like version numbers
with 4 segments
2022-10-24 16:54:54 -07:00
Joe Cheng
73e48ab5f4 Remove Remotes, add NEWS item 2022-10-24 16:22:42 -07:00
Barret Schloerke
62a95b9ce2 Reverting selectize logic change from #3644 (#3716) 2022-10-24 12:18:00 -04:00
Barret Schloerke
999eb1de3c Add fontawesome remote 2022-10-21 15:47:39 -04:00
Barret Schloerke
55985740de Skip template tests even if shinytest2 is available. Install shinytest2 from CRAN
We will bring these tests back after this release.
We will move shinytest2 to suggests after this release
2022-10-21 15:30:00 -04:00
Barret Schloerke
e82b71da65 Update template code to work with latest shinytest2 2022-10-21 14:54:05 -04:00
Joe Cheng
9ce1e6c549 Fix unit test to be compatible with fontawesome 0.4.0 2022-10-21 11:05:04 -07:00
Winston Chang
cda59da698 Remove types-jquery.patch (#3710)
Co-authored-by: wch <wch@users.noreply.github.com>
Co-authored-by: Barret Schloerke <schloerke@gmail.com>
2022-10-05 10:50:19 -04:00
Winston Chang
51da80d381 Merge pull request #3709 from rstudio/blob 2022-10-03 12:36:29 -05:00
wch
412606c594 yarn build (GitHub Actions) 2022-10-03 17:26:14 +00:00
Winston Chang
da2df5ac58 Use correct type for messages 2022-10-03 12:20:59 -05:00
66 changed files with 990 additions and 969 deletions

View File

@@ -44,9 +44,6 @@ rules:
semi:
- error
- always
newline-after-var:
- error
- always
dot-location:
- error
- property

View File

@@ -1,7 +1,7 @@
Package: shiny
Type: Package
Title: Web Application Framework for R
Version: 1.7.2.9000
Version: 1.7.4.1
Authors@R: c(
person("Winston", "Chang", role = c("aut", "cre"), email = "winston@rstudio.com", comment = c(ORCID = "0000-0002-1576-2126")),
person("Joe", "Cheng", role = "aut", email = "joe@rstudio.com"),
@@ -78,8 +78,8 @@ Imports:
mime (>= 0.3),
jsonlite (>= 0.9.16),
xtable,
fontawesome (>= 0.2.1),
htmltools (>= 0.5.2),
fontawesome (>= 0.4.0),
htmltools (>= 0.5.4),
R6 (>= 2.0),
sourcetools,
later (>= 1.0.0),
@@ -111,7 +111,7 @@ Suggests:
ragg,
showtext,
sass
URL: https://shiny.rstudio.com/
URL: https://shiny.posit.co/
BugReports: https://github.com/rstudio/shiny/issues
Collate:
'globals.R'
@@ -202,10 +202,10 @@ Collate:
'version_selectize.R'
'version_strftime.R'
'viewer.R'
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RdMacros: lifecycle
Config/testthat/edition: 3
Config/Needs/check:
rstudio/shinytest2
shinytest2

220
NEWS.md
View File

@@ -1,21 +1,37 @@
shiny 1.7.2.9000
================
# shiny 1.7.4.1
## Full changelog
* Closed #3849: In R-devel, a warning was raised when Shiny was loaded because `as.numeric_version()` was called with a number instead of a string. (#3850)
# shiny 1.7.4
## Full changelog
### Breaking changes
* Closed #3719: Output container sizes, which are available via [`session$clientData` and `getCurrentOutputInfo()`](https://shiny.rstudio.com/articles/client-data.html), no longer round to the nearest pixel (i.e., they are now more exact, possibly fractional values). (#3720)
* Closed #3704, #3735, and #3740: `renderPlot()` no longer generates an error (or segfault) when it executes before the output is visible. Instead, it'll now use the graphics device's default size for it's initial size. Relatedly, `plotPNG()` now ignores `NULL` values for `width`/`height` (and uses the device's default `width`/`height` instead). (#3739)
### New features and improvements
* Internal: Added clearer and strict TypeScript type definitions (#3644)
### Bug fixes
* `plotOutput()`, `imageOutput()`, and `uiOutput()` gain a `fill` argument. If `TRUE` (the default for `plotOutput()`), the output container is allowed to grow/shrink to fit a fill container (created via `htmltools::bindFillRole()`) with an opinionated height. This means `plotOutput()` will grow/shrink by default [inside of `bslib::card_body_fill()`](https://rstudio.github.io/bslib/articles/cards.html#responsive-sizing), but `imageOutput()` and `uiOutput()` will have to opt-in to similar behavior with `fill = TRUE`. (#3715)
* Closed #3687: Updated jQuery-UI to v1.13.2. (#3697)
* Internal: Added clearer and strict TypeScript type definitions (#3644)
shiny 1.7.2
===========
# shiny 1.7.3
### Bug fixes
* Shiny 1.7.0 changed the `icon(lib="fontawesome")` implementation from a bundled copy of fontawesome, to the {fontawesome} package. This led to issue #3688, where icons that were previously working, were now breaking. That's because {fontawesome} 0.3.0 and earlier did not have support for icon names used in Font Awesome 5 and earlier, only the newest icon names used in Font Awesome 6. Now, {fontawesome} 0.4.0 has restored support for those older icon names, and Shiny 1.7.2.1 has updated its {fontawesome} requirement to >=0.4.0.
# shiny 1.7.2
## Full changelog
@@ -66,8 +82,7 @@ shiny 1.7.2
* HTML dependencies that are sent to dynamic UI now have better type checking, and no longer require a `dep.src.href` field. (#3537)
shiny 1.7.1
===========
# shiny 1.7.1
## Bug Fixes
@@ -76,8 +91,7 @@ shiny 1.7.1
* Re-arranged conditions for testthat 1.0.0 compatibility. (#3512)
shiny 1.7.0
===========
# shiny 1.7.0
## Full changelog
@@ -134,14 +148,13 @@ shiny 1.7.0
* Updated to jQuery 3.6.0. (#3311)
shiny 1.6.0
===========
# shiny 1.6.0
This release focuses on improvements in three main areas:
1. Better theming (and Bootstrap 4) support:
* The `theme` argument of `fluidPage()`, `navbarPage()`, and `bootstrapPage()` all now understand `bslib::bs_theme()` objects, which can be used to opt-into Bootstrap 4, use any Bootswatch theme, and/or implement custom themes without writing any CSS.
* The `session` object now includes `$setCurrentTheme()` and `$getCurrentTheme()` methods to dynamically update (or obtain) the page's `theme` after initial load, which is useful for things such as [adding a dark mode switch to an app](https://rstudio.github.io/bslib/articles/bslib.html#dynamic) or some other "real-time" theming tool like `bslib::bs_themer()`.
* The `session` object now includes `$setCurrentTheme()` and `$getCurrentTheme()` methods to dynamically update (or obtain) the page's `theme` after initial load, which is useful for things such as [adding a dark mode switch to an app](https://rstudio.github.io/bslib/articles/theming.html#dynamic) or some other "real-time" theming tool like `bslib::bs_themer()`.
* For more details, see [`{bslib}`'s website](https://rstudio.github.io/bslib/)
2. Caching of `reactive()` and `render*()` (e.g. `renderText()`, `renderTable()`, etc) expressions.
@@ -244,8 +257,7 @@ This release focuses on improvements in three main areas:
* Removed es5-shim library, which was internally used within `selectInput()` for ECMAScript 5 compatibility. (#2993)
shiny 1.5.0
===========
# shiny 1.5.0
## Full changelog
@@ -298,20 +310,17 @@ shiny 1.5.0
* Updated from Font-Awesome 5.3.1 to 5.13.0, which includes icons related to COVID-19. For upgrade notes, see https://github.com/FortAwesome/Font-Awesome/blob/master/UPGRADING.md. (#2891)
shiny 1.4.0.2
===========
# shiny 1.4.0.2
Minor patch release: fixed some timing-dependent tests failed intermittently on CRAN build machines.
shiny 1.4.0.1
===========
# shiny 1.4.0.1
Minor patch release to account for changes to the grid package that will be upcoming in the R 4.0 release (#2776).
shiny 1.4.0
===========
# shiny 1.4.0
## Full changelog
@@ -374,8 +383,7 @@ shiny 1.4.0
* Fixed #2329, #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.
shiny 1.3.2
===========
# shiny 1.3.2
### Bug fixes
@@ -384,8 +392,7 @@ shiny 1.3.2
* Fixed #2280: Shiny applications that used a www/index.html file did not serve up the index file. (#2382)
shiny 1.3.1
===========
# shiny 1.3.1
## Full changelog
@@ -394,8 +401,7 @@ shiny 1.3.1
* Fixed a performance issue introduced in v1.3.0 when using large nested lists within Shiny. (#2377)
shiny 1.3.0
===========
# shiny 1.3.0
## Full changelog
@@ -426,8 +432,7 @@ shiny 1.3.0
* Fixed #2247: `renderCachedPlot` now supports using promises for either `expr` or `cacheKeyExpr`. (Shiny v1.2.0 supported async `expr`, but only if `cacheKeyExpr` was async as well; now you can use any combination of sync/async for `expr` and `cacheKeyExpr`.) #2261
shiny 1.2.0
===========
# shiny 1.2.0
This release features plot caching, an important new tool for improving performance and scalability. Using `renderCachedPlot` in place of `renderPlot` can greatly improve responsiveness for apps that show the same plot many times (for example, a dashboard or report where all users view the same data). Shiny gives you a fair amount of control in where the cache is stored and how cached plots are invalidated, so be sure to read [this article](https://shiny.rstudio.com/articles/plot-caching.html) to get the most out of this feature.
@@ -492,8 +497,7 @@ This release features plot caching, an important new tool for improving performa
* Addressed #1864 by changing `optgroup` documentation to use `list` instead of `c`. (#2084)
shiny 1.1.0
===========
# shiny 1.1.0
This is a significant release for Shiny, with a major new feature that was nearly a year in the making: support for asynchronous operations! Until now, R's single-threaded nature meant that performing long-running calculations or tasks from Shiny would bring your app to a halt for other users of that process. This release of Shiny deeply integrates the [promises](https://rstudio.github.io/promises/) package to allow you to execute some tasks asynchronously, including as part of reactive expressions and outputs. See the [promises](https://rstudio.github.io/promises/) documentation to learn more.
@@ -543,7 +547,7 @@ This is a significant release for Shiny, with a major new feature that was nearl
* Fixed #1600: URL-encoded bookmarking did not work with sliders that had dates or date-times. (#1961)
* Fixed #1962: [File dragging and dropping](https://www.rstudio.com/blog/shiny-1-0-4/) broke in the presence of jQuery version 3.0 as introduced by the [rhandsontable](https://jrowen.github.io/rhandsontable/) [htmlwidget](https://www.htmlwidgets.org/). (#2005)
* Fixed #1962: [File dragging and dropping](https://posit.co/blog/shiny-1-0-4/) broke in the presence of jQuery version 3.0 as introduced by the [rhandsontable](https://jrowen.github.io/rhandsontable/) [htmlwidget](https://www.htmlwidgets.org/). (#2005)
* Improved the error handling inside the `addResourcePath()` function, to give end users more informative error messages when the `directoryPath` argument cannot be normalized. This is especially useful for `runtime: shiny_prerendered` Rmd documents, like `learnr` tutorials. (#1968)
@@ -566,8 +570,7 @@ This is a significant release for Shiny, with a major new feature that was nearl
In some rare cases, interrupting an application (by pressing Ctrl-C or Esc) may result in the message `Error in execCallbacks(timeoutSecs) : c++ exception (unknown reason)`. Although this message sounds alarming, it is harmless, and will go away in a future version of the later package (more information [here](https://github.com/r-lib/later/issues/55)).
shiny 1.0.5
===========
# shiny 1.0.5
## Full changelog
@@ -580,8 +583,7 @@ shiny 1.0.5
* Fixed #1824: HTTP HEAD requests on static files caused the application to stop. (#1825)
shiny 1.0.4
===========
# shiny 1.0.4
There are three headlining features in this release of Shiny. It is now possible to add and remove tabs from a `tabPanel`; there is a new function, `onStop()`, which registers callbacks that execute when an application exits; and `fileInput`s now can have files dragged and dropped on them. In addition to these features, this release has a number of minor features and bug fixes. See the full changelog below for more details.
@@ -642,8 +644,7 @@ There are three headlining features in this release of Shiny. It is now possible
* Fixed #1474: A `browser()` call in an observer could cause an error in the RStudio IDE on Windows. (#1802)
shiny 1.0.3
================
# shiny 1.0.3
This is a hotfix release of Shiny. With previous versions of Shiny, when running an application on the newly-released version of R, 3.4.0, it would print a message: `Warning in body(fun) : argument is not a function`. This has no effect on the application, but because the message could be alarming to users, we are releasing a new version of Shiny that fixes this issue.
@@ -656,8 +657,7 @@ This is a hotfix release of Shiny. With previous versions of Shiny, when running
* Fixed #1676: On R 3.4.0, running a Shiny application gave a warning: `Warning in body(fun) : argument is not a function`. (#1677)
shiny 1.0.2
================
# shiny 1.0.2
This is a hotfix release of Shiny. The primary reason for this release is because the web host for MathJax JavaScript library is scheduled to be shut down in the next few weeks. After it is shut down, Shiny applications that use MathJax will no longer be able to load the MathJax library if they are run with Shiny 1.0.1 and below. (If you don't know whether your application uses MathJax, it probably does not.) For more information about why the MathJax CDN is shutting down, see https://www.mathjax.org/cdn-shutting-down/.
@@ -676,8 +676,7 @@ This is a hotfix release of Shiny. The primary reason for this release is becaus
* Fixed #1653: wrong code example in documentation. (#1658)
shiny 1.0.1
================
# shiny 1.0.1
This is a maintenance release of Shiny, mostly aimed at fixing bugs and introducing minor features. The most notable additions in this version of Shiny are the introduction of the `reactiveVal()` function (it's like `reactiveValues()`, but it only stores a single value), and that the choices of `radioButtons()` and `checkboxGroupInput()` can now contain HTML content instead of just plain text.
@@ -747,8 +746,7 @@ in shiny apps. For more info, see the documentation (`?updateQueryString` and `?
* Closed #1500: Updated ion.rangeSlider to 2.1.6. (#1540)
shiny 1.0.0
===========
# shiny 1.0.0
Shiny has reached a milestone: version 1.0.0! In the last year, we've added two major features that we considered essential for a 1.0.0 release: bookmarking, and support for testing Shiny applications. As usual, this version of Shiny also includes many minor features and bug fixes.
@@ -813,8 +811,7 @@ Now there's an official way to slow down reactive values and expressions that in
* Updated to Font Awesome 4.7.0.
shiny 0.14.2
============
# shiny 0.14.2
This is a maintenance release of Shiny, with some bug fixes and minor new features.
@@ -842,8 +839,7 @@ This is a maintenance release of Shiny, with some bug fixes and minor new featur
* Fixed a bug where, in versions of R before 3.2, Shiny applications could crash due to a bug in R's implementation of `list2env()`. (#1446)
shiny 0.14.1
============
# shiny 0.14.1
This is a maintenance release of Shiny, with some bug fixes and minor new features.
@@ -873,8 +869,7 @@ This is a maintenance release of Shiny, with some bug fixes and minor new featur
* Updated to jQuery UI 1.12.1. Previously, Shiny included a build of 1.11.4 which was missing the datepicker component due to a conflict with the bootstrap-datepicker used by Shiny's `dateInput()` and `dateRangeInput()`. (#1374)
shiny 0.14
==========
# shiny 0.14
A new Shiny release is upon us! There are many new exciting features, bug fixes, and library updates. We'll just highlight the most important changes here, but you can browse through the full changelog below for details. This will likely be the last release before shiny 1.0, so get out your party hats!
@@ -1073,14 +1068,12 @@ There are many more minor features, small improvements, and bug fixes than we ca
* Updated to jQuery 1.12.4.
shiny 0.13.2
============
# shiny 0.13.2
* Updated documentation for `htmlTemplate`.
shiny 0.13.1
============
# shiny 0.13.1
* `flexCol` did not work on RStudio for Windows or Linux.
@@ -1089,8 +1082,7 @@ shiny 0.13.1
* BREAKING CHANGE: The long-deprecated ability to pass functions (rather than expressions) to reactive() and observe() has finally been removed.
shiny 0.13.0
============
# shiny 0.13.0
* Fixed #962: plot interactions did not work with the development version of ggplot2 (after ggplot2 1.0.1).
@@ -1141,8 +1133,7 @@ shiny 0.13.0
* Added support for the new htmltools 0.3 feature `htmlTemplate`. It's now possible to use regular HTML markup to design your UI, but still use R expressions to define inputs, outputs, and HTML widgets.
shiny 0.12.2
============
# shiny 0.12.2
* GitHub changed URLs for gists from .tar.gz to .zip, so `runGist` was updated to work with the new URLs.
@@ -1165,16 +1156,14 @@ shiny 0.12.2
* Shiny now correctly handles HTTP HEAD requests. (#876)
shiny 0.12.1
============
# shiny 0.12.1
* Fixed an issue where unbindAll() causes subsequent bindAll() to be ignored for previously bound outputs. (#856)
* Undeprecate `dataTableOutput` and `renderDataTable`, which had been deprecated in favor of the new DT package. The DT package is a bit too new and has a slightly different API, we were too hasty in deprecating the existing Shiny functions.
shiny 0.12.0
============
# shiny 0.12.0
In addition to the changes listed below (in the *Full Changelog* section), there is an infrastructure change that could affect existing Shiny apps.
@@ -1230,8 +1219,7 @@ Shiny 0.12.0 deprecated Shiny's dataTableOutput and renderDataTable functions an
* renderDataTable() and dataTableOutput() have been deprecated in shiny and will be removed in future versions of shiny. Please use the DT package instead: http://rstudio.github.io/DT/ (#807)
shiny 0.11.1
============
# shiny 0.11.1
* Major client-side performance improvements for pages that have many conditionalPanels, tabPanels, and plotOutputs. (#693, #717, #723)
@@ -1258,8 +1246,7 @@ shiny 0.11.1
* downloadHandler content callback functions are now invoked with a temp file name that has the same extension as the final filename that will be used by the download. This is to deal with the fact that some file writing functions in R will auto-append the extension for their file type (pdf, zip).
shiny 0.11
==========
# shiny 0.11
Shiny 0.11 switches away from the Bootstrap 2 web framework to the next version, Bootstrap 3. This is in part because Bootstrap 2 is no longer being developed, and in part because it allows us to tap into the ecosystem of Bootstrap 3 themes.
@@ -1337,20 +1324,17 @@ Along with the release of Shiny 0.11, we've packaged up some Bootstrap 3 themes
* Password input fields can now be used, with `passwordInput()`. (#672)
shiny 0.10.2.2
==============
# shiny 0.10.2.2
* Remove use of `rstudio::viewer` in a code example, for R CMD check.
shiny 0.10.2.1
==============
# shiny 0.10.2.1
* Changed some examples to use \donttest instead of \dontrun.
shiny 0.10.2
============
# shiny 0.10.2
* The minimal version of R required for the shiny package is 3.0.0 now.
@@ -1383,8 +1367,7 @@ shiny 0.10.2
* Added `position` parameter to `navbarPage`.
shiny 0.10.1
============
# shiny 0.10.1
* Added Unicode support for Windows. Shiny apps running on Windows must use the UTF-8 encoding for ui.R and server.R (also the optional global.R) if they contain non-ASCII characters. See this article for details and examples: http://shiny.rstudio.com/gallery/unicode-characters.html (#516)
@@ -1397,8 +1380,7 @@ shiny 0.10.1
* Added support for option groups in the select/selectize inputs. When the `choices` argument for `selectInput()`/`selectizeInput()` is a list of sub-lists and any sub-list is of length greater than 1, the HTML tag `<optgroup>` will be used. See an example at http://shiny.rstudio.com/gallery/option-groups-for-selectize-input.html (#542)
shiny 0.10.0
============
# shiny 0.10.0
* BREAKING CHANGE: By default, observers now terminate themselves if they were created during a session and that session ends. See ?domains for more details.
@@ -1435,14 +1417,12 @@ shiny 0.10.0
* `runGitHub()` can also take a value of the form "username/repo" in its first argument, e.g. both runGitHub("shiny_example", "rstudio") and runGitHub("rstudio/shiny_example") are valid ways to run the GitHub repo.
shiny 0.9.1
===========
# shiny 0.9.1
* Fixed warning 'Error in Context$new : could not find function "loadMethod"' that was happening to dependent packages on "R CMD check".
shiny 0.9.0
===========
# shiny 0.9.0
* BREAKING CHANGE: Added a `host` parameter to runApp() and runExample(), which defaults to the shiny.host option if it is non-NULL, or "127.0.0.1" otherwise. This means that by default, Shiny applications can only be accessed on the same machine from which they are served. To allow other clients to connect, as in previous versions of Shiny, use "0.0.0.0" (or the IP address of one of your network interfaces, if you care to be explicit about it).
@@ -1515,8 +1495,7 @@ shiny 0.9.0
* Dots are now legal characters for inputId/outputId. (Thanks, Kevin Lindquist. #358)
shiny 0.8.0
===========
# shiny 0.8.0
* Debug hooks are registered on all user-provided functions and (reactive) expressions (e.g., in renderPlot()), which makes it possible to set breakpoints in these functions using the latest version of the RStudio IDE, and the RStudio visual debugging tools can be used to debug Shiny apps. Internally, the registration is done via installExprFunction(), which is a new function introduced in this version to replace exprToFunction() so that the registration can be automatically done.
@@ -1535,8 +1514,7 @@ shiny 0.8.0
* The minimal required version for the httpuv package was increased to 1.2 (on CRAN now).
shiny 0.7.0
===========
# shiny 0.7.0
* Stopped sending websocket subprotocol. This fixes a compatibility issue with Google Chrome 30.
@@ -1565,8 +1543,7 @@ shiny 0.7.0
* Add shiny.sharedSecret option, to require the HTTP header Shiny-Shared-Secret to be set to the given value.
shiny 0.6.0
===========
# shiny 0.6.0
* `tabsetPanel()` can be directed to start with a specific tab selected.
@@ -1597,8 +1574,7 @@ shiny 0.6.0
* Shiny apps can be run without a server.r and ui.r file.
shiny 0.5.0
===========
# shiny 0.5.0
* Switch from websockets package for handling websocket connections to httpuv.
@@ -1615,16 +1591,14 @@ shiny 0.5.0
* Fix bug #55, where `renderTable()` would throw error with an empty data frame.
shiny 0.4.1
===========
# shiny 0.4.1
* Fix bug where width and height weren't passed along properly from `reactivePlot` to `renderPlot`.
* Fix bug where infinite recursion would happen when `reactivePlot` was passed a function for width or height.
shiny 0.4.0
===========
# shiny 0.4.0
* Added suspend/resume capability to observers.
@@ -1639,8 +1613,7 @@ shiny 0.4.0
* Fixed a bug where empty values in a numericInput were sent to the R process as 0. They are now sent as NA.
shiny 0.3.1
===========
# shiny 0.3.1
* Fix issue #91: bug where downloading files did not work.
@@ -1649,8 +1622,7 @@ shiny 0.3.1
* Reactive functions now preserve the visible/invisible state of their returned values.
shiny 0.3.0
===========
# shiny 0.3.0
* Reactive functions are now evaluated lazily.
@@ -1675,52 +1647,44 @@ shiny 0.3.0
* Fix issue #64, where pressing Enter in a textbox would cause a form to submit.
shiny 0.2.4
===========
# shiny 0.2.4
* `runGist` has been updated to use the new download URLs from https://gist.github.com.
* Shiny now uses `CairoPNG()` for output, when the Cairo package is available. This provides better-looking output on Linux and Windows.
shiny 0.2.3
===========
# shiny 0.2.3
* Ignore request variables for routing purposes
shiny 0.2.2
===========
# shiny 0.2.2
* Fix CRAN warning (assigning to global environment)
shiny 0.2.1
===========
# shiny 0.2.1
* [BREAKING] Modify API of `downloadHandler`: The `content` function now takes a file path, not writable connection, as an argument. This makes it much easier to work with APIs that only write to file paths, not connections.
shiny 0.2.0
===========
# shiny 0.2.0
* Fix subtle name resolution bug--the usual symptom being S4 methods not being invoked correctly when called from inside of ui.R or server.R
shiny 0.1.14
===========
# shiny 0.1.14
* Fix slider animator, which broke in 0.1.10
shiny 0.1.13
===========
# shiny 0.1.13
* Fix temp file leak in reactivePlot
shiny 0.1.12
===========
# shiny 0.1.12
* Fix problems with runGist on Windows
@@ -1729,8 +1693,7 @@ shiny 0.1.12
* Add CSS hooks for app-wide busy indicators
shiny 0.1.11
===========
# shiny 0.1.11
* Fix input binding with IE8 on Shiny Server
@@ -1739,8 +1702,7 @@ shiny 0.1.11
* Allow dynamic sizing of reactivePlot (i.e. using a function instead of a fixed value)
shiny 0.1.10
===========
# shiny 0.1.10
* Support more MIME types when serving out of www
@@ -1753,8 +1715,7 @@ shiny 0.1.10
* Fix plot rendering with IE8 on Shiny Server
shiny 0.1.9
===========
# shiny 0.1.9
* Much less flicker when updating plots
@@ -1763,8 +1724,7 @@ shiny 0.1.9
* Add `includeText`, `includeHTML`, and `includeMarkdown` functions for putting text, HTML, and Markdown content from external files in the application's UI.
shiny 0.1.8
===========
# shiny 0.1.8
* Add `runGist` function for conveniently running a Shiny app that is published on gist.github.com.
@@ -1777,8 +1737,7 @@ shiny 0.1.8
* Add `bootstrapPage` function for creating new Bootstrap based layouts from scratch.
shiny 0.1.7
===========
# shiny 0.1.7
* Fix issue #26: Shiny.OutputBindings not correctly exported.
@@ -1787,8 +1746,7 @@ shiny 0.1.7
* Transcode JSON into UTF-8 (prevents non-ASCII reactivePrint values from causing errors on Windows).
shiny 0.1.6
===========
# shiny 0.1.6
* Import package dependencies, instead of attaching them (with the exception of websockets, which doesn't currently work unless attached).
@@ -1797,8 +1755,7 @@ shiny 0.1.6
* bindAll was not correctly sending initial values to the server; fixed.
shiny 0.1.5
===========
# shiny 0.1.5
* BREAKING CHANGE: JS APIs Shiny.bindInput and Shiny.bindOutput removed and replaced with Shiny.bindAll; Shiny.unbindInput and Shiny.unbindOutput removed and replaced with Shiny.unbindAll.
@@ -1813,8 +1770,7 @@ shiny 0.1.5
* htmlOutput (CSS class `shiny-html-output`) can contain inputs and outputs.
shiny 0.1.4
===========
# shiny 0.1.4
* Allow Bootstrap tabsets to act as reactive inputs; their value indicates which tab is active
@@ -1827,8 +1783,7 @@ shiny 0.1.4
* Add Shiny.bindInputs(scope), .unbindInputs(scope), .bindOutputs(scope), and .unbindOutputs(scope) JS API calls to allow dynamic binding/unbinding of HTML elements
shiny 0.1.3
===========
# shiny 0.1.3
* Introduce Shiny.inputBindings.register JS API and InputBinding class, for creating custom input controls
@@ -1841,7 +1796,6 @@ shiny 0.1.3
* Fix issue #10: Plots in tabsets not rendered
shiny 0.1.2
===========
# shiny 0.1.2
* Initial private beta release!

View File

@@ -25,6 +25,7 @@
#' `- tests
#' |- testthat.R
#' `- testthat
#' |- setup-shinytest2.R
#' |- test-examplemodule.R
#' |- test-server.R
#' |- test-shinytest2.R
@@ -46,6 +47,7 @@
#' `tests/testthat/` directory using the
#' [shinytest2](https://rstudio.github.io/shinytest2/reference/test_app.html)
#' package.
#' * `tests/testthat/setup-shinytest2.R` is setup file to source your `./R` folder into the testing environment.
#' * `tests/testthat/test-examplemodule.R` is a test for an application's module server function.
#' * `tests/testthat/test-server.R` is a test for the application's server code
#' * `tests/testthat/test-shinytest2.R` is a test that uses the
@@ -126,7 +128,7 @@ shinyAppTemplate <- function(path = NULL, examples = "default", dryrun = FALSE)
}
if ("tests" %in% examples) {
rlang::check_installed("shinytest2", "for {testthat} tests to work as expected")
rlang::check_installed("shinytest2", "for {testthat} tests to work as expected", version = "0.2.0")
}
# =======================================================

View File

@@ -794,7 +794,7 @@ verbatimTextOutput <- function(outputId, placeholder = FALSE) {
#' @export
imageOutput <- function(outputId, width = "100%", height="400px",
click = NULL, dblclick = NULL, hover = NULL, brush = NULL,
inline = FALSE) {
inline = FALSE, fill = FALSE) {
style <- if (!inline) {
# Using `css()` here instead of paste/sprintf so that NULL values will
@@ -850,7 +850,8 @@ imageOutput <- function(outputId, width = "100%", height="400px",
}
container <- if (inline) span else div
do.call(container, args)
res <- do.call(container, args)
bindFillRole(res, item = fill)
}
#' Create an plot or image output element
@@ -918,6 +919,11 @@ imageOutput <- function(outputId, width = "100%", height="400px",
#' `imageOutput`/`plotOutput` calls may share the same `id`
#' value; brushing one image or plot will cause any other brushes with the
#' same `id` to disappear.
#' @param fill Whether or not the returned tag should be treated as a fill item,
#' meaning that its `height` is allowed to grow/shrink to fit a fill container
#' with an opinionated height (see [htmltools::bindFillRole()]) with an
#' opinionated height. Examples of fill containers include `bslib::card()` and
#' `bslib::card_body_fill()`.
#' @inheritParams textOutput
#' @note The arguments `clickId` and `hoverId` only work for R base graphics
#' (see the \pkg{\link[graphics:graphics-package]{graphics}} package). They do
@@ -1088,11 +1094,11 @@ imageOutput <- function(outputId, width = "100%", height="400px",
#' @export
plotOutput <- function(outputId, width = "100%", height="400px",
click = NULL, dblclick = NULL, hover = NULL, brush = NULL,
inline = FALSE) {
inline = FALSE, fill = !inline) {
# Result is the same as imageOutput, except for HTML class
res <- imageOutput(outputId, width, height, click, dblclick,
hover, brush, inline)
hover, brush, inline, fill)
res$attribs$class <- "shiny-plot-output"
res
@@ -1135,15 +1141,21 @@ dataTableOutput <- function(outputId) {
#' Create an HTML output element
#'
#' Render a reactive output variable as HTML within an application page. The
#' text will be included within an HTML `div` tag, and is presumed to
#' contain HTML content which should not be escaped.
#' text will be included within an HTML `div` tag, and is presumed to contain
#' HTML content which should not be escaped.
#'
#' `uiOutput` is intended to be used with `renderUI` on the server
#' side. It is currently just an alias for `htmlOutput`.
#' `uiOutput` is intended to be used with `renderUI` on the server side. It is
#' currently just an alias for `htmlOutput`.
#'
#' @param outputId output variable to read the value from
#' @param ... Other arguments to pass to the container tag function. This is
#' useful for providing additional classes for the tag.
#' @param fill If `TRUE`, the result of `container` is treated as _both_ a fill
#' item and container (see [htmltools::bindFillRole()]), which means both the
#' `container` as well as its immediate children (i.e., the result of
#' `renderUI()`) are allowed to grow/shrink to fit a fill container with an
#' opinionated height. Set `fill = "item"` or `fill = "container"` to treat
#' `container` as just a fill item or a fill container.
#' @inheritParams textOutput
#' @return An HTML output element that can be included in a panel
#' @examples
@@ -1155,12 +1167,16 @@ dataTableOutput <- function(outputId) {
#' )
#' @export
htmlOutput <- function(outputId, inline = FALSE,
container = if (inline) span else div, ...)
container = if (inline) span else div, fill = FALSE, ...)
{
if (any_unnamed(list(...))) {
warning("Unnamed elements in ... will be replaced with dynamic UI.")
}
container(id = outputId, class="shiny-html-output", ...)
res <- container(id = outputId, class = "shiny-html-output", ...)
bindFillRole(
res, item = isTRUE(fill) || isTRUE("item" == fill),
container = isTRUE(fill) || isTRUE("container" == fill)
)
}
#' @rdname htmlOutput

View File

@@ -1,6 +1,6 @@
#' Shiny Developer Mode
#'
#' @description \lifecycle{experimental}
#' @description `r lifecycle::badge("experimental")`
#'
#' Developer Mode enables a number of [options()] to make a developer's life
#' easier, like enabling non-minified JS and printing messages about

View File

@@ -16,10 +16,4 @@
s3_register("knitr::knit_print", "reactive")
s3_register("knitr::knit_print", "shiny.appobj")
s3_register("knitr::knit_print", "shiny.render.function")
# Shiny 1.4.0 bumps jQuery 1.x to 3.x, which caused a problem
# with static-rendering of htmlwidgets, and htmlwidgets 1.5
# includes a fix for this problem
# https://github.com/rstudio/shiny/issues/2630
register_upgrade_message("htmlwidgets", 1.5)
}

View File

@@ -11,7 +11,13 @@ startPNG <- function(filename, width, height, res, ...) {
grDevices::png
}
args <- rlang::list2(filename=filename, width=width, height=height, res=res, ...)
args <- list2(filename = filename, width = width, height = height, res = res, ...)
# It's possible for width/height to be NULL/numeric(0) (e.g., when using
# suspendWhenHidden=F w/ tabsetPanel(), see rstudio/shiny#1409), so when
# this happens let the device determine what the default size should be.
if (length(args$width) == 0) args$width <- NULL
if (length(args$height) == 0) args$height <- NULL
# Set a smarter default for the device's bg argument (based on thematic's global state).
# Note that, technically, this is really only needed for CairoPNG, since the other
@@ -64,6 +70,10 @@ startPNG <- function(filename, width, height, res, ...) {
#' * Otherwise, use [grDevices::png()]. In this case, Linux and Windows
#' may not antialias some point shapes, resulting in poor quality output.
#'
#' @details
#' A `NULL` value provided to `width` or `height` is ignored (i.e., the
#' default `width` or `height` of the graphics device is used).
#'
#' @param func A function that generates a plot.
#' @param filename The name of the output file. Defaults to a temp file with
#' extension `.png`.

View File

@@ -194,8 +194,8 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
}
resizeSavedPlot <- function(name, session, result, width, height, alt, pixelratio, res, ...) {
if (result$img$width == width && result$img$height == height &&
result$pixelratio == pixelratio && result$res == res) {
if (isTRUE(result$img$width == width && result$img$height == height &&
result$pixelratio == pixelratio && result$res == res)) {
return(result)
}

View File

@@ -29,7 +29,7 @@ registerClient <- function(client) {
#' Define Server Functionality
#'
#' @description \lifecycle{superseded}
#' @description `r lifecycle::badge("superseded")`
#'
#' @description Defines the server-side logic of the Shiny application. This generally
#' involves creating functions that map user inputs to various kinds of output.

View File

@@ -148,7 +148,7 @@ shinyDependencyCSS <- function(theme) {
#' Create a Shiny UI handler
#'
#' @description \lifecycle{superseded}
#' @description `r lifecycle::badge("superseded")`
#'
#' @description Historically this function was used in ui.R files to register a user
#' interface with Shiny. It is no longer required as of Shiny 0.10; simply

View File

@@ -48,32 +48,6 @@ is_installed <- function(pkg, version = NULL) {
installed && isTRUE(get_package_version(pkg) >= version)
}
register_upgrade_message <- function(pkg, version, error = FALSE) {
msg <- sprintf(
"This version of '%s' is designed to work with '%s' >= %s.
Please upgrade via install.packages('%s').",
environmentName(environment(register_upgrade_message)),
pkg, version, pkg
)
cond <- if (error) stop else packageStartupMessage
if (pkg %in% loadedNamespaces() && !is_installed(pkg, version)) {
cond(msg)
}
# Always register hook in case pkg is loaded at some
# point the future (or, potentially, but less commonly,
# unloaded & reloaded)
setHook(
packageEvent(pkg, "onLoad"),
function(...) {
if (!is_installed(pkg, version)) cond(msg)
}
)
}
# Simplified version rlang:::s3_register() that just uses
# warning() instead of rlang::warn() when registration fails
# https://github.com/r-lib/rlang/blob/main/R/compat-s3-register.R
@@ -190,11 +164,9 @@ system_file <- function(..., package = "base") {
normalizePath(files, winslash = "/")
}
# A wrapper for `system.file()`, which caches the results, because
# `system.file()` can be slow. Note that because of caching, if
# `system_file_cached()` is called on a package that isn't installed, then the
# package is installed, and then `system_file_cached()` is called again, it will
# still return "".
# A wrapper for `system.file()`, which caches the package path because
# `system.file()` can be slow. If a package is not installed, the result won't
# be cached.
system_file_cached <- local({
pkg_dir_cache <- character()
@@ -206,7 +178,9 @@ system_file_cached <- local({
not_cached <- is.na(match(package, names(pkg_dir_cache)))
if (not_cached) {
pkg_dir <- system.file(package = package)
pkg_dir_cache[[package]] <<- pkg_dir
if (nzchar(pkg_dir)) {
pkg_dir_cache[[package]] <<- pkg_dir
}
} else {
pkg_dir <- pkg_dir_cache[[package]]
}

View File

@@ -4,7 +4,7 @@ NULL
# @staticimports pkg:staticimports
# is_installed get_package_version system_file
# s3_register register_upgrade_message
# s3_register
# any_named any_unnamed
#' Make a random number generator repeatable

View File

@@ -16,7 +16,7 @@ Easily build rich and productive interactive web apps in R &mdash; no HTML/CSS/J
* A prebuilt set of highly sophisticated, customizable, and easy-to-use widgets (e.g., plots, tables, sliders, dropdowns, date pickers, and more).
* An attractive default look based on [Bootstrap](https://getbootstrap.com/) which can also be easily customized with the [bslib](https://github.com/rstudio/bslib) package or avoided entirely with more direct R bindings to HTML/CSS/JavaScript.
* Seamless integration with [R Markdown](https://shiny.rstudio.com/articles/interactive-docs.html), making it easy to embed numerous applications natively within a larger dynamic document.
* Tools for improving and monitoring performance, including native support for [async programming](https://www.rstudio.com/blog/shiny-1-1-0/), [caching](https://talks.cpsievert.me/20201117), [load testing](https://rstudio.github.io/shinyloadtest/), and more.
* Tools for improving and monitoring performance, including native support for [async programming](https://posit.co/blog/shiny-1-1-0/), [caching](https://talks.cpsievert.me/20201117), [load testing](https://rstudio.github.io/shinyloadtest/), and more.
* [Modules](https://shiny.rstudio.com/articles/modules.html): a framework for reducing code duplication and complexity.
* An ability to [bookmark application state](https://shiny.rstudio.com/articles/bookmarking-state.html) and/or [generate code to reproduce output(s)](https://github.com/rstudio/shinymeta).
* A rich ecosystem of extension packages for more [custom widgets](http://www.htmlwidgets.org/), [input validation](https://github.com/rstudio/shinyvalidate), [unit testing](https://github.com/rstudio/shinytest), and more.

View File

@@ -0,0 +1,2 @@
# Load application support files into testing environment
shinytest2::load_app_env()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -42,7 +42,7 @@ Selectize.define("selectize-plugin-a11y", function (options) {
// random IDs are assigned when .selectize() is called, but we're
// doing it here to limit the scope of changes.
var kids = self.$dropdown_content[0].children;
for (i = 0; i < kids.length; i++) {
for (var i = 0; i < kids.length; i++) {
var attrs = kids[i].attributes;
if (!attrs.role) {
kids[i].setAttribute("role", "option");

View File

@@ -1 +1 @@
Selectize.define("selectize-plugin-a11y",function(c){var t=this,l=13;typeof t.accessibility=="undefined"&&(t.accessibility={}),t.accessibility.helpers={randomId:function(e){for(var a="",s=e||10,r="abcdefghijklmnopqrstuvwxyz0123456789",n=r.length,o=0;o<s;o++)a+=r[Math.floor(n*Math.random())];return a}},t.accessibility.liveRegion={$region:"",speak:function(e){var a=$("<div></div>");a.text(e),this.$region.html(a)},domListener:function(){var e=new MutationObserver(function(a){a.forEach(function(s){var r=$(s.target);if(r.hasClass("items"))if(r.hasClass("dropdown-active")){t.$control_input.attr("aria-expanded","true");var n=t.$dropdown_content[0].children;for(i=0;i<n.length;i++){var o=n[i].attributes;o.role||n[i].setAttribute("role","option"),o.id||n[i].setAttribute("id",t.accessibility.helpers.randomId())}}else t.$control_input.attr("aria-expanded","false"),t.$control_input.removeAttr("aria-activedescendant");else r.hasClass("active")&&r.attr("data-value")&&(t.$control_input.attr("aria-activedescendant",r.attr("id")),t.accessibility.liveRegion.speak(r.text(),500))})});e.observe(t.$dropdown[0],{attributes:!0,attributeFilter:["class"],subtree:!0,attributeOldValue:!0}),e.observe(t.$control[0],{attributes:!0,attributeFilter:["class"]}),e.observe(t.$control_input[0],{attributes:!0,attributeFilter:["value"]})},setAttributes:function(){this.$region.attr({"aria-live":"assertive",role:"log","aria-relevant":"additions","aria-atomic":"true"})},setStyles:function(){this.$region.css({position:"absolute",width:"1px",height:"1px","margin-top":"-1px",clip:"rect(1px, 1px, 1px, 1px)",overflow:"hidden"})},init:function(){this.$region=$("<div>"),this.setAttributes(),this.setStyles(),$("body").append(this.$region),this.domListener()}},this.setup=function(){var e=t.setup;return function(){e.apply(this,arguments);var a=t.accessibility.helpers.randomId(),s=t.accessibility.helpers.randomId();t.$control.on("keydown",function(r){r.keyCode===l&&(t.settings.openOnFocus?(t.settings.openOnFocus=!1,t.focus(),setTimeout(function(){t.settings.openOnFocus=!0},0)):t.focus())}),t.$control_input.attr({role:"combobox","aria-expanded":"false",haspopup:"listbox","aria-owns":s,"aria-label":t.$wrapper.closest("[data-accessibility-selectize-label]").attr("data-accessibility-selectize-label")}),t.$dropdown_content.attr({role:"listbox",id:s}),t.accessibility.liveRegion.init()}}(),this.destroy=function(){var e=t.destroy;return function(){return t.accessibility.liveRegion.$region.remove(),e.apply(this,arguments)}}()});
Selectize.define("selectize-plugin-a11y",function(c){var t=this,l=13;typeof t.accessibility=="undefined"&&(t.accessibility={}),t.accessibility.helpers={randomId:function(e){for(var r="",s=e||10,i="abcdefghijklmnopqrstuvwxyz0123456789",n=i.length,a=0;a<s;a++)r+=i[Math.floor(n*Math.random())];return r}},t.accessibility.liveRegion={$region:"",speak:function(e){var r=$("<div></div>");r.text(e),this.$region.html(r)},domListener:function(){var e=new MutationObserver(function(r){r.forEach(function(s){var i=$(s.target);if(i.hasClass("items"))if(i.hasClass("dropdown-active")){t.$control_input.attr("aria-expanded","true");for(var n=t.$dropdown_content[0].children,a=0;a<n.length;a++){var o=n[a].attributes;o.role||n[a].setAttribute("role","option"),o.id||n[a].setAttribute("id",t.accessibility.helpers.randomId())}}else t.$control_input.attr("aria-expanded","false"),t.$control_input.removeAttr("aria-activedescendant");else i.hasClass("active")&&i.attr("data-value")&&(t.$control_input.attr("aria-activedescendant",i.attr("id")),t.accessibility.liveRegion.speak(i.text(),500))})});e.observe(t.$dropdown[0],{attributes:!0,attributeFilter:["class"],subtree:!0,attributeOldValue:!0}),e.observe(t.$control[0],{attributes:!0,attributeFilter:["class"]}),e.observe(t.$control_input[0],{attributes:!0,attributeFilter:["value"]})},setAttributes:function(){this.$region.attr({"aria-live":"assertive",role:"log","aria-relevant":"additions","aria-atomic":"true"})},setStyles:function(){this.$region.css({position:"absolute",width:"1px",height:"1px","margin-top":"-1px",clip:"rect(1px, 1px, 1px, 1px)",overflow:"hidden"})},init:function(){this.$region=$("<div>"),this.setAttributes(),this.setStyles(),$("body").append(this.$region),this.domListener()}},this.setup=function(){var e=t.setup;return function(){e.apply(this,arguments);var r=t.accessibility.helpers.randomId(),s=t.accessibility.helpers.randomId();t.$control.on("keydown",function(i){i.keyCode===l&&(t.settings.openOnFocus?(t.settings.openOnFocus=!1,t.focus(),setTimeout(function(){t.settings.openOnFocus=!0},0)):t.focus())}),t.$control_input.attr({role:"combobox","aria-expanded":"false",haspopup:"listbox","aria-owns":s,"aria-label":t.$wrapper.closest("[data-accessibility-selectize-label]").attr("data-accessibility-selectize-label")}),t.$dropdown_content.attr({role:"listbox",id:s}),t.accessibility.liveRegion.init()}}(),this.destroy=function(){var e=t.destroy;return function(){return t.accessibility.liveRegion.$region.remove(),e.apply(this,arguments)}}()});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
/*! shiny 1.7.2.9000 | (c) 2012-2022 RStudio, PBC. | License: GPL-3 | file LICENSE */
#showcase-well{border-radius:0}.shiny-code{background-color:#fff;margin-bottom:0}.shiny-code code{font-family:Menlo,Consolas,"Courier New",monospace}.shiny-code-container{margin-top:20px;clear:both}.shiny-code-container h3{display:inline;margin-right:15px}.showcase-header{font-size:16px;font-weight:normal}.showcase-code-link{text-align:right;padding:15px}#showcase-app-container{vertical-align:top}#showcase-code-tabs{margin-right:15px}#showcase-code-tabs pre{border:none;line-height:1em}#showcase-code-tabs .nav{margin-bottom:0}#showcase-code-tabs ul{margin-bottom:0}#showcase-code-tabs .tab-content{border-style:solid;border-color:#e5e5e5;border-width:0px 1px 1px 1px;overflow:auto;border-bottom-right-radius:4px;border-bottom-left-radius:4px}#showcase-app-code{width:100%}#showcase-code-position-toggle{float:right}#showcase-sxs-code{padding-top:20px;vertical-align:top}.showcase-code-license{display:block;text-align:right}#showcase-code-content pre{background-color:#fff}
/*! shiny 1.7.4.1 | (c) 2012-2023 RStudio, PBC. | License: GPL-3 | file LICENSE */
#showcase-well{border-radius:0}.shiny-code{background-color:#fff;margin-bottom:0}.shiny-code code{font-family:Menlo,Consolas,Courier New,monospace}.shiny-code-container{margin-top:20px;clear:both}.shiny-code-container h3{display:inline;margin-right:15px}.showcase-header{font-size:16px;font-weight:400}.showcase-code-link{text-align:right;padding:15px}#showcase-app-container{vertical-align:top}#showcase-code-tabs{margin-right:15px}#showcase-code-tabs pre{border:none;line-height:1em}#showcase-code-tabs .nav,#showcase-code-tabs ul{margin-bottom:0}#showcase-code-tabs .tab-content{border-style:solid;border-color:#e5e5e5;border-width:0px 1px 1px 1px;overflow:auto;border-bottom-right-radius:4px;border-bottom-left-radius:4px}#showcase-app-code{width:100%}#showcase-code-position-toggle{float:right}#showcase-sxs-code{padding-top:20px;vertical-align:top}.showcase-code-license{display:block;text-align:right}#showcase-code-content pre{background-color:#fff}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
/*! shiny 1.7.2.9000 | (c) 2012-2022 RStudio, PBC. | License: GPL-3 | file LICENSE */
(function(){var a=eval;window.addEventListener("message",function(i){var e=i.data;e.code&&a(e.code)});})();
/*! shiny 1.7.4.1 | (c) 2012-2023 RStudio, PBC. | License: GPL-3 | file LICENSE */
"use strict";(function(){var a=eval;window.addEventListener("message",function(i){var e=i.data;e.code&&a(e.code)});})();
//# sourceMappingURL=shiny-testmode.js.map

View File

@@ -2,6 +2,6 @@
"version": 3,
"sources": ["../../../srcts/src/utils/eval.ts", "../../../srcts/extras/shiny-testmode.ts"],
"sourcesContent": ["//esbuild.github.io/content-types/#direct-eval\n//tl/dr;\n// * Direct usage of `eval(\"x\")` is bad with bundled code.\n// * Instead, use indirect calls to `eval` such as `indirectEval(\"x\")`\n// * Even just renaming the function works well enough.\n// > This is known as \"indirect eval\" because eval is not being called directly, and so does not trigger the grammatical special case for direct eval in the JavaScript VM. You can call indirect eval using any syntax at all except for an expression of the exact form eval('x'). For example, var eval2 = eval; eval2('x') and [eval][0]('x') and window.eval('x') are all indirect eval calls.\n// > When you use indirect eval, the code is evaluated in the global scope instead of in the inline scope of the caller.\nvar indirectEval = eval;\nexport { indirectEval };", "/* eslint-disable unicorn/filename-case */\nimport { indirectEval } from \"../src/utils/eval\"; // Listen for messages from parent frame. This file is only added when the\n// shiny.testmode option is TRUE.\n\nwindow.addEventListener(\"message\", function (e) {\n var message = e.data;\n if (message.code) indirectEval(message.code);\n});"],
"mappings": ";YAOA,GAAI,GAAe,KCHnB,OAAO,iBAAiB,UAAW,SAAU,EAAG,CAC9C,GAAI,GAAU,EAAE,KAChB,AAAI,EAAQ,MAAM,EAAa,EAAQ",
"names": []
"mappings": ";yBAOA,IAAIA,EAAe,KCHnB,OAAO,iBAAiB,UAAW,SAAUC,EAAG,CAC9C,IAAIC,EAAUD,EAAE,KACZC,EAAQ,MAAMC,EAAaD,EAAQ,IAAI,CAC7C,CAAC",
"names": ["indirectEval", "e", "message", "indirectEval"]
}

File diff suppressed because it is too large Load Diff

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

File diff suppressed because one or more lines are too long

View File

@@ -71,7 +71,7 @@ registered \code{devmode_default} value will be used.}
\code{TRUE} and the specified option is not set in \code{\link[=options]{options()}}.}
}
\description{
\lifecycle{experimental}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
Developer Mode enables a number of \code{\link[=options]{options()}} to make a developer's life
easier, like enabling non-minified JS and printing messages about

View File

@@ -9,10 +9,17 @@ htmlOutput(
outputId,
inline = FALSE,
container = if (inline) span else div,
fill = FALSE,
...
)
uiOutput(outputId, inline = FALSE, container = if (inline) span else div, ...)
uiOutput(
outputId,
inline = FALSE,
container = if (inline) span else div,
fill = FALSE,
...
)
}
\arguments{
\item{outputId}{output variable to read the value from}
@@ -22,6 +29,13 @@ for the output}
\item{container}{a function to generate an HTML element to contain the text}
\item{fill}{If \code{TRUE}, the result of \code{container} is treated as \emph{both} a fill
item and container (see \code{\link[htmltools:bindFillRole]{htmltools::bindFillRole()}}), which means both the
\code{container} as well as its immediate children (i.e., the result of
\code{renderUI()}) are allowed to grow/shrink to fit a fill container with an
opinionated height. Set \code{fill = "item"} or \code{fill = "container"} to treat
\code{container} as just a fill item or a fill container.}
\item{...}{Other arguments to pass to the container tag function. This is
useful for providing additional classes for the tag.}
}
@@ -30,12 +44,12 @@ An HTML output element that can be included in a panel
}
\description{
Render a reactive output variable as HTML within an application page. The
text will be included within an HTML \code{div} tag, and is presumed to
contain HTML content which should not be escaped.
text will be included within an HTML \code{div} tag, and is presumed to contain
HTML content which should not be escaped.
}
\details{
\code{uiOutput} is intended to be used with \code{renderUI} on the server
side. It is currently just an alias for \code{htmlOutput}.
\code{uiOutput} is intended to be used with \code{renderUI} on the server side. It is
currently just an alias for \code{htmlOutput}.
}
\examples{
htmlOutput("summary")

View File

@@ -17,7 +17,7 @@ memoryCache(
\arguments{
\item{max_size}{Maximum size of the cache, in bytes. If the cache exceeds
this size, cached objects will be removed according to the value of the
\code{evict}. Use \code{Inf} for no size limit. The default is 1 gigabyte.}
\code{evict}. Use \code{Inf} for no size limit. The default is 512 megabytes.}
\item{max_age}{Maximum age of files in cache before they are evicted, in
seconds. Use \code{Inf} for no age limit.}

View File

@@ -13,7 +13,8 @@ imageOutput(
dblclick = NULL,
hover = NULL,
brush = NULL,
inline = FALSE
inline = FALSE,
fill = FALSE
)
plotOutput(
@@ -24,7 +25,8 @@ plotOutput(
dblclick = NULL,
hover = NULL,
brush = NULL,
inline = FALSE
inline = FALSE,
fill = !inline
)
}
\arguments{
@@ -76,6 +78,12 @@ same \code{id} to disappear.}
\item{inline}{use an inline (\code{span()}) or block container (\code{div()})
for the output}
\item{fill}{Whether or not the returned tag should be treated as a fill item,
meaning that its \code{height} is allowed to grow/shrink to fit a fill container
with an opinionated height (see \code{\link[htmltools:bindFillRole]{htmltools::bindFillRole()}}) with an
opinionated height. Examples of fill containers include \code{bslib::card()} and
\code{bslib::card_body_fill()}.}
}
\value{
A plot or image output element that can be included in a panel.

View File

@@ -46,3 +46,7 @@ is not set to \code{FALSE}), then use \code{\link[Cairo:Cairo]{Cairo::CairoPNG()
may not antialias some point shapes, resulting in poor quality output.
}
}
\details{
A \code{NULL} value provided to \code{width} or \code{height} is ignored (i.e., the
default \code{width} or \code{height} of the graphics device is used).
}

View File

@@ -45,6 +45,7 @@ following files and directories is created:
`- tests
|- testthat.R
`- testthat
|- setup-shinytest2.R
|- test-examplemodule.R
|- test-server.R
|- test-shinytest2.R
@@ -67,6 +68,7 @@ choose to use or remove any of them. They can be executed by the
\verb{tests/testthat/} directory using the
\href{https://rstudio.github.io/shinytest2/reference/test_app.html}{shinytest2}
package.
\item \code{tests/testthat/setup-shinytest2.R} is setup file to source your \code{./R} folder into the testing environment.
\item \code{tests/testthat/test-examplemodule.R} is a test for an application's module server function.
\item \code{tests/testthat/test-server.R} is a test for the application's server code
\item \code{tests/testthat/test-shinytest2.R} is a test that uses the

View File

@@ -11,7 +11,7 @@ shinyServer(func)
for more information.}
}
\description{
\lifecycle{superseded}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}
Defines the server-side logic of the Shiny application. This generally
involves creating functions that map user inputs to various kinds of output.

View File

@@ -13,7 +13,7 @@ shinyUI(ui)
The user interface definition, without modifications or side effects.
}
\description{
\lifecycle{superseded}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}
Historically this function was used in ui.R files to register a user
interface with Shiny. It is no longer required as of Shiny 0.10; simply

View File

@@ -3,7 +3,7 @@
"homepage": "https://shiny.rstudio.com",
"repository": "github:rstudio/shiny",
"name": "@types/rstudio-shiny",
"version": "1.7.2-alpha.9000",
"version": "1.7.4-alpha.1",
"license": "GPL-3.0-only",
"main": "",
"browser": "",
@@ -23,7 +23,7 @@
"@types/bootstrap-datepicker": "0.0.14",
"@types/datatables.net": "^1.10.19",
"@types/ion-rangeslider": "2.3.0",
"@types/jquery": "patch:@types/jquery@3.5.5#./srcts/patch/types-jquery.patch",
"@types/jquery": "3.5.14",
"@types/selectize": "0.12.34"
},
"devDependencies": {
@@ -59,6 +59,7 @@
"eslint-plugin-jest-dom": "^4.0.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unicorn": "^43.0.2",
"fs-readdir-recursive": "^1.1.0",
"ion-rangeslider": "2.3.1",
"jest": "^26.6.3",
"jquery": "3.6.0",

97
srcts/build/_jquery.ts Normal file
View File

@@ -0,0 +1,97 @@
/*
Make sure all `*.ts` files contain `"jquery"` import statements to properly scope `jquery`.
Prior behavior:
- Use a patch file to remove globally declared `$` variable
- PR: https://github.com/rstudio/shiny/pull/3296/commits/169318382d1d00927d0148a16fde4c96a291a602
Prior reasoning:
- Only allow for jQuery type definitions to exist if imported.
- This is problematic as it can lead to improperly scoped values of `$`
- Ex:
* If `a.ts` imports jquery, then `b.ts` can see the global definition of `$`
even though `b.ts` does not import jquery.
* If `$` is not scoped / encapsulated, then it is possible to have
inconsistent versions of jquery executing within the shiny bundle.
Related:
- Open Issue ('16): https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11187
- Closed stale PR ('19): https://github.com/DefinitelyTyped/DefinitelyTyped/pull/40295/files
- Unsolved Issue ('14): https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1564
- Multiple `$` conflicts ('22): https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/60443
- Bandaid PR ('22): https://github.com/DefinitelyTyped/DefinitelyTyped/pull/60444
Approach within this file:
* For every `*.ts` file:
* Do not use `jQuery` (use `$`!)
* If utilizing `$`
* Require `jquery` import statement
- Advantages:
- Does not require a yarn patch file or separate GitHub repo containing the patched type definitions.
- Disadvantages:
- Variable reassignment isn't caught `jq = $; jq(divs)`. (This should not happen, but it is possible.)
- Only tested when bundling is started, not on every file change.
- PR: https://github.com/rstudio/shiny/pull/3710
*/
import fs from "fs";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore; Type definitions are not found
import readdirRecursive from "fs-readdir-recursive";
import { isUndefined } from "lodash";
const verifyJqueryUsage = async function (filename: string): Promise<void> {
const contents = await fs.promises.readFile(filename, "utf8");
const lines = contents.toString().split("\n");
// Find if using `jQuery` in the file
const jqueryMatch = lines.find((line) => {
return line.includes("jQuery.") || line.includes("jQuery(");
});
if (!isUndefined(jqueryMatch)) {
throw (
`Using \`jQuery\` in file: ${filename}\n` +
`Match:\n${jqueryMatch}\n` +
"Please use `$` instead of `jQuery`\n" +
"See file ./srcts/build/_jquery.ts for more details"
);
}
// Find if using `$` in the file
const dollarMatch = lines.find((line) => {
return line.includes("$.") || line.includes("$(");
});
if (isUndefined(dollarMatch)) {
// No match found. Not using jquery
return;
}
// Using jquery, find that it is being imported
const importJquery = 'import $ from "jquery";';
const hasJqueryImport = lines.includes(importJquery);
if (!hasJqueryImport) {
// Not importing jquery, yell
throw (
`Using \`$\` in file: ${filename}\n` +
`Match:\n${dollarMatch}\n` +
`Please call \`${importJquery}\` at the top of the file.\n` +
"See file ./srcts/build/_jquery.ts for more details"
);
}
// Using jquery and importing it;
return;
};
const verifyJqueryImport = async function (dir = "."): Promise<void> {
const tsFiles = (readdirRecursive(dir) as string[])
.filter((path: string) => path.endsWith(".ts"))
.map((path) => dir + "/" + path);
// Run all checks in parallel
await Promise.all(tsFiles.map((file) => verifyJqueryUsage(file)));
return;
};
export { verifyJqueryImport };

View File

@@ -10,6 +10,12 @@ import globalsPlugin from "esbuild-plugin-globals";
const opts = {
bundle: false,
sourcemap: false,
// Oddly, esbuild seems to use the top-level tsconfig.json file even when just
// minifying JS to JS. Because that tsconfig file has "strict":true, esbuild
// ends up adding "use strict" to the top of each minified JS file, which can
// alter behavior. To avoid this, we have a separate tsconfig file with
// "alwaysStrict":false.
tsconfig: "srcts/build/external_libs_tsconfig.json",
};
readdir(outDir + "datepicker/js/locales/").then(async (localeFiles) => {

View File

@@ -0,0 +1,6 @@
{
"compilerOptions": {
"target": "ES5",
"alwaysStrict": false
}
}

View File

@@ -6,6 +6,7 @@
import { banner, build, outDir, shinyDesc, babelPlugin } from "./_build";
import globalsPlugin from "esbuild-plugin-globals";
import type { BuildOptions } from "esbuild";
import { verifyJqueryImport } from "./_jquery";
const opts: BuildOptions = {
entryPoints: ["srcts/src/index.ts"],
@@ -26,12 +27,21 @@ const opts: BuildOptions = {
banner: banner,
};
build({
...opts,
outfile: outDir + "shiny.js",
});
build({
...opts,
outfile: outDir + "shiny.min.js",
minify: true,
});
// Make sure all ts files contain jquery import statements before building
verifyJqueryImport("srcts/src")
.then(() => {
Promise.all([
build({
...opts,
outfile: outDir + "shiny.js",
}),
build({
...opts,
outfile: outDir + "shiny.min.js",
minify: true,
}),
]);
})
.catch((err) => {
console.error("Error:\n" + err);
});

View File

@@ -1,7 +1,5 @@
# `yarn` Patch files
* `types-jquery.patch`
* Do not export `$` as a globally available variable. When developing TS code, I like to have full control over the variables. It is good to have a record of where everything comes from. Shiny can not use the latest jQuery loaded onto the page and needs to use a scoped `jQuery` variable. In the end, we can shim the `jquery` import to be `window.jQuery`
* `yarn_pnp.patch`
* This file is currently not used and is outdated.
* This provides a good game plan on how to use PnP with Yarn once esbuild can easily be integrated with Yarn PnP.

View File

@@ -1,21 +0,0 @@
diff --git a/misc.d.ts b/misc.d.ts
index 126d374477db459e1a251f5af548e88b46f43cdd..948cfb287b0bfa6057f3ccbcd013579aef07a29a 100644
--- a/misc.d.ts
+++ b/misc.d.ts
@@ -6618,7 +6618,7 @@ $( "#checkMetaKey" ).click(function( event ) {
}
declare const jQuery: JQueryStatic;
-declare const $: JQueryStatic;
+// declare const $: JQueryStatic;
type _Event = Event;
type _UIEvent = UIEvent;
@@ -6643,6 +6643,6 @@ interface SymbolConstructor {
readonly toStringTag: symbol;
}
-declare var Symbol: SymbolConstructor;
+// declare var Symbol: SymbolConstructor;
// #endregion

View File

@@ -71,7 +71,7 @@ class SelectInputBinding extends InputBinding {
} else {
const selectize = this._selectize(el);
selectize.setValue(value);
selectize?.setValue(value);
}
}
getState(el: SelectHTMLElement): {
@@ -107,10 +107,10 @@ class SelectInputBinding extends InputBinding {
// This will replace all the options
if (hasDefinedProperty(data, "options")) {
const selectize = this._selectize(el);
// Must destroy selectize before appending new options, otherwise
// selectize will restore the original select
if (selectize) selectize.destroy();
selectize?.destroy();
// Clear existing options and add each new one
$el.empty().append(data.options);
this._selectize(el);
@@ -176,9 +176,7 @@ class SelectInputBinding extends InputBinding {
callback(res);
if (!loaded) {
if (hasDefinedProperty(data, "value")) {
if (typeof data.value === "string") {
selectize.setValue(data.value);
}
selectize.setValue(data.value as any);
} else if (settings.maxItems === 1) {
// first item selected by default only for single-select
selectize.setValue(res[0].value);
@@ -221,15 +219,19 @@ class SelectInputBinding extends InputBinding {
initialize(el: SelectHTMLElement): void {
this._selectize(el);
}
protected _selectize(el: SelectHTMLElement, update = false): SelectizeInfo {
if (!$.fn.selectize) throw "selectize jquery is not defined";
protected _selectize(
el: SelectHTMLElement,
update = false
): SelectizeInfo | undefined {
// Apps like 008-html do not have the selectize js library
// Safe-guard against missing the selectize js library
if (!$.fn.selectize) return undefined;
const $el = $(el);
const config = $el
.parent()
.find('script[data-for="' + $escape(el.id) + '"]');
if (config.length === 0)
throw "No config found for selectize with id:" + $escape(el.id);
if (config.length === 0) return undefined;
let options: SelectizeOptions & {
labelField: "label";

View File

@@ -24,7 +24,7 @@ $(document).on(
function (e: Event) {
e;
const evt: FileDownloadEvent = jQuery.Event("shiny:filedownload");
const evt: FileDownloadEvent = $.Event("shiny:filedownload");
evt.name = this.id;
evt.href = this.href;

View File

@@ -220,11 +220,9 @@ function createBrush(
// div being resized.
function onResize() {
const boundsDataVal = boundsData();
// Check to see if we have valid boundsData
for (const val in Object.values(boundsDataVal)) {
if (isnan(val)) return;
}
// Check to see if we have valid boundsData
if (Object.values(boundsDataVal).some(isnan)) return;
boundsData(boundsDataVal);
updateDiv();

View File

@@ -11,7 +11,7 @@ class InputEventDecorator implements InputPolicy {
}
setInput(nameType: string, value: unknown, opts: InputPolicyOpts): void {
const evt = jQuery.Event("shiny:inputchanged") as ShinyEventInputChanged;
const evt = $.Event("shiny:inputchanged") as ShinyEventInputChanged;
const input = splitInputNameType(nameType);

View File

@@ -154,12 +154,12 @@ function initShiny(windowShiny: Shiny): void {
// in case it is auto-sizing
$(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(
function () {
const id = getIdFromEl(this);
const id = getIdFromEl(this),
rect = this.getBoundingClientRect();
if (this.offsetWidth !== 0 || this.offsetHeight !== 0) {
initialValues[".clientdata_output_" + id + "_width"] = this.offsetWidth;
initialValues[".clientdata_output_" + id + "_height"] =
this.offsetHeight;
if (rect.width !== 0 || rect.height !== 0) {
initialValues[".clientdata_output_" + id + "_width"] = rect.width;
initialValues[".clientdata_output_" + id + "_height"] = rect.height;
}
}
);
@@ -275,17 +275,12 @@ function initShiny(windowShiny: Shiny): void {
function doSendImageSize() {
$(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(
function () {
const id = getIdFromEl(this);
const id = getIdFromEl(this),
rect = this.getBoundingClientRect();
if (this.offsetWidth !== 0 || this.offsetHeight !== 0) {
inputs.setInput(
".clientdata_output_" + id + "_width",
this.offsetWidth
);
inputs.setInput(
".clientdata_output_" + id + "_height",
this.offsetHeight
);
if (rect.width !== 0 || rect.height !== 0) {
inputs.setInput(".clientdata_output_" + id + "_width", rect.width);
inputs.setInput(".clientdata_output_" + id + "_height", rect.height);
}
}
);

View File

@@ -43,6 +43,8 @@ type OnSuccessRequest = (value: ResponseValue) => void;
type OnErrorRequest = (err: string) => void;
type InputValues = { [key: string]: unknown };
type MessageValue = Parameters<WebSocket["send"]>[0];
//// 2021/03 - TypeScript conversion note:
// These four variables were moved from being internally defined to being defined globally within the file.
// Before the TypeScript conversion, the values where attached to `window.Shiny.addCustomMessageHandler()`.
@@ -127,7 +129,7 @@ class ShinyApp {
// Conditional bindings (show/hide element based on expression)
$conditionals = {};
$pendingMessages: string[] = [];
$pendingMessages: MessageValue[] = [];
$activeRequests: {
[key: number]: { onSuccess: OnSuccessRequest; onError: OnErrorRequest };
} = {};
@@ -381,7 +383,7 @@ class ShinyApp {
onError: onError,
};
let msg = JSON.stringify({
let msg: Blob | string = JSON.stringify({
method: method,
args: args,
tag: requestId,
@@ -423,13 +425,13 @@ class ShinyApp {
const blob: Blob = new Blob(payload);
msg = blob as unknown as string;
msg = blob;
}
this.$sendMsg(msg);
}
$sendMsg(msg: string): void {
$sendMsg(msg: MessageValue): void {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (!this.$socket!.readyState) {
this.$pendingMessages.push(msg);
@@ -446,7 +448,7 @@ class ShinyApp {
delete this.$values[name];
const binding = this.$bindings[name];
const evt: ShinyEventError = jQuery.Event("shiny:error");
const evt: ShinyEventError = $.Event("shiny:error");
evt.name = name;
evt.error = error;
@@ -459,7 +461,7 @@ class ShinyApp {
receiveOutput<T>(name: string, value: T): T | undefined {
const binding = this.$bindings[name];
const evt: ShinyEventValue = jQuery.Event("shiny:value");
const evt: ShinyEventValue = $.Event("shiny:value");
evt.name = name;
evt.value = value;
@@ -618,7 +620,7 @@ class ShinyApp {
msgObj.custom[type] = data;
}
const evt: ShinyEventMessage = jQuery.Event("shiny:message");
const evt: ShinyEventMessage = $.Event("shiny:message");
evt.message = msgObj;
$(document).trigger(evt);
@@ -698,8 +700,7 @@ class ShinyApp {
if ($obj.length > 0) {
if (!$obj.attr("aria-live")) $obj.attr("aria-live", "polite");
const el = $obj[0];
const evt: ShinyEventUpdateInput =
jQuery.Event("shiny:updateinput");
const evt: ShinyEventUpdateInput = $.Event("shiny:updateinput");
evt.message = message[i].message;
evt.binding = inputBinding;
@@ -876,7 +877,7 @@ class ShinyApp {
message.selector +
'") could not be found in the DOM.'
);
renderHtml(message.content.html, $([]).get(0), message.content.deps);
renderHtml(message.content.html, $([]), message.content.deps);
} else {
targets.each(function (i, target) {
renderContent(target, message.content, message.where);
@@ -1202,7 +1203,7 @@ class ShinyApp {
// value for the tabset gets updated (i.e. input$tabsetId
// should be null if there are no tabs).
const destTabValue = getFirstTab($tabset);
const evt: ShinyEventUpdateInput = jQuery.Event("shiny:updateinput");
const evt: ShinyEventUpdateInput = $.Event("shiny:updateinput");
evt.binding = inputBinding;
$tabset.trigger(evt);

View File

@@ -66,7 +66,7 @@ function registerNames(s: string[] | string): void {
// Inserts new content into document head
function addToHead(head: string) {
if (head.length > 0) {
const tempDiv = $("<div>" + head + "</div>").get(0);
const tempDiv = $("<div>" + head + "</div>").get(0) as HTMLDivElement;
const $head = $("head");
while (tempDiv.hasChildNodes()) {

View File

@@ -125,7 +125,8 @@ function makeResizeFilter(
let lastSize: LastSizeInterface = {};
return function () {
const size = { w: el.offsetWidth, h: el.offsetHeight };
const rect = el.getBoundingClientRect();
const size = { w: rect.width, h: rect.height };
if (size.w === 0 && size.h === 0) return;
if (size.w === lastSize.w && size.h === lastSize.h) return;

View File

@@ -33,7 +33,7 @@ declare class SelectInputBinding extends InputBinding {
subscribe(el: SelectHTMLElement, callback: (x: boolean) => void): void;
unsubscribe(el: HTMLElement): void;
initialize(el: SelectHTMLElement): void;
protected _selectize(el: SelectHTMLElement, update?: boolean): SelectizeInfo;
protected _selectize(el: SelectHTMLElement, update?: boolean): SelectizeInfo | undefined;
}
export { SelectInputBinding };
export type { SelectInputReceiveMessageData };

View File

@@ -15,6 +15,7 @@ declare type OnErrorRequest = (err: string) => void;
declare type InputValues = {
[key: string]: unknown;
};
declare type MessageValue = Parameters<WebSocket["send"]>[0];
declare function addCustomMessageHandler(type: string, handler: Handler): void;
declare class ShinyApp {
$socket: ShinyWebSocket | null;
@@ -34,7 +35,7 @@ declare class ShinyApp {
[key: string]: ErrorsMessageValue;
};
$conditionals: {};
$pendingMessages: string[];
$pendingMessages: MessageValue[];
$activeRequests: {
[key: number]: {
onSuccess: OnSuccessRequest;
@@ -60,7 +61,7 @@ declare class ShinyApp {
onDisconnected(): void;
onConnected(): void;
makeRequest(method: string, args: unknown[], onSuccess: OnSuccessRequest, onError: OnErrorRequest, blobs: Array<ArrayBuffer | Blob | string> | undefined): void;
$sendMsg(msg: string): void;
$sendMsg(msg: MessageValue): void;
receiveError(name: string, error: ErrorsMessageValue): void;
receiveOutput<T>(name: string, value: T): T | undefined;
bindOutput(id: string, binding: OutputBindingAdapter): OutputBindingAdapter;

View File

@@ -1,5 +0,0 @@
declare type BlobBuilderConstructor = typeof window.MSBlobBuilder;
declare function setBlobBuilder(blobBuilderClass_: BlobBuilderConstructor): void;
declare function makeBlob(parts: BlobPart[]): Blob;
export { makeBlob, setBlobBuilder };
export type { BlobBuilderConstructor };

View File

@@ -1,3 +0,0 @@
import type { BlobBuilderConstructor } from "../utils/blob";
declare function windowBlobBuilder(): BlobBuilderConstructor;
export { windowBlobBuilder };

View File

@@ -1,54 +0,0 @@
# app template works with runTests: all
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-all/tests/testthat.R
# app template works with runTests: app_tests
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-app_tests/tests/testthat.R
# app template works with runTests: app_module_tests
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-app_module_tests/tests/testthat.R
# app template works with runTests: app_rdir_tests
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-app_rdir_tests/tests/testthat.R
# app template works with runTests: app_module_rdir_tests
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-app_module_rdir_tests/tests/testthat.R
# app template works with runTests: app_shinytest_testthat
Code
out
Output
Shiny App Test Results
* Success
- shinyAppTemplate-app_shinytest_testthat/tests/testthat.R

View File

@@ -50,7 +50,7 @@ test_that("Repeated names for selectInput and radioButtons choices", {
choices <- x$children
expect_equal(choices[[2]]$children[[1]][[1]]$children[[1]]$children[[2]]$children[[1]],
HTML('<i class="fa fa-calendar" role="presentation" aria-label="calendar icon"></i>'))
HTML('<i class="far fa-calendar" role="presentation" aria-label="calendar icon"></i>'))
expect_equal(choices[[2]]$children[[1]][[1]]$children[[1]]$children[[1]]$attribs$value, 'icon')
expect_equal(choices[[2]]$children[[1]][[1]]$children[[1]]$children[[1]]$attribs$checked, 'checked')

View File

@@ -0,0 +1,6 @@
test_that("plotPNG()/startPNG() ignores NULL dimensions", {
f <- plotPNG(function() plot(1), width = NULL, height = NULL)
on.exit(unlink(f))
bits <- readBin(f, "raw", file.info(f)$size)
expect_true(length(bits) > 0)
})

View File

@@ -413,11 +413,11 @@ test_that("captures ggplot2 outputs", {
server <- function(input, output, session){
output$fixed <- renderPlot({
ggplot2::qplot(iris$Sepal.Length, iris$Sepal.Width)
withr::with_namespace("ggplot2", { ggplot(iris) + geom_point(aes(Sepal.Length, Sepal.Width)) })
}, width=300, height=350)
output$dynamic <- renderPlot({
ggplot2::qplot(iris$Sepal.Length, iris$Sepal.Width)
withr::with_namespace("ggplot2", { ggplot(iris) + geom_point(aes(Sepal.Length, Sepal.Width)) })
})
}

View File

@@ -1,5 +1,6 @@
# testthat::skip_on_cran()
suppressWarnings(testthat::skip_if_not_installed("shinytest2"))
testthat::skip("Refactor test for next release")
# test all combos
make_combos <- function(...) {

View File

@@ -11,7 +11,7 @@ index e3cd799e..1d494f88 100644
+ // random IDs are assigned when .selectize() is called, but we're
+ // doing it here to limit the scope of changes.
+ var kids = self.$dropdown_content[0].children;
+ for (i = 0; i < kids.length; i++) {
+ for (var i = 0; i < kids.length; i++) {
+ var attrs = kids[i].attributes;
+ if (!attrs.role) {
+ kids[i].setAttribute("role", "option");

View File

@@ -1,7 +1,7 @@
library(magrittr)
version <- "3.6.0"
version_types <- "3.5.5"
version_types <- "3.5.14"
jq_cdn_download <- function(version) {
Map(
@@ -58,7 +58,7 @@ withr::with_dir(
exit_code <- system(paste0("yarn add --dev jquery@", version))
if (exit_code != 0) stop("yarn could not install jquery")
exit_code <- system(paste0("yarn add @types/jquery@patch:@types/jquery@", version_types, "#./srcts/patch/types-jquery.patch"))
exit_code <- system(paste0("yarn add @types/jquery@", version_types))
if (exit_code != 0) stop("yarn could not install @types/jquery")
}
)

View File

@@ -1918,7 +1918,7 @@ __metadata:
languageName: node
linkType: hard
"@types/jquery@3.5.5, @types/jquery@npm:*":
"@types/jquery@npm:*":
version: 3.5.5
resolution: "@types/jquery@npm:3.5.5"
dependencies:
@@ -1927,12 +1927,12 @@ __metadata:
languageName: node
linkType: hard
"@types/jquery@patch:@types/jquery@3.5.5#./srcts/patch/types-jquery.patch::locator=%40types%2Frstudio-shiny%40workspace%3A.":
version: 3.5.5
resolution: "@types/jquery@patch:@types/jquery@npm%3A3.5.5#./srcts/patch/types-jquery.patch::version=3.5.5&hash=a7a8f9&locator=%40types%2Frstudio-shiny%40workspace%3A."
"@types/jquery@npm:3.5.14":
version: 3.5.14
resolution: "@types/jquery@npm:3.5.14"
dependencies:
"@types/sizzle": "*"
checksum: aa4ba94f98a085ae77b8717a6ce81a05d7647f0df5f87f160c21e7772d60f7ed20ba951886e36fe8d0205882dfc62107b722df4d638ae6d3b4af9bfed227e289
checksum: 159d6f804ed1a204b3f79f2d591a271d82e866bd45bd49fb6ef40561a25dbe0f47ec7815681b44cc2db5598425f72811e7e80ab0e983d980470998ac56feb375
languageName: node
linkType: hard
@@ -1999,7 +1999,7 @@ __metadata:
"@types/highlightjs": ^9.12.1
"@types/ion-rangeslider": 2.3.0
"@types/jest": ^26.0.23
"@types/jquery": "patch:@types/jquery@3.5.5#./srcts/patch/types-jquery.patch"
"@types/jquery": 3.5.14
"@types/jqueryui": 1.12.16
"@types/lodash": ^4.14.170
"@types/node": ^15.6.1
@@ -2022,6 +2022,7 @@ __metadata:
eslint-plugin-jest-dom: ^4.0.2
eslint-plugin-prettier: ^4.2.1
eslint-plugin-unicorn: ^43.0.2
fs-readdir-recursive: ^1.1.0
ion-rangeslider: 2.3.1
jest: ^26.6.3
jquery: 3.6.0
@@ -4899,6 +4900,13 @@ __metadata:
languageName: node
linkType: hard
"fs-readdir-recursive@npm:^1.1.0":
version: 1.1.0
resolution: "fs-readdir-recursive@npm:1.1.0"
checksum: 29d50f3d2128391c7fc9fd051c8b7ea45bcc8aa84daf31ef52b17218e20bfd2bd34d02382742801954cc8d1905832b68227f6b680a666ce525d8b6b75068ad1e
languageName: node
linkType: hard
"fs.realpath@npm:^1.0.0":
version: 1.0.0
resolution: "fs.realpath@npm:1.0.0"