Compare commits

...

43 Commits

Author SHA1 Message Date
Carson
4d276b307e Change header syntax in NEWS.md (to match what usethis does) 2022-12-08 14:38:53 -06:00
Carson
58c99bcd8c Remote remotes (htmltools is now in CRAN) 2022-12-08 14:38:53 -06:00
cpsievert
451e69b54e Sync package version (GitHub Actions) 2022-12-08 14:38:53 -06:00
cpsievert
5d25afed5d yarn build (GitHub Actions) 2022-12-08 14:38:52 -06:00
Carson
ec5a221cd2 Clean up news 2022-12-08 14:37:28 -06:00
Carson
f4febeab16 Get rid of warnings about qplot() usage in tests 2022-12-08 14:37:28 -06:00
Carson
b57dc0144d Start release candidate 2022-12-08 14:37:28 -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
Winston Chang
98f17e0cd2 Disable eslint rules only within scope 2022-10-03 11:41:28 -05:00
Winston Chang
9b2c04f298 Remove redundant setting 2022-09-30 19:57:03 -05:00
Winston Chang
ed4a97154d Remove makeBlob
Blob has long been available on all major browsers, so makeBlob is no longer needed.
2022-09-30 16:29:38 -05:00
Winston Chang
9dcd62f944 Update eslint 2022-09-30 16:17:19 -05:00
Winston Chang
213c645524 Upgrade esbuild and typescript 2022-09-30 15:59:24 -05:00
Winston Chang
f1c0ac2b30 Upgrade to yarn 3.2.3 2022-09-30 15:57:51 -05:00
Barret Schloerke
16c6d55f60 Enable TypeScript strict mode (#3644) 2022-09-29 16:03:05 -04:00
Hedley
6e40a3dd39 Update jQuery-UI to 1.13.2 (#3697) 2022-09-21 10:34:51 -04:00
Joe Cheng
04ad1453c1 Merge pull request #3694 from rstudio/rook-doc-link
Add link to Rook spec from docs
2022-09-07 17:38:36 -07:00
jcheng5
80eeff68ab Sync package version (GitHub Actions) 2022-09-07 14:27:51 -07:00
jcheng5
6128a3ab65 yarn build (GitHub Actions) 2022-09-07 20:43:50 +00:00
Joe Cheng
5f25537079 Add link to Rook spec from docs 2022-09-07 13:37:37 -07:00
Winston Chang
c21ba0baca Bump version to 1.7.2.9000 2022-07-19 09:18:16 -05:00
Winston Chang
ebf786c2eb Merge tag 'v1.7.2'
Shiny 1.7.2 on CRAN
2022-07-19 09:16:45 -05:00
163 changed files with 6345 additions and 4203 deletions

View File

@@ -6,7 +6,6 @@ extends:
- 'eslint:recommended'
- 'plugin:@typescript-eslint/recommended'
- 'plugin:jest/recommended'
- 'prettier/@typescript-eslint'
- 'plugin:prettier/recommended'
- 'plugin:jest-dom/recommended'
globals:
@@ -45,9 +44,6 @@ rules:
semi:
- error
- always
newline-after-var:
- error
- always
dot-location:
- error
- property
@@ -64,6 +60,7 @@ rules:
- error
- default: array-simple
readonly: array-simple
"@typescript-eslint/consistent-indexed-object-style":
- error
- index-signature

File diff suppressed because one or more lines are too long

783
.yarn/releases/yarn-3.2.3.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -6,4 +6,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-2.4.0.cjs
yarnPath: .yarn/releases/yarn-3.2.3.cjs

View File

@@ -1,7 +1,7 @@
Package: shiny
Type: Package
Title: Web Application Framework for R
Version: 1.7.2
Version: 1.7.4
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),
@@ -198,13 +198,14 @@ Collate:
'version_bs_date_picker.R'
'version_ion_range_slider.R'
'version_jquery.R'
'version_jqueryui.R'
'version_selectize.R'
'version_strftime.R'
'viewer.R'
RoxygenNote: 7.2.1
RoxygenNote: 7.2.2
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RdMacros: lifecycle
Config/testthat/edition: 3
Config/Needs/check:
rstudio/shinytest2
shinytest2

215
NEWS.md
View File

@@ -1,5 +1,30 @@
shiny 1.7.2
===========
# 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
* `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.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
@@ -50,8 +75,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
@@ -60,8 +84,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
@@ -118,8 +141,7 @@ 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:
@@ -228,8 +250,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
@@ -282,20 +303,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
@@ -358,8 +376,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
@@ -368,8 +385,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
@@ -378,8 +394,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
@@ -410,8 +425,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.
@@ -476,8 +490,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.
@@ -550,8 +563,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
@@ -564,8 +576,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.
@@ -626,8 +637,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.
@@ -640,8 +650,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/.
@@ -660,8 +669,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.
@@ -731,8 +739,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.
@@ -797,8 +804,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.
@@ -826,8 +832,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.
@@ -857,8 +862,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!
@@ -1057,14 +1061,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.
@@ -1073,8 +1075,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).
@@ -1125,8 +1126,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.
@@ -1149,16 +1149,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.
@@ -1214,8 +1212,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)
@@ -1242,8 +1239,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.
@@ -1321,20 +1317,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.
@@ -1367,8 +1360,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)
@@ -1381,8 +1373,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.
@@ -1419,14 +1410,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).
@@ -1499,8 +1488,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.
@@ -1519,8 +1507,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.
@@ -1549,8 +1536,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.
@@ -1581,8 +1567,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.
@@ -1599,16 +1584,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.
@@ -1623,8 +1606,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.
@@ -1633,8 +1615,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.
@@ -1659,52 +1640,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
@@ -1713,8 +1686,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
@@ -1723,8 +1695,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
@@ -1737,8 +1708,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
@@ -1747,8 +1717,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.
@@ -1761,8 +1730,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.
@@ -1771,8 +1739,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).
@@ -1781,8 +1748,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.
@@ -1797,8 +1763,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
@@ -1811,8 +1776,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
@@ -1825,7 +1789,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

@@ -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

@@ -103,10 +103,10 @@ fixedPanel <- function(...,
jqueryuiDependency <- function() {
htmlDependency(
'jqueryui',
'1.12.1',
src = 'www/shared/jqueryui',
package = 'shiny',
script = 'jquery-ui.min.js'
"jqueryui",
version_jqueryui,
src = "www/shared/jqueryui",
package = "shiny",
script = "jquery-ui.min.js"
)
}

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

@@ -185,9 +185,11 @@ workerId <- local({
#' session is actually connected.
#' }
#' \item{request}{
#' An environment that implements the Rook specification for HTTP requests.
#' This is the request that was used to initiate the websocket connection
#' (as opposed to the request that downloaded the web page for the app).
#' An environment that implements the [Rook
#' specification](https://github.com/jeffreyhorner/Rook#the-environment) for
#' HTTP requests. This is the request that was used to initiate the websocket
#' connection (as opposed to the request that downloaded the web page for the
#' app).
#' }
#' \item{userData}{
#' An environment for app authors and module/package authors to store whatever

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

2
R/version_jqueryui.R Normal file
View File

@@ -0,0 +1,2 @@
# Generated by tools/updatejQueryUI.R; do not edit by hand
version_jqueryui <- "1.13.2"

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

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

@@ -312,7 +312,7 @@ Mani Mishra <manimishra902@gmail.com>
Hannah Methvin <hannahmethvin@gmail.com>
Leonardo Balter <leonardo.balter@gmail.com>
Benjamin Albert <benjamin_a5@yahoo.com>
Michał Gołębiowski <m.goleb@gmail.com>
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Alyosha Pushak <alyosha.pushak@gmail.com>
Fahad Ahmad <fahadahmad41@hotmail.com>
Matt Brundage <github@mattbrundage.com>
@@ -331,3 +331,42 @@ Peter Dave Hello <hsu@peterdavehello.org>
Johannes Schäfer <johnschaefer@gmx.de>
Ville Skyttä <ville.skytta@iki.fi>
Ryan Oriecuia <ryan.oriecuia@visioncritical.com>
Sergei Ratnikov <sergeir82@gmail.com>
milk54 <milk851@gmail.com>
Evelyn Masso <evoutofambit@gmail.com>
Robin <mail@robin-fowler.com>
Simon Asika <asika32764@gmail.com>
Kevin Cupp <kevin.cupp@gmail.com>
Jeremy Mickelson <Jeremy.Mickelson@gmail.com>
Kyle Rosenberg <kyle.rosenberg@gmail.com>
Petri Partio <petri.partio@gmail.com>
pallxk <github@pallxk.com>
Luke Brookhart <luke@onjax.com>
claudi <hirt-claudia@gmx.de>
Eirik Sletteberg <eiriksletteberg@gmail.com>
Albert Johansson <albert@intervaro.se>
A. Wells <borgboyone@users.noreply.github.com>
Robert Brignull <robertbrignull@gmail.com>
Horus68 <pauloizidoro@gmail.com>
Maksymenkov Eugene <foatei@gmail.com>
OskarNS <soerensen.oskar@gmail.com>
Gez Quinn <holla@gezquinn.design>
jigar gala <jigar.gala140291@gmail.com>
Florian Wegscheider <flo.wegscheider@gmail.com>
Fatér Zsolt <fater.zsolt@gmail.com>
Szabolcs Szabolcsi-Toth <nec@shell8.net>
Jérémy Munsch <github@jeremydev.ovh>
Hrvoje Novosel <hrvoje.novosel@gmail.com>
Paul Capron <PaulCapron@users.noreply.github.com>
Micah Miller <mikhey@runbox.com>
sakshi87 <53863764+sakshi87@users.noreply.github.com>
Mikolaj Wolicki <wolicki.mikolaj@gmail.com>
Patrick McKay <patrick.mckay@vumc.org>
c-lambert <58025159+c-lambert@users.noreply.github.com>
Josep Sanz <josepsanzcamp@gmail.com>
Ben Mullins <benm@umich.edu>
Christian Oliff <christianoliff@pm.me>
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Adam Lidén Hällgren <adamlh92@gmail.com>
James Hinderks <hinderks@gmail.com>
Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com>

View File

@@ -1,5 +0,0 @@
This a full jQuery UI build, downloaded from:
https://jqueryui.com/resources/download/jquery-ui-1.12.1.zip
The copy of jQuery that is bundled with the download, under external/, is not
included because Shiny already has its own copy of jQuery.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -58,7 +58,6 @@
<h1>YOUR COMPONENTS:</h1>
<!-- Accordion -->
<h2 class="demoHeaders">Accordion</h2>
<div id="accordion">
@@ -70,23 +69,17 @@
<div>Nam dui erat, auctor a, dignissim quis.</div>
</div>
<!-- Autocomplete -->
<h2 class="demoHeaders">Autocomplete</h2>
<div>
<input id="autocomplete" title="type &quot;a&quot;">
</div>
<!-- Button -->
<h2 class="demoHeaders">Button</h2>
<button id="button">A button element</button>
<button id="button-icon">An icon-only button</button>
<!-- Checkboxradio -->
<h2 class="demoHeaders">Checkboxradio</h2>
<form style="margin-top: 1em;">
@@ -97,8 +90,6 @@
</div>
</form>
<!-- Controlgroup -->
<h2 class="demoHeaders">Controlgroup</h2>
<fieldset>
@@ -125,8 +116,6 @@
</div>
</fieldset>
<!-- Tabs -->
<h2 class="demoHeaders">Tabs</h2>
<div id="tabs">
@@ -140,8 +129,6 @@
<div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div>
</div>
<h2 class="demoHeaders">Dialog</h2>
<p>
<button id="dialog-link" class="ui-button ui-corner-all ui-widget">
@@ -167,7 +154,6 @@
</div>
<h2 class="demoHeaders">Framework Icons (content color preview)</h2>
<ul id="icons" class="ui-widget ui-helper-clearfix">
<li class="ui-state-default ui-corner-all" title=".ui-icon-caret-1-n"><span class="ui-icon ui-icon-caret-1-n"></span></li>
@@ -345,25 +331,18 @@
<li class="ui-state-default ui-corner-all" title=".ui-icon-grip-diagonal-se"><span class="ui-icon ui-icon-grip-diagonal-se"></span></li>
</ul>
<!-- Slider -->
<h2 class="demoHeaders">Slider</h2>
<div id="slider"></div>
<!-- Datepicker -->
<h2 class="demoHeaders">Datepicker</h2>
<div id="datepicker"></div>
<!-- Progressbar -->
<h2 class="demoHeaders">Progressbar</h2>
<div id="progressbar"></div>
<!-- Progressbar -->
<h2 class="demoHeaders">Selectmenu</h2>
<select id="selectmenu">
@@ -374,14 +353,10 @@
<option>Faster</option>
</select>
<!-- Spinner -->
<h2 class="demoHeaders">Spinner</h2>
<input id="spinner">
<!-- Menu -->
<h2 class="demoHeaders">Menu</h2>
<ul style="width:100px;" id="menu">
@@ -400,8 +375,6 @@
<li><div>Item 5</div></li>
</ul>
<!-- Tooltip -->
<h2 class="demoHeaders">Tooltip</h2>
<p id="tooltip">
@@ -409,7 +382,6 @@
the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
</p>
<!-- Highlight / Error -->
<h2 class="demoHeaders">Highlight / Error</h2>
<div class="ui-widget">
@@ -429,11 +401,8 @@ the element with your mouse, the title attribute is displayed in a little box ne
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script>
$( "#accordion" ).accordion();
var availableTags = [
"ActionScript",
"AppleScript",
@@ -462,28 +431,18 @@ $( "#autocomplete" ).autocomplete({
source: availableTags
});
$( "#button" ).button();
$( "#button-icon" ).button({
icon: "ui-icon-gear",
showLabel: false
});
$( "#radioset" ).buttonset();
$( "#controlgroup" ).controlgroup();
$( "#tabs" ).tabs();
$( "#dialog" ).dialog({
autoOpen: false,
width: 400,
@@ -509,42 +468,27 @@ $( "#dialog-link" ).click(function( event ) {
event.preventDefault();
});
$( "#datepicker" ).datepicker({
inline: true
});
$( "#slider" ).slider({
range: true,
values: [ 17, 67 ]
});
$( "#progressbar" ).progressbar({
value: 20
});
$( "#spinner" ).spinner();
$( "#menu" ).menu();
$( "#tooltip" ).tooltip();
$( "#selectmenu" ).selectmenu();
// Hover states on the static widgets
$( "#dialog-link, #icons li" ).hover(
function() {

View File

@@ -1,4 +1,4 @@
/*! jQuery UI - v1.12.1 - 2016-09-14
/*! jQuery UI - v1.13.2 - 2022-07-14
* http://jqueryui.com
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?bgShadowXPos=&bgOverlayXPos=&bgErrorXPos=&bgHighlightXPos=&bgContentXPos=&bgHeaderXPos=&bgActiveXPos=&bgHoverXPos=&bgDefaultXPos=&bgShadowYPos=&bgOverlayYPos=&bgErrorYPos=&bgHighlightYPos=&bgContentYPos=&bgHeaderYPos=&bgActiveYPos=&bgHoverYPos=&bgDefaultYPos=&bgShadowRepeat=&bgOverlayRepeat=&bgErrorRepeat=&bgHighlightRepeat=&bgContentRepeat=&bgHeaderRepeat=&bgActiveRepeat=&bgHoverRepeat=&bgDefaultRepeat=&iconsHover=url(%22images%2Fui-icons_555555_256x240.png%22)&iconsHighlight=url(%22images%2Fui-icons_777620_256x240.png%22)&iconsHeader=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsError=url(%22images%2Fui-icons_cc0000_256x240.png%22)&iconsDefault=url(%22images%2Fui-icons_777777_256x240.png%22)&iconsContent=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsActive=url(%22images%2Fui-icons_ffffff_256x240.png%22)&bgImgUrlShadow=&bgImgUrlOverlay=&bgImgUrlHover=&bgImgUrlHighlight=&bgImgUrlHeader=&bgImgUrlError=&bgImgUrlDefault=&bgImgUrlContent=&bgImgUrlActive=&opacityFilterShadow=Alpha(Opacity%3D30)&opacityFilterOverlay=Alpha(Opacity%3D30)&opacityShadowPerc=30&opacityOverlayPerc=30&iconColorHover=%23555555&iconColorHighlight=%23777620&iconColorHeader=%23444444&iconColorError=%23cc0000&iconColorDefault=%23777777&iconColorContent=%23444444&iconColorActive=%23ffffff&bgImgOpacityShadow=0&bgImgOpacityOverlay=0&bgImgOpacityError=95&bgImgOpacityHighlight=55&bgImgOpacityContent=75&bgImgOpacityHeader=75&bgImgOpacityActive=65&bgImgOpacityHover=75&bgImgOpacityDefault=75&bgTextureShadow=flat&bgTextureOverlay=flat&bgTextureError=flat&bgTextureHighlight=flat&bgTextureContent=flat&bgTextureHeader=flat&bgTextureActive=flat&bgTextureHover=flat&bgTextureDefault=flat&cornerRadius=3px&fwDefault=normal&ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&cornerRadiusShadow=8px&thicknessShadow=5px&offsetLeftShadow=0px&offsetTopShadow=0px&opacityShadow=.3&bgColorShadow=%23666666&opacityOverlay=.3&bgColorOverlay=%23aaaaaa&fcError=%235f3f3f&borderColorError=%23f1a899&bgColorError=%23fddfdf&fcHighlight=%23777620&borderColorHighlight=%23dad55e&bgColorHighlight=%23fffa90&fcContent=%23333333&borderColorContent=%23dddddd&bgColorContent=%23ffffff&fcHeader=%23333333&borderColorHeader=%23dddddd&bgColorHeader=%23e9e9e9&fcActive=%23ffffff&borderColorActive=%23003eff&bgColorActive=%23007fff&fcHover=%232b2b2b&borderColorHover=%23cccccc&bgColorHover=%23ededed&fcDefault=%23454545&borderColorDefault=%23c5c5c5&bgColorDefault=%23f6f6f6
@@ -45,7 +45,7 @@
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0); /* support: IE8 */
-ms-filter: "alpha(opacity=0)"; /* support: IE8 */
}
.ui-front {
@@ -664,7 +664,7 @@ button.ui-button::-moz-focus-inner {
.ui-progressbar .ui-progressbar-overlay {
background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
height: 100%;
filter: alpha(opacity=25); /* support: IE8 */
-ms-filter: "alpha(opacity=25)"; /* support: IE8 */
opacity: 0.25;
}
.ui-progressbar-indeterminate .ui-progressbar-value {
@@ -728,7 +728,7 @@ button.ui-button::-moz-focus-inner {
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
cursor: pointer;
-ms-touch-action: none;
touch-action: none;
}
@@ -1041,18 +1041,18 @@ a.ui-button:active,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
-ms-filter: "alpha(opacity=70)"; /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
-ms-filter: "alpha(opacity=35)"; /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
-ms-filter: "alpha(opacity=35)"; /* support: IE8 - See #6059 */
}
/* Icons
@@ -1093,7 +1093,10 @@ a.ui-button:active,
}
/* positioning */
.ui-icon-blank { background-position: 16px 16px; }
/* Three classes needed to override `.ui-button:hover .ui-icon` */
.ui-icon-blank.ui-icon-blank.ui-icon-blank {
background-image: none;
}
.ui-icon-caret-1-n { background-position: 0 0; }
.ui-icon-caret-1-ne { background-position: -16px 0; }
.ui-icon-caret-1-e { background-position: -32px 0; }
@@ -1304,7 +1307,7 @@ a.ui-button:active,
.ui-widget-overlay {
background: #aaaaaa;
opacity: .003;
filter: Alpha(Opacity=.3); /* support: IE8 */
-ms-filter: Alpha(Opacity=.3); /* support: IE8 */
}
.ui-widget-shadow {
-webkit-box-shadow: 0px 0px 5px #666666;

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

View File

@@ -1,5 +1,5 @@
/*!
* jQuery UI CSS Framework 1.12.1
* jQuery UI CSS Framework 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -49,7 +49,7 @@
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0); /* support: IE8 */
-ms-filter: "alpha(opacity=0)"; /* support: IE8 */
}
.ui-front {
@@ -668,7 +668,7 @@ button.ui-button::-moz-focus-inner {
.ui-progressbar .ui-progressbar-overlay {
background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
height: 100%;
filter: alpha(opacity=25); /* support: IE8 */
-ms-filter: "alpha(opacity=25)"; /* support: IE8 */
opacity: 0.25;
}
.ui-progressbar-indeterminate .ui-progressbar-value {
@@ -732,7 +732,7 @@ button.ui-button::-moz-focus-inner {
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
cursor: pointer;
-ms-touch-action: none;
touch-action: none;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/*!
* jQuery UI CSS Framework 1.12.1
* jQuery UI CSS Framework 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -172,18 +172,18 @@ a.ui-button:active,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
-ms-filter: "alpha(opacity=70)"; /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
-ms-filter: "alpha(opacity=35)"; /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
-ms-filter: "alpha(opacity=35)"; /* support: IE8 - See #6059 */
}
/* Icons
@@ -224,7 +224,10 @@ a.ui-button:active,
}
/* positioning */
.ui-icon-blank { background-position: 16px 16px; }
/* Three classes needed to override `.ui-button:hover .ui-icon` */
.ui-icon-blank.ui-icon-blank.ui-icon-blank {
background-image: none;
}
.ui-icon-caret-1-n { background-position: 0 0; }
.ui-icon-caret-1-ne { background-position: -16px 0; }
.ui-icon-caret-1-e { background-position: -32px 0; }
@@ -435,7 +438,7 @@ a.ui-button:active,
.ui-widget-overlay {
background: #aaaaaa;
opacity: .003;
filter: Alpha(Opacity=.3); /* support: IE8 */
-ms-filter: Alpha(Opacity=.3); /* support: IE8 */
}
.ui-widget-shadow {
-webkit-box-shadow: 0px 0px 5px #666666;

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 | (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 | (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: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 | (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 | (c) 2012-2022 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

@@ -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

@@ -96,9 +96,10 @@ The equivalent of hitting the browser's Reload button. Only works if the
session is actually connected.
}
\item{request}{
An environment that implements the Rook specification for HTTP requests.
This is the request that was used to initiate the websocket connection
(as opposed to the request that downloaded the web page for the app).
An environment that implements the \href{https://github.com/jeffreyhorner/Rook#the-environment}{Rook specification} for
HTTP requests. This is the request that was used to initiate the websocket
connection (as opposed to the request that downloaded the web page for the
app).
}
\item{userData}{
An environment for app authors and module/package authors to store whatever

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",
"version": "1.7.4",
"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": {
@@ -32,33 +32,34 @@
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.14.0",
"@deanc/esbuild-plugin-postcss": "^1.0.1",
"@deanc/esbuild-plugin-postcss": "^1.0.2",
"@testing-library/dom": "^7.31.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/user-event": "^13.1.9",
"@types/highlightjs": "^9.12.1",
"@types/jest": "^26.0.23",
"@types/jqueryui": "1.12.15",
"@types/jqueryui": "1.12.16",
"@types/lodash": "^4.14.170",
"@types/node": "^15.6.1",
"@types/showdown": "^1.9.3",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"autoprefixer": "^10.2.6",
"bootstrap-datepicker": "1.9.0",
"browserslist": "^4.19.1",
"caniuse-lite": "^1.0.30001312",
"core-js": "^3.13.0",
"esbuild": "^0.12.4",
"esbuild": "^0.15.10",
"esbuild-plugin-babel": "https://github.com/schloerke/esbuild-plugin-babel#patch-2",
"esbuild-plugin-globals": "^0.1.1",
"esbuild-plugin-sass": "^0.5.2",
"eslint": "^7.27.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-jest-dom": "^3.9.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-unicorn": "^33.0.1",
"esbuild-plugin-sass": "^1.0.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.0.4",
"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",
@@ -67,15 +68,15 @@
"node-gyp": "^8.1.0",
"phantomjs-prebuilt": "^2.1.16",
"postcss": "^8.3.5",
"prettier": "2.3.0",
"prettier": "^2.7.1",
"readcontrol": "^1.0.0",
"replace": "^1.2.1",
"selectize": "0.12.4",
"strftime": "0.9.2",
"ts-jest": "^26",
"ts-node": "^10.0.0",
"type-coverage": "^2.17.5",
"typescript": "~4.1.5",
"ts-node": "^10.9.1",
"type-coverage": "^2.22.0",
"typescript": "^4.8.4",
"util-inspect": "https://github.com/deecewan/browser-util-inspect#c0b4350df4378ffd743e8c36dd3898ce3992823e"
},
"scripts": {

View File

@@ -1,13 +1,23 @@
import {
build as esbuildBuild,
import type {
BuildFailure,
BuildIncremental,
BuildOptions,
BuildResult,
WatchMode,
} from "esbuild";
import readcontrol from "readcontrol";
import { build as esbuildBuild } from "esbuild";
import process from "process";
import { basename } from "path";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore; Type definitions are not found. This occurs when `strict: true` in tsconfig.json
import readcontrol from "readcontrol";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore; Type definitions are not found. This occurs when `strict: true` in tsconfig.json
import babelPlugin from "esbuild-plugin-babel";
const outDir = "./inst/www/shared/";
type ShinyDesc = { version: string; package: string; license: string };
@@ -42,7 +52,7 @@ async function build(
}
}
const onRebuild = function (error?: string) {
const onRebuild = function (error: BuildFailure | null) {
if (error) {
console.error(printNames.join(", "), "watch build failed:\n", error);
} else {
@@ -54,7 +64,7 @@ async function build(
};
let incremental = false;
let watch: false | { onRebuild: (error, result) => void } = false;
let watch: WatchMode | false = false;
if (process.argv.length >= 3 && process.argv[2] == "--watch") {
incremental = true;
@@ -73,9 +83,9 @@ async function build(
preserveSymlinks: true,
...opts,
}).then((x) => {
onRebuild();
onRebuild(null);
return x;
});
}
export { outDir, build, shinyDesc, banner };
export { outDir, build, shinyDesc, banner, babelPlugin };

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

@@ -5,8 +5,7 @@
// - TypeScript -----------------------------------------------------------
import { banner, build, outDir } from "./_build";
import babelPlugin from "esbuild-plugin-babel";
import { banner, build, outDir, babelPlugin } from "./_build";
build({
bundle: true,
@@ -25,8 +24,10 @@ build({
// - Sass -----------------------------------------------------------
import autoprefixer from "autoprefixer";
import postCssPlugin from "@deanc/esbuild-plugin-postcss";
import sassPlugin from "esbuild-plugin-sass";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore; Type definitions are not found. This occurs when `strict: true` in tsconfig.json
import postCssPlugin from "@deanc/esbuild-plugin-postcss";
const sassOpts = {
minify: true,

View File

@@ -3,10 +3,10 @@
// yarn build
// ```
import { banner, build, outDir, shinyDesc } from "./_build";
import { banner, build, outDir, shinyDesc, babelPlugin } from "./_build";
import globalsPlugin from "esbuild-plugin-globals";
import babelPlugin from "esbuild-plugin-babel";
import type { BuildOptions } from "esbuild";
import { verifyJqueryImport } from "./_jquery";
const opts: BuildOptions = {
entryPoints: ["srcts/src/index.ts"],
@@ -27,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

@@ -1,9 +1,8 @@
import $ from "jquery";
import { hasDefinedProperty } from "../../utils";
import { InputBinding } from "./inputBinding";
import { hasOwnProperty } from "../../utils";
type ActionButtonReceiveMessageData = { label?: string; icon?: string };
type ActionButtonReceiveMessageData = { label?: string; icon?: string | [] };
class ActionButtonInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement> {
@@ -40,7 +39,7 @@ class ActionButtonInputBinding extends InputBinding {
const $el = $(el);
// retrieve current label and icon
let label = $el.text();
let label: string = $el.text();
let icon = "";
// to check (and store) the previous icon, we look for a $el child
@@ -57,16 +56,18 @@ class ActionButtonInputBinding extends InputBinding {
}
// update the requested properties
if (hasOwnProperty(data, "label")) label = data.label;
if (hasOwnProperty(data, "icon")) {
icon = data.icon;
// if the user entered icon=character(0), remove the icon
if (icon.length === 0) icon = "";
if (hasDefinedProperty(data, "label")) {
label = data.label;
}
if (hasDefinedProperty(data, "icon")) {
// `data.icon` can be an [] if user gave `character(0)`.
icon = Array.isArray(data.icon) ? "" : data.icon ?? "";
}
// produce new html
$el.html(icon + " " + label);
}
unsubscribe(el: HTMLElement): void {
$(el).off(".actionButtonInputBinding");
}

View File

@@ -1,6 +1,6 @@
import $ from "jquery";
import { InputBinding } from "./inputBinding";
import { hasOwnProperty } from "../../utils";
import { hasDefinedProperty } from "../../utils";
type CheckedHTMLElement = HTMLInputElement;
@@ -35,12 +35,15 @@ class CheckboxInputBinding extends InputBinding {
el: CheckedHTMLElement,
data: CheckboxReceiveMessageData
): void {
if (hasOwnProperty(data, "value")) el.checked = data.value;
if (hasDefinedProperty(data, "value")) {
el.checked = data.value;
}
// checkboxInput()'s label works different from other
// input labels...the label container should always exist
if (hasOwnProperty(data, "label"))
if (hasDefinedProperty(data, "label")) {
$(el).parent().find("span").text(data.label);
}
$(el).trigger("change");
}

View File

@@ -1,7 +1,7 @@
import $ from "jquery";
import { InputBinding } from "./inputBinding";
import { $escape, hasOwnProperty, updateLabel } from "../../utils";
import { $escape, updateLabel, hasDefinedProperty } from "../../utils";
import type { CheckedHTMLElement } from "./checkbox";
type CheckboxGroupHTMLElement = CheckedHTMLElement;
@@ -24,9 +24,11 @@ function getLabelNode(el: CheckboxGroupHTMLElement): JQuery<HTMLElement> {
// Given an input DOM object, get the associated label. Handles labels
// that wrap the input as well as labels associated with 'for' attribute.
function getLabel(obj: HTMLElement): string | null {
const parentNode = obj.parentNode as HTMLElement;
// If <label><input /><span>label text</span></label>
if ((obj.parentNode as HTMLElement).tagName === "LABEL") {
return $(obj.parentNode).find("span").text().trim();
if (parentNode.tagName === "LABEL") {
return $(parentNode).find("span").text().trim();
}
return null;
@@ -35,9 +37,11 @@ function getLabel(obj: HTMLElement): string | null {
// that wrap the input as well as labels associated with 'for' attribute.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function setLabel(obj: HTMLElement, value: string): null {
const parentNode = obj.parentNode as HTMLElement;
// If <label><input /><span>label text</span></label>
if ((obj.parentNode as HTMLElement).tagName === "LABEL") {
$(obj.parentNode).find("span").text(value);
if (parentNode.tagName === "LABEL") {
$(parentNode).find("span").text(value);
}
return null;
@@ -58,7 +62,10 @@ class CheckboxGroupInputBinding extends InputBinding {
}
return values;
}
setValue(el: HTMLElement, value: string[] | string): void {
setValue(el: HTMLElement, value: string[] | string | null): void {
// Null value should be treated as empty array
value = value ?? [];
// Clear all checkboxes
$('input:checkbox[name="' + $escape(el.id) + '"]').prop("checked", false);
@@ -113,7 +120,7 @@ class CheckboxGroupInputBinding extends InputBinding {
const $el = $(el);
// This will replace all the options
if (hasOwnProperty(data, "options")) {
if (hasDefinedProperty(data, "options")) {
// Clear existing options and add each new one
$el.find("div.shiny-options-group").remove();
// Backward compatibility: for HTML generated by shinybootstrap2 package
@@ -121,7 +128,9 @@ class CheckboxGroupInputBinding extends InputBinding {
$el.append(data.options);
}
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) {
this.setValue(el, data.value);
}
updateLabel(data.label, getLabelNode(el));

View File

@@ -5,8 +5,9 @@ import {
updateLabel,
$escape,
parseDate,
hasOwnProperty,
hasDefinedProperty,
} from "../../utils";
import type { NotUndefined } from "../../utils/extraTypes";
declare global {
interface JQuery {
@@ -14,7 +15,9 @@ declare global {
bsDatepicker(methodName: "getUTCDate"): Date;
// Infinity is not allowed as a literal return type. Using `1e9999` as a placeholder that resolves to Infinity
// https://github.com/microsoft/TypeScript/issues/32277
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
bsDatepicker(methodName: "getStartDate"): Date | -1e9999;
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
bsDatepicker(methodName: "getEndDate"): Date | 1e9999;
bsDatepicker(methodName: string): void;
bsDatepicker(methodName: string, params: Date | null): void;
@@ -122,8 +125,7 @@ class DateInputBindingBase extends InputBinding {
}
// Given an unambiguous date string or a Date object, set the min (start) date.
// null will unset. undefined will result in no change,
protected _setMin(el: HTMLElement, date: Date | null | undefined): void {
if (date === undefined) return;
protected _setMin(el: HTMLElement, date: Date | null): void {
if (date === null) {
$(el).bsDatepicker("setStartDate", null);
return;
@@ -161,8 +163,7 @@ class DateInputBindingBase extends InputBinding {
}
// Given an unambiguous date string or a Date object, set the max (end) date
// null will unset.
protected _setMax(el: HTMLElement, date: Date): void {
if (date === undefined) return;
protected _setMax(el: HTMLElement, date: Date | null): void {
if (date === null) {
$(el).bsDatepicker("setEndDate", null);
return;
@@ -236,7 +237,7 @@ class DateInputBinding extends DateInputBindingBase {
return formatDateUTC(date);
}
// value must be an unambiguous string like '2001-01-01', or a Date object.
setValue(el: HTMLElement, value: Date): void {
setValue(el: HTMLElement, value: Date | null): void {
// R's NA, which is null here will remove current value
if (value === null) {
$(el).find("input").val("").bsDatepicker("update");
@@ -286,7 +287,7 @@ class DateInputBinding extends DateInputBindingBase {
return {
label: this._getLabelNode(el).text(),
value: this.getValue(el),
valueString: $input.val(),
valueString: $input.val() as NotUndefined<ReturnType<typeof $input.val>>,
min: min,
max: max,
language: $input.data("datepicker").language,
@@ -300,14 +301,14 @@ class DateInputBinding extends DateInputBindingBase {
updateLabel(data.label, this._getLabelNode(el));
if (hasOwnProperty(data, "min")) this._setMin($input[0], data.min);
if (hasDefinedProperty(data, "min")) this._setMin($input[0], data.min);
if (hasOwnProperty(data, "max")) this._setMax($input[0], data.max);
if (hasDefinedProperty(data, "max")) this._setMax($input[0], data.max);
// Must set value only after min and max have been set. If new value is
// outside the bounds of the previous min/max, then the result will be a
// blank input.
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) this.setValue(el, data.value);
$(el).trigger("change");
}

View File

@@ -3,7 +3,7 @@ import $ from "jquery";
import {
$escape,
formatDateUTC,
hasOwnProperty,
hasDefinedProperty,
updateLabel,
} from "../../utils";
import { DateInputBindingBase } from "./date";
@@ -114,12 +114,12 @@ class DateRangeInputBinding extends DateInputBindingBase {
updateLabel(data.label, getLabelNode(el));
if (hasOwnProperty(data, "min")) {
if (hasDefinedProperty(data, "min")) {
this._setMin($startinput[0], data.min);
this._setMin($endinput[0], data.min);
}
if (hasOwnProperty(data, "max")) {
if (hasDefinedProperty(data, "max")) {
this._setMax($startinput[0], data.max);
this._setMax($endinput[0], data.max);
}
@@ -127,7 +127,9 @@ class DateRangeInputBinding extends DateInputBindingBase {
// Must set value only after min and max have been set. If new value is
// outside the bounds of the previous min/max, then the result will be a
// blank input.
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) {
this.setValue(el, data.value);
}
$el.trigger("change");
}

View File

@@ -24,6 +24,7 @@ function enableDraghover(el: JQuery<HTMLElement>): JQuery<HTMLElement> {
const $el = $(el);
let childCounter = 0;
/* eslint-disable @typescript-eslint/naming-convention */
$el.on({
"dragenter.draghover": (e) => {
if (childCounter++ === 0) {
@@ -91,7 +92,7 @@ function canSetFiles(fileList: FileList): boolean {
return true;
}
function handleDrop(e: JQuery.DragEventBase, el: HTMLInputElement): void {
const files = e.originalEvent.dataTransfer.files,
const files = e.originalEvent?.dataTransfer?.files,
$el = $(el);
if (files === undefined || files === null) {
@@ -109,7 +110,7 @@ function handleDrop(e: JQuery.DragEventBase, el: HTMLInputElement): void {
// 3. The browser supports FileList and input.files assignment.
// (Chrome, Safari)
$el.val("");
el.files = e.originalEvent.dataTransfer.files;
el.files = files;
// Recent versions of Firefox (57+, or "Quantum" and beyond) don't seem to
// automatically trigger a change event, so we trigger one manually here.
// On browsers that do trigger change, this operation appears to be
@@ -188,7 +189,7 @@ function uploadFiles(evt: JQuery.DragEvent): void {
// TODO-barret ; Should this be an internal class property?
let $fileInputs = $();
function fileInputBindingGetId(el: HTMLInputElement): string {
function fileInputBindingGetId(this: any, el: HTMLInputElement): string {
return InputBinding.prototype.getId.call(this, el) || el.name;
}

View File

@@ -2,14 +2,13 @@ import type { RatePolicyModes } from "../../inputPolicies/inputRateDecorator";
import type { BindScope } from "../../shiny/bind";
class InputBinding {
name: string;
name!: string;
// Returns a jQuery object or element array that contains the
// descendants of scope that match this binding
find(scope: BindScope): JQuery<HTMLElement> {
throw "Not implemented";
// add so that typescript isn't mad about an unused var
scope;
scope; // unused var
}
getId(el: HTMLElement): string {
@@ -18,9 +17,9 @@ class InputBinding {
// Gives the input a type in case the server needs to know it
// to deserialize the JSON correctly
getType(el: HTMLElement): string | false {
return false;
el;
getType(el: HTMLElement): string | null {
return null;
el; // unused var
}
getValue(el: HTMLElement): any {
throw "Not implemented";
@@ -32,12 +31,12 @@ class InputBinding {
// getRatePolicy. If false, send value immediately. Default behavior is `false`
subscribe(el: HTMLElement, callback: (value: boolean) => void): void {
// empty
el;
callback;
el; // unused var
callback; // unused var
}
unsubscribe(el: HTMLElement): void {
// empty
el;
el; // unused var
}
// This is used for receiving messages that tell the input object to do
@@ -47,19 +46,19 @@ class InputBinding {
// trigger a change event.
receiveMessage(el: HTMLElement, data: unknown): void {
throw "Not implemented";
el;
data;
el; // unused var
data; // unused var
}
getState(el: HTMLElement): unknown {
throw "Not implemented";
el;
el; // unused var
}
getRatePolicy(
el: HTMLElement
): { policy: RatePolicyModes; delay: number } | null {
return null;
el;
el; // unused var
}
// Some input objects need initialization before being bound. This is

View File

@@ -1,5 +1,5 @@
import $ from "jquery";
import { $escape, hasOwnProperty, updateLabel } from "../../utils";
import { $escape, hasDefinedProperty, updateLabel } from "../../utils";
import { TextInputBindingBase } from "./text";
type NumberHTMLElement = HTMLInputElement;
@@ -23,7 +23,9 @@ class NumberInputBinding extends TextInputBindingBase {
return $(scope).find('input[type="number"]');
}
getValue(el: NumberHTMLElement): string[] | number | string {
getValue(
el: NumberHTMLElement
): string[] | number | string | null | undefined {
const numberVal = $(el).val();
if (typeof numberVal == "string") {
@@ -49,10 +51,12 @@ class NumberInputBinding extends TextInputBindingBase {
el;
}
receiveMessage(el: NumberHTMLElement, data: NumberReceiveMessageData): void {
if (hasOwnProperty(data, "value")) el.value = data.value;
if (hasOwnProperty(data, "min")) el.min = data.min;
if (hasOwnProperty(data, "max")) el.max = data.max;
if (hasOwnProperty(data, "step")) el.step = data.step;
// Setting values to `""` will remove the attribute value from the DOM element.
// The attr key will still remain, but there is not value... ex: `<input id="foo" type="number" min max/>`
if (hasDefinedProperty(data, "value")) el.value = data.value ?? "";
if (hasDefinedProperty(data, "min")) el.min = data.min ?? "";
if (hasDefinedProperty(data, "max")) el.max = data.max ?? "";
if (hasDefinedProperty(data, "step")) el.step = data.step ?? "";
updateLabel(data.label, getLabelNode(el));

View File

@@ -1,6 +1,6 @@
import $ from "jquery";
import { InputBinding } from "./inputBinding";
import { $escape, hasOwnProperty, updateLabel } from "../../utils";
import { $escape, hasDefinedProperty, updateLabel } from "../../utils";
type RadioHTMLElement = HTMLInputElement;
@@ -10,7 +10,7 @@ type ValueLabelObject = {
};
type RadioReceiveMessageData = {
value?: string;
value?: string | [];
options?: ValueLabelObject[];
label: string;
};
@@ -24,9 +24,11 @@ function getLabelNode(el: RadioHTMLElement): JQuery<HTMLElement> {
// Given an input DOM object, get the associated label. Handles labels
// that wrap the input as well as labels associated with 'for' attribute.
function getLabel(obj: HTMLElement): string | null {
const parentNode = obj.parentNode as HTMLElement;
// If <label><input /><span>label text</span></label>
if ((obj.parentNode as HTMLElement).tagName === "LABEL") {
return $(obj.parentNode).find("span").text().trim();
if (parentNode.tagName === "LABEL") {
return $(parentNode).find("span").text().trim();
}
return null;
@@ -35,9 +37,11 @@ function getLabel(obj: HTMLElement): string | null {
// that wrap the input as well as labels associated with 'for' attribute.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function setLabel(obj: HTMLElement, value: string): null {
const parentNode = obj.parentNode as HTMLElement;
// If <label><input /><span>label text</span></label>
if ((obj.parentNode as HTMLElement).tagName === "LABEL") {
$(obj.parentNode).find("span").text(value);
if (parentNode.tagName === "LABEL") {
$(parentNode).find("span").text(value);
}
return null;
@@ -47,7 +51,9 @@ class RadioInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement> {
return $(scope).find(".shiny-input-radiogroup");
}
getValue(el: RadioHTMLElement): string[] | number | string | null {
getValue(
el: RadioHTMLElement
): string[] | number | string | null | undefined {
// Select the radio objects that have name equal to the grouping div's id
const checkedItems = $(
'input:radio[name="' + $escape(el.id) + '"]:checked'
@@ -61,8 +67,8 @@ class RadioInputBinding extends InputBinding {
return checkedItems.val();
}
setValue(el: RadioHTMLElement, value: string): void {
if ($.isArray(value) && value.length === 0) {
setValue(el: RadioHTMLElement, value: string | []): void {
if (Array.isArray(value) && value.length === 0) {
// Removing all checked item if the sent data is empty
$('input:radio[name="' + $escape(el.id) + '"]').prop("checked", false);
} else {
@@ -77,7 +83,7 @@ class RadioInputBinding extends InputBinding {
}
getState(el: RadioHTMLElement): {
label: string;
value: string[] | number | string;
value: ReturnType<RadioInputBinding["getValue"]>;
options: ValueLabelObject[];
} {
const $objs = $(
@@ -101,16 +107,20 @@ class RadioInputBinding extends InputBinding {
const $el = $(el);
// This will replace all the options
if (hasOwnProperty(data, "options")) {
if (hasDefinedProperty(data, "options")) {
// Clear existing options and add each new one
$el.find("div.shiny-options-group").remove();
// Backward compatibility: for HTML generated by shinybootstrap2 package
$el.find("label.radio").remove();
// @ts-expect-error; TODO-barret; IDK what this line is doing
// TODO-barret; Should this line be setting attributes instead?
// `data.options` is an array of `{value, label}` objects
$el.append(data.options);
}
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) {
this.setValue(el, data.value);
}
updateLabel(data.label, getLabelNode(el));

View File

@@ -1,7 +1,8 @@
import $ from "jquery";
import { InputBinding } from "./inputBinding";
import { $escape, hasOwnProperty, updateLabel } from "../../utils";
import { $escape, hasDefinedProperty, updateLabel } from "../../utils";
import { indirectEval } from "../../utils/eval";
import type { NotUndefined } from "../../utils/extraTypes";
type SelectHTMLElement = HTMLSelectElement & { nonempty: boolean };
@@ -13,8 +14,9 @@ type SelectInputReceiveMessageData = {
value?: string;
};
type SelectizeOptions = Selectize.IOptions<string, unknown>;
type SelectizeInfo = Selectize.IApi<string, unknown> & {
settings: Selectize.IOptions<string, unknown>;
settings: SelectizeOptions;
};
function getLabelNode(el: SelectHTMLElement): JQuery<HTMLElement> {
@@ -42,7 +44,7 @@ class SelectInputBinding extends InputBinding {
find(scope: HTMLElement): JQuery<HTMLElement> {
return $(scope).find("select");
}
getType(el: HTMLElement): string {
getType(el: HTMLElement): string | null {
const $el = $(el);
if (!$el.hasClass("symbol")) {
@@ -58,8 +60,10 @@ class SelectInputBinding extends InputBinding {
getId(el: SelectHTMLElement): string {
return InputBinding.prototype.getId.call(this, el) || el.name;
}
getValue(el: HTMLElement): string[] | number | string {
return $(el).val();
getValue(
el: HTMLElement
): NotUndefined<ReturnType<JQuery<HTMLElement>["val"]>> {
return $(el).val() as NotUndefined<ReturnType<JQuery<HTMLElement>["val"]>>;
}
setValue(el: SelectHTMLElement, value: string): void {
if (!isSelectize(el)) {
@@ -67,14 +71,12 @@ class SelectInputBinding extends InputBinding {
} else {
const selectize = this._selectize(el);
if (selectize) {
selectize.setValue(value);
}
selectize?.setValue(value);
}
}
getState(el: SelectHTMLElement): {
label: JQuery<HTMLElement>;
value: string[] | number | string;
value: ReturnType<SelectInputBinding["getValue"]>;
options: Array<{ value: string; label: string }>;
} {
// Store options in an array of objects, each with with value and label
@@ -101,21 +103,21 @@ class SelectInputBinding extends InputBinding {
data: SelectInputReceiveMessageData
): void {
const $el = $(el);
let selectize;
// This will replace all the options
if (hasOwnProperty(data, "options")) {
selectize = this._selectize(el);
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);
}
// re-initialize selectize
if (hasOwnProperty(data, "config")) {
if (hasDefinedProperty(data, "config")) {
$el
.parent()
.find('script[data-for="' + $escape(el.id) + '"]')
@@ -124,12 +126,22 @@ class SelectInputBinding extends InputBinding {
}
// use server-side processing for selectize
if (hasOwnProperty(data, "url")) {
selectize = this._selectize(el);
if (hasDefinedProperty(data, "url")) {
type CallbackFn = Parameters<
NonNullable<SelectizeInfo["settings"]["load"]>
>[1];
const selectize = this._selectize(el) as ReturnType<
SelectInputBinding["_selectize"]
> & {
settings: {
load: (query: string, callback: CallbackFn) => any;
};
};
selectize.clearOptions();
let loaded = false;
selectize.settings.load = function (query, callback) {
selectize.settings.load = function (query: string, callback: CallbackFn) {
const settings = selectize.settings;
$.ajax({
@@ -155,7 +167,7 @@ class SelectInputBinding extends InputBinding {
// the group's label and value. We use the current settings of
// the selectize object to decide the fieldnames of that obj.
const optgroupId = elem[settings.optgroupField || "optgroup"];
const optgroup = {};
const optgroup: { [key: string]: string } = {};
optgroup[settings.optgroupLabelField || "label"] = optgroupId;
optgroup[settings.optgroupValueField || "value"] = optgroupId;
@@ -163,8 +175,8 @@ class SelectInputBinding extends InputBinding {
});
callback(res);
if (!loaded) {
if (hasOwnProperty(data, "value")) {
selectize.setValue(data.value);
if (hasDefinedProperty(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);
@@ -178,7 +190,7 @@ class SelectInputBinding extends InputBinding {
selectize.load(function (callback) {
selectize.settings.load.apply(selectize, ["", callback]);
});
} else if (hasOwnProperty(data, "value")) {
} else if (hasDefinedProperty(data, "value")) {
this.setValue(el, data.value);
}
@@ -207,7 +219,12 @@ class SelectInputBinding extends InputBinding {
initialize(el: SelectHTMLElement): void {
this._selectize(el);
}
protected _selectize(el: SelectHTMLElement, update = false): SelectizeInfo {
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
@@ -216,13 +233,13 @@ class SelectInputBinding extends InputBinding {
if (config.length === 0) return undefined;
let options: {
let options: SelectizeOptions & {
labelField: "label";
valueField: "value";
searchField: ["label"];
onItemRemove?: (value: string) => void;
onDropdownClose?: () => void;
} & { [key: string]: unknown } = $.extend(
} = $.extend(
{
labelField: "label",
valueField: "value",
@@ -235,7 +252,7 @@ class SelectInputBinding extends InputBinding {
if (typeof config.data("nonempty") !== "undefined") {
el.nonempty = true;
options = $.extend(options, {
onItemRemove: function (value) {
onItemRemove: function (this: SelectizeInfo, value: string) {
if (this.getValue() === "")
$("select#" + $escape(el.id))
.empty()
@@ -249,9 +266,10 @@ class SelectInputBinding extends InputBinding {
},
onDropdownClose:
// $dropdown: any
function () {
if (this.getValue() === "")
this.setValue($("select#" + $escape(el.id)).val());
function (this: SelectizeInfo) {
if (this.getValue() === "") {
this.setValue($("select#" + $escape(el.id)).val() as string);
}
},
});
} else {
@@ -259,8 +277,9 @@ class SelectInputBinding extends InputBinding {
}
// options that should be eval()ed
if (config.data("eval") instanceof Array)
$.each(config.data("eval"), function (i, x) {
$.each(config.data("eval"), function (i, x: string) {
/*jshint evil: true*/
// @ts-expect-error; Need to type `options` keys to know exactly which values are accessed.
options[x] = indirectEval("(" + options[x] + ")");
});
let control = $el.selectize(options)[0].selectize as SelectizeInfo;

View File

@@ -1,10 +1,14 @@
import type {
IonRangeSliderEvent,
IonRangeSliderOptions,
} from "ion-rangeslider";
import $ from "jquery";
// import { NameValueHTMLElement } from ".";
import {
formatDateUTC,
updateLabel,
$escape,
hasOwnProperty,
hasDefinedProperty,
} from "../../utils";
import type { TextHTMLElement } from "./text";
@@ -28,6 +32,11 @@ type SliderReceiveMessageData = {
min?: number;
max?: number;
step?: number;
// eslint-disable-next-line @typescript-eslint/naming-convention
"data-type"?: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
"time-format"?: string;
timezone?: string;
};
// MUST use window.strftime as the javascript dependency is dynamic
@@ -42,7 +51,7 @@ declare global {
}
// Necessary to get hidden sliders to send their updated values
function forceIonSliderUpdate(slider) {
function forceIonSliderUpdate(slider: any) {
if (slider.$cache && slider.$cache.input)
slider.$cache.input.trigger("change");
else console.log("Couldn't force ion slider to update");
@@ -73,7 +82,7 @@ function getTypePrettifyer(
// The default prettify function for ion.rangeSlider adds thousands
// separators after the decimal mark, so we have our own version here.
// (#1958)
prettify = function (num) {
prettify = function (this: IonRangeSliderOptions, num: number) {
// When executed, `this` will refer to the `IonRangeSlider.options`
// object.
return formatNumber(num, this.prettify_separator);
@@ -104,18 +113,18 @@ class SliderInputBinding extends TextInputBindingBase {
return $(scope).find("input.js-range-slider");
}
getType(el: HTMLElement): string | false {
getType(el: HTMLElement): string | null {
const dataType = $(el).data("data-type");
if (dataType === "date") return "shiny.date";
else if (dataType === "datetime") return "shiny.datetime";
else return false;
else return null;
}
getValue(
el: TextHTMLElement
): number | string | [number | string, number | string] {
const $el = $(el);
const result = $(el).data("ionRangeSlider").result;
const result = $(el).data("ionRangeSlider").result as IonRangeSliderEvent;
// Function for converting numeric value from slider to appropriate type.
let convert: (val: unknown) => number | string;
@@ -182,21 +191,28 @@ class SliderInputBinding extends TextInputBindingBase {
prettify?: Prettify;
} = {};
if (hasOwnProperty(data, "value")) {
if (hasDefinedProperty(data, "value")) {
if (numValues(el) === 2 && data.value instanceof Array) {
msg.from = data.value[0];
msg.to = data.value[1];
} else {
msg.from = data.value as number | string;
if (Array.isArray(data.value)) {
throw "Slider only contains a single value and cannot be updated with an array";
}
msg.from = data.value;
}
}
const sliderFeatures = ["min", "max", "step"];
const sliderFeatures: Array<"max" | "min" | "step"> = [
"min",
"max",
"step",
];
for (let i = 0; i < sliderFeatures.length; i++) {
const feats = sliderFeatures[i];
if (hasOwnProperty(data, feats)) {
if (hasDefinedProperty(data, feats)) {
msg[feats] = data[feats];
}
}
@@ -204,12 +220,16 @@ class SliderInputBinding extends TextInputBindingBase {
updateLabel(data.label, getLabelNode(el));
// (maybe) update data elements
const domElements = ["data-type", "time-format", "timezone"];
const domElements: Array<"data-type" | "time-format" | "timezone"> = [
"data-type",
"time-format",
"timezone",
];
for (let i = 0; i < domElements.length; i++) {
const elem = domElements[i];
if (hasOwnProperty(data, elem)) {
if (hasDefinedProperty(data, elem)) {
$el.data(elem, data[elem]);
}
}
@@ -284,12 +304,12 @@ function formatNumber(
$(document).on("click", ".slider-animate-button", function (evt: Event) {
evt.preventDefault();
const self = $(this);
const target = $("#" + $escape(self.attr("data-target-id")));
const target = $("#" + $escape(self.attr("data-target-id") as string));
const startLabel = "Play";
const stopLabel = "Pause";
const loop =
self.attr("data-loop") !== undefined &&
!/^\s*false\s*$/i.test(self.attr("data-loop"));
!/^\s*false\s*$/i.test(self.attr("data-loop") as string);
let animInterval = self.attr("data-interval") as number | string;
if (isNaN(animInterval as number)) animInterval = 1500;

View File

@@ -1,6 +1,6 @@
import $ from "jquery";
import { InputBinding } from "./inputBinding";
import { hasOwnProperty, isBS3 } from "../../utils";
import { hasDefinedProperty, isBS3 } from "../../utils";
type TabInputReceiveMessageData = { value?: string };
@@ -25,7 +25,7 @@ class BootstrapTabInputBinding extends InputBinding {
return null;
}
setValue(el: HTMLElement, value: string): void {
setValue(el: HTMLElement, value: string | undefined): void {
let success = false;
if (value) {
@@ -56,7 +56,7 @@ class BootstrapTabInputBinding extends InputBinding {
return { value: this.getValue(el) };
}
receiveMessage(el: HTMLElement, data: TabInputReceiveMessageData): void {
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) this.setValue(el, data.value);
$(el).trigger("change");
}
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {

View File

@@ -1,5 +1,5 @@
import $ from "jquery";
import { $escape, updateLabel, hasOwnProperty } from "../../utils";
import { $escape, updateLabel, hasDefinedProperty } from "../../utils";
import { InputBinding } from "./inputBinding";
@@ -109,11 +109,12 @@ class TextInputBinding extends TextInputBindingBase {
};
}
receiveMessage(el: TextHTMLElement, data: TextReceiveMessageData): void {
if (hasOwnProperty(data, "value")) this.setValue(el, data.value);
if (hasDefinedProperty(data, "value")) this.setValue(el, data.value);
updateLabel(data.label, getLabelNode(el));
if (hasOwnProperty(data, "placeholder")) el.placeholder = data.placeholder;
if (hasDefinedProperty(data, "placeholder"))
el.placeholder = data.placeholder;
$(el).trigger("change");
}

View File

@@ -22,9 +22,12 @@ class DatatableOutputBinding extends OutputBinding {
options?: {
searching?: boolean;
search?: { caseInsensitive?: boolean };
// To be sent to data table;
// Will copy in R value to this location
escape?: string;
} | null;
escape?: string; // Incoming from R
action?: string;
escape?: string;
evalOptions?: string[];
callback?: string;
searchDelay?: number;
@@ -42,7 +45,7 @@ class DatatableOutputBinding extends OutputBinding {
header = "<thead><tr>" + header + "</tr></thead>";
let footer = "";
if (data.options === null || data.options.searching !== false) {
if (data.options?.searching ?? true) {
footer = $.map(colnames, function (x) {
// placeholder needs to be escaped (and HTML tags are stripped off)
return (
@@ -62,17 +65,16 @@ class DatatableOutputBinding extends OutputBinding {
$el.append(content);
// options that should be eval()ed
if (data.evalOptions)
if (data.evalOptions) {
$.each(data.evalOptions, function (i, x) {
/*jshint evil: true */
// @ts-expect-error; If `evalOptions` is defined, `data.options` should be defined
data.options[x] = indirectEval("(" + data.options[x] + ")");
});
}
// caseInsensitive searching? default true
const searchCI =
data.options === null ||
typeof data.options.search === "undefined" ||
data.options.search.caseInsensitive !== false;
const searchCI = data.options?.search?.caseInsensitive !== false;
const oTable = $(el)
.children("table")
.DataTable(
@@ -86,8 +88,14 @@ class DatatableOutputBinding extends OutputBinding {
ajax: {
url: data.action,
type: "POST",
data: function (d) {
data: function (d: NonNullable<typeof data.options>) {
d.search || (d.search = {});
d.search.caseInsensitive = searchCI;
// Copy from the R value (`data.escape`) to the escape option
// (`d.escape`) similar to `data.options.escape`;
// Note: this logic may be wrong, but the method is strongly
// deprecated in favor of DT package. So users should not
// naturally run this line of code
d.escape = data.escape;
},
},
@@ -110,7 +118,7 @@ class DatatableOutputBinding extends OutputBinding {
.first()
.unbind("keyup")
.keyup(
debounce(data.searchDelay, function () {
debounce(data.searchDelay, function (this: HTMLInputElement) {
oTable.search(this.value).draw();
})
);
@@ -124,7 +132,7 @@ class DatatableOutputBinding extends OutputBinding {
if (!x.bSearchable) searchInputs.eq(i as number).hide();
});
searchInputs.keyup(
debounce(data.searchDelay, function () {
debounce(data.searchDelay, function (this: HTMLInputElement) {
oTable.column(searchInputs.index(this)).search(this.value).draw();
})
);

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

@@ -17,6 +17,7 @@ import {
import { isIE, IEVersion } from "../../utils/browser";
import type { CoordmapInit } from "../../imageutils/initCoordmap";
import type { ErrorsMessageValue } from "../../shiny/shinyapp";
import { ifUndefined } from "../../utils/object";
class ImageOutputBinding extends OutputBinding {
find(scope: HTMLElement): JQuery<HTMLElement> {
@@ -65,10 +66,6 @@ class ImageOutputBinding extends OutputBinding {
// If value is undefined, return alternate. Sort of like ||, except it won't
// return alternate for other falsy values (0, false, null).
function ifUndefined(value, alternate) {
if (value === undefined) return alternate;
return value;
}
const opts = {
clickId: $el.data("click-id"),

View File

@@ -3,7 +3,7 @@ import { asArray } from "../../utils";
import type { ErrorsMessageValue } from "../../shiny/shinyapp";
class OutputBinding {
name: string;
name!: string;
// Returns a jQuery object or element array that contains the
// descendants of scope that match this binding

View File

@@ -22,7 +22,8 @@ class OutputBindingAdapter {
// onResize with a version that does a makeResizeFilter on the element.
if (binding.resize) {
this.onResize = makeResizeFilter(el, function (width, height) {
binding.resize(el, width, height);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
binding.resize!(el, width, height);
});
}
}

View File

@@ -11,7 +11,7 @@ interface BindingObj<Binding> {
}
class BindingRegistry<Binding extends BindingBase> {
name: string;
name!: string;
bindings: Array<BindingObj<Binding>> = [];
bindingNames: { [key: string]: BindingObj<Binding> } = {};

View File

@@ -0,0 +1,56 @@
// Used to avoid isolated module warning
import type { JQueryEventHandlerBase } from "bootstrap";
import "jquery";
type EvtPrefix<T extends string> = `${T}.${string}`;
type EvtFn<T extends JQuery.Event> = ((evt: T) => void) | null | undefined;
declare global {
interface JQuery {
on(events: EvtPrefix<"change">, handler: EvtFn<JQuery.DragEvent>): this;
on(
events: EvtPrefix<"mousdown">,
handler: EvtFn<JQuery.MouseDownEvent>
): this;
on(
events: EvtPrefix<"dblclick">,
handler: EvtFn<JQuery.DoubleClickEvent>
): this;
on(
events: EvtPrefix<"dblclick2">,
// Note: This may not be the _right type_, but it is how it is handled internally
handler: EvtFn<JQuery.MouseDownEvent>
): this;
on(
events: EvtPrefix<"mousemove">,
handler: EvtFn<JQuery.MouseMoveEvent>
): this;
on(
events: EvtPrefix<"mouseout">,
handler: EvtFn<JQuery.MouseOutEvent>
): this;
on(
events: EvtPrefix<"mousedown">,
handler: EvtFn<JQuery.MouseDownEvent>
): this;
on(
events: EvtPrefix<"mousedown2">,
handler: EvtFn<JQuery.MouseDownEvent>
): this;
on(events: EvtPrefix<"mouseup">, handler: EvtFn<JQuery.MouseUpEvent>): this;
on(events: EvtPrefix<"resize">, handler: EvtFn<JQuery.ResizeEvent>): this;
on(
events: `shown.bs.${string}.sendImageSize`,
selector: string,
handler: (
this: HTMLElement,
e: JQueryEventHandlerBase<HTMLElement, any>
// e: JQuery.Event & {
// namespace: string;
// }
) => void
): this;
}
}

View File

@@ -13,7 +13,7 @@ type UploadEndValue = never;
// FileList object. Subclass/clone it and override the `on*` functions to
// make it do something useful.
class FileProcessor {
files: FileList;
files: File[];
fileIndex = -1;
// Currently need to use small chunk size because R-Websockets can't
// handle continuation frames
@@ -21,7 +21,7 @@ class FileProcessor {
completed = false;
constructor(files: FileList, exec$run = true) {
this.files = files;
this.files = Array.from(files);
// TODO: Register error/abort callbacks
if (exec$run) {
@@ -30,7 +30,7 @@ class FileProcessor {
}
// Begin callbacks. Subclassers/cloners may override any or all of these.
onBegin(files: FileList, cont: () => void): void {
onBegin(files: File[], cont: () => void): void {
files;
setTimeout(cont, 0);
}
@@ -99,10 +99,10 @@ class FileUploader extends FileProcessor {
id: string;
el: HTMLElement;
jobId: JobId;
uploadUrl: UploadUrl;
progressBytes: number;
totalBytes: number;
jobId!: JobId;
uploadUrl!: UploadUrl;
progressBytes!: number;
totalBytes!: number;
constructor(
shinyapp: ShinyApp,
@@ -142,7 +142,7 @@ class FileUploader extends FileProcessor {
): void {
this.shinyapp.makeRequest(method, args, onSuccess, onFailure, blobs);
}
onBegin(files: FileList, cont: () => void): void {
onBegin(files: File[], cont: () => void): void {
// Reset progress bar
this.$setError(null);
this.$setActive(true);
@@ -155,13 +155,12 @@ class FileUploader extends FileProcessor {
this.totalBytes += file.size;
});
const fileInfo = $.map(files, function (file: File, i) {
const fileInfo = $.map(files, function (file: File) {
return {
name: file.name,
size: file.size,
type: file.type,
};
i;
});
this.makeRequest(
@@ -185,6 +184,9 @@ class FileUploader extends FileProcessor {
type: "POST",
cache: false,
xhr: () => {
if (typeof $.ajaxSettings.xhr !== "function")
throw "jQuery's XHR is not a function";
const xhrVal = $.ajaxSettings.xhr();
if (xhrVal.upload) {
@@ -243,7 +245,7 @@ class FileUploader extends FileProcessor {
this.$bar().text("Upload complete");
// Reset the file input's value to "". This allows the same file to be
// uploaded again. https://stackoverflow.com/a/22521275
$(evt.el).val("");
$(evt.el as HTMLElement).val("");
},
(error) => {
this.onError(error);

View File

@@ -18,30 +18,30 @@ type BoundsCss = Bounds;
type BoundsData = Bounds;
type ImageState = {
brushing?: boolean;
dragging?: boolean;
resizing?: boolean;
brushing: boolean;
dragging: boolean;
resizing: boolean;
// Offset of last mouse down and up events (in CSS pixels)
down?: Offset;
up?: Offset;
down: Offset;
up: Offset;
// Which side(s) we're currently resizing
resizeSides?: {
resizeSides: {
left: boolean;
right: boolean;
top: boolean;
bottom: boolean;
};
boundsCss?: BoundsCss;
boundsData?: BoundsData;
boundsCss: BoundsCss;
boundsData: BoundsData;
// Panel object that the brush is in
panel?: Panel;
panel: Panel | null;
// The bounds at the start of a drag/resize (in CSS pixels)
changeStartBounds?: Bounds;
changeStartBounds: Bounds;
};
type BrushOpts = {
@@ -66,9 +66,6 @@ type Brush = {
// A callback when the wrapper div or img is resized.
onResize: () => void;
// TODO define this type as both a getter and a setter interfaces.
// boundsCss: (boxCss: BoundsCss) => void;
// boundsCss: () => BoundsCss;
boundsCss: {
(boxCss: BoundsCss): void;
(): BoundsCss;
@@ -82,11 +79,11 @@ type Brush = {
down: {
(): ImageState["down"];
(offsetCss): void;
(offsetCss: Offset): void;
};
up: {
(): ImageState["up"];
(offsetCss): void;
(offsetCss: Offset): void;
};
isBrushing: () => ImageState["brushing"];
@@ -117,9 +114,9 @@ function createBrush(
const resizeExpand = 10;
const el = $el[0];
let $div = null; // The div representing the brush
let $div: JQuery<HTMLElement> | null = null; // The div representing the brush
const state: ImageState = {};
const state = {} as ImageState;
// Aliases for conciseness
const cssToImg = coordmap.scaleCssToImg;
@@ -223,18 +220,16 @@ function createBrush(
// div being resized.
function onResize() {
const boundsDataVal = boundsData();
// Check to see if we have valid boundsData
for (const val in boundsDataVal) {
if (isnan(boundsDataVal[val])) return;
}
// Check to see if we have valid boundsData
if (Object.values(boundsDataVal).some(isnan)) return;
boundsData(boundsDataVal);
updateDiv();
}
// Return true if the offset is inside min/max coords
function isInsideBrush(offsetCss) {
function isInsideBrush(offsetCss: Offset) {
const bounds = state.boundsCss;
return (
@@ -246,14 +241,14 @@ function createBrush(
}
// Return true if offset is inside a region to start a resize
function isInResizeArea(offsetCss) {
function isInResizeArea(offsetCss: Offset) {
const sides = whichResizeSides(offsetCss);
return sides.left || sides.right || sides.top || sides.bottom;
}
// Return an object representing which resize region(s) the cursor is in.
function whichResizeSides(offsetCss) {
function whichResizeSides(offsetCss: Offset) {
const b = state.boundsCss;
// Bounds with expansion
const e = {
@@ -299,13 +294,14 @@ function createBrush(
function boundsCss(boxCss: BoundsCss): void;
function boundsCss(boxCss?: BoundsCss) {
if (boxCss === undefined) {
return $.extend({}, state.boundsCss);
return { ...state.boundsCss };
}
let minCss = { x: boxCss.xmin, y: boxCss.ymin };
let maxCss = { x: boxCss.xmax, y: boxCss.ymax };
let minCss: Offset = { x: boxCss.xmin, y: boxCss.ymin };
let maxCss: Offset = { x: boxCss.xmax, y: boxCss.ymax };
const panel = state.panel;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const panel = state.panel!;
const panelBoundsImg = panel.range;
if (opts.brushClip) {
@@ -332,8 +328,8 @@ function createBrush(
};
// Positions in data space
const minData = state.panel.scaleImgToData(cssToImg(minCss));
const maxData = state.panel.scaleImgToData(cssToImg(maxCss));
const minData = panel.scaleImgToData(cssToImg(minCss));
const maxData = panel.scaleImgToData(cssToImg(maxCss));
// For reversed scales, the min and max can be reversed, so use findBox
// to ensure correct order.
@@ -342,25 +338,28 @@ function createBrush(
// (#1634).
state.boundsData = mapValues(state.boundsData, (val) =>
roundSignif(val, 14)
) as BoundsData;
);
// We also need to attach the data bounds and panel as data attributes, so
// that if the image is re-sent, we can grab the data bounds to create a new
// brush. This should be fast because it doesn't actually modify the DOM.
$div.data("bounds-data", state.boundsData);
$div.data("panel", state.panel);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$div!.data("bounds-data", state.boundsData);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$div!.data("panel", state.panel);
return undefined;
}
// Get or set the bounds of the brush using coordinates in the data space.
function boundsData(): ImageState["boundsData"];
function boundsData(boxData: Parameters<Panel["scaleDataToImg"]>[0]): void;
function boundsData(boxData?: Parameters<Panel["scaleDataToImg"]>[0]) {
if (boxData === undefined) {
return $.extend({}, state.boundsData);
function boundsData(): BoundsData;
function boundsData(boxData: BoundsData): void;
function boundsData(boxData?: BoundsData | undefined): BoundsData | void {
if (typeof boxData === "undefined") {
return { ...state.boundsData };
}
let boxCss = imgToCss(state.panel.scaleDataToImg(boxData));
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
let boxCss = imgToCss(state.panel!.scaleDataToImg(boxData));
// Round to 13 significant digits to avoid spurious changes in FP values
// (#2197).
@@ -383,6 +382,7 @@ function createBrush(
// Add a new div representing the brush.
function addDiv() {
/* eslint-disable @typescript-eslint/naming-convention */
if ($div) $div.remove();
// Start hidden; we'll show it when movement occurs
@@ -415,7 +415,13 @@ function createBrush(
}
$el.append($div);
$div.offset({ x: 0, y: 0 }).width(0).outerHeight(0);
$div
.offset(
// @ts-expect-error; This is a jQuery Typing issue
{ x: 0, y: 0 }
)
.width(0)
.outerHeight(0);
}
// Update the brush div to reflect the current brush bounds.
@@ -425,7 +431,8 @@ function createBrush(
const imgOffsetCss = findOrigin($el.find("img"));
const b = state.boundsCss;
$div
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$div!
.offset({
top: imgOffsetCss.y + b.ymin,
left: imgOffsetCss.x + b.xmin,
@@ -434,14 +441,18 @@ function createBrush(
.outerHeight(b.ymax - b.ymin + 1);
}
function down(offsetCss?: Offset) {
function down(): ImageState["down"];
function down(offsetCss: Offset): void;
function down(offsetCss?: Offset | undefined) {
if (offsetCss === undefined) return state.down;
state.down = offsetCss;
return undefined;
}
function up(offsetCss?: Offset) {
function up(): ImageState["up"];
function up(offsetCss: Offset): void;
function up(offsetCss?: Offset | undefined) {
if (offsetCss === undefined) return state.up;
state.up = offsetCss;
@@ -463,7 +474,8 @@ function createBrush(
function brushTo(offsetCss: Offset) {
boundsCss(findBox(state.down, offsetCss));
$div.show();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$div!.show();
updateDiv();
}
@@ -479,7 +491,7 @@ function createBrush(
function startDragging() {
state.dragging = true;
state.changeStartBounds = $.extend({}, state.boundsCss);
state.changeStartBounds = { ...state.boundsCss };
}
function dragTo(offsetCss: Offset) {
@@ -498,7 +510,8 @@ function createBrush(
// Clip to the plotting area
if (opts.brushClip) {
const panelBoundsImg = state.panel.range;
const panel = state.panel as Panel;
const panelBoundsImg = panel.range;
const newBoundsImg = cssToImg(newBoundsCss);
// Convert to format for shiftToRange
@@ -539,7 +552,7 @@ function createBrush(
function startResizing() {
state.resizing = true;
state.changeStartBounds = $.extend({}, state.boundsCss);
state.changeStartBounds = { ...state.boundsCss };
state.resizeSides = whichResizeSides(state.down);
}
@@ -554,7 +567,8 @@ function createBrush(
// Calculate what new positions would be, before clipping.
const bImg = cssToImg(state.changeStartBounds);
const panelBoundsImg = state.panel.range;
const panel = state.panel as Panel;
const panelBoundsImg = panel.range;
if (state.resizeSides.left) {
const xminImg = shiftToRange(

View File

@@ -14,8 +14,8 @@ function createClickInfo(
mousedown: (e: JQuery.MouseDownEvent) => void;
dblclickIE8: (e: JQuery.DoubleClickEvent) => void;
} {
let clickTimer: ReturnType<typeof setTimeout> = null;
let pendingE: JQuery.MouseDownEvent = null; // A pending mousedown2 event
let clickTimer: number | undefined = undefined;
let pendingE: JQuery.MouseDownEvent | null = null; // A pending mousedown2 event
// Create a new event of type eventType (like 'mousedown2'), and trigger
// it with the information stored in this.e.
@@ -49,7 +49,7 @@ function createClickInfo(
function scheduleMousedown2(e: JQuery.MouseDownEvent) {
pendingE = e;
clickTimer = setTimeout(function () {
clickTimer = window.setTimeout(function () {
triggerPendingMousedown2();
}, dblclickDelay);
}

View File

@@ -21,7 +21,7 @@ type CreateHandler = {
mouseout?: (e: JQuery.MouseOutEvent) => void;
mousedown?: (e: JQuery.MouseDownEvent) => void;
onResetImg: () => void;
onResize?: () => void;
onResize: ((e: JQuery.ResizeEvent) => void) | null;
};
type BrushInfo = {
@@ -153,7 +153,17 @@ function createBrushHandler(
// el instead of the brush div, because the brush div has
// 'pointer-events:none' so that it won't intercept pointer events.
// If `style` is null, don't add a cursor style.
function setCursorStyle(style) {
function setCursorStyle(
style:
| "crosshair"
| "ew-resize"
| "grabbable"
| "grabbing"
| "nesw-resize"
| "ns-resize"
| "nwse-resize"
| null
) {
$el.removeClass(
"crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize"
);
@@ -177,7 +187,8 @@ function createBrushHandler(
return;
}
const panel = brush.getPanel();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const panel = brush.getPanel()!;
// Add the panel (facet) variables, if present
$.extend(coords, panel.panel_vars);
@@ -212,7 +223,9 @@ function createBrushHandler(
.trigger("shiny-internal:brushed", coords);
}
let brushInfoSender;
let brushInfoSender:
| Debouncer<typeof sendBrushInfo>
| Throttler<typeof sendBrushInfo>;
if (opts.brushDelayType === "throttle") {
brushInfoSender = new Throttler(null, sendBrushInfo, opts.brushDelay);

View File

@@ -3,7 +3,7 @@ import { shinySetInputValue } from "../shiny/initedMethods";
import { mapValues } from "../utils";
import type { Offset } from "./findbox";
import type { Bounds } from "./createBrush";
import type { Panel } from "./initPanelScales";
import type { Panel, PanelInit } from "./initPanelScales";
import { initPanelScales } from "./initPanelScales";
// -----------------------------------------------------------------------
@@ -16,13 +16,16 @@ function findScalingRatio($el: JQuery<HTMLElement>) {
const boundingRect = $el[0].getBoundingClientRect();
return {
x: boundingRect.width / $el.outerWidth(),
y: boundingRect.height / $el.outerHeight(),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
x: boundingRect.width / $el.outerWidth()!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
y: boundingRect.height / $el.outerHeight()!,
};
}
function findOrigin($el: JQuery<HTMLElement>): Offset {
const offset = $el.offset();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const offset = $el.offset()!;
const scalingRatio = findScalingRatio($el);
// Find the size of the padding and border, for the top and left. This is
@@ -50,8 +53,10 @@ function findDims($el: JQuery<HTMLElement>) {
// If there's any padding/border, we need to find the ratio of the actual
// element content compared to the element plus padding and border.
const contentRatio = {
x: $el.width() / $el.outerWidth(),
y: $el.height() / $el.outerHeight(),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
x: $el.width()! / $el.outerWidth()!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
y: $el.height()! / $el.outerHeight()!,
};
// Get the dimensions of the element _after_ any CSS transforms. This
@@ -85,11 +90,13 @@ type Coords = {
};
type CoordmapInit = {
panels: Panel[];
dims: {
height: number;
width: number;
};
panels: PanelInit[];
dims:
| {
height: number;
width: number;
}
| { height: null; width: null };
};
type Coordmap = {
panels: Panel[];
@@ -107,18 +114,19 @@ type Coordmap = {
(offsetImg: Bounds): Bounds;
(offsetImg: Offset): Offset;
(offsetImg: OffsetImg): OffsetCss;
(offsetImg: { [key: string]: number }): { [key: string]: number | null };
};
imgToCssScalingRatio: () => Offset;
cssToImgScalingRatio: () => Offset;
getPanelCss: (offsetCss: OffsetCss, expand?: number) => Panel;
getPanelCss: (offsetCss: OffsetCss, expand?: number) => Panel | null;
isInPanelCss: (offsetCss: OffsetCss, expand?: number) => boolean;
mouseCoordinateSender: (
inputId: string,
clip?: boolean,
nullOutside?: boolean
) => (e: JQuery.MouseDownEvent | JQuery.MouseMoveEvent) => void;
) => (e: JQuery.MouseDownEvent | JQuery.MouseMoveEvent | null) => void;
};
// This adds functions to the coordmap object to handle various
@@ -144,14 +152,13 @@ function initCoordmap(
$el: JQuery<HTMLElement>,
coordmap_: CoordmapInit
): Coordmap {
const coordmap = coordmap_ as Coordmap;
const $img = $el.find("img");
const img = $img[0];
// If we didn't get any panels, create a dummy one where the domain and range
// are simply the pixel dimensions.
// that we modify.
if (coordmap.panels.length === 0) {
if (coordmap_.panels.length === 0) {
const bounds = {
top: 0,
left: 0,
@@ -159,20 +166,23 @@ function initCoordmap(
bottom: img.clientHeight - 1,
};
coordmap.panels[0] = {
coordmap_.panels[0] = {
domain: bounds,
range: bounds,
mapping: {},
};
}
const coordmap = coordmap_ as Coordmap;
// If no dim height and width values are found, set them to the raw image height and width
// These values should be the same...
// This is only done to initialize an image output, whose height and width are unknown until the image is retrieved
coordmap.dims.height = coordmap.dims.height || img.naturalHeight;
coordmap.dims.width = coordmap.dims.width || img.naturalWidth;
// Add scaling functions to each panel
initPanelScales(coordmap.panels);
coordmap.panels = initPanelScales(coordmap_.panels);
// This returns the offset of the mouse in CSS pixels relative to the img,
// but not including the padding or border, if present.
@@ -195,7 +205,7 @@ function initCoordmap(
function scaleCssToImg(offsetCss: Bounds): Bounds;
function scaleCssToImg(offsetCss: Offset): Offset;
function scaleCssToImg(offsetCss: OffsetCss): OffsetImg;
function scaleCssToImg(offsetCss) {
function scaleCssToImg(offsetCss: OffsetCss) {
const pixelScaling = coordmap.imgToCssScalingRatio();
const result = mapValues(offsetCss, (value, key) => {
@@ -221,7 +231,7 @@ function initCoordmap(
function scaleImgToCss(offsetImg: Offset): Offset;
function scaleImgToCss(offsetImg: OffsetImg): OffsetCss;
function scaleImgToCss(offsetImg: { [key: string]: number }): {
[key: string]: number;
[key: string]: number | null;
} {
const pixelScaling = coordmap.imgToCssScalingRatio();
@@ -368,14 +378,15 @@ function initCoordmap(
shinySetInputValue(inputId, coords, { priority: "event" });
return;
}
const panel = coordmap.getPanelCss(coordsCss);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const panel = coordmap.getPanelCss(coordsCss)!;
const coordsImg = coordmap.scaleCssToImg(coordsCss);
const coordsData = panel.scaleImgToData(coordsImg);
const coords: Coords = {
x: coordsData.x,
y: coordsData.y,
x: coordsData?.x,
y: coordsData?.y,
// eslint-disable-next-line @typescript-eslint/naming-convention
coords_css: coordsCss,
// eslint-disable-next-line @typescript-eslint/naming-convention

View File

@@ -2,6 +2,7 @@
import type { Offset } from "./findbox";
import { mapValues } from "../utils";
import type { Bounds } from "./createBrush";
// range.
function mapLinear(
@@ -35,10 +36,10 @@ function scaler1D(
domainMax: number,
rangeMin: number,
rangeMax: number,
logbase: number
logbase: number | null
) {
return {
scale: function (val: number, clip: boolean) {
scale: function (val: number, clip?: boolean) {
if (logbase) val = Math.log(val) / Math.log(logbase);
return mapLinear(val, domainMin, domainMax, rangeMin, rangeMax, clip);
},
@@ -52,7 +53,7 @@ function scaler1D(
};
}
type Panel = {
type PanelInit = {
domain: {
top: number;
bottom: number;
@@ -72,22 +73,22 @@ type Panel = {
mapping: { [key: string]: string };
// eslint-disable-next-line @typescript-eslint/naming-convention
panel_vars?: { [key: string]: number | string };
scaleDataToImg?: (
val: { [key: string]: number },
clip?: boolean
) => { [key: string]: number };
scaleImgToData?: {
};
type Panel = PanelInit & {
scaleDataToImg: {
(val: Bounds, clip?: boolean): Bounds;
};
scaleImgToData: {
(val: Offset, clip?: boolean): Offset;
(val: { [key: string]: number }, clip?: boolean): { [key: string]: number };
};
clipImg?: (offsetImg: { x: number; y: number }) => { x: number; y: number };
clipImg: (offsetImg: { x: number; y: number }) => { x: number; y: number };
};
// Modify panel, adding scale and inverse-scale functions that take objects
// like {x:1, y:3}, and also add clip function.
function addScaleFuns(panel: Panel) {
function addScaleFuns(panel_: PanelInit): Panel {
const panel = panel_ as Panel;
const d = panel.domain;
const r = panel.range;
const xlog = panel.log && panel.log.x ? panel.log.x : null;
@@ -98,7 +99,16 @@ function addScaleFuns(panel: Panel) {
// Given an object of form {x:1, y:2}, or {x:1, xmin:2:, ymax: 3}, convert
// from data coordinates to img. Whether a value is converted as x or y
// depends on the first character of the key.
panel.scaleDataToImg = function (val, clip) {
// (val: Offset, clip?: boolean): Offset;
// (val: Bounds, clip?: boolean): Bounds;
// (val: { [key: `${"x" | "y"}${string}`]: number }, clip?: boolean): { [key: `${"x" | "y"}${string}`]: number }
// (val: { [key: string]: number | null }, clip?: boolean): {
// [key: string]: number | null;
// };
function scaleDataToImg(
val: Bounds,
clip?: Parameters<typeof xscaler.scale>[1]
): Bounds {
return mapValues(val, (value, key) => {
const prefix = key.substring(0, 1);
@@ -107,12 +117,13 @@ function addScaleFuns(panel: Panel) {
} else if (prefix === "y") {
return yscaler.scale(value, clip);
}
// TODO-future; If we know the input is a valid input (starts with x/y), why do we still have this value?
return null;
});
};
}) as Bounds;
}
panel.scaleDataToImg = scaleDataToImg;
function scaleImgToData(val: Offset, clip?: boolean);
function scaleImgToData(val: { [key: string]: number }, clip?: boolean) {
function scaleImgToData(val: Offset, clip?: boolean): Offset {
return mapValues(val, (value, key) => {
const prefix = key.substring(0, 1);
@@ -121,8 +132,9 @@ function addScaleFuns(panel: Panel) {
} else if (prefix === "y") {
return yscaler.scaleInv(value, clip);
}
// TODO-future; If we know the input is a valid input (starts with x/y), why do we still have this value?
return null;
});
}) as Offset;
}
panel.scaleImgToData = scaleImgToData;
@@ -143,20 +155,18 @@ function addScaleFuns(panel: Panel) {
return newOffset;
};
return panel;
}
// Modifies the panel objects in a coordmap, adding scaleImgToData(),
// scaleDataToImg(), and clipImg() functions to each one. The panel objects
// use img and data coordinates only; they do not use css coordinates. The
// domain is in data coordinates; the range is in img coordinates.
function initPanelScales(panels: Panel[]): void {
function initPanelScales(panels: PanelInit[]): Panel[] {
// Add the functions to each panel object.
for (let i = 0; i < panels.length; i++) {
const panel = panels[i];
addScaleFuns(panel);
}
return panels.map((panel) => addScaleFuns(panel));
}
export type { Panel };
export type { Panel, PanelInit };
export { initPanelScales };

View File

@@ -4,8 +4,6 @@ import { determineBrowserInfo } from "./browser";
import { windowShiny } from "../window/libraries";
import { setShiny } from "../shiny";
import { setBlobBuilder } from "../utils/blob";
import { windowBlobBuilder } from "../window/blobBuilder";
import { setUserAgent } from "../utils/userAgent";
import { windowUserAgent } from "../window/userAgent";
@@ -20,8 +18,6 @@ function init(): void {
disableFormSubmission();
setBlobBuilder(windowBlobBuilder());
initReactlog();
}

View File

@@ -1,6 +1,6 @@
import type { EventPriority } from "./inputPolicy";
import type { InputPolicy, InputPolicyOpts } from "./inputPolicy";
import { hasOwnProperty } from "../utils";
import { hasDefinedProperty } from "../utils";
class InputDeferDecorator implements InputPolicy {
pendingInput: {
@@ -18,7 +18,7 @@ class InputDeferDecorator implements InputPolicy {
}
submit(): void {
for (const nameType in this.pendingInput) {
if (hasOwnProperty(this.pendingInput, nameType)) {
if (hasDefinedProperty(this.pendingInput, nameType)) {
const { value, opts } = this.pendingInput[nameType];
this.target.setInput(nameType, value, opts);

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

@@ -1,5 +1,5 @@
import type { InputPolicy, InputPolicyOpts } from "./inputPolicy";
import { hasOwnProperty } from "../utils";
import { hasDefinedProperty } from "../utils";
import { splitInputNameType } from "./splitInputNameType";
type LastSentValues = { [key: string]: { [key: string]: string } };
@@ -40,7 +40,7 @@ class InputNoResendDecorator implements InputPolicy {
} = {};
for (const inputName in values) {
if (hasOwnProperty(values, inputName)) {
if (hasDefinedProperty(values, inputName)) {
const { name, inputType } = splitInputNameType(inputName);
cacheValues[name] = {

Some files were not shown because too many files have changed in this diff Show More