Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into expressify-input-exam…
Browse files Browse the repository at this point in the history
…ples
  • Loading branch information
Gordon Shotwell committed Jan 24, 2024
2 parents 6541998 + 39d80a5 commit fc23f97
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ doc =
jupyter
jupyter_client < 8.0.0
tabulate
shinylive @ git+https://github.com/posit-dev/py-shinylive.git@main
shinylive @ git+https://github.com/posit-dev/py-shinylive.git
pydantic==1.10
quartodoc==0.7.2
griffe==0.33.0
Expand Down
24 changes: 7 additions & 17 deletions shiny/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,29 +177,19 @@ def _(func: F) -> F:
# This part is hidden from the typechecker because shinylive is not a direct
# dependency of shiny and we only need this section when building the docs.
try:
import shinylive
from shinylive import ShinyliveApp
except ImportError:
raise RuntimeError(
"Please install the latest version of shinylive to build the docs."
)
except ModuleNotFoundError:
raise RuntimeError("Please install shinylive to build the docs.")

SHINYLIVE_CODE_TEMPLATE = """
```{{shinylive-python}}
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
{0}
```
"""

class ShinyliveExampleWriter(ExampleWriter):
def write_example(self, app_files: list[str]) -> str:
app_file = app_files.pop(0)
bundle = shinylive._url.create_shinylive_bundle_file(
app_file, app_files, language="py"
)
code = shinylive._url.create_shinylive_chunk_contents(bundle)
app = ShinyliveApp.from_local(app_file, app_files, language="py")

return SHINYLIVE_CODE_TEMPLATE.format(code.strip())
return app.to_chunk(layout="vertical", viewer_height=400)

example_writer = ShinyliveExampleWriter()
2 changes: 1 addition & 1 deletion shiny/www/shared/_version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"note!": "This file is auto-generated by scripts/htmlDependencies.R",
"package": "shiny",
"version": "Github (rstudio/shiny@370ba1f288d3f759456ef3ef6e768ee1d7fda677)"
"version": "Github (rstudio/shiny@f71f1256b8ed1ee133c5aea281bbc750a379460c)"
}
15 changes: 12 additions & 3 deletions shiny/www/shared/shiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -18574,9 +18574,10 @@
idTypes.forEach(function(type) {
return counts[type] += 1;
});
if (Object.values(counts).some(function(count) {
return count > 1;
})) {
if (counts.input === 1 && counts.output === 1 && !Shiny.inDevMode()) {
return;
}
if (counts.input + counts.output > 1) {
duplicateIds.set(id, counts);
}
});
Expand Down Expand Up @@ -22355,6 +22356,9 @@
_defineProperty19(ShinyErrorMessage, "styles", [i(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(['\n :host {\n color: var(--red-11);\n display: block;\n font-size: var(--font-md);\n\n position: relative;\n --icon-size: var(--font-lg)\n\n /* Reset box sizing */\n box-sizing: border-box;\n }\n\n .container {\n display: flex;\n gap: var(--space-2);\n }\n\n .contents {\n width: 40ch;\n display: flex;\n flex-direction: column;\n gap: var(--space-1);\n padding-block-start: 0;\n padding-block-end: var(--space-3);\n overflow: auto;\n }\n\n :host(:last-of-type) .contents {\n\n padding-block-end: var(--space-1);\n }\n\n .contents > h3 {\n font-size: 1em;\n font-weight: 500;\n color: var(--red-12);\n }\n\n .contents > * {\n margin-block: 0;\n }\n\n .error-message {\n font-family: "Courier New", Courier, monospace;\n }\n\n .decoration-container {\n flex-shrink: 0;\n position: relative;\n\n --line-w: 2px;\n --dot-size: 11px;\n }\n\n :host(:hover) .decoration-container {\n --scale: 1.25;\n }\n\n .vertical-line {\n margin-inline: auto;\n width: var(--line-w);\n height: 100%;\n\n background-color: var(--red-10);\n }\n\n :host(:first-of-type) .vertical-line {\n height: calc(100% - var(--dot-size));\n margin-top: var(--dot-size);\n }\n\n .dot {\n position: absolute;\n width: var(--dot-size);\n height: var(--dot-size);\n top: calc(-1px + var(--dot-size) / 2);\n left: calc(50% - var(--dot-size) / 2);\n border-radius: 100%;\n transform: scale(var(--scale, 1));\n\n color: var(--red-6);\n background-color: var(--red-10);\n }\n\n .actions {\n transform: scaleX(0);\n transition: transform calc(var(--animation-speed) / 2) ease-in-out;\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n\n /* Delay transition on mouseout so the buttons don\'t jump away if the user\n overshoots them with their mouse */\n :host(:not(:hover)) .actions {\n transition-delay: 0.15s;\n }\n\n :host(:hover) .actions {\n transform: scaleX(1);\n }\n\n ', "\n\n .copy-button {\n padding: 0;\n width: var(--space-8);\n height: var(--space-8);\n position: relative;\n --pad: var(--space-2);\n }\n\n .copy-button-inner {\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n transition: transform 0.5s;\n transform-style: preserve-3d;\n }\n\n /* Animate flipping to the other side when the .copy-success class is\n added to the host */\n :host(.copy-success) .copy-button-inner {\n transform: rotateY(180deg);\n }\n\n /* Position the front and back side */\n .copy-button .front,\n .copy-button .back {\n --side: calc(100% - 2 * var(--pad));\n position: absolute;\n inset: var(--pad);\n height: var(--side);\n width: var(--side);\n -webkit-backface-visibility: hidden; /* Safari */\n backface-visibility: hidden;\n }\n\n .copy-button:hover .copy-button-inner {\n background-color: var(--gray-2);\n }\n\n /* Style the back side */\n .copy-button .back {\n --pad: var(--space-1);\n color: var(--green-8);\n transform: rotateY(180deg);\n }\n "])), buttonStyles)]);
customElements.define("shiny-error-message", ShinyErrorMessage);
function showErrorInClientConsole(e4) {
if (!Shiny.inDevMode()) {
return;
}
var errorMsg = null;
var headline = "Error on client while running Shiny app";
if (typeof e4 === "string") {
Expand Down Expand Up @@ -25127,6 +25131,11 @@
windowShiny2.renderContent = renderContent;
windowShiny2.renderHtmlAsync = renderHtmlAsync;
windowShiny2.renderHtml = renderHtml2;
windowShiny2.inDevMode = function() {
if ("__SHINY_DEV_MODE__" in window)
return Boolean(window.__SHINY_DEV_MODE__);
return false;
};
(0, import_jquery40.default)(function() {
setTimeout(/* @__PURE__ */ _asyncToGenerator15(/* @__PURE__ */ _regeneratorRuntime15().mark(function _callee() {
return _regeneratorRuntime15().wrap(function _callee$(_context) {
Expand Down
4 changes: 2 additions & 2 deletions shiny/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion shiny/www/shared/shiny.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions shiny/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

0 comments on commit fc23f97

Please sign in to comment.