This release reverts the change made in v1.6.3 (to no longer recurse into list-like objects when searching for JavaScript strings wrapped in JS()
). Although that change helped prevent infinite recursion in some cases, it ultimately broke too many existing widgets that relied on the previous behavior. If you encounter infinite recursion errors ("C stack usage is too close to the limit"), the best strategy is to coerce the offending items to a character string. (#478)
- Closed #466: htmlwidgets no longer recurses into list-like objects when searching for JavaScript strings wrapped in
JS()
, unless the object has the class"list"
or"data.frame"
. This stops htmlwidgets from (possibly infinitely) recursively searching objects that are not actually recursive. Widget authors who relied on the previous behavior should ensure that their widget'sJS()
calls are wrapped in objects that have the class"list"
or"data.frame"
. (#467)
- Closed #452:
as.tag.htmlwidget()
now includes...
in it's function signature (for compatibility with thehtmltools::as.tags
generic).
- Closed #456: Fixed an issue where widgets were no longer being resized properly when rendered in a standalone fashion. (#458)
shinyWidgetOutput()
andsizingPolicy()
both gain a newfill
parameter. WhenTRUE
(the default), the widget's container element is allowed to grow/shrink to fit it's parent container so long as that parent is opinionated about its height and has been marked withhtmltools::bindFillRole(x, container = TRUE)
. (#442)- The primary motivation for this is to allow widgets to grow/shrink by default inside
bslib::card_body_fill()
- Widgets that aren't designed to fill their container in this way should consider setting
sizingPolicy(fill = FALSE)
/shinyWidgetOutput(fill = FALSE)
and/or allowing users to customize these settings (i.e., add afill
argument to thecustomWidgetOutput()
function signature).
- The primary motivation for this is to allow widgets to grow/shrink by default inside
shinyWidgetOutput()
'sreportSize
argument now defaults toTRUE
. This way, callingshiny::getCurrentOutputInfo()
inside ashinyRenderWidget()
context will report the current height and width of the widget.
- Closed #433 and #440:
saveWidget(selfcontained=TRUE)
now uses the{rmarkdown}
package to discover and call pandoc, which fixes a couple existing issues and helps "future proof" this code path from future changes to pandoc. - Closed #257 and #358:
saveWidget(selfcontained=TRUE)
now correctly prevents HTML from being interpreted as markdown. (#401)
- Closed #320:
getDependency()
no longer includes an absolute src path in its return value. (#384) - Fixed #408: An error type-check did not work correctly because it was missing parentheses. (#409)
-
Added a
reportTheme
argument toshinyWidgetOutput()
. IfTRUE
, CSS styles of the widget's output container are made available toshiny::getCurrentOutputInfo()
, making it possible to provide 'smart' styling defaults in arenderWidget()
context. (#361) -
shinyRenderWidget()
now has acacheHint
parameter, for use with Shiny's newbindCache()
function. (#391) -
Support a new
PACKAGE::widget_html.WIDGETNAME
convention for defining custom widget HTML. This replaces the earlierPACKAGE::WIDGETNAME_html
convention, which continues to work but may be deprecated at some point in the future. The goal for the new convention is to prevent accidentally matching functions that were never intended for this purpose. (Thanks, @thebioengineer!) (#376) -
Export the
JSEvals
function, allowing other packages to supportJS()
in non-widget contexts.
-
saveWidget()
nowfile
argument now properly handles relative paths. (#299) -
Fixed an issue with passing named function declarations to
JS()
andonRender()
(introduced by v1.4). (#356)
- Emergency patch release to fix an issue with rendering htmlwidgets in flexdashboard. More generally, this change implies that any htmlwidget is printed via a knitr code chunk with multiple values for fig.width/fig.height, only the first value is used for the widget's sizing policy. (#387)
- Fixed an issue with dynamically rendered widgets (i.e., using
shiny::uiOutput()
to render a widget) with any version of shiny prior to 1.4. This issue was introduced by # htmlwidgets 1.5. (#351)
- Fixed an incompatibility with Shiny v1.4.0: due to Shiny upgrading
from jQuery 1.x to 3.x, the timing of some initialization routines
has changed. This caused some widget
renderValue
calls to occur at an earlier point in Shiny's initialization process than with earlier versions of Shiny. (#345)
- JavaScript statements can now be passed along to
onRender()
andJS()
(#329).
-
All files and directories under the
inst/htmlwidgets/
directory of a widget package will be copied when a widget is rendered due to an unintended change in #306. Only the singleWIDGET.js
file should be copied (whereWIDGET
is the widget name). Fixed via #312. -
Support for async Shiny. Widget render functions that use the default implementation of
htmlwidgets::shinyRenderWidget
can receive promises of widget objects (you can, of course, continue to use regular widget objects as well).See https://rstudio.github.io/promises for more about async Shiny.
-
htmlwidgets can be created without a package, without yaml, and/or without JavaScript binding. (#304, #305)
-
Use RStudio Page Viewer for full page widgets.
-
Fix #297: Setting background in saveWidget() is broken
- The saveWidget's background parameter could not process hex color codes, due to changes introduced in htmlwidgets 1.0. (#297)
- Fix issues with self-contained mode when used with new versions of pandoc. (#289)
-
Starting with R 3.4.0, a "Calling 'structure(NULL, *)' is deprecated" warning would occur when shinyRenderWidget encountered a NULL value. (#269)
-
Fix edge case where using dynamic HTML dependencies from a widget binding's JS factory function would fail.
-
Export getDependency function
-
onRender
hooks were firing too early when used in Shiny apps. -
Widget IDs: only restore random.seed when non-NULL
-
Pass knitr options to saveWidget
-
Ensure that scaffoldWidget opens files correctly within RStudio
-
The resize handler also works for the JavaScript events
shown.bs.collapse
andhidden.bs.collapse
now so that widgets inside the Bootstrap collapse class can be displayed -
Fix references to vignettes in documentation
-
Add elementId parameter to widget function generated by scaffoldWidget
-
More robust method of generating unique widget IDs
-
Modify advanced and sizing vignettes to use new style widget declarations
-
Introduce new scheme for defining JavaScript bindings that will make it easier for widgets to gain access to other widget instances on the page.
-
Add
onRender
hook for widgets to execute custom JavaScript code after rendering. -
Add
appendContent
andprependContent
functions for adding HTML to a widget rendered in a static context (i.e. R console or Rmd) -
Fix a bug where the string
</body></html>
in the widget data causedsaveWidget()
to have malformed output. (#168) -
Tweak pandoc conversion used in saveWidget to prevent hanging with large htmlwidget script data elements (use "markdown" rather than "markdown-strict" as input format)
-
Increase pandoc stack size to 512M for saveWidget (often required for e.g. larger embedded leaflet maps). Stack size can also be controlled by the pandoc.stack.size option.
-
Import latest version of with_pandoc_safe_environment from rmarkdown
-
Fix issue that prevented calling renderValue() from within resize()
-
Add background parameter to saveWidget function
-
Fix a bug where
</script>
appearing in widget data would break parsing -
Fix a bug where multiple widgets on a page caused all but one to miss resize events
-
Sync vignettes with contents of htmlwidgets website
-
Use minified files while scaffolding widget wherever available
-
Suppress viewing widgets in non-interactive R sessions by default
-
Export the HTMLWidgets.staticRender function
-
Add a preRenderHook for widgets
-
Use jsonlite rather than RJSONIO for JSON serialization
-
Call widget.resize in more situations
- Initial release to CRAN