diff --git a/.gitignore b/.gitignore index 75a35d751..f2e390253 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .DS_Store docs/ sandbox/ -revdep/ inst/themer-demo/deploy/rsconnect inst/examples/*/rsconnect/ diff --git a/DESCRIPTION b/DESCRIPTION index b5a8e4bce..065e70622 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: bslib Title: Custom 'Bootstrap' 'Sass' Themes for 'shiny' and 'rmarkdown' -Version: 0.5.0.9000 +Version: 0.5.1 Authors@R: c( - person("Carson", "Sievert", role = c("aut", "cre"), email = "carson@rstudio.com", comment = c(ORCID = "0000-0002-4958-2844")), - person("Joe", "Cheng", role = "aut", email = "joe@rstudio.com"), + person("Carson", "Sievert", role = c("aut", "cre"), email = "carson@posit.co", comment = c(ORCID = "0000-0002-4958-2844")), + person("Joe", "Cheng", role = "aut", email = "joe@posit.co"), person("Garrick", "Aden-Buie", role = "aut", email = "garrick@posit.co", comment = c(ORCID = "0000-0002-7111-0077")), - person(given = "Posit Software, PBC", role = c("cph", "fnd")), + person("Posit Software, PBC", role = c("cph", "fnd")), person(family = "Bootstrap contributors", role = "ctb", comment = "Bootstrap library"), person(family = "Twitter, Inc", role = "cph", @@ -68,6 +68,7 @@ Collate: 'bs-theme-preview.R' 'bs-theme-update.R' 'bs-theme.R' + 'bslib-package.R' 'card.R' 'deprecated.R' 'files.R' diff --git a/LICENSE b/LICENSE index 8c2ccf3b7..69578a3e5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2021 +YEAR: 2021-2023 COPYRIGHT HOLDER: bslib contributors diff --git a/NEWS.md b/NEWS.md index d79bc01f0..a6abf505f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# bslib 0.5.0.9000 +# bslib 0.5.1 ## New features @@ -10,7 +10,7 @@ ## Improvements * Closed quarto-dev/quarto-cli#6081: `{bslib}`'s components (e.g., `card()`, `sidebar()`, etc.) now work more sensibly in Quarto docs. (#664) -* `sidebar()` gains `gap` and `padding` arguments to control the vertical gap between items in the sidebar and the padding around the sidebar's content. (#725) +* Closed #672: `sidebar()` gains `gap` and `padding` arguments to control the vertical gap between items in the sidebar and the padding around the sidebar's content. (#725) ## Bug fixes diff --git a/R/bslib-package.R b/R/bslib-package.R new file mode 100644 index 000000000..3dda036a1 --- /dev/null +++ b/R/bslib-package.R @@ -0,0 +1,17 @@ +utils::globalVariables("!!") + +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start +#' @import htmltools +#' @import sass +#' @importFrom utils modifyList packageVersion download.file URLencode getFromNamespace head +#' @importFrom stats setNames na.omit +#' @importFrom grDevices col2rgb +#' @importFrom tools file_path_sans_ext +#' @importFrom jquerylib jquery_core +#' @importFrom jsonlite fromJSON +#' @importFrom rlang := list2 abort +## usethis namespace: end +NULL diff --git a/R/imports.R b/R/imports.R index c4d8a3c64..958e3b5fd 100644 --- a/R/imports.R +++ b/R/imports.R @@ -1,17 +1,3 @@ -utils::globalVariables("!!") - -#' @import htmltools -#' @import sass -#' @importFrom utils modifyList packageVersion download.file URLencode getFromNamespace head -#' @importFrom stats setNames na.omit -#' @importFrom grDevices col2rgb -#' @importFrom tools file_path_sans_ext -#' @importFrom jquerylib jquery_core -#' @importFrom jsonlite fromJSON -#' @importFrom rlang := list2 abort -NULL - - #' Helpers for importing web fonts #' #' `font_google()`, `font_link()`, and `font_face()` are all re-exported from diff --git a/inst/components/dist/accordion/accordion.js b/inst/components/dist/accordion/accordion.js index 440b38acf..7d7aa6316 100644 --- a/inst/components/dist/accordion/accordion.js +++ b/inst/components/dist/accordion/accordion.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict"; (() => { // srcts/src/components/_utils.ts diff --git a/inst/components/dist/accordion/accordion.min.js b/inst/components/dist/accordion/accordion.min.js index e061b4337..ad281017e 100644 --- a/inst/components/dist/accordion/accordion.min.js +++ b/inst/components/dist/accordion/accordion.min.js @@ -1,3 +1,3 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict";(()=>{var a=window.Shiny?Shiny.InputBinding:class{};function c(i,e){window.Shiny&&Shiny.inputBindings.register(new i,"bslib."+e)}function r(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&i[e]!==void 0}var l=class extends a{find(e){return $(e).find(".accordion.bslib-accordion-input")}getValue(e){let n=this._getItemInfo(e).filter(s=>s.isOpen()).map(s=>s.value);return n.length===0?null:n}subscribe(e,t){$(e).on("shown.bs.collapse.accordionInputBinding hidden.bs.collapse.accordionInputBinding",function(n){t(!0)})}unsubscribe(e){$(e).off(".accordionInputBinding")}receiveMessage(e,t){let n=t.method;if(n==="set")this._setItems(e,t);else if(n==="open")this._openItems(e,t);else if(n==="close")this._closeItems(e,t);else if(n==="remove")this._removeItem(e,t);else if(n==="insert")this._insertItem(e,t);else if(n==="update")this._updateItem(e,t);else throw new Error(`Method not yet implemented: ${n}`)}_setItems(e,t){let n=this._getItemInfo(e),s=this._getValues(e,n,t.values);n.forEach(o=>{s.indexOf(o.value)>-1?o.show():o.hide()})}_openItems(e,t){let n=this._getItemInfo(e),s=this._getValues(e,n,t.values);n.forEach(o=>{s.indexOf(o.value)>-1&&o.show()})}_closeItems(e,t){let n=this._getItemInfo(e),s=this._getValues(e,n,t.values);n.forEach(o=>{s.indexOf(o.value)>-1&&o.hide()})}_insertItem(e,t){let n=this._findItem(e,t.target);n||(n=t.position==="before"?e.firstElementChild:e.lastElementChild);let s=t.panel;if(n?Shiny.renderContent(n,s,t.position==="before"?"beforeBegin":"afterEnd"):Shiny.renderContent(e,s),this._isAutoClosing(e)){let o=$(s.html).attr("data-value");$(e).find(`[data-value="${o}"] .accordion-collapse`).attr("data-bs-parent","#"+e.id)}}_removeItem(e,t){let n=this._getItemInfo(e).filter(o=>t.target.indexOf(o.value)>-1),s=Shiny==null?void 0:Shiny.unbindAll;n.forEach(o=>{s&&s(o.item),o.item.remove()})}_updateItem(e,t){let n=this._findItem(e,t.target);if(!n)throw new Error(`Unable to find an accordion_panel() with a value of ${t.target}`);if(r(t,"value")&&(n.dataset.value=t.value),r(t,"body")){let o=n.querySelector(".accordion-body");Shiny.renderContent(o,t.body)}let s=n.querySelector(".accordion-header");if(r(t,"title")){let o=s.querySelector(".accordion-title");Shiny.renderContent(o,t.title)}if(r(t,"icon")){let o=s.querySelector(".accordion-button > .accordion-icon");Shiny.renderContent(o,t.icon)}}_getItemInfo(e){return Array.from(e.querySelectorAll(":scope > .accordion-item")).map(n=>this._getSingleItemInfo(n))}_getSingleItemInfo(e){let t=e.querySelector(".accordion-collapse"),n=()=>$(t).hasClass("show");return{item:e,value:e.dataset.value,isOpen:n,show:()=>{n()||$(t).collapse("show")},hide:()=>{n()&&$(t).collapse("hide")}}}_getValues(e,t,n){let s=n!==!0?n:t.map(d=>d.value);return this._isAutoClosing(e)&&(s=s.slice(s.length-1,s.length)),s}_findItem(e,t){return e.querySelector(`[data-value="${t}"]`)}_isAutoClosing(e){return e.classList.contains("autoclose")}};c(l,"accordion");})(); //# sourceMappingURL=accordion.min.js.map diff --git a/inst/components/dist/bslibShiny/bslibShiny.js b/inst/components/dist/bslibShiny/bslibShiny.js index 1b2af009f..2fb98dd9f 100644 --- a/inst/components/dist/bslibShiny/bslibShiny.js +++ b/inst/components/dist/bslibShiny/bslibShiny.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict"; (() => { // srcts/src/components/_utils.ts diff --git a/inst/components/dist/bslibShiny/bslibShiny.min.js b/inst/components/dist/bslibShiny/bslibShiny.min.js index 423f6d360..c1c71a60b 100644 --- a/inst/components/dist/bslibShiny/bslibShiny.min.js +++ b/inst/components/dist/bslibShiny/bslibShiny.min.js @@ -1,3 +1,3 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict";(()=>{var o=window.Shiny?Shiny.InputBinding:class{};Shiny.addCustomMessageHandler("bslib.toggle-input-binary",function(e){let n=document.getElementById(e.id);n||console.warn("[bslib.toggle-input-binary] No element found",e);let t=$(n).data("shiny-input-binding");if(!(t instanceof o)){console.warn("[bslib.toggle-input-binary] No input binding found",e);return}let i=e.value;typeof i=="undefined"&&(i=!t.getValue(n)),t.receiveMessage(n,{value:i})});})(); //# sourceMappingURL=bslibShiny.min.js.map diff --git a/inst/components/dist/card/card.js b/inst/components/dist/card/card.js index c4a699ec3..f6932b226 100644 --- a/inst/components/dist/card/card.js +++ b/inst/components/dist/card/card.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict"; (() => { // srcts/src/components/_utils.ts diff --git a/inst/components/dist/card/card.min.js b/inst/components/dist/card/card.min.js index 9d87a6708..a762d3af6 100644 --- a/inst/components/dist/card/card.min.js +++ b/inst/components/dist/card/card.min.js @@ -1,3 +1,3 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict";(()=>{var p=window.Shiny?Shiny.InputBinding:class{};function h(u){let e=["a[href]","area[href]","button","details summary","input","iframe","select","textarea",'[contentEditable=""]','[contentEditable="true"]','[contentEditable="TRUE"]',"[tabindex]"],t=[':not([tabindex="-1"])',":not([disabled])"],s=e.map(i=>i+t.join("")),r=u.querySelectorAll(s.join(", "));return Array.from(r)}var d=class{constructor(){this.resizeObserverEntries=[],this.resizeObserver=new ResizeObserver(e=>{let t=new Event("resize");if(window.dispatchEvent(t),!window.Shiny)return;let s=[];for(let r of e)r.target instanceof HTMLElement&&r.target.querySelector(".shiny-bound-output")&&r.target.querySelectorAll(".shiny-bound-output").forEach(i=>{if(s.includes(i))return;let{binding:o,onResize:E}=$(i).data("shinyOutputBinding");if(!o||!o.resize)return;let c=i.shinyResizeObserver;if(c&&c!==this||(c||(i.shinyResizeObserver=this),E(i),s.push(i),!i.classList.contains("shiny-plot-output")))return;let l=i.querySelector('img:not([width="100%"])');l&&l.setAttribute("width","100%")})})}observe(e){this.resizeObserver.observe(e),this.resizeObserverEntries.push(e)}unobserve(e){let t=this.resizeObserverEntries.indexOf(e);t<0||(this.resizeObserver.unobserve(e),this.resizeObserverEntries.splice(t,1))}flush(){this.resizeObserverEntries.forEach(e=>{document.body.contains(e)||this.unobserve(e)})}};var n=class{constructor(e){var t;e.removeAttribute(n.attr.ATTR_INIT),(t=e.querySelector(`script[${n.attr.ATTR_INIT}]`))==null||t.remove(),this.card=e,n.instanceMap.set(e,this),n.shinyResizeObserver.observe(this.card),this._addEventListeners(),this.overlay=this._createOverlay(),this._exitFullScreenOnEscape=this._exitFullScreenOnEscape.bind(this),this._trapFocusExit=this._trapFocusExit.bind(this)}enterFullScreen(e){var t;e&&e.preventDefault(),document.addEventListener("keydown",this._exitFullScreenOnEscape,!1),document.addEventListener("keydown",this._trapFocusExit,!0),this.card.setAttribute(n.attr.ATTR_FULL_SCREEN,"true"),document.body.classList.add(n.attr.CLASS_HAS_FULL_SCREEN),this.card.insertAdjacentElement("beforebegin",this.overlay.container),(!this.card.contains(document.activeElement)||(t=document.activeElement)!=null&&t.classList.contains(n.attr.CLASS_FULL_SCREEN_ENTER))&&(this.card.setAttribute("tabindex","-1"),this.card.focus())}exitFullScreen(){document.removeEventListener("keydown",this._exitFullScreenOnEscape,!1),document.removeEventListener("keydown",this._trapFocusExit,!0),this.overlay.container.remove(),this.card.setAttribute(n.attr.ATTR_FULL_SCREEN,"false"),this.card.removeAttribute("tabindex"),document.body.classList.remove(n.attr.CLASS_HAS_FULL_SCREEN)}_addEventListeners(){let e=this.card.querySelector(`:scope > * > .${n.attr.CLASS_FULL_SCREEN_ENTER}`);e&&e.addEventListener("click",t=>this.enterFullScreen(t))}_exitFullScreenOnEscape(e){if(!(e.target instanceof HTMLElement))return;let t=["select[open]","input[aria-expanded='true']"];e.target.matches(t.join(", "))||e.key==="Escape"&&this.exitFullScreen()}_trapFocusExit(e){if(!(e instanceof KeyboardEvent)||e.key!=="Tab")return;let t=e.target===this.card,s=e.target===this.overlay.anchor,r=this.card.contains(e.target),i=()=>{e.preventDefault(),e.stopImmediatePropagation()};if(!(r||t||s)){i(),this.card.focus();return}let o=h(this.card).filter(b=>!b.classList.contains(n.attr.CLASS_FULL_SCREEN_ENTER));if(!(o.length>0)){i(),this.overlay.anchor.focus();return}if(t)return;let c=o[o.length-1],l=e.target===c;if(s&&e.shiftKey){i(),c.focus();return}if(l&&!e.shiftKey){i(),this.overlay.anchor.focus();return}}_createOverlay(){let e=document.createElement("div");e.id=n.attr.ID_FULL_SCREEN_OVERLAY,e.onclick=this.exitFullScreen.bind(this);let t=this._createOverlayCloseAnchor();return e.appendChild(t),{container:e,anchor:t}}_createOverlayCloseAnchor(){let e=document.createElement("a");return e.classList.add(n.attr.CLASS_FULL_SCREEN_EXIT),e.tabIndex=0,e.onclick=()=>this.exitFullScreen(),e.onkeydown=t=>{(t.key==="Enter"||t.key===" ")&&this.exitFullScreen()},e.innerHTML=this._overlayCloseHtml(),e}_overlayCloseHtml(){return"Close "}static getInstance(e){return n.instanceMap.get(e)}static initializeAllCards(e=!0){if(document.readyState==="loading"){n.onReadyScheduled||(n.onReadyScheduled=!0,document.addEventListener("DOMContentLoaded",()=>{n.initializeAllCards(!1)}));return}e&&n.shinyResizeObserver.flush();let t=`.${n.attr.CLASS_CARD}[${n.attr.ATTR_INIT}]`;if(!document.querySelector(t))return;document.querySelectorAll(t).forEach(r=>new n(r))}},a=n;a.attr={ATTR_INIT:"data-bslib-card-init",CLASS_CARD:"bslib-card",ATTR_FULL_SCREEN:"data-full-screen",CLASS_HAS_FULL_SCREEN:"bslib-has-full-screen",CLASS_FULL_SCREEN_ENTER:"bslib-full-screen-enter",CLASS_FULL_SCREEN_EXIT:"bslib-full-screen-exit",ID_FULL_SCREEN_OVERLAY:"bslib-full-screen-overlay"},a.shinyResizeObserver=new d,a.instanceMap=new WeakMap,a.onReadyScheduled=!1;window.bslib=window.bslib||{};window.bslib.Card=a;})(); //# sourceMappingURL=card.min.js.map diff --git a/inst/components/dist/sidebar/sidebar.js b/inst/components/dist/sidebar/sidebar.js index df0b4ee38..7891ca905 100644 --- a/inst/components/dist/sidebar/sidebar.js +++ b/inst/components/dist/sidebar/sidebar.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict"; (() => { // srcts/src/components/_utils.ts diff --git a/inst/components/dist/sidebar/sidebar.min.js b/inst/components/dist/sidebar/sidebar.min.js index 04d2320db..6f9b53930 100644 --- a/inst/components/dist/sidebar/sidebar.min.js +++ b/inst/components/dist/sidebar/sidebar.min.js @@ -1,3 +1,3 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict";(()=>{var g=window.Shiny?Shiny.InputBinding:class{};function f(b,e){window.Shiny&&Shiny.inputBindings.register(new b,"bslib."+e)}var u=class{constructor(){this.resizeObserverEntries=[],this.resizeObserver=new ResizeObserver(e=>{let t=new Event("resize");if(window.dispatchEvent(t),!window.Shiny)return;let i=[];for(let r of e)r.target instanceof HTMLElement&&r.target.querySelector(".shiny-bound-output")&&r.target.querySelectorAll(".shiny-bound-output").forEach(o=>{if(i.includes(o))return;let{binding:l,onResize:d}=$(o).data("shinyOutputBinding");if(!l||!l.resize)return;let s=o.shinyResizeObserver;if(s&&s!==this||(s||(o.shinyResizeObserver=this),d(o),i.push(o),!o.classList.contains("shiny-plot-output")))return;let c=o.querySelector('img:not([width="100%"])');c&&c.setAttribute("width","100%")})})}observe(e){this.resizeObserver.observe(e),this.resizeObserverEntries.push(e)}unobserve(e){let t=this.resizeObserverEntries.indexOf(e);t<0||(this.resizeObserver.unobserve(e),this.resizeObserverEntries.splice(t,1))}flush(){this.resizeObserverEntries.forEach(e=>{document.body.contains(e)||this.unobserve(e)})}};var n=class{constructor(e){if(n.instanceMap.set(e,this),this.layout={container:e,main:e.querySelector(":scope > .main"),sidebar:e.querySelector(":scope > .sidebar"),toggle:e.querySelector(":scope > .collapse-toggle")},!this.layout.toggle)throw new Error("Tried to initialize a non-collapsible sidebar.");let t=this.layout.sidebar.querySelector(":scope > .sidebar-content > .accordion");t&&t.classList.add("accordion-flush"),this._initEventListeners(),this._initSidebarCounters(),this._initDesktop(),n.shinyResizeObserver.observe(this.layout.main),e.removeAttribute("data-bslib-sidebar-init");let i=e.querySelector(":scope > script[data-bslib-sidebar-init]");i&&e.removeChild(i)}get isClosed(){return this.layout.container.classList.contains(n.classes.COLLAPSE)}static getInstance(e){return n.instanceMap.get(e)}static initCollapsibleAll(e=!0){if(document.readyState==="loading"){n.onReadyScheduled||(n.onReadyScheduled=!0,document.addEventListener("DOMContentLoaded",()=>{n.initCollapsibleAll(!1)}));return}let t=`.${n.classes.LAYOUT}[data-bslib-sidebar-init]`;if(!document.querySelector(t))return;e&&n.shinyResizeObserver.flush(),document.querySelectorAll(t).forEach(r=>new n(r))}_initEventListeners(){var t;let{toggle:e}=this.layout;e.addEventListener("click",i=>{i.preventDefault(),this.toggle("toggle")}),(t=e.querySelector(".collapse-icon"))==null||t.addEventListener("transitionend",()=>this._finalizeState())}_initSidebarCounters(){let{container:e}=this.layout,t=`.${n.classes.LAYOUT}> .main > .${n.classes.LAYOUT}:not([data-bslib-sidebar-open="always"])`;if(!(e.querySelector(t)===null))return;function r(s){return s=s?s.parentElement:null,s&&s.classList.contains("main")&&(s=s.parentElement),s&&s.classList.contains(n.classes.LAYOUT)?s:null}let o=[e],l=r(e);for(;l;)o.unshift(l),l=r(l);let d={left:0,right:0};o.forEach(function(s,c){s.style.setProperty("--bslib-sidebar-counter",c.toString());let h=s.classList.contains("sidebar-right")?d.right++:d.left++;s.style.setProperty("--bslib-sidebar-overlap-counter",h.toString())})}_initDesktop(){var i;let{container:e}=this.layout;if(((i=e.dataset.bslibSidebarOpen)==null?void 0:i.trim())!=="desktop")return;window.getComputedStyle(e).getPropertyValue("--bslib-sidebar-js-init-collapsed").trim()==="true"&&this.toggle("close")}toggle(e){typeof e=="undefined"&&(e="toggle");let{container:t,sidebar:i}=this.layout,r=this.isClosed;if(["open","close","toggle"].indexOf(e)===-1)throw new Error(`Unknown method ${e}`);e==="toggle"&&(e=r?"open":"close"),!(r&&e==="close"||!r&&e==="open")&&(e==="open"&&(i.hidden=!1),t.classList.add(n.classes.TRANSITIONING),t.classList.toggle(n.classes.COLLAPSE))}_finalizeState(){let{container:e,sidebar:t,toggle:i}=this.layout;e.classList.remove(n.classes.TRANSITIONING),t.hidden=this.isClosed,i.setAttribute("aria-expanded",this.isClosed?"false":"true");let r=new CustomEvent("bslib.sidebar",{bubbles:!0,detail:{open:!this.isClosed}});t.dispatchEvent(r),$(t).trigger("toggleCollapse.sidebarInputBinding"),$(t).trigger(this.isClosed?"hidden":"shown")}},a=n;a.shinyResizeObserver=new u,a.classes={LAYOUT:"bslib-sidebar-layout",COLLAPSE:"sidebar-collapsed",TRANSITIONING:"transitioning"},a.onReadyScheduled=!1,a.instanceMap=new WeakMap;var p=class extends g{find(e){return $(e).find(`.${a.classes.LAYOUT} > .bslib-sidebar-input`)}getValue(e){let t=a.getInstance(e.parentElement);return t?!t.isClosed:!1}setValue(e,t){let i=t?"open":"close";this.receiveMessage(e,{method:i})}subscribe(e,t){$(e).on("toggleCollapse.sidebarInputBinding",function(i){t(!0)})}unsubscribe(e){$(e).off(".sidebarInputBinding")}receiveMessage(e,t){let i=a.getInstance(e.parentElement);i&&i.toggle(t.method)}};f(p,"sidebar");window.bslib=window.bslib||{};window.bslib.Sidebar=a;})(); //# sourceMappingURL=sidebar.min.js.map diff --git a/inst/components/dist/webComponents/webComponents.js b/inst/components/dist/webComponents/webComponents.js index 88bcbaf30..6d28ff3fc 100644 --- a/inst/components/dist/webComponents/webComponents.js +++ b/inst/components/dist/webComponents/webComponents.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict"; (() => { var __defProp = Object.defineProperty; diff --git a/inst/components/dist/webComponents/webComponents.min.js b/inst/components/dist/webComponents/webComponents.min.js index 09ee7b5d0..40d95dcf9 100644 --- a/inst/components/dist/webComponents/webComponents.min.js +++ b/inst/components/dist/webComponents/webComponents.min.js @@ -1,4 +1,4 @@ -/*! bslib 0.5.0.9000 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ +/*! bslib 0.5.1 | (c) 2012-2023 RStudio, PBC. | License: MIT + file LICENSE */ "use strict";(()=>{var $e=Object.defineProperty,je=Object.defineProperties,Be=Object.getOwnPropertyDescriptor,Ke=Object.getOwnPropertyDescriptors;var Ee=Object.getOwnPropertySymbols;var Fe=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var _e=(n,e,t)=>e in n?$e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))Fe.call(e,t)&&_e(n,t,e[t]);if(Ee)for(var t of Ee(e))We.call(e,t)&&_e(n,t,e[t]);return n},j=(n,e)=>je(n,Ke(e));var L=(n,e,t,i)=>{for(var s=i>1?void 0:i?Be(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&$e(e,t,s),s};var ee=(n,e,t)=>new Promise((i,s)=>{var r=l=>{try{h(t.next(l))}catch(a){s(a)}},o=l=>{try{h(t.throw(l))}catch(a){s(a)}},h=l=>l.done?i(l.value):Promise.resolve(l.value).then(r,o);h((t=t.apply(n,e)).next())});var Je=(n,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?j(y({},e),{finisher(t){t.createProperty(e.key,n)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,n)}},Ge=(n,e,t)=>{e.constructor.createProperty(t,n)};function A(n){return(e,t)=>t!==void 0?Ge(n,e,t):Je(n,e)}var te,$t=((te=window.HTMLSlotElement)===null||te===void 0?void 0:te.prototype.assignedElements)!=null?(n,e)=>n.assignedElements(e):(n,e)=>n.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var B=window,K=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ie=Symbol(),Ae=new WeakMap,R=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==ie)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(K&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Ae.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ae.set(t,e))}return e}toString(){return this.cssText}},Ce=n=>new R(typeof n=="string"?n:n+"",void 0,ie),se=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((i,s,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[r+1],n[0]);return new R(t,n,ie)},ne=(n,e)=>{K?n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),s=B.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,n.appendChild(i)})},F=K?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Ce(t)})(n):n;var re,W=window,Se=W.trustedTypes,Qe=Se?Se.emptyScript:"",Te=W.reactiveElementPolyfillSupport,le={toAttribute(n,e){switch(e){case Boolean:n=n?Qe:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch(i){t=null}}return t}},we=(n,e)=>e!==n&&(e==e||n==n),oe={attribute:!0,type:String,converter:le,reflect:!1,hasChanged:we},ae="finalized",m=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let s=this._$Ep(i,t);s!==void 0&&(this._$Ev.set(s,i),e.push(s))}),e}static createProperty(e,t=oe){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){let r=this[e];this[t]=s,this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||oe}static finalize(){if(this.hasOwnProperty(ae))return!1;this[ae]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(F(s))}else e!==void 0&&t.push(F(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return ne(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=oe){var s;let r=this.constructor._$Ep(e,i);if(r!==void 0&&i.reflect===!0){let o=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:le).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(e,t){var i;let s=this.constructor,r=s._$Ev.get(e);if(r!==void 0&&this._$El!==r){let o=s.getPropertyOptions(r),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:le;this._$El=r,this[r]=h.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let s=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||we)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}_$Ej(){return ee(this,null,function*(){this.isUpdatePending=!0;try{yield this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&(yield e),!this.isUpdatePending})}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,r)=>this[r]=s),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(s=>{var r;return(r=s.hostUpdate)===null||r===void 0?void 0:r.call(s)}),this.update(i)):this._$Ek()}catch(s){throw t=!1,this._$Ek(),s}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};m[ae]=!0,m.elementProperties=new Map,m.elementStyles=[],m.shadowRootOptions={mode:"open"},Te==null||Te({ReactiveElement:m}),((re=W.reactiveElementVersions)!==null&&re!==void 0?re:W.reactiveElementVersions=[]).push("1.6.2");var he,J=window,M=J.trustedTypes,Oe=M?M.createPolicy("lit-html",{createHTML:n=>n}):void 0,de="$lit$",b=`lit$${(Math.random()+"").slice(9)}$`,Ie="?"+b,Ze=`<${Ie}>`,T=document,N=()=>T.createComment(""),z=n=>n===null||typeof n!="object"&&typeof n!="function",Re=Array.isArray,Xe=n=>Re(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",pe=`[ \f\r]`,U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,He=/-->/g,Le=/>/g,C=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Me=/'/g,xe=/"/g,Ue=/^(?:script|style|textarea|title)$/i,Ne=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),G=Ne(1),jt=Ne(2),w=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Pe=new WeakMap,S=T.createTreeWalker(T,129,null,!1);function ze(n,e){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Oe!==void 0?Oe.createHTML(e):e}var Ye=(n,e)=>{let t=n.length-1,i=[],s,r=e===2?"":"",o=U;for(let h=0;h"?(o=s!=null?s:U,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,a=p[1],o=p[3]===void 0?C:p[3]==='"'?xe:Me):o===xe||o===Me?o=C:o===He||o===Le?o=U:(o=C,s=void 0);let v=o===C&&n[h+1].startsWith("/>")?" ":"";r+=o===U?l+Ze:d>=0?(i.push(a),l.slice(0,d)+de+l.slice(d)+b+v):l+b+(d===-2?(i.push(void 0),h):v)}return[ze(n,r+(n[t]||"")+(e===2?"":"")),i]},O=class{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0,h=e.length-1,l=this.parts,[a,p]=Ye(e,t);if(this.el=O.createElement(a,i),S.currentNode=this.el.content,t===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(s=S.nextNode())!==null&&l.length0){s.textContent=M?M.emptyScript:"";for(let v=0;v2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,s){let r=this.strings,o=!1;if(r===void 0)e=x(this,e,t,0),o=!z(e)||e!==this._$AH&&e!==w,o&&(this._$AH=e);else{let h=e,l,a;for(e=r[0],l=0;l{var i,s;let r=(i=t==null?void 0:t.renderBefore)!==null&&i!==void 0?i:e,o=r._$litPart$;if(o===void 0){let h=(s=t==null?void 0:t.renderBefore)!==null&&s!==void 0?s:null;r._$litPart$=o=new H(e.insertBefore(N(),h),h,void 0,t!=null?t:{})}return o._$AI(n),o};var fe,ye;var E=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return w}};E.finalized=!0,E._$litElement$=!0,(fe=globalThis.litElementHydrateSupport)===null||fe===void 0||fe.call(globalThis,{LitElement:E});var De=globalThis.litElementPolyfillSupport;De==null||De({LitElement:E});((ye=globalThis.litElementVersions)!==null&&ye!==void 0?ye:globalThis.litElementVersions=[]).push("3.3.2");var _=class extends E{connectedCallback(){this.maybeCarryFill(),super.connectedCallback()}render(){return G``}maybeCarryFill(){this.isFillCarrier?(this.classList.add("html-fill-container"),this.classList.add("html-fill-item")):(this.classList.remove("html-fill-container"),this.classList.remove("html-fill-item"))}get isFillCarrier(){if(!this.parentElement)return!1;let e=this.parentElement.classList.contains("html-fill-container"),t=Array.from(this.children).some(i=>i.classList.contains("html-fill-item"));return e&&t}};_.isShinyInput=!1,_.styles=se` diff --git a/man/bslib-package.Rd b/man/bslib-package.Rd new file mode 100644 index 000000000..e91715289 --- /dev/null +++ b/man/bslib-package.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bslib-package.R +\docType{package} +\name{bslib-package} +\alias{bslib} +\alias{bslib-package} +\title{bslib: Custom 'Bootstrap' 'Sass' Themes for 'shiny' and 'rmarkdown'} +\description{ +Simplifies custom 'CSS' styling of both 'shiny' and 'rmarkdown' via 'Bootstrap' 'Sass'. Supports 'Bootstrap' 3, 4 and 5 as well as their various 'Bootswatch' themes. An interactive widget is also provided for previewing themes in real time. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://rstudio.github.io/bslib/} + \item \url{https://github.com/rstudio/bslib} + \item Report bugs at \url{https://github.com/rstudio/bslib/issues} +} + +} +\author{ +\strong{Maintainer}: Carson Sievert \email{carson@posit.co} (\href{https://orcid.org/0000-0002-4958-2844}{ORCID}) + +Authors: +\itemize{ + \item Joe Cheng \email{joe@posit.co} + \item Garrick Aden-Buie \email{garrick@posit.co} (\href{https://orcid.org/0000-0002-7111-0077}{ORCID}) +} + +Other contributors: +\itemize{ + \item Posit Software, PBC [copyright holder, funder] + \item Bootstrap contributors (Bootstrap library) [contributor] + \item Twitter, Inc (Bootstrap library) [copyright holder] + \item Javi Aguilar (Bootstrap colorpicker library) [contributor, copyright holder] + \item Thomas Park (Bootswatch library) [contributor, copyright holder] + \item PayPal (Bootstrap accessibility plugin) [contributor, copyright holder] +} + +} +\keyword{internal} diff --git a/revdep/.gitignore b/revdep/.gitignore new file mode 100644 index 000000000..8333ede7f --- /dev/null +++ b/revdep/.gitignore @@ -0,0 +1,7 @@ +checks +library +checks.noindex* +library.noindex* +cloud.noindex* +data.sqlite +*.html diff --git a/revdep/README.md b/revdep/README.md new file mode 100644 index 000000000..52e12c714 --- /dev/null +++ b/revdep/README.md @@ -0,0 +1,2 @@ +# Revdeps + diff --git a/revdep/cran.md b/revdep/cran.md new file mode 100644 index 000000000..92d81ef07 --- /dev/null +++ b/revdep/cran.md @@ -0,0 +1,7 @@ +## revdepcheck results + +We checked 41 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. + + * We saw 0 new problems + * We failed to check 0 packages + diff --git a/revdep/failures.md b/revdep/failures.md new file mode 100644 index 000000000..9a2073633 --- /dev/null +++ b/revdep/failures.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file diff --git a/revdep/problems.md b/revdep/problems.md new file mode 100644 index 000000000..9a2073633 --- /dev/null +++ b/revdep/problems.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file diff --git a/tests/testthat/_snaps/page.md b/tests/testthat/_snaps/page.md index f8342d6cd..3f30fc344 100644 --- a/tests/testthat/_snaps/page.md +++ b/tests/testthat/_snaps/page.md @@ -55,7 +55,7 @@ - + diff --git a/tests/testthat/test-page.R b/tests/testthat/test-page.R index 190b13bb1..5935f16dd 100644 --- a/tests/testthat/test-page.R +++ b/tests/testthat/test-page.R @@ -63,6 +63,8 @@ test_that("page_sidebar()", { with_private_seed() + skip_if_not_installed("bsicons", "0.1.0.9000") + expect_snapshot( renderTags( page_sidebar(