diff --git a/.gitattributes b/.gitattributes index 20e4efd4c..a7c05f903 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ /NEWS merge=union /inst/www/shared/shiny.js -merge -diff +/inst/www/shared/shiny-*.js -merge -diff +/inst/www/shared/shiny*.css -merge -diff *.min.js -merge -diff *.js.map -merge -diff diff --git a/inst/www/shared/shiny-autoreload.js b/inst/www/shared/shiny-autoreload.js index 10a86dfa2..89336b19d 100644 --- a/inst/www/shared/shiny-autoreload.js +++ b/inst/www/shared/shiny-autoreload.js @@ -1,17 +1,3 @@ -(function() { - var protocol = 'ws:'; - if (window.location.protocol === 'https:') - protocol = 'wss:'; - - var defaultPath = window.location.pathname; - if (!/\/$/.test(defaultPath)) - defaultPath += '/'; - defaultPath += 'autoreload/'; - - var ws = new WebSocket(protocol + '//' + window.location.host + defaultPath); - ws.onmessage = function(event) { - if (event.data === "autoreload") { - window.location.reload() - } - } -})(); +/*! shiny 1.6.0.9021 | (c) 2012-2021 RStudio, PBC. | License: GPL-3 | file LICENSE */ +(function(){var t="ws:";window.location.protocol==="https:"&&(t="wss:");var o=window.location.pathname;/\/$/.test(o)||(o+="/");o+="autoreload/";var n=new WebSocket(t+"//"+window.location.host+o);n.onmessage=function(a){a.data==="autoreload"&&window.location.reload()};})(); +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjdHMvZXh0cmFzL3NoaW55LWF1dG9yZWxvYWQudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbInZhciBwcm90b2NvbCA9IFwid3M6XCI7XG5pZiAod2luZG93LmxvY2F0aW9uLnByb3RvY29sID09PSBcImh0dHBzOlwiKSBwcm90b2NvbCA9IFwid3NzOlwiO1xudmFyIGRlZmF1bHRQYXRoID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lO1xuaWYgKCEvXFwvJC8udGVzdChkZWZhdWx0UGF0aCkpIGRlZmF1bHRQYXRoICs9IFwiL1wiO1xuZGVmYXVsdFBhdGggKz0gXCJhdXRvcmVsb2FkL1wiO1xudmFyIHdzID0gbmV3IFdlYlNvY2tldChwcm90b2NvbCArIFwiLy9cIiArIHdpbmRvdy5sb2NhdGlvbi5ob3N0ICsgZGVmYXVsdFBhdGgpO1xuXG53cy5vbm1lc3NhZ2UgPSBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgaWYgKGV2ZW50LmRhdGEgPT09IFwiYXV0b3JlbG9hZFwiKSB7XG4gICAgd2luZG93LmxvY2F0aW9uLnJlbG9hZCgpO1xuICB9XG59O1xuXG5leHBvcnQge307Il0sCiAgIm1hcHBpbmdzIjogIjtZQUFBLEdBQUksR0FBVyxNQUNmLEFBQUksT0FBTyxTQUFTLFdBQWEsVUFBVSxHQUFXLFFBQ3RELEdBQUksR0FBYyxPQUFPLFNBQVMsU0FDbEMsQUFBSyxNQUFNLEtBQUssSUFBYyxJQUFlLEtBQzdDLEdBQWUsY0FDZixHQUFJLEdBQUssR0FBSSxXQUFVLEVBQVcsS0FBTyxPQUFPLFNBQVMsS0FBTyxHQUVoRSxFQUFHLFVBQVksU0FBVSxFQUFPLENBQzlCLEFBQUksRUFBTSxPQUFTLGNBQ2pCLE9BQU8sU0FBUyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/inst/www/shared/shiny-showcase.css b/inst/www/shared/shiny-showcase.css index 15753a68d..50ff493bf 100644 --- a/inst/www/shared/shiny-showcase.css +++ b/inst/www/shared/shiny-showcase.css @@ -1,87 +1,2 @@ -#showcase-well { - border-radius: 0; - -webkit-border-radius: 0; - -moz-border-radius: 0; -} - -.shiny-code { - background-color: white; - 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 pre { - border: none; - line-height: 1em; -} - -#showcase-code-tabs .nav, -#showcase-code-tabs ul { - margin-bottom: 0px; -} - -#showcase-app-code { - width: 100%; -} - -#showcase-code-tabs { - margin-right: 15px; -} - -#showcase-code-tabs .tab-content { - border-style: solid; - border-color: #e5e5e5; - border-width: 0px 1px 1px 1px; - overflow:auto; - -webkit-border-bottom-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -moz-border-radius-bottomleft: 4px; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; -} - -#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: white; -} +/*! shiny 1.6.0.9021 | (c) 2012-2021 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} diff --git a/inst/www/shared/shiny-showcase.js b/inst/www/shared/shiny-showcase.js index 6c1085e46..52b423855 100644 --- a/inst/www/shared/shiny-showcase.js +++ b/inst/www/shared/shiny-showcase.js @@ -1,272 +1,3 @@ -/*jshint browser:true, jquery:true, strict:false, curly:false, indent:2*/ - -(function() { - var animateMs = 400; - - // Given a DOM node and a column (count of characters), walk recursively - // through the node's siblings counting characters until the given number - // of characters have been found. - // - // If the given count is bigger than the number of characters contained by - // the node and its siblings, returns a null node and the number of - // characters found. - function findTextColPoint(node, col) { - var cols = 0; - if (node.nodeType === 3) { - var nchar = node.nodeValue.replace(/\n/g, "").length; - if (nchar >= col) { - return { element: node, offset: col }; - } else { - cols += nchar; - } - } else if (node.nodeType === 1 && node.firstChild) { - var ret = findTextColPoint(node.firstChild, col); - if (ret.element !== null) { - return ret; - } else { - cols += ret.offset; - } - } - if (node.nextSibling) - return findTextColPoint(node.nextSibling, col - cols); - else - return { element: null, offset: cols }; - } - - // Returns an object indicating the element containing the given line and - // column of text, and the offset into that element where the text was found. - // - // If the given line and column are not found, returns a null element and - // the number of lines found. - function findTextPoint(el, line, col) { - var newlines = 0; - for (var childId = 0; childId < el.childNodes.length; childId++) { - var child = el.childNodes[childId]; - // If this is a text node, count the number of newlines it contains. - if (child.nodeType === 3) { // TEXT_NODE - var newlinere = /\n/g; - var match; - while ((match = newlinere.exec(child.nodeValue)) !== null) { - newlines++; - // Found the desired line, now find the column. - if (newlines === line) { - return findTextColPoint(child, match.index + col + 1); - } - } - } - // If this is not a text node, descend recursively to see how many - // lines it contains. - else if (child.nodeType === 1) { // ELEMENT_NODE - var ret = findTextPoint(child, line - newlines, col); - if (ret.element !== null) - return ret; - else - newlines += ret.offset; - } - } - return { element: null, offset: newlines }; - } - - // Draw a highlight effect for the given source ref. srcref is assumed to be - // an integer array of length 6, following the standard R format for source - // refs. - function highlightSrcref (srcref, srcfile) { - // Check to see if the browser supports text ranges (IE8 doesn't) - if (!document.createRange) - return; - - // Check to see if we already have a marker for this source ref - var el = document.getElementById("srcref_" + srcref); - if (!el) { - // We don't have a marker, create one - el = document.createElement("span"); - el.id = "srcref_" + srcref; - var ref = srcref; - var code = document.getElementById(srcfile.replace(/\./g, "_") + "_code"); - // if there is no code file (might be a shiny file), quit early - if (!code) return; - var start = findTextPoint(code, ref[0], ref[4]); - var end = findTextPoint(code, ref[2], ref[5]); - - // If the insertion point can't be found, bail out now - if (start.element === null || end.element === null) - return; - - var range = document.createRange(); - // If the text points are inside different s, we may not be able to - // surround them without breaking apart the elements to keep the DOM tree - // intact. Just move the selection points to encompass the contents of - // the SPANs. - if (start.element.parentNode.nodeName === "SPAN" && - start.element !== end.element) { - range.setStartBefore(start.element.parentNode); - } else { - range.setStart(start.element, start.offset); - } - if (end.element.parentNode.nodeName === "SPAN" && - start.element !== end.element) { - range.setEndAfter(end.element.parentNode); - } else { - range.setEnd(end.element, end.offset); - } - range.surroundContents(el); - } - // End any previous highlight before starting this one - jQuery(el) - .stop(true, true) - .effect("highlight", null, 1600); - } - - // If this is the main Shiny window, wire up our custom message handler. - if (window.Shiny) { - Shiny.addCustomMessageHandler('showcase-src', function(message) { - if (message.srcref && message.srcfile) { - highlightSrcref(message.srcref, message.srcfile); - } - }); - } - - var isCodeAbove = false; - var setCodePosition = function(above, animate) { - var animateCodeMs = animate ? animateMs : 1; - - // set the source and targets for the tab move - var newHostElement = above ? - document.getElementById("showcase-sxs-code") : - document.getElementById("showcase-code-inline"); - var currentHostElement = above ? - document.getElementById("showcase-code-inline") : - document.getElementById("showcase-sxs-code"); - - var metadataElement = document.getElementById("showcase-app-metadata"); - if (metadataElement === null) { - // if there's no app metadata, show and hide the entire well container - // when the code changes position - var wellElement = $("#showcase-well"); - if (above) { - wellElement.fadeOut(animateCodeMs); - } else { - wellElement.fadeIn(animateCodeMs); - } - } - - // hide the new element before doing anything to it - $(newHostElement).hide(); - $(currentHostElement).fadeOut(animateCodeMs, function() { - var tabs = document.getElementById("showcase-code-tabs"); - currentHostElement.removeChild(tabs); - newHostElement.appendChild(tabs); - - // remove or set the height of the code - if (above) { - setCodeHeightFromDocHeight(); - } else { - document.getElementById("showcase-code-content").removeAttribute("style"); - } - - $(newHostElement).fadeIn(animateCodeMs); - if (!above) { - // remove the applied width and zoom on the app container, and - // scroll smoothly down to the code's new home - document.getElementById("showcase-app-container").removeAttribute("style"); - if (animate) - $(document.body).animate({ scrollTop: $(newHostElement).offset().top }); - } - // if there's a readme, move it either alongside the code or beneath - // the app - var readme = document.getElementById("readme-md"); - if (readme !== null) { - readme.parentElement.removeChild(readme); - if (above) { - currentHostElement.appendChild(readme); - $(currentHostElement).fadeIn(animateCodeMs); - } - else - document.getElementById("showcase-app-metadata").appendChild(readme); - } - - // change the text on the toggle button to reflect the new state - document.getElementById("showcase-code-position-toggle").innerHTML = above ? - ' show below' : - ' show with app'; - }); - if (above) { - $(document.body).animate({ scrollTop: 0 }, animateCodeMs); - } - isCodeAbove = above; - setAppCodeSxsWidths(above && animate); - $(window).trigger("resize"); - }; - - var setAppCodeSxsWidths = function(animate) { - var appTargetWidth = 960; - var appWidth = appTargetWidth; - var zoom = 1.0; - var totalWidth = document.getElementById("showcase-app-code").offsetWidth; - if (totalWidth / 2 > appTargetWidth) { - // If the app can use only half the available space and still meet its - // target, take half the available space. - appWidth = totalWidth / 2; - } else if (totalWidth * 0.66 > appTargetWidth) { - // If the app can meet its target by taking up more space (up to 66% - // of its container), take up more space. - appWidth = 960; - } else { - // The space is too narrow for the app and code to live side-by-side - // in a friendly way. Keep the app at 2/3 of the space but scale it. - appWidth = totalWidth * 0.66; - zoom = appWidth/appTargetWidth; - } - var app = document.getElementById("showcase-app-container"); - $(app).animate({ - width: appWidth + "px", - zoom: (zoom*100) + "%" - }, animate ? animateMs : 0); - }; - - var toggleCodePosition = function() { - setCodePosition(!isCodeAbove, true); - }; - - // if the browser is sized to wider than 1350px, show the code next to the - // app by default - var setInitialCodePosition = function() { - if (document.body.offsetWidth > 1350) { - setCodePosition(true, false); - } - }; - - // make the code scrollable to about the height of the browser, less space - // for the tabs - var setCodeHeightFromDocHeight = function() { - document.getElementById("showcase-code-content").style.height = - $(window).height() + "px"; - }; - - // if there's a block of markdown content, render it to HTML - var renderMarkdown = function() { - var mdContent = document.getElementById("showcase-markdown-content"); - if (mdContent !== null) { - // IE8 puts the content of