mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 23:48:01 -05:00
Compare commits
279 Commits
barret/deb
...
slider-che
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03b03f1173 | ||
|
|
28dc3ecd5b | ||
|
|
d582e53f73 | ||
|
|
52ad7d12cb | ||
|
|
10810308f0 | ||
|
|
4ce1058448 | ||
|
|
0db06df77f | ||
|
|
fdca53d4d2 | ||
|
|
8395598328 | ||
|
|
1b8635db32 | ||
|
|
60db1e02b0 | ||
|
|
a86e9c3609 | ||
|
|
6d77b22f97 | ||
|
|
e1b3756166 | ||
|
|
edf354f416 | ||
|
|
954a979a83 | ||
|
|
fe9a87fb06 | ||
|
|
1842a15f74 | ||
|
|
a568238472 | ||
|
|
fa200022c5 | ||
|
|
a6347341e3 | ||
|
|
c41481e488 | ||
|
|
767abc3c0c | ||
|
|
e005c24fbf | ||
|
|
8580f544fc | ||
|
|
2daa8ec944 | ||
|
|
2b92014ea5 | ||
|
|
f540679513 | ||
|
|
d165cc6e8e | ||
|
|
c1878fe54f | ||
|
|
f05948629e | ||
|
|
3e37dab4a1 | ||
|
|
6584e1f960 | ||
|
|
64c5a67a0e | ||
|
|
aea4e560ea | ||
|
|
12554a0004 | ||
|
|
c3e6fdc550 | ||
|
|
83336ef9a5 | ||
|
|
08ab21b50e | ||
|
|
5628346ae1 | ||
|
|
b165127d20 | ||
|
|
905e2238d4 | ||
|
|
47bb1f657c | ||
|
|
c917d18d67 | ||
|
|
93568cd53f | ||
|
|
6af06559f4 | ||
|
|
43239a0485 | ||
|
|
e05f4097d6 | ||
|
|
35e62eaee9 | ||
|
|
858c2e66e6 | ||
|
|
0d156171d4 | ||
|
|
b57cb6c8e1 | ||
|
|
5ddff1bd37 | ||
|
|
036f923e05 | ||
|
|
130f4764a7 | ||
|
|
c4b5e5f8a2 | ||
|
|
ecb21df941 | ||
|
|
71d11ec103 | ||
|
|
213f0d3a93 | ||
|
|
8948eca0f3 | ||
|
|
aa0c841aff | ||
|
|
a8449382f0 | ||
|
|
5b27d9258e | ||
|
|
2590cf3895 | ||
|
|
a9f7068b2f | ||
|
|
1f9e4929a6 | ||
|
|
d56afca33e | ||
|
|
8fa023b4ec | ||
|
|
d9f73c4c6d | ||
|
|
68cf1c5410 | ||
|
|
a70220c6c4 | ||
|
|
99207d1d8f | ||
|
|
0baf2ecd70 | ||
|
|
2c6f830223 | ||
|
|
98eb1b596d | ||
|
|
145d222653 | ||
|
|
67e54572a8 | ||
|
|
3cc9b33a8d | ||
|
|
12bc94fbc0 | ||
|
|
b2379bfa5b | ||
|
|
f4fc13fc2f | ||
|
|
95081c43a7 | ||
|
|
bb3b3d5a47 | ||
|
|
f635f98ccb | ||
|
|
eef44295db | ||
|
|
5e1afc61c1 | ||
|
|
8edcbb3dc1 | ||
|
|
dca3722cb8 | ||
|
|
7eb0e93731 | ||
|
|
6034c3ff7a | ||
|
|
4eeb4a12a7 | ||
|
|
6daa689888 | ||
|
|
cded44b40a | ||
|
|
290c9f6b20 | ||
|
|
be3d712fdf | ||
|
|
f5666bcba1 | ||
|
|
f3c89bed01 | ||
|
|
9b0f170730 | ||
|
|
74350cd443 | ||
|
|
61aa7bb3b0 | ||
|
|
82fdbeda49 | ||
|
|
196b220faf | ||
|
|
f41c484913 | ||
|
|
a1a20b3f4b | ||
|
|
bbf9bee28e | ||
|
|
24a1ef9594 | ||
|
|
c5adef0a05 | ||
|
|
508c197446 | ||
|
|
473ec834fe | ||
|
|
66968904bf | ||
|
|
f169792e59 | ||
|
|
39a23af138 | ||
|
|
d8715819dc | ||
|
|
12444807e8 | ||
|
|
92077d47a1 | ||
|
|
4f54276e1b | ||
|
|
ac30848019 | ||
|
|
921650f53b | ||
|
|
72d81e8a85 | ||
|
|
5c5974106d | ||
|
|
c2cbd3a127 | ||
|
|
8e5aedec00 | ||
|
|
13965acb37 | ||
|
|
8a99b9d401 | ||
|
|
f739a1d476 | ||
|
|
87dd00be13 | ||
|
|
8cd393597a | ||
|
|
b7366ef672 | ||
|
|
3d6329dee8 | ||
|
|
2171420e0c | ||
|
|
e44a9b1ded | ||
|
|
bde5a88295 | ||
|
|
11babd5567 | ||
|
|
4c35d483bc | ||
|
|
d049558728 | ||
|
|
8eed42387c | ||
|
|
5b3366f35a | ||
|
|
fea7397c3b | ||
|
|
4a33582482 | ||
|
|
1bad0553b7 | ||
|
|
ac0b723bb0 | ||
|
|
39454a6c09 | ||
|
|
569157aded | ||
|
|
d2d7770c76 | ||
|
|
5da846f1ce | ||
|
|
713c9ec923 | ||
|
|
b3369616d2 | ||
|
|
082b8ef080 | ||
|
|
0fb9226a9b | ||
|
|
bb55f45d94 | ||
|
|
5b12980b7a | ||
|
|
493ef59dda | ||
|
|
b42d835cbf | ||
|
|
d1d177f80f | ||
|
|
433e5814ed | ||
|
|
2bf9f42b49 | ||
|
|
65efb573bd | ||
|
|
26a701215d | ||
|
|
3be7a20f40 | ||
|
|
6f8092f5a4 | ||
|
|
652fcfe799 | ||
|
|
d7d03ee6a8 | ||
|
|
dc6335ed4d | ||
|
|
b421f6bd7f | ||
|
|
d4358e0793 | ||
|
|
a8dfa0771f | ||
|
|
6df3ce4b19 | ||
|
|
8f40f8cab8 | ||
|
|
0d5a2cee58 | ||
|
|
8db4f41fa9 | ||
|
|
b85b03583b | ||
|
|
28e18fe87b | ||
|
|
2c1961acd7 | ||
|
|
04386f1a5e | ||
|
|
9c915e52ca | ||
|
|
6b6ab48377 | ||
|
|
bf36d07670 | ||
|
|
7166192143 | ||
|
|
509f0790db | ||
|
|
67a776a39a | ||
|
|
d3701df4e6 | ||
|
|
0195e34a7b | ||
|
|
0aa49c8a93 | ||
|
|
437de58922 | ||
|
|
fc76cf21fb | ||
|
|
23d1b25c46 | ||
|
|
8bfb59875f | ||
|
|
36e866743d | ||
|
|
d35c6e35ce | ||
|
|
e9afd8c99e | ||
|
|
43b7c41c4f | ||
|
|
921f60475e | ||
|
|
58433cda01 | ||
|
|
ed5eca5496 | ||
|
|
eff4a1f23e | ||
|
|
9f72b15fcf | ||
|
|
8069ff2b05 | ||
|
|
10deddf2f0 | ||
|
|
3ad1c4076d | ||
|
|
943f31e117 | ||
|
|
c43bc195e7 | ||
|
|
92b1e8f256 | ||
|
|
985970d320 | ||
|
|
5eabaa5207 | ||
|
|
7f60ecc725 | ||
|
|
7c635e1283 | ||
|
|
4727a7adf4 | ||
|
|
8940f14dde | ||
|
|
2fd0ce1a09 | ||
|
|
638bcc0f85 | ||
|
|
d411da3114 | ||
|
|
0acae46835 | ||
|
|
61cc61d9aa | ||
|
|
194320d163 | ||
|
|
902bfb8628 | ||
|
|
b25d72f698 | ||
|
|
a4d8f541dd | ||
|
|
6aaf2ff4d5 | ||
|
|
b0f77d6591 | ||
|
|
f2885dafd2 | ||
|
|
b0725e0153 | ||
|
|
4ce62034ce | ||
|
|
7d4c0ad611 | ||
|
|
d189cd9f23 | ||
|
|
f61ba70bb9 | ||
|
|
6e48692637 | ||
|
|
f7b1bc0e5c | ||
|
|
a213d6f7e1 | ||
|
|
a7d793ecf9 | ||
|
|
5d25481f66 | ||
|
|
77a8a783de | ||
|
|
0492eb7958 | ||
|
|
d37feea299 | ||
|
|
ffb9ad2094 | ||
|
|
1e63dfc4c5 | ||
|
|
051cc51d4b | ||
|
|
56dd92fee8 | ||
|
|
51b835b57f | ||
|
|
ccd7342986 | ||
|
|
82decaa070 | ||
|
|
d1e808d090 | ||
|
|
7aad389338 | ||
|
|
7e07c460de | ||
|
|
81a8ec3ce1 | ||
|
|
800f0a216d | ||
|
|
dade7dc069 | ||
|
|
b271d0a9a2 | ||
|
|
5daa0bc38e | ||
|
|
22665dc9b4 | ||
|
|
a99f11fb10 | ||
|
|
81824575e6 | ||
|
|
f6d010056a | ||
|
|
ffd20bcc6e | ||
|
|
55eaaa869d | ||
|
|
c2e66ca474 | ||
|
|
62b848c2e2 | ||
|
|
dbb657bd91 | ||
|
|
de871b79b0 | ||
|
|
146a6d459d | ||
|
|
9fb1dd18a7 | ||
|
|
9ae894d9e3 | ||
|
|
56e0fbdb05 | ||
|
|
e6325629a9 | ||
|
|
9a3329acc7 | ||
|
|
75ab225d84 | ||
|
|
883668ac93 | ||
|
|
c5f2dece49 | ||
|
|
b55bc5318e | ||
|
|
a39450c2b2 | ||
|
|
b784068701 | ||
|
|
bac4e68b89 | ||
|
|
20e95a4cab | ||
|
|
96da457db3 | ||
|
|
37b8715cff | ||
|
|
7aa3a243ba | ||
|
|
f2b549f9cd | ||
|
|
bc58dba0ad | ||
|
|
8ef9be5290 | ||
|
|
42af54ca04 |
@@ -12,7 +12,7 @@
|
||||
^\.travis\.yml$
|
||||
^staticdocs$
|
||||
^tools$
|
||||
^srcjs$
|
||||
^srcts$
|
||||
^CONTRIBUTING.md$
|
||||
^cran-comments.md$
|
||||
^.*\.o$
|
||||
|
||||
136
.github/workflows/R-CMD-check.yaml
vendored
136
.github/workflows/R-CMD-check.yaml
vendored
@@ -45,38 +45,52 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: r-lib/actions/setup-r@master
|
||||
id: install-r
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@master
|
||||
|
||||
- name: Query dependencies
|
||||
run: |
|
||||
install.packages('remotes')
|
||||
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
|
||||
- name: Install pak and query dependencies
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
|
||||
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
|
||||
|
||||
- name: Cache R packages
|
||||
if: runner.os != 'Windows'
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }}
|
||||
restore-keys: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-1-
|
||||
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
|
||||
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
|
||||
|
||||
- name: Install system dependencies
|
||||
if: runner.os == 'Linux'
|
||||
env:
|
||||
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
Rscript -e "remotes::install_github('r-hub/sysreqs')"
|
||||
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
|
||||
sudo -s eval "$sysreqs"
|
||||
pak::local_system_requirements(execute = TRUE)
|
||||
|
||||
# xquartz and cairo are needed for Cairo package.
|
||||
# harfbuzz and fribidi are needed for textshaping package.
|
||||
- name: Mac systemdeps
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install --cask xquartz
|
||||
brew install cairo
|
||||
brew install harfbuzz fribidi
|
||||
|
||||
# Use a shorter temp directory for pak installations, due to filename
|
||||
# length issues on Windows. https://github.com/r-lib/pak/issues/252
|
||||
- name: Windows temp dir
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
New-Item -Path "C:\" -Name "tmp" -ItemType Directory
|
||||
echo "TMPDIR=c:\tmp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
remotes::install_deps(dependencies = TRUE)
|
||||
remotes::install_cran("rcmdcheck")
|
||||
pak::local_install_dev_deps(upgrade = TRUE)
|
||||
pak::pkg_install("rcmdcheck")
|
||||
shell: Rscript {0}
|
||||
|
||||
- name: Find PhantomJS path
|
||||
@@ -84,11 +98,11 @@ jobs:
|
||||
run: |
|
||||
echo "::set-output name=path::$(Rscript -e 'cat(shinytest:::phantom_paths()[[1]])')"
|
||||
- name: Cache PhantomJS
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.phantomjs.outputs.path }}
|
||||
key: ${{ runner.os }}-phantomjs
|
||||
restore-keys: ${{ runner.os }}-phantomjs
|
||||
key: ${{ matrix.config.os }}-phantomjs
|
||||
restore-keys: ${{ matrix.config.os }}-phantomjs
|
||||
- name: Install PhantomJS
|
||||
run: >
|
||||
Rscript
|
||||
@@ -116,83 +130,13 @@ jobs:
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
|
||||
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
|
||||
path: check
|
||||
|
||||
|
||||
documentation:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: documentation
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {os: macOS-latest, r: '4.0'}
|
||||
|
||||
env:
|
||||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: r-lib/actions/setup-r@master
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
|
||||
- name: Query dependencies
|
||||
run: |
|
||||
install.packages('remotes')
|
||||
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
|
||||
shell: Rscript {0}
|
||||
- name: Cache R packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-2-${{ hashFiles('.github/depends.Rds') }}
|
||||
restore-keys: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-2-
|
||||
- name: Remove dependencies file
|
||||
run: |
|
||||
rm .github/depends.Rds
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
install.packages(c("remotes"))
|
||||
remotes::install_deps(dependencies = TRUE)
|
||||
remotes::install_cran("devtools")
|
||||
remotes::install_cran("rprojroot")
|
||||
shell: Rscript {0}
|
||||
|
||||
- name: Check documentation
|
||||
run: |
|
||||
./tools/documentation/checkDocsCurrent.sh
|
||||
|
||||
|
||||
node_js:
|
||||
runs-on: macOS-latest
|
||||
name: node_js
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
# https://github.com/actions/cache/blame/ccf96194800dbb7b7094edcd5a7cf3ec3c270f10/examples.md#L185-L200
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: yarn cache
|
||||
uses: actions/cache@v1
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Check node build
|
||||
run: |
|
||||
./tools/checkJSCurrent.sh
|
||||
- name: Fix path for Windows caching
|
||||
if: runner.os == 'Windows'
|
||||
# This is needed because if you use the default tar at this stage,
|
||||
# C:/Rtools/bin/tar.exe, it will say that it can't find gzip.exe. So
|
||||
# we'll just set the path so that the original tar that would be
|
||||
# found, will be found.
|
||||
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH
|
||||
|
||||
35
.github/workflows/pr-commands.yaml
vendored
35
.github/workflows/pr-commands.yaml
vendored
@@ -1,35 +0,0 @@
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
name: Commands
|
||||
jobs:
|
||||
document:
|
||||
if: startsWith(github.event.comment.body, '/document')
|
||||
name: document
|
||||
runs-on: macOS-latest
|
||||
env:
|
||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: r-lib/actions/pr-fetch@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: r-lib/actions/setup-r@master
|
||||
- name: Install dependencies
|
||||
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
|
||||
- name: Document
|
||||
run: Rscript -e 'roxygen2::roxygenise()'
|
||||
- name: commit
|
||||
run: |
|
||||
git add man/\* NAMESPACE
|
||||
git commit -m 'Document'
|
||||
- uses: r-lib/actions/pr-push@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# added so that the workflow doesn't fail.
|
||||
always_runner:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Always run
|
||||
run: echo "This job is used to prevent the workflow status from showing as failed when all other jobs are skipped"
|
||||
153
.github/workflows/rituals.yaml
vendored
Normal file
153
.github/workflows/rituals.yaml
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- ghactions
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
name: Rituals
|
||||
|
||||
jobs:
|
||||
rituals:
|
||||
name: Rituals
|
||||
# if: false
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- { os: ubuntu-16.04, r: '4.0', node: "14.x", rspm: "https://packagemanager.rstudio.com/all/__linux__/xenial/latest"}
|
||||
|
||||
env:
|
||||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
||||
RSPM: ${{ matrix.config.rspm }}
|
||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- uses: r-lib/actions/pr-fetch@master
|
||||
name: Git Pull (PR)
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: r-lib/actions/setup-r@master
|
||||
id: install-r
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@master
|
||||
|
||||
- name: Git Config
|
||||
run: |
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
|
||||
- name: Install pak and query dependencies
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
|
||||
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
|
||||
|
||||
- name: Cache R packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.R_LIBS_USER }}
|
||||
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
|
||||
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
|
||||
|
||||
- name: Install system dependencies
|
||||
# if: runner.os == 'Linux'
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
pak::local_system_requirements(execute = TRUE)
|
||||
|
||||
- name: Install dependencies
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
pak::local_install_dev_deps(upgrade = TRUE)
|
||||
pak::pkg_install("sessioninfo")
|
||||
pak::pkg_install("devtools")
|
||||
|
||||
- name: Session info
|
||||
shell: Rscript {0}
|
||||
run: |
|
||||
options(width = 100)
|
||||
pkgs <- installed.packages()[, "Package"]
|
||||
sessioninfo::session_info(pkgs, include_base = TRUE)
|
||||
|
||||
- name: Url redirects
|
||||
# only perform if in an RC branch (`rc-vX.Y.Z`)
|
||||
if: ${{ github.event_name == 'push' && contains(github.ref, '/rc-v') }}
|
||||
run: |
|
||||
Rscript -e 'pak::pkg_install("r-lib/urlchecker"); urlchecker::url_update()'
|
||||
# throw an error if man files were updated
|
||||
if [ -n "$(git status --porcelain man)" ]
|
||||
then
|
||||
git status --porcelain
|
||||
>&2 echo "Updated links found in files above"
|
||||
>&2 echo 'Run `urlchecker::url_update()` to fix links locally'
|
||||
exit 1
|
||||
fi
|
||||
# Add locally changed urls
|
||||
git add .
|
||||
git commit -m 'Update links (GitHub Actions)' || echo "No link changes to commit"
|
||||
|
||||
- name: Document
|
||||
run: |
|
||||
Rscript -e 'devtools::document()'
|
||||
git add man/\* NAMESPACE
|
||||
git commit -m 'Document (GitHub Actions)' || echo "No documentation changes to commit"
|
||||
|
||||
- name: Check documentation
|
||||
run: |
|
||||
./tools/documentation/checkDocsCurrent.sh
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.config.node }}
|
||||
# https://github.com/actions/cache/blame/ccf96194800dbb7b7094edcd5a7cf3ec3c270f10/examples.md#L185-L200
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: yarn cache
|
||||
uses: actions/cache@v2
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ matrix.config.os }}-${{ matrix.config.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ matrix.config.os }}-${{ matrix.config.node }}-yarn-
|
||||
- name: Build JS
|
||||
run: |
|
||||
cd srcts
|
||||
tree src
|
||||
yarn install --immutable && yarn build
|
||||
git add ./src && git commit -m 'yarn lint (GitHub Actions)' || echo "No yarn lint changes to commit"
|
||||
git add ../inst && git commit -m 'yarn build (GitHub Actions)' || echo "No yarn build changes to commit"
|
||||
|
||||
- name: Check JS build is latest
|
||||
run: |
|
||||
./tools/checkJSCurrent.sh
|
||||
|
||||
|
||||
- name: Git Push (PR)
|
||||
uses: r-lib/actions/pr-push@master
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Git Push (MASTER)
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No changes to push"
|
||||
|
||||
# Execute after pushing, as no updated files will be produced
|
||||
- name: Test TypeScript code
|
||||
run: |
|
||||
cd srcts
|
||||
yarn test
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -10,3 +10,6 @@ shinyapps/
|
||||
README.html
|
||||
.*.Rnb.cached
|
||||
tools/yarn-error.log
|
||||
|
||||
# GHA remotes installation
|
||||
.github/r-depends.rds
|
||||
|
||||
35
DESCRIPTION
35
DESCRIPTION
@@ -1,7 +1,7 @@
|
||||
Package: shiny
|
||||
Type: Package
|
||||
Title: Web Application Framework for R
|
||||
Version: 1.5.0.9004
|
||||
Version: 1.6.0.9000
|
||||
Authors@R: c(
|
||||
person("Winston", "Chang", role = c("aut", "cre"), email = "winston@rstudio.com"),
|
||||
person("Joe", "Cheng", role = "aut", email = "joe@rstudio.com"),
|
||||
@@ -80,7 +80,6 @@ Imports:
|
||||
mime (>= 0.3),
|
||||
jsonlite (>= 0.9.16),
|
||||
xtable,
|
||||
digest,
|
||||
htmltools (>= 0.5.0.9001),
|
||||
R6 (>= 2.0),
|
||||
sourcetools,
|
||||
@@ -88,41 +87,41 @@ Imports:
|
||||
promises (>= 1.1.0),
|
||||
tools,
|
||||
crayon,
|
||||
rlang (>= 0.4.0),
|
||||
fastmap (>= 1.0.0),
|
||||
rlang (>= 0.4.10),
|
||||
fastmap (>= 1.1.0),
|
||||
withr,
|
||||
commonmark (>= 1.7),
|
||||
glue (>= 1.3.2),
|
||||
bootstraplib (>= 0.2.0.9001)
|
||||
bslib (>= 0.2.2.9002),
|
||||
cachem,
|
||||
ellipsis,
|
||||
lifecycle (>= 0.2.0)
|
||||
Suggests:
|
||||
datasets,
|
||||
Cairo (>= 1.5-5),
|
||||
testthat (>= 2.1.1),
|
||||
testthat (>= 3.0.0),
|
||||
knitr (>= 1.6),
|
||||
markdown,
|
||||
rmarkdown,
|
||||
ggplot2,
|
||||
reactlog (>= 1.0.0),
|
||||
magrittr,
|
||||
shinytest,
|
||||
shinytest (>= 1.4.0.9003),
|
||||
yaml,
|
||||
future,
|
||||
dygraphs,
|
||||
ragg,
|
||||
showtext,
|
||||
sass
|
||||
Remotes:
|
||||
rstudio/htmltools,
|
||||
rstudio/sass,
|
||||
rstudio/bootstraplib
|
||||
URL: http://shiny.rstudio.com
|
||||
URL: https://shiny.rstudio.com/
|
||||
BugReports: https://github.com/rstudio/shiny/issues
|
||||
Collate:
|
||||
'globals.R'
|
||||
'app-state.R'
|
||||
'app_template.R'
|
||||
'bind-cache.R'
|
||||
'bind-event.R'
|
||||
'bookmark-state-local.R'
|
||||
'stack.R'
|
||||
'bookmark-state.R'
|
||||
'bootstrap-deprecated.R'
|
||||
'bootstrap-layout.R'
|
||||
@@ -130,9 +129,9 @@ Collate:
|
||||
'map.R'
|
||||
'utils.R'
|
||||
'bootstrap.R'
|
||||
'cache-disk.R'
|
||||
'cache-memory.R'
|
||||
'cache-utils.R'
|
||||
'deprecated.R'
|
||||
'devmode.R'
|
||||
'diagnose.R'
|
||||
'fileupload.R'
|
||||
'font-awesome.R'
|
||||
@@ -142,7 +141,6 @@ Collate:
|
||||
'history.R'
|
||||
'hooks.R'
|
||||
'html-deps.R'
|
||||
'htmltools.R'
|
||||
'image-interact-opts.R'
|
||||
'image-interact.R'
|
||||
'imageutils.R'
|
||||
@@ -187,6 +185,7 @@ Collate:
|
||||
'server-resource-paths.R'
|
||||
'server.R'
|
||||
'shiny-options.R'
|
||||
'shiny-package.R'
|
||||
'shinyapp.R'
|
||||
'shinyui.R'
|
||||
'shinywrappers.R'
|
||||
@@ -197,7 +196,11 @@ Collate:
|
||||
'test-server.R'
|
||||
'test.R'
|
||||
'update-input.R'
|
||||
'utils-lang.R'
|
||||
'version_jquery.R'
|
||||
'viewer.R'
|
||||
RoxygenNote: 7.1.1
|
||||
Encoding: UTF-8
|
||||
Roxygen: list(markdown = TRUE)
|
||||
RdMacros: lifecycle
|
||||
Config/testthat/edition: 3
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -335,7 +335,7 @@ THE SOFTWARE.
|
||||
|
||||
----
|
||||
|
||||
Copyright (c) 2014, Dave Gandy http://fontawesome.io/,
|
||||
Copyright (c) 2014, Dave Gandy http://fontawesome.com/,
|
||||
with Reserved Font Name Font Awesome.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
|
||||
55
NAMESPACE
55
NAMESPACE
@@ -25,6 +25,22 @@ S3method(as.shiny.appobj,list)
|
||||
S3method(as.shiny.appobj,shiny.appobj)
|
||||
S3method(as.tags,shiny.appobj)
|
||||
S3method(as.tags,shiny.render.function)
|
||||
S3method(bindCache,"function")
|
||||
S3method(bindCache,Observer)
|
||||
S3method(bindCache,default)
|
||||
S3method(bindCache,reactive.cache)
|
||||
S3method(bindCache,reactive.event)
|
||||
S3method(bindCache,reactiveExpr)
|
||||
S3method(bindCache,shiny.render.function)
|
||||
S3method(bindCache,shiny.render.function.cache)
|
||||
S3method(bindCache,shiny.render.function.event)
|
||||
S3method(bindCache,shiny.renderPlot)
|
||||
S3method(bindEvent,Observer)
|
||||
S3method(bindEvent,Observer.event)
|
||||
S3method(bindEvent,default)
|
||||
S3method(bindEvent,reactive.event)
|
||||
S3method(bindEvent,reactiveExpr)
|
||||
S3method(bindEvent,shiny.render.function)
|
||||
S3method(format,reactiveExpr)
|
||||
S3method(format,reactiveVal)
|
||||
S3method(names,reactivevalues)
|
||||
@@ -50,6 +66,8 @@ export(animationOptions)
|
||||
export(appendTab)
|
||||
export(as.shiny.appobj)
|
||||
export(basicPage)
|
||||
export(bindCache)
|
||||
export(bindEvent)
|
||||
export(bookmarkButton)
|
||||
export(bootstrapLib)
|
||||
export(bootstrapPage)
|
||||
@@ -73,6 +91,7 @@ export(dateInput)
|
||||
export(dateRangeInput)
|
||||
export(dblclickOpts)
|
||||
export(debounce)
|
||||
export(devmode)
|
||||
export(dialogViewer)
|
||||
export(diskCache)
|
||||
export(div)
|
||||
@@ -104,6 +123,7 @@ export(getDefaultReactiveDomain)
|
||||
export(getQueryString)
|
||||
export(getShinyOption)
|
||||
export(getUrlHash)
|
||||
export(get_devmode_option)
|
||||
export(h1)
|
||||
export(h2)
|
||||
export(h3)
|
||||
@@ -121,6 +141,7 @@ export(httpResponse)
|
||||
export(icon)
|
||||
export(imageOutput)
|
||||
export(img)
|
||||
export(in_devmode)
|
||||
export(incProgress)
|
||||
export(includeCSS)
|
||||
export(includeHTML)
|
||||
@@ -181,6 +202,7 @@ export(pre)
|
||||
export(prependTab)
|
||||
export(printError)
|
||||
export(printStackTrace)
|
||||
export(quoToFunction)
|
||||
export(radioButtons)
|
||||
export(reactive)
|
||||
export(reactiveConsole)
|
||||
@@ -310,13 +332,15 @@ export(withMathJax)
|
||||
export(withProgress)
|
||||
export(withReactiveDomain)
|
||||
export(withTags)
|
||||
export(with_devmode)
|
||||
import(R6)
|
||||
import(digest)
|
||||
import(htmltools)
|
||||
import(httpuv)
|
||||
import(methods)
|
||||
import(mime)
|
||||
import(xtable)
|
||||
importFrom(ellipsis,check_dots_empty)
|
||||
importFrom(ellipsis,check_dots_unnamed)
|
||||
importFrom(fastmap,fastmap)
|
||||
importFrom(fastmap,is.key_missing)
|
||||
importFrom(fastmap,key_missing)
|
||||
@@ -360,5 +384,34 @@ importFrom(htmltools,tagSetChildren)
|
||||
importFrom(htmltools,tags)
|
||||
importFrom(htmltools,validateCssUnit)
|
||||
importFrom(htmltools,withTags)
|
||||
importFrom(lifecycle,deprecated)
|
||||
importFrom(promises,"%...!%")
|
||||
importFrom(promises,"%...>%")
|
||||
importFrom(promises,as.promise)
|
||||
importFrom(promises,is.promising)
|
||||
importFrom(promises,promise)
|
||||
importFrom(promises,promise_reject)
|
||||
importFrom(promises,promise_resolve)
|
||||
importFrom(rlang,"%||%")
|
||||
importFrom(rlang,as_function)
|
||||
importFrom(rlang,as_quosure)
|
||||
importFrom(rlang,enexpr)
|
||||
importFrom(rlang,enquo)
|
||||
importFrom(rlang,enquos)
|
||||
importFrom(rlang,enquos0)
|
||||
importFrom(rlang,eval_tidy)
|
||||
importFrom(rlang,expr)
|
||||
importFrom(rlang,get_env)
|
||||
importFrom(rlang,get_expr)
|
||||
importFrom(rlang,inject)
|
||||
importFrom(rlang,is_false)
|
||||
importFrom(rlang,is_missing)
|
||||
importFrom(rlang,is_na)
|
||||
importFrom(rlang,is_quosure)
|
||||
importFrom(rlang,maybe_missing)
|
||||
importFrom(rlang,missing_arg)
|
||||
importFrom(rlang,new_function)
|
||||
importFrom(rlang,new_quosure)
|
||||
importFrom(rlang,pairlist2)
|
||||
importFrom(rlang,quo)
|
||||
importFrom(rlang,zap_srcref)
|
||||
|
||||
94
NEWS.md
94
NEWS.md
@@ -1,11 +1,49 @@
|
||||
|
||||
shiny 1.5.0.9000
|
||||
shiny 1.6.0.9000
|
||||
================
|
||||
|
||||
## Full changelog
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* The `format` and `locale` arguments to `sliderInput()` have been removed. They have been deprecated since 0.10.2.2 (released on 2014-12-08).
|
||||
|
||||
### Minor new features and improvements
|
||||
|
||||
* Shiny's core JavaScript code was converted to TypeScript. For the latest development information, please see the [README.md in `./srcts`](https://github.com/rstudio/shiny/tree/master/srcts). (#3296)
|
||||
|
||||
* Switched from `digest::digest()` to `rlang::hash()` for hashing. (#3264)
|
||||
|
||||
* Switched from internal `Stack` class to `fastmap::faststack()`, and used `fastmap::fastqueue()`. (#3176)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
### Library updates
|
||||
|
||||
* Closed #3286: Updated to Font-Awesome 5.15.2. (#3288)
|
||||
|
||||
* Updated to jQuery 3.6.0. (#3311)
|
||||
|
||||
shiny 1.6.0
|
||||
===========
|
||||
|
||||
This release focuses on improvements in three main areas:
|
||||
|
||||
1. Better theming (and Bootstrap 4) support:
|
||||
* The `theme` argument of `fluidPage()`, `navbarPage()`, and `bootstrapPage()` all now understand `bslib::bs_theme()` objects, which can be used to opt-into Bootstrap 4, use any Bootswatch theme, and/or implement custom themes without writing any CSS.
|
||||
* The `session` object now includes `$setCurrentTheme()` and `$getCurrentTheme()` methods to dynamically update (or obtain) the page's `theme` after initial load, which is useful for things such as [adding a dark mode switch to an app](https://rstudio.github.io/bslib/articles/theming.html#dynamic-shiny) or some other "real-time" theming tool like `bslib::bs_themer()`.
|
||||
* For more details, see [`{bslib}`'s website](https://rstudio.github.io/bslib/)
|
||||
|
||||
2. Caching of `reactive()` and `render*()` (e.g. `renderText()`, `renderTable()`, etc) expressions.
|
||||
* Such expressions automatically cache their _most recent value_, which helps to avoid redundant computation within a single "flush" of reactivity. The new `bindCache()` function can be used to cache _all previous values_ (as long as they fit in the cache). This cache may be optionally scoped within and/or across user sessions, possibly leading to huge performance gains, especially when deployed at scale across user sessions.
|
||||
* For more details, see `help(bindCache, package = "shiny")`
|
||||
|
||||
3. Various improvements to accessibility for screen-reader and keyboard users.
|
||||
* For more details, see the accessibility section below.
|
||||
|
||||
## Full changelog
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* Closed #3074: Shiny no longer supports file uploads for Internet Explorer 8 or 9. (#3075)
|
||||
|
||||
* Subtle changes, and some soft-deprecations, have come to `freezeReactiveValue` and `freezeReactiveVal` (#3055). These functions have been fragile at best in previous releases (issues #1791, #2463, #2946). In this release, we've solved all the problems we know about with `freezeReactiveValue(input, "x")`, by 1) invalidating `input$x` and set it to `NULL` whenever we freeze, and 2) ensuring that, after a freeze, even if the effect of `renderUI` or `updateXXXInput` is to set `input$x` to the same value it already has, this will result in an invalidation (whereas by default, Shiny filters out such spurious assignments).
|
||||
@@ -16,6 +54,8 @@ shiny 1.5.0.9000
|
||||
|
||||
* Added [bootstrap accessibility plugin](https://github.com/paypal/bootstrap-accessibility-plugin) under the hood to improve accessibility of shiny apps for screen-reader and keyboard users: the enhancements include better navigations for alert, tooltip, popover, modal dialog, dropdown, tab Panel, collapse, and carousel elements. (#2911)
|
||||
|
||||
* Closed #2987: Improved accessibility of "live regions" -- namely, `*Output()` bindings and `update*Input()`. (#3042)
|
||||
|
||||
* Added appropriate labels to `icon()` element to provide screen-reader users with alternative descriptions for the `fontawesome` and `glyphicon`: `aria-label` is automatically applied based on the fontawesome name. For example, `icon("calendar")` will be announced as "calendar icon" to screen readers. "presentation" aria role has also been attached to `icon()` to remove redundant semantic info for screen readers. (#2917)
|
||||
|
||||
* Closed #2929: Fixed keyboard accessibility for file picker button: keyboard users can now tab to focus on `fileInput()` widget. (#2937)
|
||||
@@ -30,8 +70,12 @@ shiny 1.5.0.9000
|
||||
|
||||
* Closed #2844: Added `lang` argument to ui `*Page()` functions (e.g., `fluidPage`, `bootstrapPage`) that specifies document-level language within the app for the accessibility of screen readers and search-engine parsers. By default, it is set to empty string which is commonly recognized as a browser's default locale. (#2920)
|
||||
|
||||
* Improved accessibility for `radioButtons()` and `checkboxGroupInput()`: All options are now grouped together semantically for assistive technologies. (thanks @jooyoungseo, #3187).
|
||||
|
||||
### Minor new features and improvements
|
||||
|
||||
* Added support for Shiny Developer Mode. Developer Mode enables a number of `options()` to make a developer's life easier, like enabling non-minified JS and printing messages about deprecated functions and options. See `?devmode()` for more details. (#3174)
|
||||
|
||||
* New `reactiveConsole()` makes it easier to interactively experiment with reactivity at the console (#2518).
|
||||
|
||||
* When UI is specified as a function (e.g. `ui <- function(req) { ... }`), the response can now be an HTTP response as returned from the (newly exported) `httpResponse()` function. (#2970)
|
||||
@@ -54,20 +98,34 @@ shiny 1.5.0.9000
|
||||
|
||||
* `shinyOptions()` now has session-level scoping, in addition to global and application-level scoping. (#3080)
|
||||
|
||||
### Bug fixes
|
||||
* `runApp()` now warns when running an application in an R package directory. (#3114)
|
||||
|
||||
* Fixed #2859: `renderPlot()` wasn't correctly setting `showtext::showtext_opts()`'s `dpi` setting with the correct resolution on high resolution displays; which means, if the font was rendered by showtext, font sizes would look smaller than they should on such displays. (#2941)
|
||||
* Shiny now uses `cache_mem` from the cachem package, instead of `memoryCache` and `diskCache`. (#3118)
|
||||
|
||||
* Closed #3140: Added support for `...` argument in `icon()`. (#3143)
|
||||
|
||||
* Closed #629: All `update*` functions now have a default value for `session`, and issue an informative warning if it is missing. (#3195, #3199)
|
||||
|
||||
* Improved error messages when reading reactive values outside of a reactive domain (e.g., `reactiveVal()()`). (#3007)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* Fixed #1942: Calling `runApp("app.R")` no longer ignores options passed into `shinyApp()`. This makes it possible for Shiny apps to specify what port/host should be used by default. (#2969)
|
||||
|
||||
* Fixed #3033: When a `DiskCache` was created with both `max_n` and `max_size`, too many items could get pruned when `prune()` was called. (#3034)
|
||||
|
||||
* Fixed #2703: Fixed numerous issues with some combinations of `min`/`value`/`max` causing issues with `date[Range]Input()` and `updateDate[Range]Input()`. (#3038, #3201)
|
||||
|
||||
* Fixed #2936: `dateYMD` was giving a warning when passed a vector of dates from `dateInput` which was greater than length 1. The length check was removed because it was not needed. (#3061)
|
||||
|
||||
* Fixed #2266, #2688: `radioButtons` and `updateRadioButtons` now accept `character(0)` to indicate that none of the options should be selected (thanks to @ColinFay). (#3043)
|
||||
|
||||
* Fixed a bug that `textAreaInput()` doesn't work as expected for relative `width` (thanks to @shrektan). (#2049)
|
||||
|
||||
* Fixed #2859: `renderPlot()` wasn't correctly setting `showtext::showtext_opts()`'s `dpi` setting with the correct resolution on high resolution displays; which means, if the font was rendered by showtext, font sizes would look smaller than they should on such displays. (#2941)
|
||||
|
||||
* Closed #2910, #2909, #1552: `sliderInput()` warns if the `value` is outside of `min` and `max`, and errors if `value` is `NULL` or `NA`. (#3194)
|
||||
|
||||
### Library updates
|
||||
|
||||
* Removed html5shiv and respond.js, which were used for IE 8 and IE 9 compatibility. (#2973)
|
||||
@@ -260,7 +318,7 @@ shiny 1.3.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](http://shiny.rstudio.com/articles/plot-caching.html) to get the most out of this feature.
|
||||
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.
|
||||
|
||||
## Full changelog
|
||||
|
||||
@@ -684,7 +742,7 @@ This is a maintenance release of Shiny, with some bug fixes and minor new featur
|
||||
|
||||
* Restored file inputs are now copied on restore, so that the restored application can't modify the bookmarked file. (#1370)
|
||||
|
||||
* Added support for plot interaction in the development version of ggplot2, 2.1.0.9000. Also added support for ggplot2 plots with `coord_flip()` (in the development version of ggplot2). ([hadley/ggplot2#1781](https://github.com/hadley/ggplot2/issues/1781), #1392)
|
||||
* Added support for plot interaction in the development version of ggplot2, 2.1.0.9000. Also added support for ggplot2 plots with `coord_flip()` (in the development version of ggplot2). ([hadley/ggplot2#1781](https://github.com/tidyverse/ggplot2/issues/1781), #1392)
|
||||
|
||||
|
||||
### Bug fixes
|
||||
@@ -716,7 +774,7 @@ Shiny now supports bookmarkable state: users can save the state of an applicatio
|
||||
**_Important note_:**
|
||||
> Saved-to-server bookmarking currently works with Shiny Server Open Source. Support on Shiny Server Pro, RStudio Connect, and shinyapps.io is under development and testing. However, URL-encoded bookmarking works on all hosting platforms.
|
||||
|
||||
See [this article](http://shiny.rstudio.com/articles/bookmarking-state.html) to get started with bookmarkable state. There is also an [advanced-level article](http://shiny.rstudio.com/articles/advanced-bookmarking.html) (for apps that have a complex state), and [a modules article](http://shiny.rstudio.com/articles/bookmarking-modules.html) that details how to use bookmarking in conjunction with modules.
|
||||
See [this article](https://shiny.rstudio.com/articles/bookmarking-state.html) to get started with bookmarkable state. There is also an [advanced-level article](https://shiny.rstudio.com/articles/advanced-bookmarking.html) (for apps that have a complex state), and [a modules article](https://shiny.rstudio.com/articles/bookmarking-modules.html) that details how to use bookmarking in conjunction with modules.
|
||||
|
||||
## Notifications
|
||||
|
||||
@@ -726,7 +784,7 @@ Shiny can now display notifications on the client browser by using the `showNoti
|
||||
<img src="http://shiny.rstudio.com/images/notification.png" alt="notification" width="50%"/>
|
||||
</p>
|
||||
|
||||
[Here](http://shiny.rstudio.com/articles/notifications.html)'s our article about it, and the [reference documentation](http://shiny.rstudio.com/reference/shiny/latest/showNotification.html).
|
||||
[Here](https://shiny.rstudio.com/articles/notifications.html)'s our article about it, and the [reference documentation](https://shiny.rstudio.com/reference/shiny/latest/showNotification.html).
|
||||
|
||||
## Progress indicators
|
||||
|
||||
@@ -735,7 +793,7 @@ If your Shiny app contains computations that take a long time to complete, a pro
|
||||
**_Important note_:**
|
||||
> If you were already using progress bars and had customized them with your own CSS, you can add the `style = "old"` argument to your `withProgress()` call (or `Progress$new()`). This will result in the same appearance as before. You can also call `shinyOptions(progress.style = "old")` in your app's server function to make all progress indicators use the old styling.
|
||||
|
||||
To see new progress bars in action, see [this app](https://gallery.shinyapps.io/085-progress/) in the gallery. You can also learn more about this in [our article](http://shiny.rstudio.com/articles/progress.html) and in the reference documentation (either for the easier [`withProgress` functional API](http://shiny.rstudio.com/reference/shiny/latest/withProgress.html) or the more complicated, but more powerful, [`Progress` object-oriented API](http://shiny.rstudio.com/reference/shiny/latest/Progress.html).
|
||||
To see new progress bars in action, see [this app](https://gallery.shinyapps.io/085-progress/) in the gallery. You can also learn more about this in [our article](https://shiny.rstudio.com/articles/progress.html) and in the reference documentation (either for the easier [`withProgress` functional API](https://shiny.rstudio.com/reference/shiny/latest/withProgress.html) or the more complicated, but more powerful, [`Progress` object-oriented API](https://shiny.rstudio.com/reference/shiny/latest/Progress.html).
|
||||
|
||||
## Reconnection
|
||||
|
||||
@@ -749,7 +807,7 @@ Shiny has now built-in support for displaying modal dialogs like the one below (
|
||||
<img src="http://shiny.rstudio.com/images/modal-dialog.png" alt="modal-dialog" width="50%"/>
|
||||
</p>
|
||||
|
||||
To learn more about this, read [our article](http://shiny.rstudio.com/articles/modal-dialogs.html) and the [reference documentation](http://shiny.rstudio.com/reference/shiny/latest/modalDialog.html).
|
||||
To learn more about this, read [our article](https://shiny.rstudio.com/articles/modal-dialogs.html) and the [reference documentation](https://shiny.rstudio.com/reference/shiny/latest/modalDialog.html).
|
||||
|
||||
## `insertUI` and `removeUI`
|
||||
|
||||
@@ -757,13 +815,13 @@ Sometimes in a Shiny app, arbitrary HTML UI may need to be created on-the-fly in
|
||||
|
||||
See [this simple demo app](https://gallery.shinyapps.io/111-insert-ui/) of how one could use `insertUI` and `removeUI` to insert and remove text elements using a queue. Also see [this other app](https://gallery.shinyapps.io/insertUI/) that demonstrates how to insert and remove a few common Shiny input objects. Finally, [this app](https://gallery.shinyapps.io/insertUI-modules/) shows how to dynamically insert modules using `insertUI`.
|
||||
|
||||
For more, read [our article](http://shiny.rstudio.com/articles/dynamic-ui.html) about dynamic UI generation and the reference documentation about [`insertUI`](http://shiny.rstudio.com/reference/shiny/latest/insertUI.html) and [`removeUI`](http://shiny.rstudio.com/reference/shiny/latest/removeUI.html).
|
||||
For more, read [our article](https://shiny.rstudio.com/articles/dynamic-ui.html) about dynamic UI generation and the reference documentation about [`insertUI`](https://shiny.rstudio.com/reference/shiny/latest/insertUI.html) and [`removeUI`](https://shiny.rstudio.com/reference/shiny/latest/insertUI.html).
|
||||
|
||||
## Documentation for connecting to an external database
|
||||
|
||||
Many Shiny users have asked about best practices for accessing external databases from their Shiny applications. Although database access has long been possible using various database connector packages in R, it can be challenging to use them robustly in the dynamic environment that Shiny provides. So far, it has been mostly up to application authors to find the appropriate database drivers and to discover how to manage the database connections within an application. In order to demystify this process, we wrote a series of articles ([first one here](http://shiny.rstudio.com/articles/overview.html)) that covers the basics of connecting to an external database, as well as some security precautions to keep in mind (e.g. [how to avoid SQL injection attacks](http://shiny.rstudio.com/articles/sql-injections.html)).
|
||||
Many Shiny users have asked about best practices for accessing external databases from their Shiny applications. Although database access has long been possible using various database connector packages in R, it can be challenging to use them robustly in the dynamic environment that Shiny provides. So far, it has been mostly up to application authors to find the appropriate database drivers and to discover how to manage the database connections within an application. In order to demystify this process, we wrote a series of articles ([first one here](https://shiny.rstudio.com/articles/overview.html)) that covers the basics of connecting to an external database, as well as some security precautions to keep in mind (e.g. [how to avoid SQL injection attacks](https://shiny.rstudio.com/articles/sql-injections.html)).
|
||||
|
||||
There are a few packages that you should look at if you're using a relational database in a Shiny app: the `dplyr` and `DBI` packages (both featured in the article linked to above), and the brand new `pool` package, which provides a further layer of abstraction to make it easier and safer to use either `DBI` or `dplyr`. `pool` is not yet on CRAN. In particular, `pool` will take care of managing connections, preventing memory leaks, and ensuring the best performance. See this [`pool` basics article](http://shiny.rstudio.com/articles/pool-basics.html) and the [more advanced-level article](http://shiny.rstudio.com/articles/pool-advanced.html) if you're feeling adventurous! (Both of these articles contain Shiny app examples that use `DBI` to connect to an external MySQL database.) If you are more comfortable with `dplyr` than `DBI`, don't miss the article about the [integration of `pool` and `dplyr`](http://shiny.rstudio.com/articles/pool-dplyr.html).
|
||||
There are a few packages that you should look at if you're using a relational database in a Shiny app: the `dplyr` and `DBI` packages (both featured in the article linked to above), and the brand new `pool` package, which provides a further layer of abstraction to make it easier and safer to use either `DBI` or `dplyr`. `pool` is not yet on CRAN. In particular, `pool` will take care of managing connections, preventing memory leaks, and ensuring the best performance. See this [`pool` basics article](https://shiny.rstudio.com/articles/pool-basics.html) and the [more advanced-level article](https://shiny.rstudio.com/articles/pool-advanced.html) if you're feeling adventurous! (Both of these articles contain Shiny app examples that use `DBI` to connect to an external MySQL database.) If you are more comfortable with `dplyr` than `DBI`, don't miss the article about the [integration of `pool` and `dplyr`](https://shiny.rstudio.com/articles/pool-dplyr.html).
|
||||
|
||||
If you're new to databases in the Shiny world, we recommend using `dplyr` and `pool` if possible. If you need greater control than `dplyr` offers (for example, if you need to modify data in the database or use transactions), then use `DBI` and `pool`. The `pool` package was introduced to make your life easier, but in no way constrains you, so we don't envision any situation in which you'd be better off *not* using it. The only caveat is that `pool` is not yet on CRAN, so you may prefer to wait for that.
|
||||
|
||||
@@ -771,11 +829,11 @@ If you're new to databases in the Shiny world, we recommend using `dplyr` and `p
|
||||
|
||||
There are many more minor features, small improvements, and bug fixes than we can cover here, so we'll just mention a few of the more noteworthy ones (the full changelog, with links to all the relevant issues and pull requests, is right below this section):
|
||||
|
||||
* **Error Sanitization**: you now have the option to sanitize error messages; in other words, the content of the original error message can be suppressed so that it doesn't leak any sensitive information. To sanitize errors everywhere in your app, just add `options(shiny.sanitize.errors = TRUE)` somewhere in your app. Read [this article](http://shiny.rstudio.com/articles/sanitize-errors.html) for more, or play with the [demo app](https://gallery.shinyapps.io/110-error-sanitization/).
|
||||
* **Error Sanitization**: you now have the option to sanitize error messages; in other words, the content of the original error message can be suppressed so that it doesn't leak any sensitive information. To sanitize errors everywhere in your app, just add `options(shiny.sanitize.errors = TRUE)` somewhere in your app. Read [this article](https://shiny.rstudio.com/articles/sanitize-errors.html) for more, or play with the [demo app](https://gallery.shinyapps.io/110-error-sanitization/).
|
||||
|
||||
* **Code Diagnostics**: if there is an error parsing `ui.R`, `server.R`, `app.R`, or `global.R`, Shiny will search the code for missing commas, extra commas, and unmatched braces, parens, and brackets, and will print out messages pointing out those problems. (#1126)
|
||||
|
||||
* **Reactlog visualization**: by default, the [`showReactLog()` function](http://shiny.rstudio.com/reference/shiny/latest/reactlog.html) (which brings up the reactive graph) also displays the time that each reactive and observer were active for:
|
||||
* **Reactlog visualization**: by default, the [`showReactLog()` function](https://shiny.rstudio.com/reference/shiny/latest/reactlog.html) (which brings up the reactive graph) also displays the time that each reactive and observer were active for:
|
||||
|
||||
<p align="center">
|
||||
<img src="http://shiny.rstudio.com/images/reactlog.png" alt="modal-dialog" width="75%"/>
|
||||
@@ -791,7 +849,7 @@ There are many more minor features, small improvements, and bug fixes than we ca
|
||||
<img src="http://shiny.rstudio.com/images/render-table.png" alt="render-table" width="75%"/>
|
||||
</p>
|
||||
|
||||
For more, read our [short article](http://shiny.rstudio.com/articles/render-table.html) about this update, experiment with all the new features in this [demo app](https://gallery.shinyapps.io/109-render-table/), or check out the [reference documentation](http://shiny.rstudio.com/reference/shiny/latest/renderTable.html).
|
||||
For more, read our [short article](https://shiny.rstudio.com/articles/render-table.html) about this update, experiment with all the new features in this [demo app](https://gallery.shinyapps.io/109-render-table/), or check out the [reference documentation](https://shiny.rstudio.com/reference/shiny/latest/renderTable.html).
|
||||
|
||||
## Full changelog
|
||||
|
||||
@@ -1118,7 +1176,7 @@ Shiny 0.11 switches away from the Bootstrap 2 web framework to the next version,
|
||||
* `updateSliderInput()` can now control the min, max, value, and step size of a slider. Previously, only the value could be controlled this way, and if you wanted to change other values, you needed to use Shiny's dynamic UI.
|
||||
|
||||
|
||||
* If in your HTML you are using custom CSS classes that are specific to Bootstrap, you may need to update them for Bootstrap 3. See the Bootstrap [migration guide](http://getbootstrap.com/migration/).
|
||||
* If in your HTML you are using custom CSS classes that are specific to Bootstrap, you may need to update them for Bootstrap 3. See the Bootstrap [migration guide](https://getbootstrap.com/migration/).
|
||||
|
||||
|
||||
If you encounter other migration issues, please let us know on the [shiny-discuss](https://groups.google.com/forum/#!forum/shiny-discuss) mailing list, or on the Shiny [issue tracker](https://github.com/rstudio/shiny/issues).
|
||||
@@ -1311,7 +1369,7 @@ shiny 0.9.0
|
||||
|
||||
* Added `theme` parameter to page building functions for specifying alternate bootstrap css styles.
|
||||
|
||||
* Added `icon()` function for embedding icons from the [font awesome](http://fontawesome.io/) icon library
|
||||
* Added `icon()` function for embedding icons from the [font awesome](https://fontawesome.com) icon library
|
||||
|
||||
* Added `makeReactiveBinding` function to turn a "regular" variable into a reactive one (i.e. reading the variable makes the current reactive context dependent on it, and setting the variable is a source of reactivity).
|
||||
|
||||
|
||||
774
R/bind-cache.R
Normal file
774
R/bind-cache.R
Normal file
@@ -0,0 +1,774 @@
|
||||
utils::globalVariables(".GenericCallEnv", add = TRUE)
|
||||
|
||||
#' Add caching with reactivity to an object
|
||||
#'
|
||||
#' @description
|
||||
#'
|
||||
#' `bindCache()` adds caching [reactive()] expressions and `render*` functions
|
||||
#' (like [renderText()], [renderTable()], ...).
|
||||
#'
|
||||
#' Ordinary [reactive()] expressions automatically cache their _most recent_
|
||||
#' value, which helps to avoid redundant computation in downstream reactives.
|
||||
#' `bindCache()` will cache all previous values (as long as they fit in the
|
||||
#' cache) and they can be shared across user sessions. This allows
|
||||
#' `bindCache()` to dramatically improve performance when used correctly.
|
||||
|
||||
#' @details
|
||||
#'
|
||||
#' `bindCache()` requires one or more expressions that are used to generate a
|
||||
#' **cache key**, which is used to determine if a computation has occurred
|
||||
#' before and hence can be retrieved from the cache. If you're familiar with the
|
||||
#' concept of memoizing pure functions (e.g., the \pkg{memoise} package), you
|
||||
#' can think of the cache key as the input(s) to a pure function. As such, one
|
||||
#' should take care to make sure the use of `bindCache()` is _pure_ in the same
|
||||
#' sense, namely:
|
||||
#'
|
||||
#' 1. For a given key, the return value is always the same.
|
||||
#' 2. Evaluation has no side-effects.
|
||||
#'
|
||||
#' In the example here, the `bindCache()` key consists of `input$x` and
|
||||
#' `input$y` combined, and the value is `input$x * input$y`. In this simple
|
||||
#' example, for any given key, there is only one possible returned value.
|
||||
#'
|
||||
#' ```
|
||||
#' r <- reactive({ input$x * input$y }) %>%
|
||||
#' bindCache(input$x, input$y)
|
||||
#' ```
|
||||
#'
|
||||
|
||||
#' The largest performance improvements occur when the cache key is fast to
|
||||
#' compute and the reactive expression is slow to compute. To see if the value
|
||||
#' should be computed, a cached reactive evaluates the key, and then serializes
|
||||
#' and hashes the result. If the resulting hashed key is in the cache, then the
|
||||
#' cached reactive simply retrieves the previously calculated value and returns
|
||||
#' it; if not, then the value is computed and the result is stored in the cache
|
||||
#' before being returned.
|
||||
#'
|
||||
#' To compute the cache key, `bindCache()` hashes the contents of `...`, so it's
|
||||
#' best to avoid including large objects in a cache key since that can result in
|
||||
#' slow hashing. It's also best to avoid reference objects like environments and
|
||||
#' R6 objects, since the serialization of these objects may not capture relevant
|
||||
#' changes.
|
||||
#'
|
||||
#' If you want to use a large object as part of a cache key, it may make sense
|
||||
#' to do some sort of reduction on the data that still captures information
|
||||
#' about whether a value can be retrieved from the cache. For example, if you
|
||||
#' have a large data set with timestamps, it might make sense to extract the
|
||||
#' most recent timestamp and return that. Then, instead of hashing the entire
|
||||
#' data object, the cached reactive only needs to hash the timestamp.
|
||||
#'
|
||||
#' ```
|
||||
#' r <- reactive({ compute(bigdata()) } %>%
|
||||
#' bindCache({ extract_most_recent_time(bigdata()) })
|
||||
#' ```
|
||||
#'
|
||||
#' For computations that are very slow, it often makes sense to pair
|
||||
#' [bindCache()] with [bindEvent()] so that no computation is performed until
|
||||
#' the user explicitly requests it (for more, see the Details section of
|
||||
#' [bindEvent()]).
|
||||
|
||||
#' @section Cache keys and reactivity:
|
||||
#'
|
||||
#' Because the **value** expression (from the original [reactive()]) is
|
||||
#' cached, it is not necessarily re-executed when someone retrieves a value,
|
||||
#' and therefore it can't be used to decide what objects to take reactive
|
||||
#' dependencies on. Instead, the **key** is used to figure out which objects
|
||||
#' to take reactive dependencies on. In short, the key expression is reactive,
|
||||
#' and value expression is no longer reactive.
|
||||
#'
|
||||
#' Here's an example of what not to do: if the key is `input$x` and the value
|
||||
#' expression is from `reactive({input$x + input$y})`, then the resulting
|
||||
#' cached reactive will only take a reactive dependency on `input$x` -- it
|
||||
#' won't recompute `{input$x + input$y}` when just `input$y` changes.
|
||||
#' Moreover, the cache won't use `input$y` as part of the key, and so it could
|
||||
#' return incorrect values in the future when it retrieves values from the
|
||||
#' cache. (See the examples below for an example of this.)
|
||||
#'
|
||||
#' A better cache key would be something like `input$x, input$y`. This does
|
||||
#' two things: it ensures that a reactive dependency is taken on both
|
||||
#' `input$x` and `input$y`, and it also makes sure that both values are
|
||||
#' represented in the cache key.
|
||||
#'
|
||||
#' In general, `key` should use the same reactive inputs as `value`, but the
|
||||
#' computation should be simpler. If there are other (non-reactive) values
|
||||
#' that are consumed, such as external data sources, they should be used in
|
||||
#' the `key` as well. Note that if the `key` is large, it can make sense to do
|
||||
#' some sort of reduction on it so that the serialization and hashing of the
|
||||
#' cache key is not too expensive.
|
||||
#'
|
||||
#' Remember that the key is _reactive_, so it is not re-executed every single
|
||||
#' time that someone accesses the cached reactive. It is only re-executed if
|
||||
#' it has been invalidated by one of the reactives it depends on. For
|
||||
#' example, suppose we have this cached reactive:
|
||||
#'
|
||||
#' ```
|
||||
#' r <- reactive({ input$x * input$y }) %>%
|
||||
#' bindCache(input$x, input$y)
|
||||
#' ```
|
||||
#'
|
||||
#' In this case, the key expression is essentially `reactive(list(input$x,
|
||||
#' input$y))` (there's a bit more to it, but that's a good enough
|
||||
#' approximation). The first time `r()` is called, it executes the key, then
|
||||
#' fails to find it in the cache, so it executes the value expression, `{
|
||||
#' input$x + input$y }`. If `r()` is called again, then it does not need to
|
||||
#' re-execute the key expression, because it has not been invalidated via a
|
||||
#' change to `input$x` or `input$y`; it simply returns the previous value.
|
||||
#' However, if `input$x` or `input$y` changes, then the reactive expression will
|
||||
#' be invalidated, and the next time that someone calls `r()`, the key
|
||||
#' expression will need to be re-executed.
|
||||
#'
|
||||
#' Note that if the cached reactive is passed to [bindEvent()], then the key
|
||||
#' expression will no longer be reactive; instead, the event expression will be
|
||||
#' reactive.
|
||||
#'
|
||||
#'
|
||||
#' @section Cache scope:
|
||||
#'
|
||||
#' By default, when `bindCache()` is used, it is scoped to the running
|
||||
#' application. That means that it shares a cache with all user sessions
|
||||
#' connected to the application (within the R process). This is done with the
|
||||
#' `cache` parameter's default value, `"app"`.
|
||||
#'
|
||||
#' With an app-level cache scope, one user can benefit from the work done for
|
||||
#' another user's session. In most cases, this is the best way to get
|
||||
#' performance improvements from caching. However, in some cases, this could
|
||||
#' leak information between sessions. For example, if the cache key does not
|
||||
#' fully encompass the inputs used by the value, then data could leak between
|
||||
#' the sessions. Or if a user sees that a cached reactive returns its value
|
||||
#' very quickly, they may be able to infer that someone else has already used
|
||||
#' it with the same values.
|
||||
#'
|
||||
#' It is also possible to scope the cache to the session, with
|
||||
#' `cache="session"`. This removes the risk of information leaking between
|
||||
#' sessions, but then one session cannot benefit from computations performed in
|
||||
#' another session.
|
||||
#'
|
||||
#' It is possible to pass in caching objects directly to
|
||||
#' `bindCache()`. This can be useful if, for example, you want to use a
|
||||
#' particular type of cache with specific cached reactives, or if you want to
|
||||
#' use a [cachem::cache_disk()] that is shared across multiple processes and
|
||||
#' persists beyond the current R session.
|
||||
#'
|
||||
#' To use different settings for an application-scoped cache, you can call
|
||||
#' [shinyOptions()] at the top of your app.R, server.R, or
|
||||
#' global.R. For example, this will create a cache with 500 MB of space
|
||||
#' instead of the default 200 MB:
|
||||
#'
|
||||
#' ```
|
||||
#' shinyOptions(cache = cachem::cache_mem(max_size = 500e6))
|
||||
#' ```
|
||||
#'
|
||||
#' To use different settings for a session-scoped cache, you can set
|
||||
#' `self$cache` at the top of your server function. By default, it will create
|
||||
#' a 200 MB memory cache for each session, but you can replace it with
|
||||
#' something different. To use the session-scoped cache, you must also call
|
||||
#' `bindCache()` with `cache="session"`. This will create a 100 MB cache for
|
||||
#' the session:
|
||||
#'
|
||||
#' ```
|
||||
#' function(input, output, session) {
|
||||
#' session$cache <- cachem::cache_mem(max_size = 100e6)
|
||||
#' ...
|
||||
#' }
|
||||
#' ```
|
||||
#'
|
||||
#' If you want to use a cache that is shared across multiple R processes, you
|
||||
#' can use a [cachem::cache_disk()]. You can create a application-level shared
|
||||
#' cache by putting this at the top of your app.R, server.R, or global.R:
|
||||
#'
|
||||
#' ```
|
||||
#' shinyOptions(cache = cachem::cache_disk(file.path(dirname(tempdir()), "myapp-cache"))
|
||||
#' ```
|
||||
#'
|
||||
#' This will create a subdirectory in your system temp directory named
|
||||
#' `myapp-cache` (replace `myapp-cache` with a unique name of
|
||||
#' your choosing). On most platforms, this directory will be removed when
|
||||
#' your system reboots. This cache will persist across multiple starts and
|
||||
#' stops of the R process, as long as you do not reboot.
|
||||
#'
|
||||
#' To have the cache persist even across multiple reboots, you can create the
|
||||
#' cache in a location outside of the temp directory. For example, it could
|
||||
#' be a subdirectory of the application:
|
||||
#'
|
||||
#' ```
|
||||
#' shinyOptions(cache = cachem::cache_disk("./myapp-cache"))
|
||||
#' ```
|
||||
#'
|
||||
#' In this case, resetting the cache will have to be done manually, by deleting
|
||||
#' the directory.
|
||||
#'
|
||||
#' You can also scope a cache to just one item, or selected items. To do that,
|
||||
#' create a [cachem::cache_mem()] or [cachem::cache_disk()], and pass it
|
||||
#' as the `cache` argument of `bindCache()`.
|
||||
#'
|
||||
|
||||
#'
|
||||
#' @section Computing cache keys:
|
||||
#'
|
||||
#' The actual cache key that is used internally takes value from evaluating
|
||||
#' the key expression(s) (from the `...` arguments) and combines it with the
|
||||
#' (unevaluated) value expression.
|
||||
#'
|
||||
#' This means that if there are two cached reactives which have the same
|
||||
#' result from evaluating the key, but different value expressions, then they
|
||||
#' will not need to worry about collisions.
|
||||
#'
|
||||
#' However, if two cached reactives have identical key and value expressions
|
||||
#' expressions, they will share the cached values. This is useful when using
|
||||
#' `cache="app"`: there may be multiple user sessions which create separate
|
||||
#' cached reactive objects (because they are created from the same code in the
|
||||
#' server function, but the server function is executed once for each user
|
||||
#' session), and those cached reactive objects across sessions can share
|
||||
#' values in the cache.
|
||||
|
||||
|
||||
|
||||
#'
|
||||
#' @section Async with cached reactives:
|
||||
#'
|
||||
#' With a cached reactive expression, the key and/or value expression can be
|
||||
#' _asynchronous_. In other words, they can be promises --- not regular R
|
||||
#' promises, but rather objects provided by the
|
||||
#' \href{https://rstudio.github.io/promises/}{\pkg{promises}} package, which
|
||||
#' are similar to promises in JavaScript. (See [promises::promise()] for more
|
||||
#' information.) You can also use [future::future()] objects to run code in a
|
||||
#' separate process or even on a remote machine.
|
||||
#'
|
||||
#' If the value returns a promise, then anything that consumes the cached
|
||||
#' reactive must expect it to return a promise.
|
||||
#'
|
||||
#' Similarly, if the key is a promise (in other words, if it is asynchronous),
|
||||
#' then the entire cached reactive must be asynchronous, since the key must be
|
||||
#' computed asynchronously before it knows whether to compute the value or the
|
||||
#' value is retrieved from the cache. Anything that consumes the cached
|
||||
#' reactive must therefore expect it to return a promise.
|
||||
#'
|
||||
|
||||
#'
|
||||
#' @section Developing render functions for caching:
|
||||
#'
|
||||
#' If you've implemented your own `render*()` function, it may just work with
|
||||
#' `bindCache()`, but it is possible that you will need to make some
|
||||
#' modifications. These modifications involve helping `bindCache()` avoid
|
||||
#' cache collisions, dealing with internal state that may be set by the,
|
||||
#' `render` function, and modifying the data as it goes in and comes out of
|
||||
#' the cache.
|
||||
#'
|
||||
#' You may need to provide a `cacheHint` to [createRenderFunction()] (or
|
||||
#' [htmlwidgets::shinyRenderWidget()], if you've authored an htmlwidget) in
|
||||
#' order for `bindCache()` to correctly compute a cache key.
|
||||
#'
|
||||
#' The potential problem is a cache collision. Consider the following:
|
||||
#'
|
||||
#' ```
|
||||
#' output$x1 <- renderText({ input$x }) %>% bindCache(input$x)
|
||||
#' output$x2 <- renderText({ input$x * 2 }) %>% bindCache(input$x)
|
||||
#' ```
|
||||
#'
|
||||
#' Both `output$x1` and `output$x2` use `input$x` as part of their cache key,
|
||||
#' but if it were the only thing used in the cache key, then the two outputs
|
||||
#' would have a cache collision, and they would have the same output. To avoid
|
||||
#' this, a _cache hint_ is automatically added when [renderText()] calls
|
||||
#' [createRenderFunction()]. The cache hint is used as part of the actual
|
||||
#' cache key, in addition to the one passed to `bindCache()` by the user. The
|
||||
#' cache hint can be viewed by calling the internal Shiny function
|
||||
#' `extractCacheHint()`:
|
||||
#'
|
||||
#' ```
|
||||
#' r <- renderText({ input$x })
|
||||
#' shiny:::extractCacheHint(r)
|
||||
#' ```
|
||||
#'
|
||||
#' This returns a nested list containing an item, `$origUserFunc$body`, which
|
||||
#' in this case is the expression which was passed to `renderText()`:
|
||||
#' `{ input$x }`. This (quoted) expression is mixed into the actual cache
|
||||
#' key, and it is how `output$x1` does not have collisions with `output$x2`.
|
||||
#'
|
||||
#' For most developers of render functions, nothing extra needs to be done;
|
||||
#' the automatic inference of the cache hint is sufficient. Again, you can
|
||||
#' check it by calling `shiny:::extractCacheHint()`, and by testing the
|
||||
#' render function for cache collisions in a real application.
|
||||
#'
|
||||
#' In some cases, however, the automatic cache hint inference is not
|
||||
#' sufficient, and it is necessary to provide a cache hint. This is true
|
||||
#' for `renderPrint()`. Unlike `renderText()`, it wraps the user-provided
|
||||
#' expression in another function, before passing it to [markRenderFunction()]
|
||||
#' (instead of [createRenderFunction()]). Because the user code is wrapped in
|
||||
#' another function, `markRenderFunction()` is not able to automatically
|
||||
#' extract the user-provided code and use it in the cache key. Instead,
|
||||
#' `renderPrint` calls `markRenderFunction()`, it explicitly passes along a
|
||||
#' `cacheHint`, which includes a label and the original user expression.
|
||||
#'
|
||||
#' In general, if you need to provide a `cacheHint`, it is best practice to
|
||||
#' provide a `label` id, the user's `expr`, as well as any other arguments
|
||||
#' that may influence the final value.
|
||||
#'
|
||||
#' For \pkg{htmlwidgets}, it will try to automatically infer a cache hint;
|
||||
#' again, you can inspect the cache hint with `shiny:::extractCacheHint()` and
|
||||
#' also test it in an application. If you do need to explicitly provide a
|
||||
#' cache hint, pass it to `shinyRenderWidget`. For example:
|
||||
#'
|
||||
#' ```
|
||||
#' renderMyWidget <- function(expr) {
|
||||
#' expr <- substitute(expr)
|
||||
#'
|
||||
#' htmlwidgets::shinyRenderWidget(expr,
|
||||
#' myWidgetOutput,
|
||||
#' quoted = TRUE,
|
||||
#' env = parent.frame(),
|
||||
#' cacheHint = list(label = "myWidget", userExpr = expr)
|
||||
#' )
|
||||
#' }
|
||||
#' ```
|
||||
#'
|
||||
#' If your `render` function sets any internal state, you may find it useful
|
||||
#' in your call to [createRenderFunction()] or [markRenderFunction()] to use
|
||||
#' the `cacheWriteHook` and/or `cacheReadHook` parameters. These hooks are
|
||||
#' functions that run just before the object is stored in the cache, and just
|
||||
#' after the object is retrieved from the cache. They can modify the data
|
||||
#' that is stored and retrieved; this can be useful if extra information needs
|
||||
#' to be stored in the cache. They can also be used to modify the state of the
|
||||
#' application; for example, it can call [createWebDependency()] to make
|
||||
#' JS/CSS resources available if the cached object is loaded in a different R
|
||||
#' process. (See the source of `htmlwidgets::shinyRenderWidget` for an example
|
||||
#' of this.)
|
||||
#'
|
||||
#' @section Uncacheable objects:
|
||||
#'
|
||||
#' Some render functions cannot be cached, typically because they have side
|
||||
#' effects or modify some external state, and they must re-execute each time
|
||||
#' in order to work properly.
|
||||
#'
|
||||
#' For developers of such code, they should call [createRenderFunction()] or
|
||||
#' [markRenderFunction()] with `cacheHint = FALSE`.
|
||||
#'
|
||||
#'
|
||||
#' @section Caching with `renderPlot()`:
|
||||
#'
|
||||
#' When `bindCache()` is used with `renderPlot()`, the `height` and `width`
|
||||
#' passed to the original `renderPlot()` are ignored. They are superseded by
|
||||
#' `sizePolicy` argument passed to `bindCache. The default is:
|
||||
#'
|
||||
#' ```
|
||||
#' sizePolicy = sizeGrowthRatio(width = 400, height = 400, growthRate = 1.2)
|
||||
#' ```
|
||||
#'
|
||||
#' `sizePolicy` must be a function that takes a two-element numeric vector as
|
||||
#' input, representing the width and height of the `<img>` element in the
|
||||
#' browser window, and it must return a two-element numeric vector, representing
|
||||
#' the pixel dimensions of the plot to generate. The purpose is to round the
|
||||
#' actual pixel dimensions from the browser to some other dimensions, so that
|
||||
#' this will not generate and cache images of every possible pixel dimension.
|
||||
#' See [sizeGrowthRatio()] for more information on the default sizing policy.
|
||||
#'
|
||||
#' @param x The object to add caching to.
|
||||
#' @param ... One or more expressions to use in the caching key.
|
||||
#' @param cache The scope of the cache, or a cache object. This can be `"app"`
|
||||
#' (the default), `"session"`, or a cache object like a
|
||||
#' [cachem::cache_disk()]. See the Cache Scoping section for more information.
|
||||
#'
|
||||
#' @seealso [bindEvent()], [renderCachedPlot()] for caching plots.
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' rc <- bindCache(
|
||||
#' x = reactive({
|
||||
#' Sys.sleep(2) # Pretend this is expensive
|
||||
#' input$x * 100
|
||||
#' }),
|
||||
#' input$x
|
||||
#' )
|
||||
#'
|
||||
#' # Can make it prettier with the %>% operator
|
||||
#' library(magrittr)
|
||||
#'
|
||||
#' rc <- reactive({
|
||||
#' Sys.sleep(2)
|
||||
#' input$x * 100
|
||||
#' }) %>%
|
||||
#' bindCache(input$x)
|
||||
#'
|
||||
#' }
|
||||
#'
|
||||
#' ## Only run app examples in interactive R sessions
|
||||
#' if (interactive()) {
|
||||
#'
|
||||
#' # Basic example
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' sliderInput("x", "x", 1, 10, 5),
|
||||
#' sliderInput("y", "y", 1, 10, 5),
|
||||
#' div("x * y: "),
|
||||
#' verbatimTextOutput("txt")
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' r <- reactive({
|
||||
#' # The value expression is an _expensive_ computation
|
||||
#' message("Doing expensive computation...")
|
||||
#' Sys.sleep(2)
|
||||
#' input$x * input$y
|
||||
#' }) %>%
|
||||
#' bindCache(input$x, input$y)
|
||||
#'
|
||||
#' output$txt <- renderText(r())
|
||||
#' }
|
||||
#' )
|
||||
#'
|
||||
#'
|
||||
#' # Caching renderText
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' sliderInput("x", "x", 1, 10, 5),
|
||||
#' sliderInput("y", "y", 1, 10, 5),
|
||||
#' div("x * y: "),
|
||||
#' verbatimTextOutput("txt")
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' output$txt <- renderText({
|
||||
#' message("Doing expensive computation...")
|
||||
#' Sys.sleep(2)
|
||||
#' input$x * input$y
|
||||
#' }) %>%
|
||||
#' bindCache(input$x, input$y)
|
||||
#' }
|
||||
#' )
|
||||
#'
|
||||
#'
|
||||
#' # Demo of using events and caching with an actionButton
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' sliderInput("x", "x", 1, 10, 5),
|
||||
#' sliderInput("y", "y", 1, 10, 5),
|
||||
#' actionButton("go", "Go"),
|
||||
#' div("x * y: "),
|
||||
#' verbatimTextOutput("txt")
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' r <- reactive({
|
||||
#' message("Doing expensive computation...")
|
||||
#' Sys.sleep(2)
|
||||
#' input$x * input$y
|
||||
#' }) %>%
|
||||
#' bindCache(input$x, input$y) %>%
|
||||
#' bindEvent(input$go)
|
||||
#' # The cached, eventified reactive takes a reactive dependency on
|
||||
#' # input$go, but doesn't use it for the cache key. It uses input$x and
|
||||
#' # input$y for the cache key, but doesn't take a reactive depdency on
|
||||
#' # them, because the reactive dependency is superseded by addEvent().
|
||||
#'
|
||||
#' output$txt <- renderText(r())
|
||||
#' }
|
||||
#' )
|
||||
#'
|
||||
#' }
|
||||
#'
|
||||
#' @export
|
||||
bindCache <- function(x, ..., cache = "app") {
|
||||
force(cache)
|
||||
|
||||
UseMethod("bindCache")
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.default <- function(x, ...) {
|
||||
stop("Don't know how to handle object with class ", paste(class(x), collapse = ", "))
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.reactiveExpr <- function(x, ..., cache = "app") {
|
||||
check_dots_unnamed()
|
||||
|
||||
label <- exprToLabel(substitute(key), "cachedReactive")
|
||||
domain <- reactive_get_domain(x)
|
||||
|
||||
# Convert the ... to a function that returns their evaluated values.
|
||||
keyFunc <- quos_to_func(enquos0(...))
|
||||
|
||||
valueFunc <- reactive_get_value_func(x)
|
||||
# Hash cache hint now -- this will be added to the key later on, to reduce the
|
||||
# chance of key collisions with other cachedReactives.
|
||||
cacheHint <- rlang::hash(extractCacheHint(x))
|
||||
valueFunc <- wrapFunctionLabel(valueFunc, "cachedReactiveValueFunc", ..stacktraceon = TRUE)
|
||||
|
||||
# Don't hold on to the reference for x, so that it can be GC'd
|
||||
rm(x)
|
||||
# Hacky workaround for issue with `%>%` preventing GC:
|
||||
# https://github.com/tidyverse/magrittr/issues/229
|
||||
if (exists(".GenericCallEnv") && exists(".", envir = .GenericCallEnv)) {
|
||||
rm(list = ".", envir = .GenericCallEnv)
|
||||
}
|
||||
|
||||
|
||||
res <- reactive(label = label, domain = domain, {
|
||||
cache <- resolve_cache_object(cache, domain)
|
||||
hybrid_chain(
|
||||
keyFunc(),
|
||||
generateCacheFun(valueFunc, cache, cacheHint, cacheReadHook = identity, cacheWriteHook = identity)
|
||||
)
|
||||
})
|
||||
|
||||
class(res) <- c("reactive.cache", class(res))
|
||||
res
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.shiny.render.function <- function(x, ..., cache = "app") {
|
||||
check_dots_unnamed()
|
||||
|
||||
keyFunc <- quos_to_func(enquos0(...))
|
||||
|
||||
cacheHint <- rlang::hash(extractCacheHint(x))
|
||||
|
||||
cacheWriteHook <- attr(x, "cacheWriteHook", exact = TRUE) %||% identity
|
||||
cacheReadHook <- attr(x, "cacheReadHook", exact = TRUE) %||% identity
|
||||
|
||||
valueFunc <- x
|
||||
|
||||
renderFunc <- function(...) {
|
||||
domain <- getDefaultReactiveDomain()
|
||||
cache <- resolve_cache_object(cache, domain)
|
||||
|
||||
hybrid_chain(
|
||||
keyFunc(),
|
||||
generateCacheFun(valueFunc, cache, cacheHint, cacheReadHook, cacheWriteHook, ...)
|
||||
)
|
||||
}
|
||||
|
||||
renderFunc <- addAttributes(renderFunc, renderFunctionAttributes(valueFunc))
|
||||
class(renderFunc) <- c("shiny.render.function.cache", class(valueFunc))
|
||||
renderFunc
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.shiny.renderPlot <- function(x, ...,
|
||||
cache = "app",
|
||||
sizePolicy = sizeGrowthRatio(width = 400, height = 400, growthRate = 1.2))
|
||||
{
|
||||
check_dots_unnamed()
|
||||
|
||||
valueFunc <- x
|
||||
|
||||
# Given the actual width/height of the image element in the browser, the
|
||||
# resize observer computes the width/height using sizePolicy() and pushes
|
||||
# those values into `fitWidth` and `fitHeight`. It's done this way so that the
|
||||
# `fitWidth` and `fitHeight` only change (and cause invalidations of the key
|
||||
# expression) when the rendered image size changes, and not every time the
|
||||
# browser's <img> tag changes size.
|
||||
#
|
||||
# If the key expression were invalidated every time the image element changed
|
||||
# size, even if the resulting key was the same (because `sizePolicy()` gave
|
||||
# the same output for a slightly different img element size), it would result
|
||||
# in getting the (same) image from the cache and sending it to the client
|
||||
# again. This resize observer prevents that.
|
||||
fitDims <- reactiveVal(NULL)
|
||||
resizeObserverCreated <- FALSE
|
||||
outputName <- NULL
|
||||
ensureResizeObserver <- function() {
|
||||
if (resizeObserverCreated)
|
||||
return()
|
||||
|
||||
doResizeCheck <- function() {
|
||||
if (is.null(outputName)) {
|
||||
outputName <<- getCurrentOutputInfo()$name
|
||||
}
|
||||
session <- getDefaultReactiveDomain()
|
||||
|
||||
width <- session$clientData[[paste0('output_', outputName, '_width')]] %||% 0
|
||||
height <- session$clientData[[paste0('output_', outputName, '_height')]] %||% 0
|
||||
|
||||
rect <- sizePolicy(c(width, height))
|
||||
fitDims(list(width = rect[1], height = rect[2]))
|
||||
}
|
||||
|
||||
# Run it once immediately, then set up the observer
|
||||
isolate(doResizeCheck())
|
||||
|
||||
observe({
|
||||
doResizeCheck()
|
||||
})
|
||||
# TODO: Make sure this observer gets GC'd if output$foo is replaced.
|
||||
# Currently, if you reassign output$foo, the observer persists until the
|
||||
# session ends. This is generally bad programming practice and should be
|
||||
# rare, but still, we should try to clean up properly.
|
||||
|
||||
resizeObserverCreated <<- TRUE
|
||||
}
|
||||
|
||||
renderFunc <- function(...) {
|
||||
hybrid_chain(
|
||||
# Pass in fitDims so that so that the generated plot will be the
|
||||
# dimensions specified by the sizePolicy; otherwise the plot would be the
|
||||
# exact dimensions of the img element, which isn't what we want for cached
|
||||
# plots.
|
||||
valueFunc(..., get_dims = fitDims),
|
||||
function(img) {
|
||||
# Replace exact pixel dimensions; instead, the max-height and max-width
|
||||
# will be set to 100% from CSS.
|
||||
img$class <- "shiny-scalable"
|
||||
img$width <- NULL
|
||||
img$height <- NULL
|
||||
|
||||
img
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
renderFunc <- addAttributes(renderFunc, renderFunctionAttributes(valueFunc))
|
||||
class(renderFunc) <- class(valueFunc)
|
||||
|
||||
bindCache.shiny.render.function(
|
||||
renderFunc,
|
||||
...,
|
||||
{
|
||||
ensureResizeObserver()
|
||||
session <- getDefaultReactiveDomain()
|
||||
if (is.null(session) || is.null(fitDims())) {
|
||||
req(FALSE)
|
||||
}
|
||||
pixelratio <- session$clientData$pixelratio %||% 1
|
||||
|
||||
list(fitDims(), pixelratio)
|
||||
},
|
||||
cache = cache
|
||||
)
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.reactive.cache <- function(x, ...) {
|
||||
stop("bindCache() has already been called on the object.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.shiny.render.function.cache <- bindCache.reactive.cache
|
||||
|
||||
#' @export
|
||||
bindCache.reactive.event <- function(x, ...) {
|
||||
stop("Can't call bindCache() after calling bindEvent() on an object. Maybe you wanted to call bindEvent() after bindCache()?")
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.shiny.render.function.event <- bindCache.reactive.event
|
||||
|
||||
#' @export
|
||||
bindCache.Observer <- function(x, ...) {
|
||||
stop("Can't bindCache an observer, because observers exist for the side efects, not for their return values.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindCache.function <- function(x, ...) {
|
||||
stop(
|
||||
"Don't know how to add caching to a plain function. ",
|
||||
"If this is a render* function for Shiny, it may need to be updated. ",
|
||||
"Please see ?shiny::bindCache for more information."
|
||||
)
|
||||
}
|
||||
|
||||
# Returns a function which should be passed as a step in to hybrid_chain(). The
|
||||
# returned function takes a cache key as input and manages storing and retrieving
|
||||
# values from the cache, as well as executing the valueFunc if needed.
|
||||
generateCacheFun <- function(
|
||||
valueFunc,
|
||||
cache,
|
||||
cacheHint,
|
||||
cacheReadHook,
|
||||
cacheWriteHook,
|
||||
...
|
||||
) {
|
||||
function(cacheKeyResult) {
|
||||
key_str <- rlang::hash(list(cacheKeyResult, cacheHint))
|
||||
res <- cache$get(key_str)
|
||||
|
||||
# Case 1: cache hit
|
||||
if (!is.key_missing(res)) {
|
||||
return(hybrid_chain(
|
||||
{
|
||||
# The first step is just to convert `res` to a promise or not, so
|
||||
# that hybrid_chain() knows to propagate the promise-ness.
|
||||
if (res$is_promise) promise_resolve(res)
|
||||
else res
|
||||
},
|
||||
function(res) {
|
||||
if (res$error) {
|
||||
stop(res$value)
|
||||
}
|
||||
|
||||
cacheReadHook(valueWithVisible(res))
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
# Case 2: cache miss
|
||||
#
|
||||
# valueFunc() might return a promise, or an actual value. Normally we'd
|
||||
# use a hybrid_chain() for this, but in this case, we need to have
|
||||
# different behavior if it's a promise or not a promise -- the
|
||||
# information about whether or not it's a promise needs to be stored in
|
||||
# the cache. We need to handle both cases and record in the cache
|
||||
# whether it's a promise or not, so that any consumer of the
|
||||
# cachedReactive() will be given the correct kind of object (a promise
|
||||
# vs. an actual value) in the case of a future cache hit.
|
||||
p <- withCallingHandlers(
|
||||
withVisible(isolate(valueFunc(...))),
|
||||
error = function(e) {
|
||||
cache$set(key_str, list(
|
||||
is_promise = FALSE,
|
||||
value = e,
|
||||
visible = TRUE,
|
||||
error = TRUE
|
||||
))
|
||||
}
|
||||
)
|
||||
|
||||
if (is.promising(p$value)) {
|
||||
p$value <- as.promise(p$value)
|
||||
p$value <- p$value$
|
||||
then(function(value) {
|
||||
res <- withVisible(value)
|
||||
cache$set(key_str, list(
|
||||
is_promise = TRUE,
|
||||
value = cacheWriteHook(res$value),
|
||||
visible = res$visible,
|
||||
error = FALSE
|
||||
))
|
||||
valueWithVisible(res)
|
||||
})$
|
||||
catch(function(e) {
|
||||
cache$set(key_str, list(
|
||||
is_promise = TRUE,
|
||||
value = e,
|
||||
visible = TRUE,
|
||||
error = TRUE
|
||||
))
|
||||
stop(e)
|
||||
})
|
||||
valueWithVisible(p)
|
||||
} else {
|
||||
# result is an ordinary value, not a promise.
|
||||
cache$set(key_str, list(
|
||||
is_promise = FALSE,
|
||||
value = cacheWriteHook(p$value),
|
||||
visible = p$visible,
|
||||
error = FALSE
|
||||
))
|
||||
return(valueWithVisible(p))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extractCacheHint <- function(func) {
|
||||
cacheHint <- attr(func, "cacheHint", exact = TRUE)
|
||||
|
||||
if (is_false(cacheHint)) {
|
||||
stop(
|
||||
"Cannot call `bindCache()` on this object because it is marked as not cacheable.",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
if (is.null(cacheHint)) {
|
||||
warning("No cacheHint found for this object. ",
|
||||
"Caching may not work properly.")
|
||||
}
|
||||
|
||||
cacheHint
|
||||
}
|
||||
315
R/bind-event.R
Normal file
315
R/bind-event.R
Normal file
@@ -0,0 +1,315 @@
|
||||
#' Make an object respond only to specified reactive events
|
||||
#'
|
||||
#' @description
|
||||
#'
|
||||
#' Modify an object to respond to "event-like" reactive inputs, values, and
|
||||
#' expressions. `bindEvent()` can be used with reactive expressions, render
|
||||
#' functions, and observers. The resulting object takes a reactive dependency on
|
||||
#' the `...` arguments, and not on the original object's code. This can, for
|
||||
#' example, be used to make an observer execute only when a button is pressed.
|
||||
#'
|
||||
#' `bindEvent()` was added in Shiny 1.6.0. When it is used with [reactive()] and
|
||||
#' [observe()], it does the same thing as [eventReactive()] and
|
||||
#' [observeEvent()]. However, `bindEvent()` is more flexible: it can be combined
|
||||
#' with [bindCache()], and it can also be used with `render` functions (like
|
||||
#' [renderText()] and [renderPlot()]).
|
||||
#'
|
||||
#' @section Details:
|
||||
#'
|
||||
#' Shiny's reactive programming framework is primarily designed for calculated
|
||||
#' values (reactive expressions) and side-effect-causing actions (observers)
|
||||
#' that respond to *any* of their inputs changing. That's often what is
|
||||
#' desired in Shiny apps, but not always: sometimes you want to wait for a
|
||||
#' specific action to be taken from the user, like clicking an
|
||||
#' [actionButton()], before calculating an expression or taking an action. A
|
||||
#' reactive value or expression that is used to trigger other calculations in
|
||||
#' this way is called an *event*.
|
||||
#'
|
||||
#' These situations demand a more imperative, "event handling" style of
|
||||
#' programming that is possible--but not particularly intuitive--using the
|
||||
#' reactive programming primitives [observe()] and [isolate()]. `bindEvent()`
|
||||
#' provides a straightforward API for event handling that wraps `observe` and
|
||||
#' `isolate`.
|
||||
#'
|
||||
#' The `...` arguments are captured as expressions and combined into an
|
||||
#' **event expression**. When this event expression is invalidated (when its
|
||||
#' upstream reactive inputs change), that is an **event**, and it will cause
|
||||
#' the original object's code to execute.
|
||||
#'
|
||||
#' Use `bindEvent()` with `observe()` whenever you want to *perform an action*
|
||||
#' in response to an event. (This does the same thing as [observeEvent()],
|
||||
#' which was available in Shiny prior to version 1.6.0.) Note that
|
||||
#' "recalculate a value" does not generally count as performing an action --
|
||||
#' use [reactive()] for that.
|
||||
#'
|
||||
#' Use `bindEvent()` with `reactive()` to create a *calculated value* that
|
||||
#' only updates in response to an event. This is just like a normal [reactive
|
||||
#' expression][reactive] except it ignores all the usual invalidations that
|
||||
#' come from its reactive dependencies; it only invalidates in response to the
|
||||
#' given event. (This does the same thing as [eventReactive()], which was
|
||||
#' available in Shiny prior to version 1.6.0.)
|
||||
#'
|
||||
#' `bindEvent()` is often used with [bindCache()].
|
||||
#'
|
||||
#' @section ignoreNULL and ignoreInit:
|
||||
#'
|
||||
#' `bindEvent()` takes an `ignoreNULL` parameter that affects behavior when
|
||||
#' the event expression evaluates to `NULL` (or in the special case of an
|
||||
#' [actionButton()], `0`). In these cases, if `ignoreNULL` is `TRUE`, then it
|
||||
#' will raise a silent [validation][validate] error. This is useful behavior
|
||||
#' if you don't want to do the action or calculation when your app first
|
||||
#' starts, but wait for the user to initiate the action first (like a "Submit"
|
||||
#' button); whereas `ignoreNULL=FALSE` is desirable if you want to initially
|
||||
#' perform the action/calculation and just let the user re-initiate it (like a
|
||||
#' "Recalculate" button).
|
||||
#'
|
||||
#' `bindEvent()` also takes an `ignoreInit` argument. By default, reactive
|
||||
#' expressions and observers will run on the first reactive flush after they
|
||||
#' are created (except if, at that moment, the event expression evaluates to
|
||||
#' `NULL` and `ignoreNULL` is `TRUE`). But when responding to a click of an
|
||||
#' action button, it may often be useful to set `ignoreInit` to `TRUE`. For
|
||||
#' example, if you're setting up an observer to respond to a dynamically
|
||||
#' created button, then `ignoreInit = TRUE` will guarantee that the action
|
||||
#' will only be triggered when the button is actually clicked, instead of also
|
||||
#' being triggered when it is created/initialized. Similarly, if you're
|
||||
#' setting up a reactive that responds to a dynamically created button used to
|
||||
#' refresh some data (which is then returned by that `reactive`), then you
|
||||
#' should use `reactive(...) %>% bindEvent(..., ignoreInit = TRUE)` if you
|
||||
#' want to let the user decide if/when they want to refresh the data (since,
|
||||
#' depending on the app, this may be a computationally expensive operation).
|
||||
#'
|
||||
#' Even though `ignoreNULL` and `ignoreInit` can be used for similar purposes
|
||||
#' they are independent from one another. Here's the result of combining
|
||||
#' these:
|
||||
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`ignoreNULL = TRUE` and `ignoreInit = FALSE`}{
|
||||
#' This is the default. This combination means that reactive/observer code
|
||||
#' will run every time that event expression is not
|
||||
#' `NULL`. If, at the time of creation, the event expression happens
|
||||
#' to *not* be `NULL`, then the code runs.
|
||||
#' }
|
||||
#' \item{`ignoreNULL = FALSE` and `ignoreInit = FALSE`}{
|
||||
#' This combination means that reactive/observer code will
|
||||
#' run every time no matter what.
|
||||
#' }
|
||||
#' \item{`ignoreNULL = FALSE` and `ignoreInit = TRUE`}{
|
||||
#' This combination means that reactive/observer code will
|
||||
#' *not* run at the time of creation (because `ignoreInit = TRUE`),
|
||||
#' but it will run every other time.
|
||||
#' }
|
||||
#' \item{`ignoreNULL = TRUE` and `ignoreInit = TRUE`}{
|
||||
#' This combination means that reactive/observer code will
|
||||
#' *not* at the time of creation (because `ignoreInit = TRUE`).
|
||||
#' After that, the reactive/observer code will run every time that
|
||||
#' the event expression is not `NULL`.
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
|
||||
#' @section Types of objects:
|
||||
#'
|
||||
#' `bindEvent()` can be used with reactive expressions, observers, and shiny
|
||||
#' render functions.
|
||||
#'
|
||||
#' When `bindEvent()` is used with `reactive()`, it creates a new reactive
|
||||
#' expression object.
|
||||
#'
|
||||
#' When `bindEvent()` is used with `observe()`, it alters the observer in
|
||||
#' place. It can only be used with observers which have not yet executed.
|
||||
#'
|
||||
#' @section Combining events and caching:
|
||||
#'
|
||||
#' In many cases, it makes sense to use `bindEvent()` along with
|
||||
#' `bindCache()`, because they each can reduce the amount of work done on the
|
||||
#' server. For example, you could have [sliderInput]s `x` and `y` and a
|
||||
#' `reactive()` that performs a time-consuming operation with those values.
|
||||
#' Using `bindCache()` can speed things up, especially if there are multiple
|
||||
#' users. But it might make sense to also not do the computation until the
|
||||
#' user sets both `x` and `y`, and then clicks on an [actionButton] named
|
||||
#' `go`.
|
||||
#'
|
||||
#' To use both caching and events, the object should first be passed to
|
||||
#' `bindCache()`, then `bindEvent()`. For example:
|
||||
|
||||
#'
|
||||
#' ```
|
||||
#' r <- reactive({
|
||||
#' Sys.sleep(2) # Pretend this is an expensive computation
|
||||
#' input$x * input$y
|
||||
#' }) %>%
|
||||
#' bindCache(input$x, input$y) %>%
|
||||
#' bindEvent(input$go)
|
||||
#' ```
|
||||
|
||||
#'
|
||||
#' Anything that consumes `r()` will take a reactive dependency on the event
|
||||
#' expression given to `bindEvent()`, and not the cache key expression given to
|
||||
#' `bindCache()`. In this case, it is just `input$go`.
|
||||
#'
|
||||
#' @param x An object to wrap so that is triggered only when a the specified
|
||||
#' event occurs.
|
||||
#' @param ignoreNULL Whether the action should be triggered (or value
|
||||
#' calculated) when the input is `NULL`. See Details.
|
||||
#' @param ignoreInit If `TRUE`, then, when the eventified object is first
|
||||
#' created/initialized, don't trigger the action or (compute the value). The
|
||||
#' default is `FALSE`. See Details.
|
||||
#' @param once Used only for observers. Whether this `observer` should be
|
||||
#' immediately destroyed after the first time that the code in the observer is
|
||||
#' run. This pattern is useful when you want to subscribe to a event that
|
||||
#' should only happen once.
|
||||
#' @param label A label for the observer or reactive, useful for debugging.
|
||||
#' @param ... One or more expressions that represents the event; this can be a
|
||||
#' simple reactive value like `input$click`, a call to a reactive expression
|
||||
#' like `dataset()`, or even a complex expression inside curly braces. If
|
||||
#' there are multiple expressions in the `...`, then it will take a dependency
|
||||
#' on all of them.
|
||||
#' @export
|
||||
bindEvent <- function(x, ..., ignoreNULL = TRUE, ignoreInit = FALSE,
|
||||
once = FALSE, label = NULL)
|
||||
{
|
||||
check_dots_unnamed()
|
||||
force(ignoreNULL)
|
||||
force(ignoreInit)
|
||||
force(once)
|
||||
|
||||
UseMethod("bindEvent")
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
bindEvent.default <- function(x, ...) {
|
||||
stop("Don't know how to handle object with class ", paste(class(x), collapse = ", "))
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
bindEvent.reactiveExpr <- function(x, ..., ignoreNULL = TRUE, ignoreInit = FALSE,
|
||||
label = NULL)
|
||||
{
|
||||
domain <- reactive_get_domain(x)
|
||||
|
||||
qs <- enquos0(...)
|
||||
eventFunc <- quos_to_func(qs)
|
||||
|
||||
valueFunc <- reactive_get_value_func(x)
|
||||
valueFunc <- wrapFunctionLabel(valueFunc, "eventReactiveValueFunc", ..stacktraceon = TRUE)
|
||||
|
||||
label <- label %||%
|
||||
sprintf('bindEvent(%s, %s)', attr(x, "observable", exact = TRUE)$.label, quos_to_label(qs))
|
||||
|
||||
# Don't hold on to the reference for x, so that it can be GC'd
|
||||
rm(x)
|
||||
|
||||
initialized <- FALSE
|
||||
|
||||
res <- reactive(label = label, domain = domain, ..stacktraceon = FALSE, {
|
||||
hybrid_chain(
|
||||
eventFunc(),
|
||||
function(value) {
|
||||
if (ignoreInit && !initialized) {
|
||||
initialized <<- TRUE
|
||||
req(FALSE)
|
||||
}
|
||||
|
||||
req(!ignoreNULL || !isNullEvent(value))
|
||||
|
||||
isolate(valueFunc())
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
class(res) <- c("reactive.event", class(res))
|
||||
res
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
bindEvent.shiny.render.function <- function(x, ..., ignoreNULL = TRUE, ignoreInit = FALSE) {
|
||||
eventFunc <- quos_to_func(enquos0(...))
|
||||
|
||||
valueFunc <- x
|
||||
|
||||
initialized <- FALSE
|
||||
|
||||
renderFunc <- function(...) {
|
||||
hybrid_chain(
|
||||
eventFunc(),
|
||||
function(value) {
|
||||
if (ignoreInit && !initialized) {
|
||||
initialized <<- TRUE
|
||||
req(FALSE)
|
||||
}
|
||||
|
||||
req(!ignoreNULL || !isNullEvent(value))
|
||||
|
||||
isolate(valueFunc(...))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
renderFunc <- addAttributes(renderFunc, renderFunctionAttributes(valueFunc))
|
||||
class(renderFunc) <- c("shiny.render.function.event", class(valueFunc))
|
||||
renderFunc
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
bindEvent.Observer <- function(x, ..., ignoreNULL = TRUE, ignoreInit = FALSE,
|
||||
once = FALSE, label = NULL)
|
||||
{
|
||||
if (x$.execCount > 0) {
|
||||
stop("Cannot call bindEvent() on an Observer that has already been executed.")
|
||||
}
|
||||
|
||||
qs <- enquos0(...)
|
||||
eventFunc <- quos_to_func(qs)
|
||||
valueFunc <- x$.func
|
||||
|
||||
# Note that because the observer will already have been logged by this point,
|
||||
# this updated label won't show up in the reactlog.
|
||||
x$.label <- label %||% sprintf('bindEvent(%s, %s)', x$.label, quos_to_label(qs))
|
||||
|
||||
initialized <- FALSE
|
||||
|
||||
x$.func <- wrapFunctionLabel(
|
||||
name = x$.label,
|
||||
..stacktraceon = FALSE,
|
||||
func = function() {
|
||||
hybrid_chain(
|
||||
eventFunc(),
|
||||
function(value) {
|
||||
if (ignoreInit && !initialized) {
|
||||
initialized <<- TRUE
|
||||
return()
|
||||
}
|
||||
|
||||
if (ignoreNULL && isNullEvent(value)) {
|
||||
return()
|
||||
}
|
||||
|
||||
if (once) {
|
||||
on.exit(x$destroy())
|
||||
}
|
||||
|
||||
req(!ignoreNULL || !isNullEvent(value))
|
||||
|
||||
isolate(valueFunc())
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
class(x) <- c("Observer.event", class(x))
|
||||
invisible(x)
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
bindEvent.reactive.event <- function(x, ...) {
|
||||
stop("bindEvent() has already been called on the object.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
bindEvent.Observer.event <- bindEvent.reactive.event
|
||||
@@ -1,6 +1,3 @@
|
||||
#' @include stack.R
|
||||
NULL
|
||||
|
||||
ShinySaveState <- R6Class("ShinySaveState",
|
||||
public = list(
|
||||
input = NULL,
|
||||
@@ -79,7 +76,7 @@ saveShinySaveState <- function(state) {
|
||||
|
||||
# Look for a save.interface function. This will be defined by the hosting
|
||||
# environment if it supports bookmarking.
|
||||
saveInterface <- getShinyOption("save.interface")
|
||||
saveInterface <- getShinyOption("save.interface", default = NULL)
|
||||
|
||||
if (is.null(saveInterface)) {
|
||||
if (inShinyServer()) {
|
||||
@@ -296,7 +293,7 @@ RestoreContext <- R6Class("RestoreContext",
|
||||
|
||||
# Look for a load.interface function. This will be defined by the hosting
|
||||
# environment if it supports bookmarking.
|
||||
loadInterface <- getShinyOption("load.interface")
|
||||
loadInterface <- getShinyOption("load.interface", default = NULL)
|
||||
|
||||
if (is.null(loadInterface)) {
|
||||
if (inShinyServer()) {
|
||||
@@ -447,8 +444,8 @@ RestoreInputSet <- R6Class("RestoreInputSet",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
restoreCtxStack <- Stack$new()
|
||||
# This is a fastmap::faststack(); value is assigned in .onLoad().
|
||||
restoreCtxStack <- NULL
|
||||
|
||||
withRestoreContext <- function(ctx, expr) {
|
||||
restoreCtxStack$push(ctx)
|
||||
@@ -1160,10 +1157,10 @@ setBookmarkExclude <- function(names = character(0), session = getDefaultReactiv
|
||||
#' toupper(input$text)
|
||||
#' })
|
||||
#' onBookmark(function(state) {
|
||||
#' state$values$hash <- digest::digest(input$text, "md5")
|
||||
#' state$values$hash <- rlang::hash(input$text)
|
||||
#' })
|
||||
#' onRestore(function(state) {
|
||||
#' if (identical(digest::digest(input$text, "md5"), state$values$hash)) {
|
||||
#' if (identical(rlang::hash(input$text), state$values$hash)) {
|
||||
#' message("Module's input text matches hash ", state$values$hash)
|
||||
#' } else {
|
||||
#' message("Module's input text does not match hash ", state$values$hash)
|
||||
@@ -1186,10 +1183,10 @@ setBookmarkExclude <- function(names = character(0), session = getDefaultReactiv
|
||||
#' server <- function(input, output, session) {
|
||||
#' callModule(capitalizerServer, "tc")
|
||||
#' onBookmark(function(state) {
|
||||
#' state$values$hash <- digest::digest(input$text, "md5")
|
||||
#' state$values$hash <- rlang::hash(input$text)
|
||||
#' })
|
||||
#' onRestore(function(state) {
|
||||
#' if (identical(digest::digest(input$text, "md5"), state$values$hash)) {
|
||||
#' if (identical(rlang::hash(input$text), state$values$hash)) {
|
||||
#' message("App's input text matches hash ", state$values$hash)
|
||||
#' } else {
|
||||
#' message("App's input text does not match hash ", state$values$hash)
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
#' Can also be set as a side effect of the [titlePanel()] function.
|
||||
#' @param responsive This option is deprecated; it is no longer optional with
|
||||
#' Bootstrap 3.
|
||||
#' @param theme Alternative Bootstrap stylesheet (normally a css file within the
|
||||
#' www directory). For example, to use the theme located at
|
||||
#' `www/bootstrap.css` you would use `theme = "bootstrap.css"`.
|
||||
#' @inheritParams bootstrapPage
|
||||
#'
|
||||
#' @return A UI defintion that can be passed to the [shinyUI] function.
|
||||
@@ -26,7 +23,7 @@
|
||||
#' higher-level layout functions like [sidebarLayout()].
|
||||
#'
|
||||
#' @note See the [
|
||||
#' Shiny-Application-Layout-Guide](http://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fluid
|
||||
#' Shiny-Application-Layout-Guide](https://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fluid
|
||||
#' pages.
|
||||
#'
|
||||
#' @family layout functions
|
||||
@@ -88,7 +85,7 @@
|
||||
#' }
|
||||
#' @rdname fluidPage
|
||||
#' @export
|
||||
fluidPage <- function(..., title = NULL, responsive = NULL, theme = NULL, lang = NULL) {
|
||||
fluidPage <- function(..., title = NULL, responsive = deprecated(), theme = NULL, lang = NULL) {
|
||||
bootstrapPage(div(class = "container-fluid", ...),
|
||||
title = title,
|
||||
responsive = responsive,
|
||||
@@ -117,9 +114,6 @@ fluidRow <- function(...) {
|
||||
#' @param title The browser window title (defaults to the host URL of the page)
|
||||
#' @param responsive This option is deprecated; it is no longer optional with
|
||||
#' Bootstrap 3.
|
||||
#' @param theme Alternative Bootstrap stylesheet (normally a css file within the
|
||||
#' www directory). For example, to use the theme located at
|
||||
#' `www/bootstrap.css` you would use `theme = "bootstrap.css"`.
|
||||
#' @inheritParams bootstrapPage
|
||||
#'
|
||||
#' @return A UI defintion that can be passed to the [shinyUI] function.
|
||||
@@ -131,7 +125,7 @@ fluidRow <- function(...) {
|
||||
#' with `fixedRow` and `column`.
|
||||
#'
|
||||
#' @note See the [
|
||||
#' Shiny Application Layout Guide](http://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fixed
|
||||
#' Shiny Application Layout Guide](https://shiny.rstudio.com/articles/layout-guide.html) for additional details on laying out fixed
|
||||
#' pages.
|
||||
#'
|
||||
#' @family layout functions
|
||||
@@ -159,7 +153,7 @@ fluidRow <- function(...) {
|
||||
#'
|
||||
#' @rdname fixedPage
|
||||
#' @export
|
||||
fixedPage <- function(..., title = NULL, responsive = NULL, theme = NULL, lang = NULL) {
|
||||
fixedPage <- function(..., title = NULL, responsive = deprecated(), theme = NULL, lang = NULL) {
|
||||
bootstrapPage(div(class = "container", ...),
|
||||
title = title,
|
||||
responsive = responsive,
|
||||
@@ -440,7 +434,7 @@ verticalLayout <- function(..., fluid = TRUE) {
|
||||
flowLayout <- function(..., cellArgs = list()) {
|
||||
|
||||
children <- list(...)
|
||||
childIdx <- !nzchar(names(children) %OR% character(length(children)))
|
||||
childIdx <- !nzchar(names(children) %||% character(length(children)))
|
||||
attribs <- children[!childIdx]
|
||||
children <- children[childIdx]
|
||||
|
||||
@@ -523,7 +517,7 @@ inputPanel <- function(...) {
|
||||
splitLayout <- function(..., cellWidths = NULL, cellArgs = list()) {
|
||||
|
||||
children <- list(...)
|
||||
childIdx <- !nzchar(names(children) %OR% character(length(children)))
|
||||
childIdx <- !nzchar(names(children) %||% character(length(children)))
|
||||
attribs <- children[!childIdx]
|
||||
children <- children[childIdx]
|
||||
count <- length(children)
|
||||
@@ -701,37 +695,3 @@ flexfill <- function(..., direction, flex, width = width, height = height) {
|
||||
)
|
||||
do.call(tags$div, c(attrs, divArgs))
|
||||
}
|
||||
|
||||
css <- function(..., collapse_ = "") {
|
||||
props <- list(...)
|
||||
if (length(props) == 0) {
|
||||
return("")
|
||||
}
|
||||
|
||||
if (is.null(names(props)) || any(names(props) == "")) {
|
||||
stop("cssList expects all arguments to be named")
|
||||
}
|
||||
|
||||
# Necessary to make factors show up as level names, not numbers
|
||||
props[] <- lapply(props, paste, collapse = " ")
|
||||
|
||||
# Drop null args
|
||||
props <- props[!sapply(props, empty)]
|
||||
if (length(props) == 0) {
|
||||
return("")
|
||||
}
|
||||
|
||||
# Replace all '.' and '_' in property names to '-'
|
||||
names(props) <- gsub("[._]", "-", tolower(gsub("([A-Z])", "-\\1", names(props))))
|
||||
|
||||
# Create "!important" suffix for each property whose name ends with !, then
|
||||
# remove the ! from the property name
|
||||
important <- ifelse(grepl("!$", names(props), perl = TRUE), " !important", "")
|
||||
names(props) <- sub("!$", "", names(props), perl = TRUE)
|
||||
|
||||
paste0(names(props), ":", props, important, ";", collapse = collapse_)
|
||||
}
|
||||
|
||||
empty <- function(x) {
|
||||
length(x) == 0 || (is.character(x) && !any(nzchar(x)))
|
||||
}
|
||||
|
||||
165
R/bootstrap.R
165
R/bootstrap.R
@@ -4,7 +4,7 @@ NULL
|
||||
#' Create a Bootstrap page
|
||||
#'
|
||||
#' Create a Shiny UI page that loads the CSS and JavaScript for
|
||||
#' [Bootstrap](http://getbootstrap.com/), and has no content in the page
|
||||
#' [Bootstrap](https://getbootstrap.com/), and has no content in the page
|
||||
#' body (other than what you provide).
|
||||
#'
|
||||
#' This function is primarily intended for users who are proficient in HTML/CSS,
|
||||
@@ -18,7 +18,7 @@ NULL
|
||||
#' Bootstrap 3.
|
||||
#' @param theme One of the following:
|
||||
#' * `NULL` (the default), which implies a "stock" build of Bootstrap 3.
|
||||
#' * A [bootstraplib::bs_theme()] object. This can be used to replace a stock
|
||||
#' * A [bslib::bs_theme()] object. This can be used to replace a stock
|
||||
#' build of Bootstrap 3 with a customized version of Bootstrap 3 or higher.
|
||||
#' * A character string pointing to an alternative Bootstrap stylesheet
|
||||
#' (normally a css file within the www directory, e.g. `www/bootstrap.css`).
|
||||
@@ -33,26 +33,39 @@ NULL
|
||||
#'
|
||||
#' @seealso [fluidPage()], [fixedPage()]
|
||||
#' @export
|
||||
bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL, lang = NULL) {
|
||||
bootstrapPage <- function(..., title = NULL, responsive = deprecated(), theme = NULL, lang = NULL) {
|
||||
|
||||
if (!is.null(responsive)) {
|
||||
shinyDeprecated("The 'responsive' argument is no longer used with Bootstrap 3.")
|
||||
if (lifecycle::is_present(responsive)) {
|
||||
shinyDeprecated(
|
||||
"0.10.2.2", "bootstrapPage(responsive=)",
|
||||
details = "The 'responsive' argument is no longer used with the latest version of Bootstrap."
|
||||
)
|
||||
}
|
||||
|
||||
ui <- tagList(
|
||||
bootstrapLib(theme),
|
||||
args <- list(
|
||||
if (!is.null(title)) tags$head(tags$title(title)),
|
||||
# TODO: throw better error when length > 1?
|
||||
if (is.character(theme)) {
|
||||
tags$head(tags$link(rel="stylesheet", type="text/css", href = theme))
|
||||
if (length(theme) > 1) stop("`theme` must point to a single CSS file, not multiple files.")
|
||||
tags$head(tags$link(rel="stylesheet", type="text/css", href=theme))
|
||||
},
|
||||
# remainder of tags passed to the function
|
||||
list(...)
|
||||
)
|
||||
|
||||
ui <- setLang(ui, lang)
|
||||
# If theme is a bslib::bs_theme() object, bootstrapLib() needs to come first
|
||||
# (so other tags, when rendered via tagFunction(), know about the relevant
|
||||
# theme). However, if theme is anything else, we intentionally avoid changing
|
||||
# the tagList() contents to avoid breaking user code that makes assumptions
|
||||
# about the return value https://github.com/rstudio/shiny/issues/3235
|
||||
if (is_bs_theme(theme)) {
|
||||
args <- c(bootstrapLib(theme), args)
|
||||
ui <- do.call(tagList, args)
|
||||
} else {
|
||||
ui <- do.call(tagList, args)
|
||||
ui <- attachDependencies(ui, bootstrapLib())
|
||||
}
|
||||
|
||||
return(ui)
|
||||
setLang(ui, lang)
|
||||
}
|
||||
|
||||
setLang <- function(ui, lang) {
|
||||
@@ -78,7 +91,7 @@ getLang <- function(ui) {
|
||||
#' @export
|
||||
bootstrapLib <- function(theme = NULL) {
|
||||
tagFunction(function() {
|
||||
# If we're not compiling Bootstrap Sass (from bootstraplib), return the
|
||||
# If we're not compiling Bootstrap Sass (from bslib), return the
|
||||
# static Bootstrap build.
|
||||
if (!is_bs_theme(theme)) {
|
||||
# We'll enter here if `theme` is the path to a .css file, like that
|
||||
@@ -100,7 +113,7 @@ bootstrapLib <- function(theme = NULL) {
|
||||
# option is automatically reset when the app (or session) exits
|
||||
if (isRunning()) {
|
||||
setCurrentTheme(theme)
|
||||
registerThemeDependency(bs_theme_dependencies_css)
|
||||
registerThemeDependency(bs_theme_deps)
|
||||
|
||||
} else {
|
||||
# Technically, this a potential issue (someone trying to execute/render
|
||||
@@ -119,22 +132,19 @@ bootstrapLib <- function(theme = NULL) {
|
||||
#)
|
||||
}
|
||||
|
||||
bootstraplib::bs_theme_dependencies(theme)
|
||||
bslib::bs_theme_dependencies(theme)
|
||||
})
|
||||
}
|
||||
|
||||
# This is defined outside of bootstrapLib() because registerThemeDependency()
|
||||
# wants non-anonymous functions.
|
||||
bs_theme_dependencies_css <- function(theme) {
|
||||
deps <- bootstraplib::bs_theme_dependencies(theme)
|
||||
# Extract out the CSS files only (no need to re-send JS files, even though
|
||||
# they wouldn't be re-rendered on the client anyway.)
|
||||
Filter(deps, f = function(dep) !is.null(dep$stylesheet))
|
||||
# wants a non-anonymous function with a single argument
|
||||
bs_theme_deps <- function(theme) {
|
||||
bslib::bs_theme_dependencies(theme)
|
||||
}
|
||||
|
||||
is_bs_theme <- function(x) {
|
||||
is_available("bootstraplib", "0.2.0.9000") &&
|
||||
bootstraplib::is_bs_theme(x)
|
||||
is_available("bslib", "0.2.0.9000") &&
|
||||
bslib::is_bs_theme(x)
|
||||
}
|
||||
|
||||
#' Obtain Shiny's Bootstrap Sass theme
|
||||
@@ -143,14 +153,14 @@ is_bs_theme <- function(x) {
|
||||
#' styling based on the [bootstrapLib()]'s `theme` value.
|
||||
#'
|
||||
#' @return If called at render-time (i.e., inside a [htmltools::tagFunction()]),
|
||||
#' and [bootstrapLib()]'s `theme` has been set to a [bootstraplib::bs_theme()]
|
||||
#' and [bootstrapLib()]'s `theme` has been set to a [bslib::bs_theme()]
|
||||
#' object, then this returns the `theme`. Otherwise, this returns `NULL`.
|
||||
#' @seealso [getCurrentOutputInfo()], [bootstrapLib()], [htmltools::tagFunction()]
|
||||
#'
|
||||
#' @keywords internal
|
||||
#' @export
|
||||
getCurrentTheme <- function() {
|
||||
getShinyOption("bootstrapTheme")
|
||||
getShinyOption("bootstrapTheme", default = NULL)
|
||||
}
|
||||
|
||||
setCurrentTheme <- function(theme) {
|
||||
@@ -188,7 +198,7 @@ registerThemeDependency <- function(func) {
|
||||
|
||||
# Note that this will automatically scope to the app or session level,
|
||||
# depending on if this is called from within a session or not.
|
||||
funcs <- getShinyOption("themeDependencyFuncs")
|
||||
funcs <- getShinyOption("themeDependencyFuncs", default = list())
|
||||
|
||||
# Don't add func if it's already present.
|
||||
have_func <- any(vapply(funcs, identical, logical(1), func))
|
||||
@@ -212,9 +222,9 @@ bootstrapDependency <- function(theme) {
|
||||
"accessibility/js/bootstrap-accessibility.min.js"
|
||||
),
|
||||
stylesheet = c(
|
||||
theme %OR% "css/bootstrap.min.css",
|
||||
theme %||% "css/bootstrap.min.css",
|
||||
# Safely adding accessibility plugin for screen readers and keyboard users; no break for sighted aspects (see https://github.com/paypal/bootstrap-accessibility-plugin)
|
||||
"accessibility/css/bootstrap-accessibility.css"
|
||||
"accessibility/css/bootstrap-accessibility.min.css"
|
||||
),
|
||||
meta = list(viewport = "width=device-width, initial-scale=1")
|
||||
)
|
||||
@@ -273,7 +283,6 @@ basicPage <- function(...) {
|
||||
#' @param title The title to use for the browser window/tab (it will not be
|
||||
#' shown in the document).
|
||||
#' @param bootstrap If `TRUE`, load the Bootstrap CSS library.
|
||||
#' @param theme URL to alternative Bootstrap stylesheet.
|
||||
#' @inheritParams bootstrapPage
|
||||
#'
|
||||
#' @family layout functions
|
||||
@@ -368,9 +377,6 @@ collapseSizes <- function(padding) {
|
||||
#' layout.
|
||||
#' @param responsive This option is deprecated; it is no longer optional with
|
||||
#' Bootstrap 3.
|
||||
#' @param theme Alternative Bootstrap stylesheet (normally a css file within the
|
||||
#' www directory). For example, to use the theme located at
|
||||
#' `www/bootstrap.css` you would use `theme = "bootstrap.css"`.
|
||||
#' @param windowTitle The title that should be displayed by the browser window.
|
||||
#' Useful if `title` is not a string.
|
||||
#' @inheritParams bootstrapPage
|
||||
@@ -414,15 +420,15 @@ navbarPage <- function(title,
|
||||
footer = NULL,
|
||||
inverse = FALSE,
|
||||
collapsible = FALSE,
|
||||
collapsable,
|
||||
collapsable = deprecated(),
|
||||
fluid = TRUE,
|
||||
responsive = NULL,
|
||||
responsive = deprecated(),
|
||||
theme = NULL,
|
||||
windowTitle = title,
|
||||
lang = NULL) {
|
||||
|
||||
if (!missing(collapsable)) {
|
||||
shinyDeprecated("`collapsable` is deprecated; use `collapsible` instead.")
|
||||
if (lifecycle::is_present(collapsable)) {
|
||||
shinyDeprecated("0.10.2.2", "navbarPage(collapsable =)", "navbarPage(collapsible =)")
|
||||
collapsible <- collapsable
|
||||
}
|
||||
|
||||
@@ -736,11 +742,12 @@ tabsetPanel <- function(...,
|
||||
id = NULL,
|
||||
selected = NULL,
|
||||
type = c("tabs", "pills", "hidden"),
|
||||
position = NULL) {
|
||||
if (!is.null(position)) {
|
||||
shinyDeprecated(msg = paste("tabsetPanel: argument 'position' is deprecated;",
|
||||
"it has been discontinued in Bootstrap 3."),
|
||||
version = "0.10.2.2")
|
||||
position = deprecated()) {
|
||||
if (lifecycle::is_present(position)) {
|
||||
shinyDeprecated(
|
||||
"0.10.2.2", "bootstrapPage(position =)",
|
||||
details = "The 'position' argument is no longer used with the latest version of Bootstrap."
|
||||
)
|
||||
}
|
||||
|
||||
if (!is.null(id))
|
||||
@@ -871,7 +878,7 @@ findAndMarkSelectedTab <- function(tabs, selected, foundSelected) {
|
||||
foundSelected <<- TRUE
|
||||
div <- markTabAsSelected(div)
|
||||
} else {
|
||||
tabValue <- div$attribs$`data-value` %OR% div$attribs$title
|
||||
tabValue <- div$attribs$`data-value` %||% div$attribs$title
|
||||
if (identical(selected, tabValue)) {
|
||||
foundSelected <<- TRUE
|
||||
div <- markTabAsSelected(div)
|
||||
@@ -998,15 +1005,15 @@ buildTabItem <- function(index, tabsetId, foundSelected, tabs = NULL,
|
||||
#' Render a reactive output variable as text within an application page.
|
||||
#' `textOutput()` is usually paired with [renderText()] and puts regular text
|
||||
#' in `<div>` or `<span>`; `verbatimTextOutput()` is usually paired with
|
||||
#' [renderPrint()] and provudes fixed-width text in a `<pre>`.
|
||||
#' [renderPrint()] and provides fixed-width text in a `<pre>`.
|
||||
#'
|
||||
#' In both funtions, text is HTML-escaped prior to rendering.
|
||||
#' In both functions, text is HTML-escaped prior to rendering.
|
||||
#'
|
||||
#' @param outputId output variable to read the value from
|
||||
#' @param container a function to generate an HTML element to contain the text
|
||||
#' @param inline use an inline (`span()`) or block container (`div()`)
|
||||
#' for the output
|
||||
#' @return A output element for use in UI.
|
||||
#' @return An output element for use in UI.
|
||||
#' @examples
|
||||
#' ## Only run this example in interactive R sessions
|
||||
#' if (interactive()) {
|
||||
@@ -1029,14 +1036,14 @@ textOutput <- function(outputId, container = if (inline) span else div, inline =
|
||||
|
||||
#' @param placeholder if the output is empty or `NULL`, should an empty
|
||||
#' rectangle be displayed to serve as a placeholder? (does not affect
|
||||
#' behavior when the the output in nonempty)
|
||||
#' behavior when the output is nonempty)
|
||||
#' @export
|
||||
#' @rdname textOutput
|
||||
verbatimTextOutput <- function(outputId, placeholder = FALSE) {
|
||||
pre(id = outputId,
|
||||
class = paste(c("shiny-text-output", if (!placeholder) "noplaceholder"),
|
||||
collapse = " ")
|
||||
)
|
||||
class = "shiny-text-output",
|
||||
class = if (!placeholder) "noplaceholder"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1048,7 +1055,9 @@ imageOutput <- function(outputId, width = "100%", height="400px",
|
||||
inline = FALSE) {
|
||||
|
||||
style <- if (!inline) {
|
||||
paste("width:", validateCssUnit(width), ";", "height:", validateCssUnit(height))
|
||||
# Using `css()` here instead of paste/sprintf so that NULL values will
|
||||
# result in the property being dropped altogether
|
||||
css(width = validateCssUnit(width), height = validateCssUnit(height))
|
||||
}
|
||||
|
||||
|
||||
@@ -1347,49 +1356,8 @@ plotOutput <- function(outputId, width = "100%", height="400px",
|
||||
res
|
||||
}
|
||||
|
||||
#' Create a table output element
|
||||
#'
|
||||
#' Render a [renderTable()] or [renderDataTable()] within an
|
||||
#' application page. `renderTable` uses a standard HTML table, while
|
||||
#' `renderDataTable` uses the DataTables Javascript library to create an
|
||||
#' interactive table with more features.
|
||||
#'
|
||||
#' @param outputId output variable to read the table from
|
||||
#' @return A table output element that can be included in a panel
|
||||
#'
|
||||
#' @seealso [renderTable()], [renderDataTable()].
|
||||
#' @examples
|
||||
#' ## Only run this example in interactive R sessions
|
||||
#' if (interactive()) {
|
||||
#' # table example
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' fluidRow(
|
||||
#' column(12,
|
||||
#' tableOutput('table')
|
||||
#' )
|
||||
#' )
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' output$table <- renderTable(iris)
|
||||
#' }
|
||||
#' )
|
||||
#'
|
||||
#'
|
||||
#' # DataTables example
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' fluidRow(
|
||||
#' column(12,
|
||||
#' dataTableOutput('table')
|
||||
#' )
|
||||
#' )
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' output$table <- renderDataTable(iris)
|
||||
#' }
|
||||
#' )
|
||||
#' }
|
||||
#' @rdname renderTable
|
||||
#' @export
|
||||
tableOutput <- function(outputId) {
|
||||
div(id = outputId, class="shiny-html-output")
|
||||
@@ -1407,7 +1375,7 @@ dataTableDependency <- list(
|
||||
)
|
||||
)
|
||||
|
||||
#' @rdname tableOutput
|
||||
#' @rdname renderDataTable
|
||||
#' @export
|
||||
dataTableOutput <- function(outputId) {
|
||||
attachDependencies(
|
||||
@@ -1526,20 +1494,21 @@ downloadLink <- function(outputId, label="Download", class=NULL, ...) {
|
||||
#' @param name Name of icon. Icons are drawn from the
|
||||
#' [Font Awesome Free](https://fontawesome.com/) (currently icons from
|
||||
#' the v5.13.0 set are supported with the v4 naming convention) and
|
||||
#' [Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
||||
#' [Glyphicons](https://getbootstrap.com/components/#glyphicons)
|
||||
#' libraries. Note that the "fa-" and "glyphicon-" prefixes should not be used
|
||||
#' in icon names (i.e. the "fa-calendar" icon should be referred to as
|
||||
#' "calendar")
|
||||
#' @param class Additional classes to customize the style of the icon (see the
|
||||
#' [usage examples](http://fontawesome.io/examples/) for details on
|
||||
#' [usage examples](https://fontawesome.com/how-to-use) for details on
|
||||
#' supported styles).
|
||||
#' @param lib Icon library to use ("font-awesome" or "glyphicon")
|
||||
#' @param ... Arguments passed to the `<i>` tag of [htmltools::tags]
|
||||
#'
|
||||
#' @return An icon element
|
||||
#'
|
||||
#' @seealso For lists of available icons, see
|
||||
#' [http://fontawesome.io/icons/](http://fontawesome.io/icons/) and
|
||||
#' [http://getbootstrap.com/components/#glyphicons](http://getbootstrap.com/components/#glyphicons).
|
||||
#' [https://fontawesome.com/icons](https://fontawesome.com/icons) and
|
||||
#' [https://getbootstrap.com/components/#glyphicons](https://getbootstrap.com/components/#glyphicons).
|
||||
#'
|
||||
#'
|
||||
#' @examples
|
||||
@@ -1552,7 +1521,7 @@ downloadLink <- function(outputId, label="Download", class=NULL, ...) {
|
||||
#' tabPanel("Table", icon = icon("table"))
|
||||
#' )
|
||||
#' @export
|
||||
icon <- function(name, class = NULL, lib = "font-awesome") {
|
||||
icon <- function(name, class = NULL, lib = "font-awesome", ...) {
|
||||
prefixes <- list(
|
||||
"font-awesome" = "fa",
|
||||
"glyphicon" = "glyphicon"
|
||||
@@ -1578,7 +1547,7 @@ icon <- function(name, class = NULL, lib = "font-awesome") {
|
||||
if (!is.null(class))
|
||||
iconClass <- paste(iconClass, class)
|
||||
|
||||
iconTag <- tags$i(class = iconClass, role = "presentation", `aria-label` = paste(name, "icon"))
|
||||
iconTag <- tags$i(class = iconClass, role = "presentation", `aria-label` = paste(name, "icon"), ...)
|
||||
|
||||
# font-awesome needs an additional dependency (glyphicon is in bootstrap)
|
||||
if (lib == "font-awesome") {
|
||||
|
||||
567
R/cache-disk.R
567
R/cache-disk.R
@@ -1,567 +0,0 @@
|
||||
#' Create a disk cache object
|
||||
#'
|
||||
#' A disk cache object is a key-value store that saves the values as files in a
|
||||
#' directory on disk. Objects can be stored and retrieved using the `get()`
|
||||
#' and `set()` methods. Objects are automatically pruned from the cache
|
||||
#' according to the parameters `max_size`, `max_age`, `max_n`,
|
||||
#' and `evict`.
|
||||
#'
|
||||
#'
|
||||
#' @section Missing Keys:
|
||||
#'
|
||||
#' The `missing` and `exec_missing` parameters controls what happens
|
||||
#' when `get()` is called with a key that is not in the cache (a cache
|
||||
#' miss). The default behavior is to return a [key_missing()]
|
||||
#' object. This is a *sentinel value* that indicates that the key was not
|
||||
#' present in the cache. You can test if the returned value represents a
|
||||
#' missing key by using the [is.key_missing()] function. You can
|
||||
#' also have `get()` return a different sentinel value, like `NULL`.
|
||||
#' If you want to throw an error on a cache miss, you can do so by providing a
|
||||
#' function for `missing` that takes one argument, the key, and also use
|
||||
#' `exec_missing=TRUE`.
|
||||
#'
|
||||
#' When the cache is created, you can supply a value for `missing`, which
|
||||
#' sets the default value to be returned for missing values. It can also be
|
||||
#' overridden when `get()` is called, by supplying a `missing`
|
||||
#' argument. For example, if you use `cache$get("mykey", missing =
|
||||
#' NULL)`, it will return `NULL` if the key is not in the cache.
|
||||
#'
|
||||
#' If your cache is configured so that `get()` returns a sentinel value
|
||||
#' to represent a cache miss, then `set` will also not allow you to store
|
||||
#' the sentinel value in the cache. It will throw an error if you attempt to
|
||||
#' do so.
|
||||
#'
|
||||
#' Instead of returning the same sentinel value each time there is cache miss,
|
||||
#' the cache can execute a function each time `get()` encounters missing
|
||||
#' key. If the function returns a value, then `get()` will in turn return
|
||||
#' that value. However, a more common use is for the function to throw an
|
||||
#' error. If an error is thrown, then `get()` will not return a value.
|
||||
#'
|
||||
#' To do this, pass a one-argument function to `missing`, and use
|
||||
#' `exec_missing=TRUE`. For example, if you want to throw an error that
|
||||
#' prints the missing key, you could do this:
|
||||
#'
|
||||
#' \preformatted{
|
||||
#' diskCache(
|
||||
#' missing = function(key) {
|
||||
#' stop("Attempted to get missing key: ", key)
|
||||
#' },
|
||||
#' exec_missing = TRUE
|
||||
#' )
|
||||
#' }
|
||||
#'
|
||||
#' If you use this, the code that calls `get()` should be wrapped with
|
||||
#' [tryCatch()] to gracefully handle missing keys.
|
||||
#'
|
||||
#' @section Cache pruning:
|
||||
#'
|
||||
#' Cache pruning occurs when `set()` is called, or it can be invoked
|
||||
#' manually by calling `prune()`.
|
||||
#'
|
||||
#' The disk cache will throttle the pruning so that it does not happen on
|
||||
#' every call to `set()`, because the filesystem operations for checking
|
||||
#' the status of files can be slow. Instead, it will prune once in every 20
|
||||
#' calls to `set()`, or if at least 5 seconds have elapsed since the last
|
||||
#' prune occurred, whichever is first. These parameters are currently not
|
||||
#' customizable, but may be in the future.
|
||||
#'
|
||||
#' When a pruning occurs, if there are any objects that are older than
|
||||
#' `max_age`, they will be removed.
|
||||
#'
|
||||
#' The `max_size` and `max_n` parameters are applied to the cache as
|
||||
#' a whole, in contrast to `max_age`, which is applied to each object
|
||||
#' individually.
|
||||
#'
|
||||
#' If the number of objects in the cache exceeds `max_n`, then objects
|
||||
#' will be removed from the cache according to the eviction policy, which is
|
||||
#' set with the `evict` parameter. Objects will be removed so that the
|
||||
#' number of items is `max_n`.
|
||||
#'
|
||||
#' If the size of the objects in the cache exceeds `max_size`, then
|
||||
#' objects will be removed from the cache. Objects will be removed from the
|
||||
#' cache so that the total size remains under `max_size`. Note that the
|
||||
#' size is calculated using the size of the files, not the size of disk space
|
||||
#' used by the files --- these two values can differ because of files are
|
||||
#' stored in blocks on disk. For example, if the block size is 4096 bytes,
|
||||
#' then a file that is one byte in size will take 4096 bytes on disk.
|
||||
#'
|
||||
#' Another time that objects can be removed from the cache is when
|
||||
#' `get()` is called. If the target object is older than `max_age`,
|
||||
#' it will be removed and the cache will report it as a missing value.
|
||||
#'
|
||||
#' @section Eviction policies:
|
||||
#'
|
||||
#' If `max_n` or `max_size` are used, then objects will be removed
|
||||
#' from the cache according to an eviction policy. The available eviction
|
||||
#' policies are:
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`"lru"`}{
|
||||
#' Least Recently Used. The least recently used objects will be removed.
|
||||
#' This uses the filesystem's mtime property. When "lru" is used, each
|
||||
#' `get()` is called, it will update the file's mtime.
|
||||
#' }
|
||||
#' \item{`"fifo"`}{
|
||||
#' First-in-first-out. The oldest objects will be removed.
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' Both of these policies use files' mtime. Note that some filesystems (notably
|
||||
#' FAT) have poor mtime resolution. (atime is not used because support for
|
||||
#' atime is worse than mtime.)
|
||||
#'
|
||||
#'
|
||||
#' @section Sharing among multiple processes:
|
||||
#'
|
||||
#' The directory for a DiskCache can be shared among multiple R processes. To
|
||||
#' do this, each R process should have a DiskCache object that uses the same
|
||||
#' directory. Each DiskCache will do pruning independently of the others, so if
|
||||
#' they have different pruning parameters, then one DiskCache may remove cached
|
||||
#' objects before another DiskCache would do so.
|
||||
#'
|
||||
#' Even though it is possible for multiple processes to share a DiskCache
|
||||
#' directory, this should not be done on networked file systems, because of
|
||||
#' slow performance of networked file systems can cause problems. If you need
|
||||
#' a high-performance shared cache, you can use one built on a database like
|
||||
#' Redis, SQLite, mySQL, or similar.
|
||||
#'
|
||||
#' When multiple processes share a cache directory, there are some potential
|
||||
#' race conditions. For example, if your code calls `exists(key)` to check
|
||||
#' if an object is in the cache, and then call `get(key)`, the object may
|
||||
#' be removed from the cache in between those two calls, and `get(key)`
|
||||
#' will throw an error. Instead of calling the two functions, it is better to
|
||||
#' simply call `get(key)`, and check that the returned object is not a
|
||||
#' `key_missing()` object, using `is.key_missing()`. This effectively tests for
|
||||
#' existence and gets the object in one operation.
|
||||
#'
|
||||
#' It is also possible for one processes to prune objects at the same time that
|
||||
#' another processes is trying to prune objects. If this happens, you may see
|
||||
#' a warning from `file.remove()` failing to remove a file that has
|
||||
#' already been deleted.
|
||||
#'
|
||||
#'
|
||||
#' @section Methods:
|
||||
#'
|
||||
#' A disk cache object has the following methods:
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`get(key, missing, exec_missing)`}{
|
||||
#' Returns the value associated with `key`. If the key is not in the
|
||||
#' cache, then it returns the value specified by `missing` or,
|
||||
#' `missing` is a function and `exec_missing=TRUE`, then
|
||||
#' executes `missing`. The function can throw an error or return the
|
||||
#' value. If either of these parameters are specified here, then they
|
||||
#' will override the defaults that were set when the DiskCache object was
|
||||
#' created. See section Missing Keys for more information.
|
||||
#' }
|
||||
#' \item{`set(key, value)`}{
|
||||
#' Stores the `key`-`value` pair in the cache.
|
||||
#' }
|
||||
#' \item{`exists(key)`}{
|
||||
#' Returns `TRUE` if the cache contains the key, otherwise
|
||||
#' `FALSE`.
|
||||
#' }
|
||||
#' \item{`size()`}{
|
||||
#' Returns the number of items currently in the cache.
|
||||
#' }
|
||||
#' \item{`keys()`}{
|
||||
#' Returns a character vector of all keys currently in the cache.
|
||||
#' }
|
||||
#' \item{`reset()`}{
|
||||
#' Clears all objects from the cache.
|
||||
#' }
|
||||
#' \item{`destroy()`}{
|
||||
#' Clears all objects in the cache, and removes the cache directory from
|
||||
#' disk.
|
||||
#' }
|
||||
#' \item{`prune()`}{
|
||||
#' Prunes the cache, using the parameters specified by `max_size`,
|
||||
#' `max_age`, `max_n`, and `evict`.
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @param dir Directory to store files for the cache. If `NULL` (the
|
||||
#' default) it will create and use a temporary directory.
|
||||
#' @param max_age Maximum age of files in cache before they are evicted, in
|
||||
#' seconds. Use `Inf` for no age limit.
|
||||
#' @param max_size Maximum size of the cache, in bytes. If the cache exceeds
|
||||
#' this size, cached objects will be removed according to the value of the
|
||||
#' `evict`. Use `Inf` for no size limit.
|
||||
#' @param max_n Maximum number of objects in the cache. If the number of objects
|
||||
#' exceeds this value, then cached objects will be removed according to the
|
||||
#' value of `evict`. Use `Inf` for no limit of number of items.
|
||||
#' @param evict The eviction policy to use to decide which objects are removed
|
||||
#' when a cache pruning occurs. Currently, `"lru"` and `"fifo"` are
|
||||
#' supported.
|
||||
#' @param destroy_on_finalize If `TRUE`, then when the DiskCache object is
|
||||
#' garbage collected, the cache directory and all objects inside of it will be
|
||||
#' deleted from disk. If `FALSE` (the default), it will do nothing when
|
||||
#' finalized.
|
||||
#' @param missing A value to return or a function to execute when
|
||||
#' `get(key)` is called but the key is not present in the cache. The
|
||||
#' default is a [key_missing()] object. If it is a function to
|
||||
#' execute, the function must take one argument (the key), and you must also
|
||||
#' use `exec_missing = TRUE`. If it is a function, it is useful in most
|
||||
#' cases for it to throw an error, although another option is to return a
|
||||
#' value. If a value is returned, that value will in turn be returned by
|
||||
#' `get()`. See section Missing keys for more information.
|
||||
#' @param exec_missing If `FALSE` (the default), then treat `missing`
|
||||
#' as a value to return when `get()` results in a cache miss. If
|
||||
#' `TRUE`, treat `missing` as a function to execute when
|
||||
#' `get()` results in a cache miss.
|
||||
#' @param logfile An optional filename or connection object to where logging
|
||||
#' information will be written. To log to the console, use `stdout()`.
|
||||
#'
|
||||
#' @export
|
||||
diskCache <- function(
|
||||
dir = NULL,
|
||||
max_size = 10 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
destroy_on_finalize = FALSE,
|
||||
missing = key_missing(),
|
||||
exec_missing = FALSE,
|
||||
logfile = NULL)
|
||||
{
|
||||
DiskCache$new(dir, max_size, max_age, max_n, evict, destroy_on_finalize,
|
||||
missing, exec_missing, logfile)
|
||||
}
|
||||
|
||||
|
||||
DiskCache <- R6Class("DiskCache",
|
||||
public = list(
|
||||
initialize = function(
|
||||
dir = NULL,
|
||||
max_size = 10 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
destroy_on_finalize = FALSE,
|
||||
missing = key_missing(),
|
||||
exec_missing = FALSE,
|
||||
logfile = NULL)
|
||||
{
|
||||
if (exec_missing && (!is.function(missing) || length(formals(missing)) == 0)) {
|
||||
stop("When `exec_missing` is true, `missing` must be a function that takes one argument.")
|
||||
}
|
||||
if (is.null(dir)) {
|
||||
dir <- tempfile("DiskCache-")
|
||||
}
|
||||
if (!is.numeric(max_size)) stop("max_size must be a number. Use `Inf` for no limit.")
|
||||
if (!is.numeric(max_age)) stop("max_age must be a number. Use `Inf` for no limit.")
|
||||
if (!is.numeric(max_n)) stop("max_n must be a number. Use `Inf` for no limit.")
|
||||
|
||||
if (!dirExists(dir)) {
|
||||
private$log(paste0("initialize: Creating ", dir))
|
||||
dir.create(dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
private$dir <- normalizePath(dir)
|
||||
private$max_size <- max_size
|
||||
private$max_age <- max_age
|
||||
private$max_n <- max_n
|
||||
private$evict <- match.arg(evict)
|
||||
private$destroy_on_finalize <- destroy_on_finalize
|
||||
private$missing <- missing
|
||||
private$exec_missing <- exec_missing
|
||||
private$logfile <- logfile
|
||||
|
||||
private$prune_last_time <- as.numeric(Sys.time())
|
||||
},
|
||||
|
||||
get = function(key, missing = private$missing, exec_missing = private$exec_missing) {
|
||||
private$log(paste0('get: key "', key, '"'))
|
||||
self$is_destroyed(throw = TRUE)
|
||||
validate_key(key)
|
||||
|
||||
private$maybe_prune_single(key)
|
||||
|
||||
filename <- private$key_to_filename(key)
|
||||
|
||||
# Instead of calling exists() before fetching the value, just try to
|
||||
# fetch the value. This reduces the risk of a race condition when
|
||||
# multiple processes share a cache.
|
||||
read_error <- FALSE
|
||||
tryCatch(
|
||||
{
|
||||
value <- suppressWarnings(readRDS(filename))
|
||||
if (private$evict == "lru"){
|
||||
Sys.setFileTime(filename, Sys.time())
|
||||
}
|
||||
},
|
||||
error = function(e) {
|
||||
read_error <<- TRUE
|
||||
}
|
||||
)
|
||||
if (read_error) {
|
||||
private$log(paste0('get: key "', key, '" is missing'))
|
||||
|
||||
if (exec_missing) {
|
||||
if (!is.function(missing) || length(formals(missing)) == 0) {
|
||||
stop("When `exec_missing` is true, `missing` must be a function that takes one argument.")
|
||||
}
|
||||
return(missing(key))
|
||||
} else {
|
||||
return(missing)
|
||||
}
|
||||
}
|
||||
|
||||
private$log(paste0('get: key "', key, '" found'))
|
||||
value
|
||||
},
|
||||
|
||||
set = function(key, value) {
|
||||
private$log(paste0('set: key "', key, '"'))
|
||||
self$is_destroyed(throw = TRUE)
|
||||
validate_key(key)
|
||||
|
||||
file <- private$key_to_filename(key)
|
||||
temp_file <- paste0(file, "-temp-", createUniqueId(8))
|
||||
|
||||
save_error <- FALSE
|
||||
ref_object <- FALSE
|
||||
tryCatch(
|
||||
{
|
||||
saveRDS(value, file = temp_file,
|
||||
refhook = function(x) {
|
||||
ref_object <<- TRUE
|
||||
NULL
|
||||
}
|
||||
)
|
||||
file.rename(temp_file, file)
|
||||
},
|
||||
error = function(e) {
|
||||
save_error <<- TRUE
|
||||
# Unlike file.remove(), unlink() does not raise warning if file does
|
||||
# not exist.
|
||||
unlink(temp_file)
|
||||
}
|
||||
)
|
||||
if (save_error) {
|
||||
private$log(paste0('set: key "', key, '" error'))
|
||||
stop('Error setting value for key "', key, '".')
|
||||
}
|
||||
if (ref_object) {
|
||||
private$log(paste0('set: value is a reference object'))
|
||||
warning("A reference object was cached in a serialized format. The restored object may not work as expected.")
|
||||
}
|
||||
|
||||
private$prune_throttled()
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
exists = function(key) {
|
||||
self$is_destroyed(throw = TRUE)
|
||||
validate_key(key)
|
||||
file.exists(private$key_to_filename(key))
|
||||
},
|
||||
|
||||
# Return all keys in the cache
|
||||
keys = function() {
|
||||
self$is_destroyed(throw = TRUE)
|
||||
files <- dir(private$dir, "\\.rds$")
|
||||
sub("\\.rds$", "", files)
|
||||
},
|
||||
|
||||
remove = function(key) {
|
||||
private$log(paste0('remove: key "', key, '"'))
|
||||
self$is_destroyed(throw = TRUE)
|
||||
validate_key(key)
|
||||
file.remove(private$key_to_filename(key))
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
reset = function() {
|
||||
private$log(paste0('reset'))
|
||||
self$is_destroyed(throw = TRUE)
|
||||
file.remove(dir(private$dir, "\\.rds$", full.names = TRUE))
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
prune = function() {
|
||||
# TODO: It would be good to add parameters `n` and `size`, so that the
|
||||
# cache can be pruned to `max_n - n` and `max_size - size` before adding
|
||||
# an object. Right now we prune after adding the object, so the cache
|
||||
# can temporarily grow past the limits. The reason we don't do this now
|
||||
# is because it is expensive to find the size of the serialized object
|
||||
# before adding it.
|
||||
|
||||
private$log('prune')
|
||||
self$is_destroyed(throw = TRUE)
|
||||
|
||||
current_time <- Sys.time()
|
||||
|
||||
filenames <- dir(private$dir, "\\.rds$", full.names = TRUE)
|
||||
info <- file.info(filenames)
|
||||
info <- info[info$isdir == FALSE, ]
|
||||
info$name <- rownames(info)
|
||||
rownames(info) <- NULL
|
||||
# Files could be removed between the dir() and file.info() calls. The
|
||||
# entire row for such files will have NA values. Remove those rows.
|
||||
info <- info[!is.na(info$size), ]
|
||||
|
||||
# 1. Remove any files where the age exceeds max age.
|
||||
if (is.finite(private$max_age)) {
|
||||
timediff <- as.numeric(current_time - info$mtime, units = "secs")
|
||||
rm_idx <- timediff > private$max_age
|
||||
if (any(rm_idx)) {
|
||||
private$log(paste0("prune max_age: Removing ", paste(info$name[rm_idx], collapse = ", ")))
|
||||
rm_success <- file.remove(info$name[rm_idx])
|
||||
# This maps rm_success back into the TRUEs in the rm_idx vector.
|
||||
# If (for example) rm_idx is c(F,T,F,T,T) and rm_success is c(T,F,T),
|
||||
# then this line modifies rm_idx to be c(F,T,F,F,T).
|
||||
rm_idx[rm_idx] <- rm_success
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
}
|
||||
|
||||
# Sort objects by priority. The sorting is done in a function which can be
|
||||
# called multiple times but only does the work the first time.
|
||||
info_is_sorted <- FALSE
|
||||
ensure_info_is_sorted <- function() {
|
||||
if (info_is_sorted) return()
|
||||
|
||||
info <<- info[order(info$mtime, decreasing = TRUE), ]
|
||||
info_is_sorted <<- TRUE
|
||||
}
|
||||
|
||||
# 2. Remove files if there are too many.
|
||||
if (is.finite(private$max_n) && nrow(info) > private$max_n) {
|
||||
ensure_info_is_sorted()
|
||||
rm_idx <- seq_len(nrow(info)) > private$max_n
|
||||
private$log(paste0("prune max_n: Removing ", paste(info$name[rm_idx], collapse = ", ")))
|
||||
rm_success <- file.remove(info$name[rm_idx])
|
||||
rm_idx[rm_idx] <- rm_success
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
|
||||
# 3. Remove files if cache is too large.
|
||||
if (is.finite(private$max_size) && sum(info$size) > private$max_size) {
|
||||
ensure_info_is_sorted()
|
||||
cum_size <- cumsum(info$size)
|
||||
rm_idx <- cum_size > private$max_size
|
||||
private$log(paste0("prune max_size: Removing ", paste(info$name[rm_idx], collapse = ", ")))
|
||||
rm_success <- file.remove(info$name[rm_idx])
|
||||
rm_idx[rm_idx] <- rm_success
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
|
||||
private$prune_last_time <- as.numeric(current_time)
|
||||
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
size = function() {
|
||||
self$is_destroyed(throw = TRUE)
|
||||
length(dir(private$dir, "\\.rds$"))
|
||||
},
|
||||
|
||||
destroy = function() {
|
||||
if (self$is_destroyed()) {
|
||||
return(invisible(self))
|
||||
}
|
||||
|
||||
private$log(paste0("destroy: Removing ", private$dir))
|
||||
# First create a sentinel file so that other processes sharing this
|
||||
# cache know that the cache is to be destroyed. This is needed because
|
||||
# the recursive unlink is not atomic: another process can add a file to
|
||||
# the directory after unlink starts removing files but before it removes
|
||||
# the directory, and when that happens, the directory removal will fail.
|
||||
file.create(file.path(private$dir, "__destroyed__"))
|
||||
# Remove all the .rds files. This will not remove the setinel file.
|
||||
file.remove(dir(private$dir, "\\.rds$", full.names = TRUE))
|
||||
# Next remove dir recursively, including sentinel file.
|
||||
unlink(private$dir, recursive = TRUE)
|
||||
private$destroyed <- TRUE
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
is_destroyed = function(throw = FALSE) {
|
||||
if (!dirExists(private$dir) ||
|
||||
file.exists(file.path(private$dir, "__destroyed__")))
|
||||
{
|
||||
# It's possible for another process to destroy a shared cache directory
|
||||
private$destroyed <- TRUE
|
||||
}
|
||||
|
||||
if (throw) {
|
||||
if (private$destroyed) {
|
||||
stop("Attempted to use cache which has been destroyed:\n ", private$dir)
|
||||
}
|
||||
|
||||
} else {
|
||||
private$destroyed
|
||||
}
|
||||
},
|
||||
|
||||
finalize = function() {
|
||||
if (private$destroy_on_finalize) {
|
||||
self$destroy()
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
private = list(
|
||||
dir = NULL,
|
||||
max_age = NULL,
|
||||
max_size = NULL,
|
||||
max_n = NULL,
|
||||
evict = NULL,
|
||||
destroy_on_finalize = NULL,
|
||||
destroyed = FALSE,
|
||||
missing = NULL,
|
||||
exec_missing = FALSE,
|
||||
logfile = NULL,
|
||||
|
||||
prune_throttle_counter = 0,
|
||||
prune_last_time = NULL,
|
||||
|
||||
key_to_filename = function(key) {
|
||||
validate_key(key)
|
||||
# Additional validation. This 80-char limit is arbitrary, and is
|
||||
# intended to avoid hitting a filename length limit on Windows.
|
||||
if (nchar(key) > 80) {
|
||||
stop("Invalid key: key must have fewer than 80 characters.")
|
||||
}
|
||||
file.path(private$dir, paste0(key, ".rds"))
|
||||
},
|
||||
|
||||
# A wrapper for prune() that throttles it, because prune() can be
|
||||
# expensive due to filesystem operations. This function will prune only
|
||||
# once every 20 times it is called, or if it has been more than 5 seconds
|
||||
# since the last time the cache was actually pruned, whichever is first.
|
||||
# In the future, the behavior may be customizable.
|
||||
prune_throttled = function() {
|
||||
# Count the number of times prune() has been called.
|
||||
private$prune_throttle_counter <- private$prune_throttle_counter + 1
|
||||
|
||||
if (private$prune_throttle_counter > 20 ||
|
||||
private$prune_last_time - as.numeric(Sys.time()) > 5)
|
||||
{
|
||||
self$prune()
|
||||
private$prune_throttle_counter <- 0
|
||||
}
|
||||
},
|
||||
|
||||
# Prunes a single object if it exceeds max_age. If the object does not
|
||||
# exceed max_age, or if the object doesn't exist, do nothing.
|
||||
maybe_prune_single = function(key) {
|
||||
obj <- private$cache[[key]]
|
||||
if (is.null(obj)) return()
|
||||
|
||||
timediff <- as.numeric(Sys.time()) - obj$mtime
|
||||
if (timediff > private$max_age) {
|
||||
private$log(paste0("pruning single object exceeding max_age: Removing ", key))
|
||||
rm(list = key, envir = private$cache)
|
||||
}
|
||||
},
|
||||
|
||||
log = function(text) {
|
||||
if (is.null(private$logfile)) return()
|
||||
|
||||
text <- paste0(format(Sys.time(), "[%Y-%m-%d %H:%M:%OS3] DiskCache "), text)
|
||||
cat(text, sep = "\n", file = private$logfile, append = TRUE)
|
||||
}
|
||||
)
|
||||
)
|
||||
365
R/cache-memory.R
365
R/cache-memory.R
@@ -1,365 +0,0 @@
|
||||
#' Create a memory cache object
|
||||
#'
|
||||
#' A memory cache object is a key-value store that saves the values in an
|
||||
#' environment. Objects can be stored and retrieved using the `get()` and
|
||||
#' `set()` methods. Objects are automatically pruned from the cache
|
||||
#' according to the parameters `max_size`, `max_age`, `max_n`,
|
||||
#' and `evict`.
|
||||
#'
|
||||
#' In a `MemoryCache`, R objects are stored directly in the cache; they are
|
||||
#' not *not* serialized before being stored in the cache. This contrasts
|
||||
#' with other cache types, like [diskCache()], where objects are
|
||||
#' serialized, and the serialized object is cached. This can result in some
|
||||
#' differences of behavior. For example, as long as an object is stored in a
|
||||
#' MemoryCache, it will not be garbage collected.
|
||||
#'
|
||||
#'
|
||||
#' @section Missing keys:
|
||||
#' The `missing` and `exec_missing` parameters controls what happens
|
||||
#' when `get()` is called with a key that is not in the cache (a cache
|
||||
#' miss). The default behavior is to return a [key_missing()]
|
||||
#' object. This is a *sentinel value* that indicates that the key was not
|
||||
#' present in the cache. You can test if the returned value represents a
|
||||
#' missing key by using the [is.key_missing()] function. You can
|
||||
#' also have `get()` return a different sentinel value, like `NULL`.
|
||||
#' If you want to throw an error on a cache miss, you can do so by providing a
|
||||
#' function for `missing` that takes one argument, the key, and also use
|
||||
#' `exec_missing=TRUE`.
|
||||
#'
|
||||
#' When the cache is created, you can supply a value for `missing`, which
|
||||
#' sets the default value to be returned for missing values. It can also be
|
||||
#' overridden when `get()` is called, by supplying a `missing`
|
||||
#' argument. For example, if you use `cache$get("mykey", missing =
|
||||
#' NULL)`, it will return `NULL` if the key is not in the cache.
|
||||
#'
|
||||
#' If your cache is configured so that `get()` returns a sentinel value
|
||||
#' to represent a cache miss, then `set` will also not allow you to store
|
||||
#' the sentinel value in the cache. It will throw an error if you attempt to
|
||||
#' do so.
|
||||
#'
|
||||
#' Instead of returning the same sentinel value each time there is cache miss,
|
||||
#' the cache can execute a function each time `get()` encounters missing
|
||||
#' key. If the function returns a value, then `get()` will in turn return
|
||||
#' that value. However, a more common use is for the function to throw an
|
||||
#' error. If an error is thrown, then `get()` will not return a value.
|
||||
#'
|
||||
#' To do this, pass a one-argument function to `missing`, and use
|
||||
#' `exec_missing=TRUE`. For example, if you want to throw an error that
|
||||
#' prints the missing key, you could do this:
|
||||
#'
|
||||
#' \preformatted{
|
||||
#' diskCache(
|
||||
#' missing = function(key) {
|
||||
#' stop("Attempted to get missing key: ", key)
|
||||
#' },
|
||||
#' exec_missing = TRUE
|
||||
#' )
|
||||
#' }
|
||||
#'
|
||||
#' If you use this, the code that calls `get()` should be wrapped with
|
||||
#' [tryCatch()] to gracefully handle missing keys.
|
||||
#'
|
||||
#' @section Cache pruning:
|
||||
#'
|
||||
#' Cache pruning occurs when `set()` is called, or it can be invoked
|
||||
#' manually by calling `prune()`.
|
||||
#'
|
||||
#' When a pruning occurs, if there are any objects that are older than
|
||||
#' `max_age`, they will be removed.
|
||||
#'
|
||||
#' The `max_size` and `max_n` parameters are applied to the cache as
|
||||
#' a whole, in contrast to `max_age`, which is applied to each object
|
||||
#' individually.
|
||||
#'
|
||||
#' If the number of objects in the cache exceeds `max_n`, then objects
|
||||
#' will be removed from the cache according to the eviction policy, which is
|
||||
#' set with the `evict` parameter. Objects will be removed so that the
|
||||
#' number of items is `max_n`.
|
||||
#'
|
||||
#' If the size of the objects in the cache exceeds `max_size`, then
|
||||
#' objects will be removed from the cache. Objects will be removed from the
|
||||
#' cache so that the total size remains under `max_size`. Note that the
|
||||
#' size is calculated using the size of the files, not the size of disk space
|
||||
#' used by the files --- these two values can differ because of files are
|
||||
#' stored in blocks on disk. For example, if the block size is 4096 bytes,
|
||||
#' then a file that is one byte in size will take 4096 bytes on disk.
|
||||
#'
|
||||
#' Another time that objects can be removed from the cache is when
|
||||
#' `get()` is called. If the target object is older than `max_age`,
|
||||
#' it will be removed and the cache will report it as a missing value.
|
||||
#'
|
||||
#' @section Eviction policies:
|
||||
#'
|
||||
#' If `max_n` or `max_size` are used, then objects will be removed
|
||||
#' from the cache according to an eviction policy. The available eviction
|
||||
#' policies are:
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`"lru"`}{
|
||||
#' Least Recently Used. The least recently used objects will be removed.
|
||||
#' This uses the filesystem's atime property. Some filesystems do not
|
||||
#' support atime, or have a very low atime resolution. The DiskCache will
|
||||
#' check for atime support, and if the filesystem does not support atime,
|
||||
#' a warning will be issued and the "fifo" policy will be used instead.
|
||||
#' }
|
||||
#' \item{`"fifo"`}{
|
||||
#' First-in-first-out. The oldest objects will be removed.
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @section Methods:
|
||||
#'
|
||||
#' A disk cache object has the following methods:
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`get(key, missing, exec_missing)`}{
|
||||
#' Returns the value associated with `key`. If the key is not in the
|
||||
#' cache, then it returns the value specified by `missing` or,
|
||||
#' `missing` is a function and `exec_missing=TRUE`, then
|
||||
#' executes `missing`. The function can throw an error or return the
|
||||
#' value. If either of these parameters are specified here, then they
|
||||
#' will override the defaults that were set when the DiskCache object was
|
||||
#' created. See section Missing Keys for more information.
|
||||
#' }
|
||||
#' \item{`set(key, value)`}{
|
||||
#' Stores the `key`-`value` pair in the cache.
|
||||
#' }
|
||||
#' \item{`exists(key)`}{
|
||||
#' Returns `TRUE` if the cache contains the key, otherwise
|
||||
#' `FALSE`.
|
||||
#' }
|
||||
#' \item{`size()`}{
|
||||
#' Returns the number of items currently in the cache.
|
||||
#' }
|
||||
#' \item{`keys()`}{
|
||||
#' Returns a character vector of all keys currently in the cache.
|
||||
#' }
|
||||
#' \item{`reset()`}{
|
||||
#' Clears all objects from the cache.
|
||||
#' }
|
||||
#' \item{`destroy()`}{
|
||||
#' Clears all objects in the cache, and removes the cache directory from
|
||||
#' disk.
|
||||
#' }
|
||||
#' \item{`prune()`}{
|
||||
#' Prunes the cache, using the parameters specified by `max_size`,
|
||||
#' `max_age`, `max_n`, and `evict`.
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @inheritParams diskCache
|
||||
#'
|
||||
#' @export
|
||||
memoryCache <- function(
|
||||
max_size = 10 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
missing = key_missing(),
|
||||
exec_missing = FALSE,
|
||||
logfile = NULL)
|
||||
{
|
||||
MemoryCache$new(max_size, max_age, max_n, evict, missing, exec_missing, logfile)
|
||||
}
|
||||
|
||||
MemoryCache <- R6Class("MemoryCache",
|
||||
public = list(
|
||||
initialize = function(
|
||||
max_size = 10 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
missing = key_missing(),
|
||||
exec_missing = FALSE,
|
||||
logfile = NULL)
|
||||
{
|
||||
if (exec_missing && (!is.function(missing) || length(formals(missing)) == 0)) {
|
||||
stop("When `exec_missing` is true, `missing` must be a function that takes one argument.")
|
||||
}
|
||||
if (!is.numeric(max_size)) stop("max_size must be a number. Use `Inf` for no limit.")
|
||||
if (!is.numeric(max_age)) stop("max_age must be a number. Use `Inf` for no limit.")
|
||||
if (!is.numeric(max_n)) stop("max_n must be a number. Use `Inf` for no limit.")
|
||||
private$cache <- fastmap()
|
||||
private$max_size <- max_size
|
||||
private$max_age <- max_age
|
||||
private$max_n <- max_n
|
||||
private$evict <- match.arg(evict)
|
||||
private$missing <- missing
|
||||
private$exec_missing <- exec_missing
|
||||
private$logfile <- logfile
|
||||
},
|
||||
|
||||
get = function(key, missing = private$missing, exec_missing = private$exec_missing) {
|
||||
private$log(paste0('get: key "', key, '"'))
|
||||
validate_key(key)
|
||||
|
||||
private$maybe_prune_single(key)
|
||||
|
||||
if (!self$exists(key)) {
|
||||
private$log(paste0('get: key "', key, '" is missing'))
|
||||
if (exec_missing) {
|
||||
if (!is.function(missing) || length(formals(missing)) == 0) {
|
||||
stop("When `exec_missing` is true, `missing` must be a function that takes one argument.")
|
||||
}
|
||||
return(missing(key))
|
||||
} else {
|
||||
return(missing)
|
||||
}
|
||||
}
|
||||
|
||||
private$log(paste0('get: key "', key, '" found'))
|
||||
value <- private$cache$get(key)$value
|
||||
value
|
||||
},
|
||||
|
||||
set = function(key, value) {
|
||||
private$log(paste0('set: key "', key, '"'))
|
||||
validate_key(key)
|
||||
|
||||
time <- as.numeric(Sys.time())
|
||||
|
||||
# Only record size if we're actually using max_size for pruning.
|
||||
if (is.finite(private$max_size)) {
|
||||
# Reported size is rough! See ?object.size.
|
||||
size <- as.numeric(object.size(value))
|
||||
} else {
|
||||
size <- NULL
|
||||
}
|
||||
|
||||
private$cache$set(key, list(
|
||||
key = key,
|
||||
value = value,
|
||||
size = size,
|
||||
mtime = time,
|
||||
atime = time
|
||||
))
|
||||
self$prune()
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
exists = function(key) {
|
||||
validate_key(key)
|
||||
private$cache$has(key)
|
||||
},
|
||||
|
||||
keys = function() {
|
||||
private$cache$keys()
|
||||
},
|
||||
|
||||
remove = function(key) {
|
||||
private$log(paste0('remove: key "', key, '"'))
|
||||
validate_key(key)
|
||||
private$cache$remove(key)
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
reset = function() {
|
||||
private$log(paste0('reset'))
|
||||
private$cache$reset()
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
prune = function() {
|
||||
private$log(paste0('prune'))
|
||||
info <- private$object_info()
|
||||
|
||||
# 1. Remove any objects where the age exceeds max age.
|
||||
if (is.finite(private$max_age)) {
|
||||
time <- as.numeric(Sys.time())
|
||||
timediff <- time - info$mtime
|
||||
rm_idx <- timediff > private$max_age
|
||||
if (any(rm_idx)) {
|
||||
private$log(paste0("prune max_age: Removing ", paste(info$key[rm_idx], collapse = ", ")))
|
||||
private$cache$remove(info$key[rm_idx])
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
}
|
||||
|
||||
# Sort objects by priority, according to eviction policy. The sorting is
|
||||
# done in a function which can be called multiple times but only does
|
||||
# the work the first time.
|
||||
info_is_sorted <- FALSE
|
||||
ensure_info_is_sorted <- function() {
|
||||
if (info_is_sorted) return()
|
||||
|
||||
if (private$evict == "lru") {
|
||||
info <<- info[order(info$atime, decreasing = TRUE), ]
|
||||
} else if (private$evict == "fifo") {
|
||||
info <<- info[order(info$mtime, decreasing = TRUE), ]
|
||||
} else {
|
||||
stop('Unknown eviction policy "', private$evict, '"')
|
||||
}
|
||||
info_is_sorted <<- TRUE
|
||||
}
|
||||
|
||||
# 2. Remove objects if there are too many.
|
||||
if (is.finite(private$max_n) && nrow(info) > private$max_n) {
|
||||
ensure_info_is_sorted()
|
||||
rm_idx <- seq_len(nrow(info)) > private$max_n
|
||||
private$log(paste0("prune max_n: Removing ", paste(info$key[rm_idx], collapse = ", ")))
|
||||
private$cache$remove(info$key[rm_idx])
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
|
||||
# 3. Remove objects if cache is too large.
|
||||
if (is.finite(private$max_size) && sum(info$size) > private$max_size) {
|
||||
ensure_info_is_sorted()
|
||||
cum_size <- cumsum(info$size)
|
||||
rm_idx <- cum_size > private$max_size
|
||||
private$log(paste0("prune max_size: Removing ", paste(info$key[rm_idx], collapse = ", ")))
|
||||
private$cache$remove(info$key[rm_idx])
|
||||
info <- info[!rm_idx, ]
|
||||
}
|
||||
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
size = function() {
|
||||
length(self$keys())
|
||||
}
|
||||
),
|
||||
|
||||
private = list(
|
||||
cache = NULL,
|
||||
max_age = NULL,
|
||||
max_size = NULL,
|
||||
max_n = NULL,
|
||||
evict = NULL,
|
||||
missing = NULL,
|
||||
exec_missing = NULL,
|
||||
logfile = NULL,
|
||||
|
||||
# Prunes a single object if it exceeds max_age. If the object does not
|
||||
# exceed max_age, or if the object doesn't exist, do nothing.
|
||||
maybe_prune_single = function(key) {
|
||||
if (!is.finite(private$max_age)) return()
|
||||
|
||||
obj <- private$cache$get(key)
|
||||
if (is.null(obj)) return()
|
||||
|
||||
timediff <- as.numeric(Sys.time()) - obj$mtime
|
||||
if (timediff > private$max_age) {
|
||||
private$log(paste0("pruning single object exceeding max_age: Removing ", key))
|
||||
private$cache$remove(key)
|
||||
}
|
||||
},
|
||||
|
||||
object_info = function() {
|
||||
keys <- private$cache$keys()
|
||||
data.frame(
|
||||
key = keys,
|
||||
size = vapply(keys, function(key) private$cache$get(key)$size, 0),
|
||||
mtime = vapply(keys, function(key) private$cache$get(key)$mtime, 0),
|
||||
atime = vapply(keys, function(key) private$cache$get(key)$atime, 0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
},
|
||||
|
||||
log = function(text) {
|
||||
if (is.null(private$logfile)) return()
|
||||
|
||||
text <- paste0(format(Sys.time(), "[%Y-%m-%d %H:%M:%OS3] MemoryCache "), text)
|
||||
cat(text, sep = "\n", file = private$logfile, append = TRUE)
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -1,9 +1,25 @@
|
||||
|
||||
validate_key <- function(key) {
|
||||
if (!is.character(key) || length(key) != 1 || nchar(key) == 0) {
|
||||
stop("Invalid key: key must be single non-empty string.")
|
||||
}
|
||||
if (grepl("[^a-z0-9]", key)) {
|
||||
stop("Invalid key: ", key, ". Only lowercase letters and numbers are allowed.")
|
||||
}
|
||||
# For our purposes, cache objects must support these methods.
|
||||
is_cache_object <- function(x) {
|
||||
# Use tryCatch in case the object does not support `$`.
|
||||
tryCatch(
|
||||
is.function(x$get) && is.function(x$set),
|
||||
error = function(e) FALSE
|
||||
)
|
||||
}
|
||||
|
||||
# Given a cache object, or string "app" or "session", return appropriate cache
|
||||
# object.
|
||||
resolve_cache_object <- function(cache, session) {
|
||||
if (identical(cache, "app")) {
|
||||
cache <- getShinyOption("cache", default = NULL)
|
||||
|
||||
} else if (identical(cache, "session")) {
|
||||
cache <- session$cache
|
||||
}
|
||||
|
||||
if (is_cache_object(cache)) {
|
||||
return(cache)
|
||||
}
|
||||
|
||||
stop('`cache` must either be "app", "session", or a cache object with methods, `$get`, and `$set`.')
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ captureStackTraces <- function(expr) {
|
||||
createStackTracePromiseDomain <- function() {
|
||||
# These are actually stateless, we wouldn't have to create a new one each time
|
||||
# if we didn't want to. They're pretty cheap though.
|
||||
|
||||
|
||||
d <- promises::new_promise_domain(
|
||||
wrapOnFulfilled = function(onFulfilled) {
|
||||
force(onFulfilled)
|
||||
@@ -217,7 +217,7 @@ doCaptureStack <- function(e) {
|
||||
#' @rdname stacktrace
|
||||
#' @export
|
||||
withLogErrors <- function(expr,
|
||||
full = getOption("shiny.fullstacktrace", FALSE),
|
||||
full = get_devmode_option("shiny.fullstacktrace", FALSE),
|
||||
offset = getOption("shiny.stacktraceoffset", TRUE)) {
|
||||
|
||||
withCallingHandlers(
|
||||
@@ -264,34 +264,34 @@ withLogErrors <- function(expr,
|
||||
#' @rdname stacktrace
|
||||
#' @export
|
||||
printError <- function(cond,
|
||||
full = getOption("shiny.fullstacktrace", FALSE),
|
||||
full = get_devmode_option("shiny.fullstacktrace", FALSE),
|
||||
offset = getOption("shiny.stacktraceoffset", TRUE)) {
|
||||
|
||||
warning(call. = FALSE, immediate. = TRUE, sprintf("Error in %s: %s",
|
||||
|
||||
warning(call. = FALSE, immediate. = TRUE, sprintf("Error in %s: %s",
|
||||
getCallNames(list(conditionCall(cond))), conditionMessage(cond)))
|
||||
|
||||
|
||||
printStackTrace(cond, full = full, offset = offset)
|
||||
}
|
||||
|
||||
#' @rdname stacktrace
|
||||
#' @export
|
||||
printStackTrace <- function(cond,
|
||||
full = getOption("shiny.fullstacktrace", FALSE),
|
||||
full = get_devmode_option("shiny.fullstacktrace", FALSE),
|
||||
offset = getOption("shiny.stacktraceoffset", TRUE)) {
|
||||
|
||||
should_drop <- !full
|
||||
should_strip <- !full
|
||||
should_prune <- !full
|
||||
|
||||
|
||||
stackTraceCalls <- c(
|
||||
attr(cond, "deep.stack.trace", exact = TRUE),
|
||||
list(attr(cond, "stack.trace", exact = TRUE))
|
||||
)
|
||||
|
||||
|
||||
stackTraceParents <- lapply(stackTraceCalls, attr, which = "parents", exact = TRUE)
|
||||
stackTraceCallNames <- lapply(stackTraceCalls, getCallNames)
|
||||
stackTraceCalls <- lapply(stackTraceCalls, offsetSrcrefs, offset = offset)
|
||||
|
||||
|
||||
# Use dropTrivialFrames logic to remove trailing bits (.handleSimpleError, h)
|
||||
if (should_drop) {
|
||||
# toKeep is a list of logical vectors, of which elements (stack frames) to keep
|
||||
@@ -301,7 +301,7 @@ printStackTrace <- function(cond,
|
||||
stackTraceCallNames <- mapply(stackTraceCallNames, FUN = `[`, toKeep, SIMPLIFY = FALSE)
|
||||
stackTraceParents <- mapply(stackTraceParents, FUN = `[`, toKeep, SIMPLIFY = FALSE)
|
||||
}
|
||||
|
||||
|
||||
delayedAssign("all_true", {
|
||||
# List of logical vectors that are all TRUE, the same shape as
|
||||
# stackTraceCallNames. Delay the evaluation so we don't create it unless
|
||||
@@ -310,7 +310,7 @@ printStackTrace <- function(cond,
|
||||
rep_len(TRUE, length(st))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
# stripStackTraces and lapply(stackTraceParents, pruneStackTrace) return lists
|
||||
# of logical vectors. Use mapply(FUN = `&`) to boolean-and each pair of the
|
||||
# logical vectors.
|
||||
@@ -320,7 +320,7 @@ printStackTrace <- function(cond,
|
||||
FUN = `&`,
|
||||
SIMPLIFY = FALSE
|
||||
)
|
||||
|
||||
|
||||
dfs <- mapply(seq_along(stackTraceCalls), rev(stackTraceCalls), rev(stackTraceCallNames), rev(toShow), FUN = function(i, calls, nms, index) {
|
||||
st <- data.frame(
|
||||
num = rev(which(index)),
|
||||
@@ -329,7 +329,7 @@ printStackTrace <- function(cond,
|
||||
category = rev(getCallCategories(calls[index])),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
|
||||
|
||||
if (i != 1) {
|
||||
message("From earlier call:")
|
||||
}
|
||||
@@ -357,7 +357,7 @@ printStackTrace <- function(cond,
|
||||
|
||||
st
|
||||
}, SIMPLIFY = FALSE)
|
||||
|
||||
|
||||
invisible()
|
||||
}
|
||||
|
||||
@@ -370,12 +370,13 @@ printStackTrace <- function(cond,
|
||||
#' @rdname stacktrace
|
||||
#' @export
|
||||
extractStackTrace <- function(calls,
|
||||
full = getOption("shiny.fullstacktrace", FALSE),
|
||||
full = get_devmode_option("shiny.fullstacktrace", FALSE),
|
||||
offset = getOption("shiny.stacktraceoffset", TRUE)) {
|
||||
|
||||
shinyDeprecated(NULL,
|
||||
"extractStackTrace is deprecated. Please contact the Shiny team if you were using this functionality.",
|
||||
version = "1.0.5")
|
||||
|
||||
shinyDeprecated(
|
||||
"1.0.5", "extractStackTrace()",
|
||||
details = "Please contact the Shiny team if you were using this functionality."
|
||||
)
|
||||
|
||||
srcrefs <- getSrcRefs(calls)
|
||||
if (offset) {
|
||||
@@ -459,19 +460,19 @@ stripOneStackTrace <- function(stackTrace, truncateFloor, startingScore) {
|
||||
prefix <- rep_len(FALSE, indexOfFloor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (length(stackTrace) == 0) {
|
||||
return(list(score = startingScore, character(0)))
|
||||
}
|
||||
|
||||
|
||||
score <- rep.int(0L, length(stackTrace))
|
||||
score[stackTrace == "..stacktraceon.."] <- 1L
|
||||
score[stackTrace == "..stacktraceoff.."] <- -1L
|
||||
score <- startingScore + cumsum(score)
|
||||
|
||||
|
||||
toShow <- score > 0 & !(stackTrace %in% c("..stacktraceon..", "..stacktraceoff..", "..stacktracefloor.."))
|
||||
|
||||
|
||||
|
||||
|
||||
list(score = utils::tail(score, 1), trace = c(prefix, toShow))
|
||||
}
|
||||
|
||||
@@ -486,11 +487,11 @@ pruneStackTrace <- function(parents) {
|
||||
# sufficient; we also need to drop nodes that are the last child, but one of
|
||||
# their ancestors is not.
|
||||
is_dupe <- duplicated(parents, fromLast = TRUE)
|
||||
|
||||
|
||||
# The index of the most recently seen node that was actually kept instead of
|
||||
# dropped.
|
||||
current_node <- 0
|
||||
|
||||
|
||||
# Loop over the parent indices. Anything that is not parented by current_node
|
||||
# (a.k.a. last-known-good node), or is a dupe, can be discarded. Anything that
|
||||
# is kept becomes the new current_node.
|
||||
@@ -502,7 +503,7 @@ pruneStackTrace <- function(parents) {
|
||||
FALSE
|
||||
}
|
||||
}, FUN.VALUE = logical(1))
|
||||
|
||||
|
||||
include
|
||||
}
|
||||
|
||||
@@ -515,7 +516,7 @@ dropTrivialFrames <- function(callnames) {
|
||||
# What's the last that *didn't* match stop/.handleSimpleError/h?
|
||||
lastGoodCall <- max(which(!hideable))
|
||||
toRemove <- length(callnames) - lastGoodCall
|
||||
|
||||
|
||||
c(
|
||||
rep_len(TRUE, length(callnames) - toRemove),
|
||||
rep_len(FALSE, toRemove)
|
||||
@@ -530,10 +531,10 @@ offsetSrcrefs <- function(calls, offset = TRUE) {
|
||||
# E.g. for "foo [bar.R:10]", line 10 of bar.R will be part of
|
||||
# the definition of foo().
|
||||
srcrefs <- c(utils::tail(srcrefs, -1), list(NULL))
|
||||
|
||||
|
||||
calls <- setSrcRefs(calls, srcrefs)
|
||||
}
|
||||
|
||||
|
||||
calls
|
||||
}
|
||||
|
||||
@@ -544,13 +545,14 @@ offsetSrcrefs <- function(calls, offset = TRUE) {
|
||||
#' @rdname stacktrace
|
||||
#' @export
|
||||
formatStackTrace <- function(calls, indent = " ",
|
||||
full = getOption("shiny.fullstacktrace", FALSE),
|
||||
full = get_devmode_option("shiny.fullstacktrace", FALSE),
|
||||
offset = getOption("shiny.stacktraceoffset", TRUE)) {
|
||||
|
||||
shinyDeprecated(NULL,
|
||||
"extractStackTrace is deprecated. Please contact the Shiny team if you were using this functionality.",
|
||||
version = "1.0.5")
|
||||
|
||||
shinyDeprecated(
|
||||
"1.0.5", "formatStackTrace()",
|
||||
details = "Please contact the Shiny team if you were using this functionality."
|
||||
)
|
||||
|
||||
st <- extractStackTrace(calls, full = full, offset = offset)
|
||||
if (nrow(st) == 0) {
|
||||
return(character(0))
|
||||
|
||||
108
R/deprecated.R
Normal file
108
R/deprecated.R
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
#' Print message for deprecated functions in Shiny
|
||||
#'
|
||||
#' To disable these messages, use `options(shiny.deprecation.messages=FALSE)`.
|
||||
#'
|
||||
#' @param version Shiny version when the function was deprecated
|
||||
#' @param what Function with possible arguments
|
||||
#' @param with Possible function with arguments that should be used instead
|
||||
#' @param details Additional information to be added after a new line to the displayed message
|
||||
#' @keywords internal
|
||||
shinyDeprecated <- function(
|
||||
version, what, with = NULL, details = NULL
|
||||
) {
|
||||
if (is_false(getOption("shiny.deprecation.messages"))) {
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
msg <- paste0("`", what, "` is deprecated as of shiny ", version, ".")
|
||||
if (!is.null(with)) {
|
||||
msg <- paste0(msg, "\n", "Please use `", with, "` instead.")
|
||||
}
|
||||
if (!is.null(details)) {
|
||||
msg <- paste0(msg, "\n", details)
|
||||
}
|
||||
|
||||
# lifecycle::deprecate_soft(when, what, with = with, details = details, id = id, env = env)
|
||||
rlang::inform(message = msg, .frequency = "always", .frequency_id = msg, .file = stderr())
|
||||
}
|
||||
|
||||
|
||||
deprecatedEnvQuotedMessage <- function() {
|
||||
if (!in_devmode()) return(invisible())
|
||||
if (is_false(getOption("shiny.deprecation.messages"))) return(invisible())
|
||||
|
||||
# manually
|
||||
msg <- paste0(
|
||||
"The `env` and `quoted` arguments are deprecated as of shiny 1.6.0.",
|
||||
" Please use quosures from `rlang` instead.\n",
|
||||
"See <https://github.com/rstudio/shiny/issues/3108> for more information."
|
||||
)
|
||||
rlang::inform(message = msg, .frequency = "always", .frequency_id = msg, .file = stderr())
|
||||
}
|
||||
|
||||
|
||||
#' Create disk cache (deprecated)
|
||||
#'
|
||||
#' @param exec_missing Deprecated.
|
||||
#' @inheritParams cachem::cache_disk
|
||||
#' @keywords internal
|
||||
#' @export
|
||||
diskCache <- function(
|
||||
dir = NULL,
|
||||
max_size = 500 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
destroy_on_finalize = FALSE,
|
||||
missing = key_missing(),
|
||||
exec_missing = deprecated(),
|
||||
logfile = NULL
|
||||
) {
|
||||
shinyDeprecated("1.6.0", "diskCache()", "cachem::cache_disk()")
|
||||
if (lifecycle::is_present(exec_missing)) {
|
||||
shinyDeprecated("1.6.0", "diskCache(exec_missing =)")
|
||||
}
|
||||
|
||||
cachem::cache_disk(
|
||||
dir = dir,
|
||||
max_size = max_size,
|
||||
max_age = max_age,
|
||||
max_n = max_n,
|
||||
evict = evict,
|
||||
destroy_on_finalize = destroy_on_finalize,
|
||||
missing = missing,
|
||||
logfile = logfile
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#' Create memory cache (deprecated)
|
||||
#'
|
||||
#' @param exec_missing Deprecated.
|
||||
#' @inheritParams cachem::cache_mem
|
||||
#' @keywords internal
|
||||
#' @export
|
||||
memoryCache <- function(
|
||||
max_size = 200 * 1024 ^ 2,
|
||||
max_age = Inf,
|
||||
max_n = Inf,
|
||||
evict = c("lru", "fifo"),
|
||||
missing = key_missing(),
|
||||
exec_missing = deprecated(),
|
||||
logfile = NULL)
|
||||
{
|
||||
shinyDeprecated("1.6.0", "diskCache()", "cachem::cache_mem()")
|
||||
if (lifecycle::is_present(exec_missing)) {
|
||||
shinyDeprecated("1.6.0", "diskCache(exec_missing =)")
|
||||
}
|
||||
|
||||
cachem::cache_mem(
|
||||
max_size = max_size,
|
||||
max_age = max_age,
|
||||
max_n = max_n,
|
||||
evict = evict,
|
||||
missing = missing,
|
||||
logfile = logfile
|
||||
)
|
||||
}
|
||||
358
R/devmode.R
Normal file
358
R/devmode.R
Normal file
@@ -0,0 +1,358 @@
|
||||
#' Shiny Developer Mode
|
||||
#'
|
||||
#' @description \lifecycle{experimental}
|
||||
#'
|
||||
#' Developer Mode enables a number of [options()] to make a developer's life
|
||||
#' easier, like enabling non-minified JS and printing messages about
|
||||
#' deprecated functions and options.
|
||||
#'
|
||||
#' Shiny Developer Mode can be enabled by calling `devmode(TRUE)` and disabled
|
||||
#' by calling `devmode(FALSE)`.
|
||||
#'
|
||||
#' Please see the function descriptions for more details.
|
||||
#'
|
||||
#' @describeIn devmode Function to set two options to enable/disable Shiny
|
||||
#' Developer Mode and Developer messages
|
||||
#' @param devmode Logical value which should be set to `TRUE` to enable Shiny
|
||||
#' Developer Mode
|
||||
#' @param verbose Logical value which should be set to `TRUE` display Shiny
|
||||
#' Developer messages
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # Enable Shiny Developer mode
|
||||
#' devmode()
|
||||
#'
|
||||
devmode <- function(
|
||||
devmode = getOption("shiny.devmode", TRUE),
|
||||
verbose = getOption("shiny.devmode.verbose", TRUE)
|
||||
) {
|
||||
options(
|
||||
shiny.devmode = devmode,
|
||||
shiny.devmode.verbose = verbose
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#' @describeIn devmode Determines if Shiny is in Developer Mode. If the
|
||||
#' `getOption("shiny.devmode")` is set to `TRUE` and not in testing inside
|
||||
#' `testthat`, then Shiny Developer Mode is enabled.
|
||||
#' @section Avoiding direct dependency on shiny:
|
||||
#'
|
||||
#' The methods explained in this help file act independently from the rest of
|
||||
#' Shiny but are included to provide blue prints for your own packages. If
|
||||
#' your package already has (or is willing to take) a dependency on Shiny, we
|
||||
#' recommend using the exported Shiny methods for consistent behavior. Note
|
||||
#' that if you use exported Shiny methods, it will cause the Shiny package to
|
||||
#' load. This may be undesirable if your code will be used in (for example) R
|
||||
#' Markdown documents that do not have a Shiny runtime (`runtime: shiny`).
|
||||
#'
|
||||
#' If your package can **not** take a dependency on Shiny, we recommending
|
||||
#' re-implementing these two functions:
|
||||
#'
|
||||
#' \enumerate{
|
||||
#' \item `in_devmode()`:
|
||||
#'
|
||||
#' This function should return `TRUE` if `getOption("shiny.devmode")` is set.
|
||||
#' In addition, we strongly recommend that it also checks to make sure
|
||||
#' `testthat` is not testing.
|
||||
#'
|
||||
#' ```r
|
||||
#' in_devmode <- function() {
|
||||
#' isTRUE(getOption("shiny.devmode", FALSE)) &&
|
||||
#' !identical(Sys.getenv("TESTTHAT"), "true")
|
||||
#' }
|
||||
#' ```
|
||||
#'
|
||||
#' \item `get_devmode_option(name, default, devmode_default, devmode_message)`:
|
||||
#'
|
||||
#' This function is similar to `getOption(name, default)`, but when the option
|
||||
#' is not set, the default value changes depending on the Dev Mode.
|
||||
#' `get_devmode_option()` should be implemented as follows:
|
||||
#'
|
||||
#' * If not in Dev Mode:
|
||||
#' * Return `getOption(name, default)`.
|
||||
#' * If in Dev Mode:
|
||||
#' * Get the global option `getOption(name)` value.
|
||||
#' * If the global option value is set:
|
||||
#' * Return the value.
|
||||
#' * If the global option value is not set:
|
||||
#' * Notify the developer that the Dev Mode default value will be used.
|
||||
#' * Return the Dev Mode default value.
|
||||
#'
|
||||
#' When notifying the developer that the default value has changed, we strongly
|
||||
#' recommend displaying a message (`devmode_message`) to `stderr()` once every 8
|
||||
#' hours using [rlang::inform()]. This will keep the author up to date as to
|
||||
#' which Dev Mode options are being altered. To allow developers a chance to
|
||||
#' disable Dev Mode messages, the message should be skipped if
|
||||
#' `getOption("shiny.devmode.verbose", TRUE)` is not `TRUE`.
|
||||
#'
|
||||
#' ```r
|
||||
#' get_devmode_option <- function(name, default = NULL, devmode_default, devmode_message) {
|
||||
#' if (!in_devmode()) {
|
||||
#' # Dev Mode disabled, act like `getOption()`
|
||||
#' return(getOption(name, default = default))
|
||||
#' }
|
||||
#'
|
||||
#' # Dev Mode enabled, update the default value for `getOption()`
|
||||
#' getOption(name, default = {
|
||||
#' # Notify developer
|
||||
#' if (
|
||||
#' !missing(devmode_message) &&
|
||||
#' !is.null(devmode_message) &&
|
||||
#' getOption("shiny.devmode.verbose", TRUE)
|
||||
#' ) {
|
||||
#' rlang::inform(
|
||||
#' message = devmode_message,
|
||||
#' .frequency = "regularly",
|
||||
#' .frequency_id = devmode_message,
|
||||
#' .file = stderr()
|
||||
#' )
|
||||
#' }
|
||||
#'
|
||||
#' # Return Dev Mode default value `devmode_default`
|
||||
#' devmode_default
|
||||
#' })
|
||||
#' }
|
||||
#' ```
|
||||
#' }
|
||||
#'
|
||||
#' The remaining functions in this file are used for author convenience and are
|
||||
#' not recommended for all reimplementation situations.
|
||||
#' @export
|
||||
#' @examples
|
||||
#' in_devmode() # TRUE/FALSE?
|
||||
#'
|
||||
in_devmode <- function() {
|
||||
isTRUE(getOption("shiny.devmode", FALSE)) &&
|
||||
# !testthat::is_testing()
|
||||
!identical(Sys.getenv("TESTTHAT"), "true")
|
||||
}
|
||||
|
||||
#' @describeIn devmode Temporarily set Shiny Developer Mode and Developer
|
||||
#' message verbosity
|
||||
#' @param code Code to execute with the temporary Dev Mode options set
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # Execute code in a temporary shiny dev mode
|
||||
#' with_devmode(TRUE, in_devmode()) # TRUE
|
||||
#'
|
||||
with_devmode <- function(
|
||||
devmode,
|
||||
code,
|
||||
verbose = getOption("shiny.devmode.verbose", TRUE)
|
||||
) {
|
||||
withr::with_options(
|
||||
list(
|
||||
shiny.devmode = devmode,
|
||||
shiny.devmode.verbose = verbose
|
||||
),
|
||||
code
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#' @describeIn devmode If Shiny Developer Mode and verbosity are enabled,
|
||||
#' displays a message once every 8 hrs (by default)
|
||||
#' @param message Developer Mode message to be sent to [rlang::inform()]
|
||||
#' @param .frequency Frequency of the Developer Mode message used with
|
||||
#' [rlang::inform()]. Defaults to once every 8 hours.
|
||||
#' @param .frequency_id [rlang::inform()] message identifier. Defaults to
|
||||
#' `message`.
|
||||
#' @param .file Output connection for [rlang::inform()]. Defaults to [stderr()]
|
||||
#' @param ... Parameters passed to [rlang::inform()]
|
||||
devmode_inform <- function(
|
||||
message,
|
||||
.frequency = "regularly",
|
||||
.frequency_id = message,
|
||||
.file = stderr(),
|
||||
...
|
||||
) {
|
||||
|
||||
if (!(
|
||||
in_devmode() &&
|
||||
isTRUE(getOption("shiny.devmode.verbose", TRUE))
|
||||
)) {
|
||||
return()
|
||||
}
|
||||
if (is.null(message)) {
|
||||
return()
|
||||
}
|
||||
|
||||
rlang::inform(
|
||||
message = paste0("shiny devmode - ", message),
|
||||
.frequency = .frequency,
|
||||
.frequency_id = .frequency_id,
|
||||
.file = .file,
|
||||
...
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#' @include map.R
|
||||
registered_devmode_options <- Map$new()
|
||||
|
||||
#' @describeIn devmode Registers a Shiny Developer Mode option with an updated
|
||||
#' value and Developer message. This registration method allows package
|
||||
#' authors to write one message in a single location.
|
||||
#'
|
||||
#' For example, the following Shiny Developer Mode options are registered:
|
||||
#'
|
||||
#' ```r
|
||||
#' # Reload the Shiny app when a sourced R file changes
|
||||
#' register_devmode_option(
|
||||
#' "shiny.autoreload",
|
||||
#' "Turning on shiny autoreload. To disable, call `options(shiny.autoreload = FALSE)`",
|
||||
#' devmode_default = TRUE
|
||||
#' )
|
||||
#'
|
||||
#' # Use the unminified Shiny JavaScript file, `shiny.js`
|
||||
#' register_devmode_option(
|
||||
#' "shiny.minified",
|
||||
#' "Using full shiny javascript file. To use the minified version, call `options(shiny.minified = TRUE)`",
|
||||
#' devmode_default = FALSE
|
||||
#' )
|
||||
#'
|
||||
#' # Display the full stack trace when errors occur during Shiny app execution
|
||||
#' register_devmode_option(
|
||||
#' "shiny.fullstacktrace",
|
||||
#' "Turning on full stack trace. To disable, call `options(shiny.fullstacktrace = FALSE)`",
|
||||
#' devmode_default = TRUE
|
||||
#' )
|
||||
#' ```
|
||||
#'
|
||||
#' Other known, non-Shiny Developer Mode options:
|
||||
#'
|
||||
#' * Sass:
|
||||
#' ```r
|
||||
#' # Display the full stack trace when errors occur during Shiny app execution
|
||||
#' register_devmode_option(
|
||||
#' "sass.cache",
|
||||
#' "Turning off sass cache. To use default caching, call `options(sass.cache = TRUE)`",
|
||||
#' devmode_default = FALSE
|
||||
#' )
|
||||
#' ```
|
||||
#' @param name Name of option to look for in `options()`
|
||||
#' @param default Default value to return if `in_devmode()` returns
|
||||
#' `TRUE` and the specified option is not set in [`options()`].
|
||||
#' @param devmode_message Message to display once every 8 hours when utilizing
|
||||
#' the `devmode_default` value. If `devmode_message` is missing, the
|
||||
#' registered `devmode_message` value be used.
|
||||
#' @param devmode_default Default value to return if `in_devmode()` returns
|
||||
#' `TRUE` and the specified option is not set in [`options()`]. For
|
||||
#' `get_devmode_option()`, if `devmode_default` is missing, the
|
||||
#' registered `devmode_default` value will be used.
|
||||
#' @examples
|
||||
#' # Ex: Within shiny, we register the option "shiny.minified"
|
||||
#' # to default to `FALSE` when in Dev Mode
|
||||
#' \dontrun{register_devmode_option(
|
||||
#' "shiny.minified",
|
||||
#' devmode_message = paste0(
|
||||
#' "Using full shiny javascript file. ",
|
||||
#' "To use the minified version, call `options(shiny.minified = TRUE)`"
|
||||
#' ),
|
||||
#' devmode_default = FALSE
|
||||
#' )}
|
||||
#'
|
||||
register_devmode_option <- function(
|
||||
name,
|
||||
devmode_message = NULL,
|
||||
devmode_default = NULL
|
||||
) {
|
||||
if (!is.null(devmode_message)) {
|
||||
stopifnot(length(devmode_message) == 1 && is.character(devmode_message))
|
||||
}
|
||||
registered_devmode_options$set(
|
||||
name,
|
||||
list(devmode_default = devmode_default, devmode_message = devmode_message)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#' @describeIn devmode Provides a consistent way to change the expected
|
||||
#' [getOption()] behavior when Developer Mode is enabled. This method is very
|
||||
#' similar to [getOption()] where the globally set option takes precedence.
|
||||
#' See section "Avoiding direct dependency on shiny" for
|
||||
#' `get_devmode_option()` implementation details.
|
||||
#'
|
||||
#' **Package developers:** Register your Dev Mode option using
|
||||
#' `register_devmode_option()` to avoid supplying the same `devmode_default`
|
||||
#' and `devmode_message` values throughout your package. (This requires a
|
||||
#' \pkg{shiny} dependency.)
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # Used within `shiny::runApp(launch.browser)`
|
||||
#' get_devmode_option("shiny.minified", TRUE) # TRUE if Dev mode is off
|
||||
#' is_minified <- with_devmode(TRUE, {
|
||||
#' get_devmode_option("shiny.minified", TRUE)
|
||||
#' })
|
||||
#' is_minified # FALSE
|
||||
#'
|
||||
get_devmode_option <- function(
|
||||
name,
|
||||
default = NULL,
|
||||
devmode_default = missing_arg(),
|
||||
devmode_message = missing_arg()
|
||||
) {
|
||||
getOption(
|
||||
name,
|
||||
local({
|
||||
if (!in_devmode()) {
|
||||
# typical case
|
||||
return(default)
|
||||
}
|
||||
|
||||
info <- registered_devmode_options$get(name)
|
||||
if (is.null(info)) {
|
||||
# Not registered,
|
||||
# Warn and return default value
|
||||
rlang::warn(
|
||||
message = paste0(
|
||||
"`get_devmode_option(name)` could not find `name = \"", name, "\"`. ",
|
||||
"Returning `default` value"
|
||||
)
|
||||
)
|
||||
return(default)
|
||||
}
|
||||
|
||||
# display message
|
||||
devmode_inform(
|
||||
maybe_missing(
|
||||
# use provided `devmode_message` value
|
||||
devmode_message,
|
||||
# If `devmode_message` is missing, display registered `devmode_message`
|
||||
default = info$devmode_message
|
||||
)
|
||||
)
|
||||
|
||||
# return value
|
||||
maybe_missing(
|
||||
# use provided `devmode_default` value
|
||||
devmode_default,
|
||||
# if `devmode_default` is missing, provide registered `devmode_default`
|
||||
default = info$devmode_default
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
register_devmode_option(
|
||||
"shiny.autoreload",
|
||||
"Turning on shiny autoreload. To disable, call `options(shiny.autoreload = FALSE)`",
|
||||
TRUE
|
||||
)
|
||||
|
||||
register_devmode_option(
|
||||
"shiny.minified",
|
||||
"Using full shiny javascript file. To use the minified version, call `options(shiny.minified = TRUE)`",
|
||||
FALSE
|
||||
)
|
||||
|
||||
register_devmode_option(
|
||||
"shiny.fullstacktrace",
|
||||
"Turning on full stack trace. To disable, call `options(shiny.fullstacktrace = FALSE)`",
|
||||
TRUE
|
||||
)
|
||||
@@ -1,10 +1,10 @@
|
||||
# Generated by tools/updateFontAwesome.R: do not edit by hand
|
||||
font_awesome_brands <- c(
|
||||
"500px",
|
||||
"accessible-icon",
|
||||
"accusoft",
|
||||
"acquisitions-incorporated",
|
||||
"adn",
|
||||
"adobe",
|
||||
"adversal",
|
||||
"affiliatetheme",
|
||||
"airbnb",
|
||||
@@ -65,6 +65,7 @@ font_awesome_brands <- c(
|
||||
"centos",
|
||||
"chrome",
|
||||
"chromecast",
|
||||
"cloudflare",
|
||||
"cloudscale",
|
||||
"cloudsmith",
|
||||
"cloudversify",
|
||||
@@ -97,6 +98,7 @@ font_awesome_brands <- c(
|
||||
"d-and-d-beyond",
|
||||
"dailymotion",
|
||||
"dashcube",
|
||||
"deezer",
|
||||
"delicious",
|
||||
"deploydog",
|
||||
"deskpro",
|
||||
@@ -119,6 +121,7 @@ font_awesome_brands <- c(
|
||||
"earlybirds",
|
||||
"ebay",
|
||||
"edge",
|
||||
"edge-legacy",
|
||||
"elementor",
|
||||
"ello",
|
||||
"ember",
|
||||
@@ -179,6 +182,7 @@ font_awesome_brands <- c(
|
||||
"goodreads-g",
|
||||
"google",
|
||||
"google-drive",
|
||||
"google-pay",
|
||||
"google-play",
|
||||
"google-plus",
|
||||
"google-plus-g",
|
||||
@@ -188,12 +192,14 @@ font_awesome_brands <- c(
|
||||
"grav",
|
||||
"gripfire",
|
||||
"grunt",
|
||||
"guilded",
|
||||
"gulp",
|
||||
"hacker-news",
|
||||
"hacker-news-square",
|
||||
"hackerrank",
|
||||
"hips",
|
||||
"hire-a-helper",
|
||||
"hive",
|
||||
"hooli",
|
||||
"hornbill",
|
||||
"hotjar",
|
||||
@@ -202,8 +208,10 @@ font_awesome_brands <- c(
|
||||
"hubspot",
|
||||
"ideal",
|
||||
"imdb",
|
||||
"innosoft",
|
||||
"instagram",
|
||||
"instagram-square",
|
||||
"instalod",
|
||||
"intercom",
|
||||
"internet-explorer",
|
||||
"invision",
|
||||
@@ -267,6 +275,7 @@ font_awesome_brands <- c(
|
||||
"npm",
|
||||
"ns8",
|
||||
"nutritionix",
|
||||
"octopus-deploy",
|
||||
"odnoklassniki",
|
||||
"odnoklassniki-square",
|
||||
"old-republic",
|
||||
@@ -282,6 +291,7 @@ font_awesome_brands <- c(
|
||||
"patreon",
|
||||
"paypal",
|
||||
"penny-arcade",
|
||||
"perbyte",
|
||||
"periscope",
|
||||
"phabricator",
|
||||
"phoenix-framework",
|
||||
@@ -321,6 +331,7 @@ font_awesome_brands <- c(
|
||||
"rev",
|
||||
"rocketchat",
|
||||
"rockrms",
|
||||
"rust",
|
||||
"safari",
|
||||
"salesforce",
|
||||
"sass",
|
||||
@@ -378,6 +389,7 @@ font_awesome_brands <- c(
|
||||
"themeco",
|
||||
"themeisle",
|
||||
"think-peaks",
|
||||
"tiktok",
|
||||
"trade-federation",
|
||||
"trello",
|
||||
"tripadvisor",
|
||||
@@ -391,8 +403,10 @@ font_awesome_brands <- c(
|
||||
"ubuntu",
|
||||
"uikit",
|
||||
"umbraco",
|
||||
"uncharted",
|
||||
"uniregistry",
|
||||
"unity",
|
||||
"unsplash",
|
||||
"untappd",
|
||||
"ups",
|
||||
"usb",
|
||||
@@ -410,6 +424,7 @@ font_awesome_brands <- c(
|
||||
"vk",
|
||||
"vnv",
|
||||
"vuejs",
|
||||
"watchman-monitoring",
|
||||
"waze",
|
||||
"weebly",
|
||||
"weibo",
|
||||
@@ -421,6 +436,7 @@ font_awesome_brands <- c(
|
||||
"windows",
|
||||
"wix",
|
||||
"wizards-of-the-coast",
|
||||
"wodu",
|
||||
"wolf-pack-battalion",
|
||||
"wordpress",
|
||||
"wordpress-simple",
|
||||
|
||||
@@ -56,6 +56,10 @@ register_upgrade_message <- function(pkg, version) {
|
||||
# the private seed during load.
|
||||
withPrivateSeed(set.seed(NULL))
|
||||
|
||||
# Create this at the top level, but since the object is from a different
|
||||
# package, we don't want to bake it into the built binary package.
|
||||
restoreCtxStack <<- fastmap::faststack()
|
||||
|
||||
# Make sure these methods are available to knitr if shiny is loaded but not
|
||||
# attached.
|
||||
register_s3_method("knitr", "knit_print", "reactive")
|
||||
|
||||
@@ -10,7 +10,7 @@ check_suggested <- function(package, version = NULL) {
|
||||
|
||||
msg <- paste0(
|
||||
sQuote(package),
|
||||
if (is.na(version %OR% NA)) "" else paste0("(>= ", version, ")"),
|
||||
if (is.na(version %||% NA)) "" else paste0("(>= ", version, ")"),
|
||||
" must be installed for this functionality."
|
||||
)
|
||||
|
||||
@@ -98,7 +98,8 @@ reactlogShow <- function(time = TRUE) {
|
||||
#' @export
|
||||
# legacy purposes
|
||||
showReactLog <- function(time = TRUE) {
|
||||
shinyDeprecated(new = "`reactlogShow`", version = "1.2.0")
|
||||
shinyDeprecated("1.2.0", "showReactLog()", "reactlogShow()")
|
||||
|
||||
reactlogShow(time = time)
|
||||
}
|
||||
#' @describeIn reactlog Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history.
|
||||
@@ -211,7 +212,7 @@ RLog <- R6Class(
|
||||
reset = function() {
|
||||
.globals$reactIdCounter <- 0L
|
||||
|
||||
self$logStack <- Stack$new()
|
||||
self$logStack <- fastmap::faststack()
|
||||
self$msg <- MessageLogger$new(option = private$msgOption)
|
||||
|
||||
# setup dummy and missing react information
|
||||
@@ -559,5 +560,4 @@ MessageLogger = R6Class(
|
||||
)
|
||||
)
|
||||
|
||||
#' @include stack.R
|
||||
rLog <- RLog$new("shiny.reactlog", "shiny.reactlog.console")
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#' @import htmltools
|
||||
#' @export tags p h1 h2 h3 h4 h5 h6 a br div span pre code img strong em hr
|
||||
#' @export tag tagList tagAppendAttributes tagHasAttribute tagGetAttribute tagAppendChild tagAppendChildren tagSetChildren
|
||||
#' @export HTML
|
||||
#' @export includeHTML includeText includeMarkdown includeCSS includeScript
|
||||
#' @export singleton is.singleton
|
||||
#' @export validateCssUnit
|
||||
#' @export htmlTemplate
|
||||
#' @export suppressDependencies
|
||||
#' @export withTags
|
||||
NULL
|
||||
@@ -76,8 +76,12 @@ hoverOpts <- function(id, delay = 300,
|
||||
#' `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 Fill color of the brush.
|
||||
#' @param stroke Outline color of the brush.
|
||||
#' @param fill Fill color of the brush. If `'auto'`, it derives from the link
|
||||
#' color of the plot's HTML container (if **thematic** is enabled, and `accent`
|
||||
#' is a non-`'auto'` value, that color is used instead).
|
||||
#' @param stroke Outline color of the brush. If `'auto'`, it derives from the
|
||||
#' foreground color of the plot's HTML container (if **thematic** is enabled,
|
||||
#' and `fg` is a non-`'auto'` value, that color is used instead).
|
||||
#' @param opacity Opacity of the brush
|
||||
#' @param delay How long to delay (in milliseconds) when debouncing or
|
||||
#' throttling, before sending the brush data to the server.
|
||||
@@ -107,6 +111,13 @@ brushOpts <- function(id, fill = "#9cf", stroke = "#036",
|
||||
if (is.null(id))
|
||||
stop("id must not be NULL")
|
||||
|
||||
if (identical(fill, "auto")) {
|
||||
fill <- getThematicOption("accent", "auto")
|
||||
}
|
||||
if (identical(stroke, "auto")) {
|
||||
stroke <- getThematicOption("fg", "auto")
|
||||
}
|
||||
|
||||
list(
|
||||
id = id,
|
||||
fill = fill,
|
||||
@@ -119,3 +130,13 @@ brushOpts <- function(id, fill = "#9cf", stroke = "#036",
|
||||
resetOnNew = resetOnNew
|
||||
)
|
||||
}
|
||||
|
||||
getThematicOption <- function(name = "", default = NULL, resolve = FALSE) {
|
||||
if (isNamespaceLoaded("thematic")) {
|
||||
# TODO: use :: once thematic is on CRAN
|
||||
tgo <- utils::getFromNamespace("thematic_get_option", "thematic")
|
||||
tgo(name = name, default = default, resolve = resolve)
|
||||
} else {
|
||||
default
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,11 +92,21 @@ brushedPoints <- function(df, brush, xvar = NULL, yvar = NULL,
|
||||
use_x <- grepl("x", brush$direction)
|
||||
use_y <- grepl("y", brush$direction)
|
||||
|
||||
# We transitioned to using %||% in Shiny 1.6.0. Previously, these vars could
|
||||
# be NA, because the old %OR% operator recognized NA. These warnings and
|
||||
# the NULL replacement are here just to ease the transition in case anyone is
|
||||
# using NA. We can remove these checks in a future version of Shiny.
|
||||
# https://github.com/rstudio/shiny/pull/3172
|
||||
if (is_na(xvar)) { xvar <- NULL; warning("xvar should be NULL, not NA.") }
|
||||
if (is_na(yvar)) { yvar <- NULL; warning("yvar should be NULL, not NA.") }
|
||||
if (is_na(panelvar1)) { panelvar1 <- NULL; warning("panelvar1 should be NULL, not NA.") }
|
||||
if (is_na(panelvar2)) { panelvar2 <- NULL; warning("panelvar2 should be NULL, not NA.") }
|
||||
|
||||
# Try to extract vars from brush object
|
||||
xvar <- xvar %OR% brush$mapping$x
|
||||
yvar <- yvar %OR% brush$mapping$y
|
||||
panelvar1 <- panelvar1 %OR% brush$mapping$panelvar1
|
||||
panelvar2 <- panelvar2 %OR% brush$mapping$panelvar2
|
||||
xvar <- xvar %||% brush$mapping$x
|
||||
yvar <- yvar %||% brush$mapping$y
|
||||
panelvar1 <- panelvar1 %||% brush$mapping$panelvar1
|
||||
panelvar2 <- panelvar2 %||% brush$mapping$panelvar2
|
||||
|
||||
# Filter out x and y values
|
||||
keep_rows <- rep(TRUE, nrow(df))
|
||||
@@ -230,11 +240,21 @@ nearPoints <- function(df, coordinfo, xvar = NULL, yvar = NULL,
|
||||
stop("nearPoints requires a click/hover/double-click object with x and y values.")
|
||||
}
|
||||
|
||||
# We transitioned to using %||% in Shiny 1.6.0. Previously, these vars could
|
||||
# be NA, because the old %OR% operator recognized NA. These warnings and
|
||||
# the NULL replacement are here just to ease the transition in case anyone is
|
||||
# using NA. We can remove these checks in a future version of Shiny.
|
||||
# https://github.com/rstudio/shiny/pull/3172
|
||||
if (is_na(xvar)) { xvar <- NULL; warning("xvar should be NULL, not NA.") }
|
||||
if (is_na(yvar)) { yvar <- NULL; warning("yvar should be NULL, not NA.") }
|
||||
if (is_na(panelvar1)) { panelvar1 <- NULL; warning("panelvar1 should be NULL, not NA.") }
|
||||
if (is_na(panelvar2)) { panelvar2 <- NULL; warning("panelvar2 should be NULL, not NA.") }
|
||||
|
||||
# Try to extract vars from coordinfo object
|
||||
xvar <- xvar %OR% coordinfo$mapping$x
|
||||
yvar <- yvar %OR% coordinfo$mapping$y
|
||||
panelvar1 <- panelvar1 %OR% coordinfo$mapping$panelvar1
|
||||
panelvar2 <- panelvar2 %OR% coordinfo$mapping$panelvar2
|
||||
xvar <- xvar %||% coordinfo$mapping$x
|
||||
yvar <- yvar %||% coordinfo$mapping$y
|
||||
panelvar1 <- panelvar1 %||% coordinfo$mapping$panelvar1
|
||||
panelvar2 <- panelvar2 %||% coordinfo$mapping$panelvar2
|
||||
|
||||
if (is.null(xvar))
|
||||
stop("nearPoints: not able to automatically infer `xvar` from coordinfo")
|
||||
|
||||
@@ -4,12 +4,12 @@ startPNG <- function(filename, width, height, res, ...) {
|
||||
# to use ragg (say, instead of showtext, for custom font rendering).
|
||||
# In the next shiny release, this option will likely be superseded in
|
||||
# favor of a fully customizable graphics device option
|
||||
if ((getOption('shiny.useragg') %OR% FALSE) && is_available("ragg")) {
|
||||
if ((getOption('shiny.useragg') %||% FALSE) && is_available("ragg")) {
|
||||
pngfun <- ragg::agg_png
|
||||
} else if (capabilities("aqua")) {
|
||||
# i.e., png(type = 'quartz')
|
||||
pngfun <- grDevices::png
|
||||
} else if ((getOption('shiny.usecairo') %OR% TRUE) && is_available("Cairo")) {
|
||||
} else if ((getOption('shiny.usecairo') %||% TRUE) && is_available("Cairo")) {
|
||||
pngfun <- Cairo::CairoPNG
|
||||
} else {
|
||||
# i.e., png(type = 'cairo')
|
||||
@@ -23,8 +23,7 @@ startPNG <- function(filename, width, height, res, ...) {
|
||||
# devices allow their bg arg to be overridden by par(bg=...), which thematic does prior
|
||||
# to plot-time, but it shouldn't hurt to inform other the device directly as well
|
||||
if (is.null(args$bg) && isNamespaceLoaded("thematic")) {
|
||||
# TODO: use :: once thematic is on CRAN
|
||||
args$bg <- utils::getFromNamespace("thematic_get_option", "thematic")("bg", "white")
|
||||
args$bg <- getThematicOption("bg", "white")
|
||||
# auto vals aren't resolved until plot time, so if we see one, resolve it
|
||||
if (isTRUE("auto" == args$bg)) {
|
||||
args$bg <- getCurrentOutputInfo()[["bg"]]()
|
||||
@@ -95,7 +94,6 @@ plotPNG <- function(func, filename=tempfile(fileext='.png'),
|
||||
filename
|
||||
}
|
||||
|
||||
#' @importFrom grDevices dev.set dev.cur
|
||||
createGraphicsDevicePromiseDomain <- function(which = dev.cur()) {
|
||||
force(which)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ actionButton <- function(inputId, label, icon = NULL, width = NULL, ...) {
|
||||
value <- restoreInput(id = inputId, default = NULL)
|
||||
|
||||
tags$button(id=inputId,
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
type="button",
|
||||
class="btn btn-default action-button",
|
||||
`data-val` = value,
|
||||
|
||||
@@ -36,7 +36,7 @@ checkboxInput <- function(inputId, label, value = FALSE, width = NULL) {
|
||||
inputTag$attribs$checked <- "checked"
|
||||
|
||||
div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
div(class = "checkbox",
|
||||
tags$label(inputTag, tags$span(label))
|
||||
)
|
||||
|
||||
@@ -94,10 +94,14 @@ checkboxGroupInput <- function(inputId, label, choices = NULL, selected = NULL,
|
||||
divClass <- paste(divClass, "shiny-input-container-inline")
|
||||
|
||||
# return label and select tag
|
||||
inputLabel <- shinyInputLabel(inputId, label)
|
||||
tags$div(id = inputId,
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
class = divClass,
|
||||
shinyInputLabel(inputId, label),
|
||||
# https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-1/checkbox-1.html
|
||||
role = "group",
|
||||
`aria-labelledby` = inputLabel$attribs$id,
|
||||
inputLabel,
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ dateInput <- function(inputId, label, value = NULL, min = NULL, max = NULL,
|
||||
|
||||
tags$div(id = inputId,
|
||||
class = "shiny-date-input form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
|
||||
shinyInputLabel(inputId, label),
|
||||
tags$input(type = "text",
|
||||
@@ -141,7 +141,8 @@ datePickerDependency <- function(theme) {
|
||||
name = "bootstrap-datepicker-js",
|
||||
version = datePickerVersion,
|
||||
src = c(href = "shared/datepicker"),
|
||||
script = "js/bootstrap-datepicker.min.js",
|
||||
script = if (getOption("shiny.minified", TRUE)) "js/bootstrap-datepicker.min.js"
|
||||
else "js/bootstrap-datepicker.js",
|
||||
# Need to enable noConflict mode. See #1346.
|
||||
head = "<script>(function() {
|
||||
var datepicker = $.fn.datepicker.noConflict();
|
||||
@@ -149,7 +150,7 @@ datePickerDependency <- function(theme) {
|
||||
})();
|
||||
</script>"
|
||||
),
|
||||
bootstraplib::bs_dependency_defer(datePickerCSS)
|
||||
bslib::bs_dependency_defer(datePickerCSS)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -165,11 +166,11 @@ datePickerCSS <- function(theme) {
|
||||
|
||||
scss_file <- system.file(package = "shiny", "www/shared/datepicker/scss/build3.scss")
|
||||
|
||||
bootstraplib::bs_dependency(
|
||||
bslib::bs_dependency(
|
||||
input = sass::sass_file(scss_file),
|
||||
theme = theme,
|
||||
name = "bootstrap-datepicker",
|
||||
version = datePickerVersion,
|
||||
cache_key_extra = utils::packageVersion("shiny")
|
||||
cache_key_extra = shinyPackageVersion()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ dateRangeInput <- function(inputId, label, start = NULL, end = NULL,
|
||||
attachDependencies(
|
||||
div(id = inputId,
|
||||
class = "shiny-date-range-input form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
|
||||
shinyInputLabel(inputId, label),
|
||||
# input-daterange class is needed for dropdown behavior
|
||||
|
||||
@@ -103,7 +103,7 @@ fileInput <- function(inputId, label, multiple = FALSE, accept = NULL,
|
||||
|
||||
|
||||
div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
|
||||
div(class = "input-group",
|
||||
|
||||
@@ -45,7 +45,7 @@ numericInput <- function(inputId, label, value, min = NA, max = NA, step = NA,
|
||||
inputTag$attribs$step = step
|
||||
|
||||
div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
inputTag
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
passwordInput <- function(inputId, label, value = "", width = NULL,
|
||||
placeholder = NULL) {
|
||||
div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
tags$input(id = inputId, type="password", class="form-control", value=value,
|
||||
placeholder = placeholder)
|
||||
|
||||
@@ -104,10 +104,14 @@ radioButtons <- function(inputId, label, choices = NULL, selected = NULL,
|
||||
divClass <- "form-group shiny-input-radiogroup shiny-input-container"
|
||||
if (inline) divClass <- paste(divClass, "shiny-input-container-inline")
|
||||
|
||||
inputLabel <- shinyInputLabel(inputId, label)
|
||||
tags$div(id = inputId,
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
class = divClass,
|
||||
shinyInputLabel(inputId, label),
|
||||
# https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/examples/radio/radio-1/radio-1.html
|
||||
role = "radiogroup",
|
||||
`aria-labelledby` = inputLabel$attribs$id,
|
||||
inputLabel,
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ selectInput <- function(inputId, label, choices, selected = NULL,
|
||||
# return label and select tag
|
||||
res <- div(
|
||||
class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
div(selectTag)
|
||||
)
|
||||
@@ -197,6 +197,12 @@ selectizeInput <- function(inputId, ..., options = NULL, width = NULL) {
|
||||
|
||||
# given a select input and its id, selectize it
|
||||
selectizeIt <- function(inputId, select, options, nonempty = FALSE) {
|
||||
if (length(options) == 0) {
|
||||
# For NULL and empty unnamed list, replace with an empty named list, so that
|
||||
# it will get translated to {} in JSON later on.
|
||||
options <- empty_named_list()
|
||||
}
|
||||
|
||||
# Make sure accessibility plugin is included
|
||||
if (!('selectize-plugin-a11y' %in% options$plugins)) {
|
||||
options$plugins <- c(options$plugins, list('selectize-plugin-a11y'))
|
||||
@@ -204,17 +210,16 @@ selectizeIt <- function(inputId, select, options, nonempty = FALSE) {
|
||||
|
||||
res <- checkAsIs(options)
|
||||
|
||||
selectizeDep <- selectizeDependency()
|
||||
deps <- list(selectizeDependency())
|
||||
|
||||
if ('drag_drop' %in% options$plugins) {
|
||||
selectizeDep <- c(
|
||||
selectizeDep,
|
||||
htmlDependency(
|
||||
'jqueryui',
|
||||
'1.12.1',
|
||||
deps <- c(
|
||||
deps,
|
||||
list(htmlDependency(
|
||||
'jqueryui', '1.12.1',
|
||||
c(href = 'shared/jqueryui'),
|
||||
script = 'jquery-ui.min.js'
|
||||
)
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -225,56 +230,62 @@ selectizeIt <- function(inputId, select, options, nonempty = FALSE) {
|
||||
type = 'application/json',
|
||||
`data-for` = inputId, `data-nonempty` = if (nonempty) '',
|
||||
`data-eval` = if (length(res$eval)) HTML(toJSON(res$eval)),
|
||||
if (length(res$options)) HTML(toJSON(res$options)) else '{}'
|
||||
HTML(toJSON(res$options))
|
||||
)
|
||||
)
|
||||
|
||||
attachDependencies(select, selectizeDep)
|
||||
attachDependencies(select, deps)
|
||||
}
|
||||
|
||||
|
||||
selectizeVersion <- "0.12.4"
|
||||
|
||||
selectizeDependency <- function(theme) {
|
||||
list(
|
||||
htmlDependency(
|
||||
"selectize-js",
|
||||
selectizeVersion,
|
||||
src = c(href = "shared/selectize"),
|
||||
script = c(
|
||||
"js/selectize.min.js",
|
||||
# Accessibility plugin for screen readers (https://github.com/SLMNBJ/selectize-plugin-a11y):
|
||||
"accessibility/js/selectize-plugin-a11y.min.js"
|
||||
)
|
||||
),
|
||||
bootstraplib::bs_dependency_defer(selectizeCSS)
|
||||
)
|
||||
selectizeDependency <- function() {
|
||||
bslib::bs_dependency_defer(selectizeDependencyFunc)
|
||||
}
|
||||
|
||||
selectizeCSS <- function(theme) {
|
||||
selectizeDependencyFunc <- function(theme) {
|
||||
selectizeVersion <- "0.12.4"
|
||||
if (!is_bs_theme(theme)) {
|
||||
return(htmlDependency(
|
||||
name = "selectize-css",
|
||||
version = selectizeVersion,
|
||||
src = c(href = "shared/selectize"),
|
||||
stylesheet = "css/selectize.bootstrap3.css"
|
||||
))
|
||||
return(selectizeStaticDependency(selectizeVersion))
|
||||
}
|
||||
|
||||
scss_file <- system.file(
|
||||
package = "shiny", "www/shared/selectize/scss",
|
||||
if ("3" %in% bootstraplib::theme_version(theme)) {
|
||||
selectizeDir <- system.file(package = "shiny", "www/shared/selectize/")
|
||||
stylesheet <- file.path(
|
||||
selectizeDir, "scss",
|
||||
if ("3" %in% bslib::theme_version(theme)) {
|
||||
"selectize.bootstrap3.scss"
|
||||
} else {
|
||||
"selectize.bootstrap4.scss"
|
||||
}
|
||||
)
|
||||
bootstraplib::bs_dependency(
|
||||
input = sass::sass_file(scss_file),
|
||||
# It'd be cleaner to ship the JS in a separate, href-based,
|
||||
# HTML dependency (which we currently do for other themable widgets),
|
||||
# but DT, crosstalk, and maybe other pkgs include selectize JS/CSS
|
||||
# in HTML dependency named selectize, so if we were to change that
|
||||
# name, the JS/CSS would be loaded/included twice, which leads to
|
||||
# strange issues, especially since we now include a 3rd party
|
||||
# accessibility plugin https://github.com/rstudio/shiny/pull/3153
|
||||
script <- file.path(
|
||||
selectizeDir, c("js/selectize.min.js", "accessibility/js/selectize-plugin-a11y.min.js")
|
||||
)
|
||||
bslib::bs_dependency(
|
||||
input = sass::sass_file(stylesheet),
|
||||
theme = theme,
|
||||
name = "selectize",
|
||||
version = selectizeVersion,
|
||||
cache_key_extra = utils::packageVersion("shiny")
|
||||
cache_key_extra = shinyPackageVersion(),
|
||||
.dep_args = list(script = script)
|
||||
)
|
||||
}
|
||||
|
||||
selectizeStaticDependency <- function(version) {
|
||||
htmlDependency(
|
||||
"selectize", version,
|
||||
src = c(href = "shared/selectize"),
|
||||
stylesheet = "css/selectize.bootstrap3.css",
|
||||
script = c(
|
||||
"js/selectize.min.js",
|
||||
"accessibility/js/selectize-plugin-a11y.min.js"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
103
R/input-slider.R
103
R/input-slider.R
@@ -1,25 +1,24 @@
|
||||
#' Slider Input Widget
|
||||
#'
|
||||
#' Constructs a slider widget to select a numeric value from a range.
|
||||
#' Constructs a slider widget to select a number, date, or date-time from a
|
||||
#' range.
|
||||
#'
|
||||
#' @inheritParams textInput
|
||||
#' @param min The minimum value (inclusive) that can be selected.
|
||||
#' @param max The maximum value (inclusive) that can be selected.
|
||||
#' @param value The initial value of the slider. A numeric vector of length one
|
||||
#' will create a regular slider; a numeric vector of length two will create a
|
||||
#' double-ended range slider. A warning will be issued if the value doesn't
|
||||
#' fit between `min` and `max`.
|
||||
#' @param min,max The minimum and maximum values (inclusive) that can be
|
||||
#' selected.
|
||||
#' @param value The initial value of the slider, either a number, a date
|
||||
#' (class Date), or a date-time (class POSIXt). A length one vector will
|
||||
#' create a regular slider; a length two vector will create a double-ended
|
||||
#' range slider. Must lie between `min` and `max`.
|
||||
#' @param step Specifies the interval between each selectable value on the
|
||||
#' slider (if `NULL`, a heuristic is used to determine the step size). If
|
||||
#' the values are dates, `step` is in days; if the values are times
|
||||
#' (POSIXt), `step` is in seconds.
|
||||
#' slider. Either `NULL`, the default, which uses a heuristic to determine the
|
||||
#' step size or a single number. If the values are dates, `step` is in days;
|
||||
#' if the values are date-times, `step` is in seconds.
|
||||
#' @param round `TRUE` to round all values to the nearest integer;
|
||||
#' `FALSE` if no rounding is desired; or an integer to round to that
|
||||
#' number of digits (for example, 1 will round to the nearest 10, and -2 will
|
||||
#' round to the nearest .01). Any rounding will be applied after snapping to
|
||||
#' the nearest step.
|
||||
#' @param format Deprecated.
|
||||
#' @param locale Deprecated.
|
||||
#' @param ticks `FALSE` to hide tick marks, `TRUE` to show them
|
||||
#' according to some simple heuristics.
|
||||
#' @param animate `TRUE` to show simple animation controls with default
|
||||
@@ -72,24 +71,20 @@
|
||||
#' }
|
||||
#'
|
||||
#' @section Server value:
|
||||
#' A number, or in the case of slider range, a vector of two numbers.
|
||||
#' A number, date, or date-time (depending on the class of `value`), or
|
||||
#' in the case of slider range, a vector of two numbers/dates/date-times.
|
||||
#'
|
||||
#' @export
|
||||
sliderInput <- function(inputId, label, min, max, value, step = NULL,
|
||||
round = FALSE, format = NULL, locale = NULL,
|
||||
ticks = TRUE, animate = FALSE, width = NULL, sep = ",",
|
||||
pre = NULL, post = NULL, timeFormat = NULL,
|
||||
timezone = NULL, dragRange = TRUE) {
|
||||
if (!missing(format)) {
|
||||
shinyDeprecated(msg = "The `format` argument to sliderInput is deprecated. Use `sep`, `pre`, and `post` instead.",
|
||||
version = "0.10.2.2")
|
||||
}
|
||||
if (!missing(locale)) {
|
||||
shinyDeprecated(msg = "The `locale` argument to sliderInput is deprecated. Use `sep`, `pre`, and `post` instead.",
|
||||
version = "0.10.2.2")
|
||||
}
|
||||
round = FALSE, ticks = TRUE, animate = FALSE,
|
||||
width = NULL, sep = ",", pre = NULL, post = NULL,
|
||||
timeFormat = NULL, timezone = NULL, dragRange = TRUE) {
|
||||
|
||||
dataType <- getSliderType(min, max, value)
|
||||
# Force required arguments for maximally informative errors
|
||||
inputId; label; min; max; value
|
||||
|
||||
validate_slider_value(min, max, value, "sliderInput")
|
||||
dataType <- slider_type(value)
|
||||
|
||||
if (is.null(timeFormat)) {
|
||||
timeFormat <- switch(dataType, date = "%F", datetime = "%F %T", number = NULL)
|
||||
@@ -175,7 +170,7 @@ sliderInput <- function(inputId, label, min, max, value, step = NULL,
|
||||
})
|
||||
|
||||
sliderTag <- div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
do.call(tags$input, sliderProps)
|
||||
)
|
||||
@@ -224,7 +219,7 @@ ionRangeSliderDependency <- function() {
|
||||
src = c(href = "shared/strftime"),
|
||||
script = "strftime-min.js"
|
||||
),
|
||||
bootstraplib::bs_dependency_defer(ionRangeSliderDependencyCSS)
|
||||
bslib::bs_dependency_defer(ionRangeSliderDependencyCSS)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -241,8 +236,13 @@ ionRangeSliderDependencyCSS <- function(theme) {
|
||||
# Remap some variable names for ionRangeSlider's scss
|
||||
sass_input <- list(
|
||||
list(
|
||||
bg = "$input-bg",
|
||||
fg = "$input-color",
|
||||
# The bootswatch materia theme sets $input-bg: transparent;
|
||||
# which is an issue for the slider's handle(s) (#3130)
|
||||
bg = "if(alpha($input-bg)==0, $body-bg, $input-bg)",
|
||||
fg = sprintf(
|
||||
"if(alpha($input-color)==0, $%s, $input-color)",
|
||||
if ("3" %in% bslib::theme_version(theme)) "text-color" else "body-color"
|
||||
),
|
||||
accent = "$component-active-bg",
|
||||
`font-family` = "$font-family-base"
|
||||
),
|
||||
@@ -251,12 +251,12 @@ ionRangeSliderDependencyCSS <- function(theme) {
|
||||
)
|
||||
)
|
||||
|
||||
bootstraplib::bs_dependency(
|
||||
bslib::bs_dependency(
|
||||
input = sass_input,
|
||||
theme = theme,
|
||||
name = "ionRangeSlider",
|
||||
version = ionRangeSliderVersion,
|
||||
cache_key_extra = utils::packageVersion("shiny")
|
||||
cache_key_extra = shinyPackageVersion()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -292,6 +292,45 @@ findStepSize <- function(min, max, step) {
|
||||
}
|
||||
|
||||
|
||||
# Throw a warning if ever `value` is not in the [`min`, `max`] range
|
||||
validate_slider_value <- function(min, max, value, fun) {
|
||||
if (!is_slider_type(min) || length(min) != 1 || is_na(min)) {
|
||||
rlang::abort("sliderInput(min) must be a single number, Date, or POSIXct")
|
||||
}
|
||||
if (!is_slider_type(min) || length(max) != 1 || is_na(max)) {
|
||||
rlang::abort("sliderInput(value) must be a single number, Date, or POSIXct")
|
||||
}
|
||||
if (!is_slider_type(value) || !length(value) %in% c(1, 2) || any(is_na(value))) {
|
||||
rlang::abort(
|
||||
"sliderInput(value) must be a single or pair of numbers, Dates, or POSIXcts"
|
||||
)
|
||||
}
|
||||
|
||||
if (!identical(class(min), class(value)) || !identical(class(max), class(value))) {
|
||||
rlang::abort(c(
|
||||
"Type mismatch for `min`, `max`, and `value`.",
|
||||
i = "All values must have same type: either numeric, Date, or POSIXt."
|
||||
))
|
||||
}
|
||||
|
||||
if (min(value) < min || max(value) > max) {
|
||||
rlang::abort("`value` does not lie within [min, max]")
|
||||
}
|
||||
}
|
||||
|
||||
is_slider_type <- function(x) {
|
||||
is.numeric(x) || inherits(x, "Date") || inherits(x, "POSIXct")
|
||||
}
|
||||
slider_type <- function(x) {
|
||||
if (is.numeric(x)) {
|
||||
"number"
|
||||
} else if (inherits(x, "Date")) {
|
||||
"date"
|
||||
} else if (inherits(x, "POSIXct")) {
|
||||
"datetime"
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname sliderInput
|
||||
#'
|
||||
#' @param interval The interval, in milliseconds, between each animation step.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#' [actionButton()] instead of `submitButton` when you
|
||||
#' want to delay a reaction.
|
||||
#' See [this
|
||||
#' article](http://shiny.rstudio.com/articles/action-buttons.html) for more information (including a demo of how to "translate"
|
||||
#' article](https://shiny.rstudio.com/articles/action-buttons.html) for more information (including a demo of how to "translate"
|
||||
#' code using a `submitButton` to code using an `actionButton`).
|
||||
#'
|
||||
#' In essence, the presence of a submit button stops all inputs from
|
||||
@@ -58,7 +58,7 @@ submitButton <- function(text = "Apply Changes", icon = NULL, width = NULL) {
|
||||
tags$button(
|
||||
type="submit",
|
||||
class="btn btn-primary",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
list(icon, text)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@ textInput <- function(inputId, label, value = "", width = NULL,
|
||||
value <- restoreInput(id = inputId, default = value)
|
||||
|
||||
div(class = "form-group shiny-input-container",
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
style = css(width = validateCssUnit(width)),
|
||||
shinyInputLabel(inputId, label),
|
||||
tags$input(id = inputId, type="text", class="form-control", value=value,
|
||||
placeholder = placeholder)
|
||||
|
||||
@@ -50,17 +50,13 @@ textAreaInput <- function(inputId, label, value = "", width = NULL, height = NUL
|
||||
resize <- match.arg(resize, c("both", "none", "vertical", "horizontal"))
|
||||
}
|
||||
|
||||
style <- paste(
|
||||
style <- css(
|
||||
# The width is specified on the parent div.
|
||||
if (!is.null(width)) paste0("width: ", "100%", ";"),
|
||||
if (!is.null(height)) paste0("height: ", validateCssUnit(height), ";"),
|
||||
if (!is.null(resize)) paste0("resize: ", resize, ";")
|
||||
width = if (!is.null(width)) "width: 100%;",
|
||||
height = validateCssUnit(height),
|
||||
resize = resize
|
||||
)
|
||||
|
||||
# Workaround for tag attribute=character(0) bug:
|
||||
# https://github.com/rstudio/htmltools/issues/65
|
||||
if (length(style) == 0) style <- NULL
|
||||
|
||||
div(class = "form-group shiny-input-container",
|
||||
shinyInputLabel(inputId, label),
|
||||
style = if (!is.null(width)) paste0("width: ", validateCssUnit(width), ";"),
|
||||
|
||||
@@ -25,7 +25,7 @@ shiny_rmd_warning <- function() {
|
||||
|
||||
#' @rdname knitr_methods
|
||||
knit_print.shiny.appobj <- function(x, ...) {
|
||||
opts <- x$options %OR% list()
|
||||
opts <- x$options %||% list()
|
||||
width <- if (is.null(opts$width)) "100%" else opts$width
|
||||
height <- if (is.null(opts$height)) "400" else opts$height
|
||||
|
||||
|
||||
15
R/map.R
15
R/map.R
@@ -1,18 +1,3 @@
|
||||
# TESTS
|
||||
# Simple set/get
|
||||
# Simple remove
|
||||
# Simple containsKey
|
||||
# Simple keys
|
||||
# Simple values
|
||||
# Simple clear
|
||||
# Get of unknown key returns NULL
|
||||
# Remove of unknown key does nothing
|
||||
# Setting a key twice always results in last-one-wins
|
||||
# /TESTS
|
||||
|
||||
# Note that Map objects can't be saved in one R session and restored in
|
||||
# another, because they are based on fastmap, which uses an external pointer,
|
||||
# and external pointers can't be saved and restored in another session.
|
||||
#' @importFrom fastmap fastmap
|
||||
Map <- R6Class(
|
||||
'Map',
|
||||
|
||||
@@ -309,7 +309,7 @@ HandlerManager <- R6Class("HandlerManager",
|
||||
createHttpuvApp = function() {
|
||||
list(
|
||||
onHeaders = function(req) {
|
||||
maxSize <- getOption('shiny.maxRequestSize') %OR% (5 * 1024 * 1024)
|
||||
maxSize <- getOption('shiny.maxRequestSize') %||% (5 * 1024 * 1024)
|
||||
if (maxSize <= 0)
|
||||
return(NULL)
|
||||
|
||||
@@ -346,7 +346,7 @@ HandlerManager <- R6Class("HandlerManager",
|
||||
),
|
||||
catch = function(err) {
|
||||
httpResponse(status = 500L,
|
||||
content_type = "text/html",
|
||||
content_type = "text/html; charset=UTF-8",
|
||||
content = as.character(htmltools::htmlTemplate(
|
||||
system.file("template", "error.html", package = "shiny"),
|
||||
message = conditionMessage(err)
|
||||
@@ -426,7 +426,7 @@ HandlerManager <- R6Class("HandlerManager",
|
||||
)
|
||||
|
||||
maybeInjectAutoreload <- function(resp) {
|
||||
if (getOption("shiny.autoreload", FALSE) &&
|
||||
if (get_devmode_option("shiny.autoreload", FALSE) &&
|
||||
isTRUE(grepl("^text/html($|;)", resp$content_type)) &&
|
||||
is.character(resp$content)) {
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ wait_for_it <- function() {
|
||||
|
||||
# Block until the promise is resolved/rejected. If resolved, return the value.
|
||||
# If rejected, throw (yes throw, not return) the error.
|
||||
#' @importFrom promises %...!%
|
||||
#' @importFrom promises %...>%
|
||||
extract <- function(promise) {
|
||||
promise_value <- NULL
|
||||
error <- NULL
|
||||
@@ -156,6 +154,7 @@ makeExtraMethods <- function() {
|
||||
"sendInsertUI",
|
||||
"sendModal",
|
||||
"setCurrentTheme",
|
||||
"getCurrentTheme",
|
||||
"sendNotification",
|
||||
"sendProgress",
|
||||
"sendRemoveTab",
|
||||
@@ -234,9 +233,9 @@ MockShinySession <- R6Class(
|
||||
progressStack = 'Stack',
|
||||
#' @field token On a real `ShinySession`, used to identify this instance in URLs.
|
||||
token = 'character',
|
||||
#' @field cache The session cache MemoryCache.
|
||||
#' @field cache The session cache object.
|
||||
cache = NULL,
|
||||
#' @field appcache The app cache MemoryCache.
|
||||
#' @field appcache The app cache object.
|
||||
appcache = NULL,
|
||||
#' @field restoreContext Part of bookmarking support in a real
|
||||
#' `ShinySession` but always `NULL` for a `MockShinySession`.
|
||||
@@ -260,7 +259,7 @@ MockShinySession <- R6Class(
|
||||
private$file_generators <- fastmap()
|
||||
|
||||
private$timer <- MockableTimerCallbacks$new()
|
||||
self$progressStack <- Stack$new()
|
||||
self$progressStack <- fastmap::faststack()
|
||||
|
||||
self$userData <- new.env(parent=emptyenv())
|
||||
|
||||
@@ -277,8 +276,8 @@ MockShinySession <- R6Class(
|
||||
# Copy app-level options
|
||||
self$options <- getCurrentAppState()$options
|
||||
|
||||
self$cache <- MemoryCache$new()
|
||||
self$appcache <- MemoryCache$new()
|
||||
self$cache <- cachem::cache_mem()
|
||||
self$appcache <- cachem::cache_mem()
|
||||
|
||||
# Adds various generated noop and error-producing method implementations.
|
||||
# Note that noop methods can be configured to produce warnings by setting
|
||||
|
||||
29
R/modules.R
29
R/modules.R
@@ -31,17 +31,42 @@ createSessionProxy <- function(parentSession, ...) {
|
||||
# but not `session$userData <- TRUE`) from within a module
|
||||
# without any hacks (see PR #1732)
|
||||
if (identical(x[[name]], value)) return(x)
|
||||
|
||||
# Special case for $options (issue #3112)
|
||||
if (name == "options") {
|
||||
session <- find_ancestor_session(x)
|
||||
session[[name]] <- value
|
||||
return(x)
|
||||
}
|
||||
|
||||
stop("Attempted to assign value on session proxy.")
|
||||
}
|
||||
|
||||
`[[<-.session_proxy` <- `$<-.session_proxy`
|
||||
|
||||
# Given a session_proxy, search `parent` recursively to find the real
|
||||
# ShinySession object. If given a ShinySession, simply return it.
|
||||
find_ancestor_session <- function(x, depth = 20) {
|
||||
if (depth < 0) {
|
||||
stop("ShinySession not found")
|
||||
}
|
||||
if (inherits(x, "ShinySession")) {
|
||||
return(x)
|
||||
}
|
||||
if (inherits(x, "session_proxy")) {
|
||||
return(find_ancestor_session(.subset2(x, "parent"), depth-1))
|
||||
}
|
||||
|
||||
stop("ShinySession not found")
|
||||
}
|
||||
|
||||
|
||||
#' Shiny modules
|
||||
#'
|
||||
#' Shiny's module feature lets you break complicated UI and server logic into
|
||||
#' smaller, self-contained pieces. Compared to large monolithic Shiny apps,
|
||||
#' modules are easier to reuse and easier to reason about. See the article at
|
||||
#' <http://shiny.rstudio.com/articles/modules.html> to learn more.
|
||||
#' <https://shiny.rstudio.com/articles/modules.html> to learn more.
|
||||
#'
|
||||
#' Starting in Shiny 1.5.0, we recommend using `moduleServer` instead of
|
||||
#' [`callModule()`], because the syntax is a little easier
|
||||
@@ -55,7 +80,7 @@ createSessionProxy <- function(parentSession, ...) {
|
||||
#' almost always be used).
|
||||
#'
|
||||
#' @return The return value, if any, from executing the module server function
|
||||
#' @seealso <http://shiny.rstudio.com/articles/modules.html>
|
||||
#' @seealso <https://shiny.rstudio.com/articles/modules.html>
|
||||
#'
|
||||
#' @examples
|
||||
#' # Define the UI for a module
|
||||
|
||||
@@ -76,8 +76,10 @@ Progress <- R6Class(
|
||||
min = 0, max = 1,
|
||||
style = getShinyOption("progress.style", default = "notification"))
|
||||
{
|
||||
if (is.null(session))
|
||||
rlang::abort("Can only use Progress$new() inside a Shiny app")
|
||||
if (is.null(session$progressStack))
|
||||
stop("'session' is not a ShinySession object.")
|
||||
rlang::abort("`session` is not a ShinySession object.")
|
||||
|
||||
private$session <- session
|
||||
private$id <- createUniqueId(8)
|
||||
|
||||
19
R/react.R
19
R/react.R
@@ -5,7 +5,7 @@ processId <- local({
|
||||
cached <- NULL
|
||||
function() {
|
||||
if (is.null(cached)) {
|
||||
cached <<- digest::digest(list(
|
||||
cached <<- rlang::hash(list(
|
||||
Sys.info(),
|
||||
Sys.time()
|
||||
))
|
||||
@@ -65,7 +65,7 @@ Context <- R6Class(
|
||||
that have been registered with onInvalidate()."
|
||||
|
||||
if (!identical(.pid, processId())) {
|
||||
stop("Reactive context was created in one process and invalidated from another")
|
||||
rlang::abort("Reactive context was created in one process and invalidated from another.")
|
||||
}
|
||||
|
||||
if (.invalidated)
|
||||
@@ -87,7 +87,7 @@ Context <- R6Class(
|
||||
immediately."
|
||||
|
||||
if (!identical(.pid, processId())) {
|
||||
stop("Reactive context was created in one process and accessed from another")
|
||||
rlang::abort("Reactive context was created in one process and accessed from another.")
|
||||
}
|
||||
|
||||
if (.invalidated)
|
||||
@@ -140,9 +140,13 @@ ReactiveEnvironment <- R6Class(
|
||||
if (isTRUE(getOption('shiny.suppressMissingContextError'))) {
|
||||
return(getDummyContext())
|
||||
} else {
|
||||
stop('Operation not allowed without an active reactive context. ',
|
||||
'(You tried to do something that can only be done from inside a ',
|
||||
'reactive expression or observer.)')
|
||||
rlang::abort(c(
|
||||
'Operation not allowed without an active reactive context.',
|
||||
paste0(
|
||||
'You tried to do something that can only be done from inside a ',
|
||||
'reactive consumer.'
|
||||
)
|
||||
))
|
||||
}
|
||||
}
|
||||
return(.currentContext)
|
||||
@@ -202,7 +206,8 @@ getCurrentContext <- function() {
|
||||
.getReactiveEnvironment()$currentContext()
|
||||
}
|
||||
hasCurrentContext <- function() {
|
||||
!is.null(.getReactiveEnvironment()$.currentContext)
|
||||
!is.null(.getReactiveEnvironment()$.currentContext) ||
|
||||
isTRUE(getOption("shiny.suppressMissingContextError"))
|
||||
}
|
||||
|
||||
getDummyContext <- function() {
|
||||
|
||||
280
R/reactives.R
280
R/reactives.R
@@ -105,9 +105,7 @@ ReactiveVal <- R6Class(
|
||||
invisible(TRUE)
|
||||
},
|
||||
freeze = function(session = getDefaultReactiveDomain()) {
|
||||
if (is.null(session)) {
|
||||
stop("Can't freeze a reactiveVal without a reactive domain")
|
||||
}
|
||||
checkReactiveDomain(session)
|
||||
rLog$freezeReactiveVal(private$reactId, session)
|
||||
session$onFlushed(function() {
|
||||
self$thaw(session)
|
||||
@@ -238,17 +236,23 @@ freezeReactiveVal <- function(x) {
|
||||
}
|
||||
|
||||
domain <- getDefaultReactiveDomain()
|
||||
if (is.null(domain)) {
|
||||
stop("freezeReactiveVal() must be called when a default reactive domain is active.")
|
||||
}
|
||||
checkReactiveDomain(domain)
|
||||
|
||||
if (!inherits(x, "reactiveVal")) {
|
||||
stop("x must be a reactiveVal object")
|
||||
rlang::abort("`x` must be a reactiveVal.")
|
||||
}
|
||||
|
||||
attr(x, ".impl", exact = TRUE)$freeze(domain)
|
||||
invisible()
|
||||
}
|
||||
|
||||
checkReactiveDomain <- function(x) {
|
||||
if (is.null(x)) {
|
||||
rlang::abort("Can't freeze reactive values without a reactive domain.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
format.reactiveVal <- function(x, ...) {
|
||||
attr(x, ".impl", exact = TRUE)$format(...)
|
||||
@@ -566,7 +570,7 @@ ReactiveValues <- R6Class(
|
||||
reactiveValues <- function(...) {
|
||||
args <- list(...)
|
||||
if ((length(args) > 0) && (is.null(names(args)) || any(names(args) == "")))
|
||||
stop("All arguments passed to reactiveValues() must be named.")
|
||||
rlang::abort("All arguments passed to reactiveValues() must be named.")
|
||||
|
||||
values <- .createReactiveValues(ReactiveValues$new())
|
||||
|
||||
@@ -577,7 +581,7 @@ reactiveValues <- function(...) {
|
||||
|
||||
checkName <- function(x) {
|
||||
if (!is.character(x) || length(x) != 1) {
|
||||
stop("Must use single string to index into reactivevalues")
|
||||
rlang::abort("Must use single string to index into reactivevalues.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,6 +623,14 @@ is.reactivevalues <- function(x) inherits(x, 'reactivevalues')
|
||||
#' @export
|
||||
`$.reactivevalues` <- function(x, name) {
|
||||
checkName(name)
|
||||
|
||||
if (!hasCurrentContext()) {
|
||||
rlang::abort(c(
|
||||
paste0("Can't access reactive value '", name, "' outside of reactive consumer."),
|
||||
i = "Do you need to wrap inside reactive() or observe()?"
|
||||
))
|
||||
}
|
||||
|
||||
.subset2(x, 'impl')$get(.subset2(x, 'ns')(name))
|
||||
}
|
||||
|
||||
@@ -628,7 +640,7 @@ is.reactivevalues <- function(x) inherits(x, 'reactivevalues')
|
||||
#' @export
|
||||
`$<-.reactivevalues` <- function(x, name, value) {
|
||||
if (.subset2(x, 'readonly')) {
|
||||
stop("Attempted to assign value to a read-only reactivevalues object")
|
||||
rlang::abort(paste0("Can't modify read-only reactive value '", name, "'"))
|
||||
}
|
||||
checkName(name)
|
||||
.subset2(x, 'impl')$set(.subset2(x, 'ns')(name), value)
|
||||
@@ -640,12 +652,12 @@ is.reactivevalues <- function(x) inherits(x, 'reactivevalues')
|
||||
|
||||
#' @export
|
||||
`[.reactivevalues` <- function(values, name) {
|
||||
stop("Single-bracket indexing of reactivevalues object is not allowed.")
|
||||
rlang::abort("Can't index reactivevalues with `[`.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
`[<-.reactivevalues` <- function(values, name, value) {
|
||||
stop("Single-bracket indexing of reactivevalues object is not allowed.")
|
||||
rlang::abort("Can't index reactivevalues with `[`.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
@@ -661,16 +673,15 @@ names.reactivevalues <- function(x) {
|
||||
|
||||
#' @export
|
||||
`names<-.reactivevalues` <- function(x, value) {
|
||||
stop("Can't assign names to reactivevalues object")
|
||||
rlang::abort("Can't assign names to reactivevalues.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
as.list.reactivevalues <- function(x, all.names=FALSE, ...) {
|
||||
shinyDeprecated("reactiveValuesToList",
|
||||
msg = paste("'as.list.reactivevalues' is deprecated. ",
|
||||
"Use reactiveValuesToList instead.",
|
||||
"\nPlease see ?reactiveValuesToList for more information.",
|
||||
sep = ""))
|
||||
shinyDeprecated(
|
||||
"0.4.0", "as.list.reactivevalues()", "reactiveValuesToList()",
|
||||
details = "Please see ?reactiveValuesToList for more information."
|
||||
)
|
||||
|
||||
reactiveValuesToList(x, all.names)
|
||||
}
|
||||
@@ -785,9 +796,7 @@ str.reactivevalues <- function(object, indent.str = " ", ...) {
|
||||
#' @export
|
||||
freezeReactiveValue <- function(x, name) {
|
||||
domain <- getDefaultReactiveDomain()
|
||||
if (is.null(domain)) {
|
||||
stop("freezeReactiveValue() must be called when a default reactive domain is active.")
|
||||
}
|
||||
checkReactiveDomain(domain)
|
||||
|
||||
domain$freezeValue(x, name)
|
||||
invisible()
|
||||
@@ -819,9 +828,10 @@ Observable <- R6Class(
|
||||
domain = getDefaultReactiveDomain(),
|
||||
..stacktraceon = TRUE) {
|
||||
if (length(formals(func)) > 0)
|
||||
stop("Can't make a reactive expression from a function that takes one ",
|
||||
"or more parameters; only functions without parameters can be ",
|
||||
"reactive.")
|
||||
rlang::abort(c(
|
||||
"Can't make a reactive expression from a function that takes arguments.",
|
||||
"Only functions without parameters can become reactive expressions."
|
||||
))
|
||||
|
||||
# This is to make sure that the function labels that show in the profiler
|
||||
# and in stack traces doesn't contain whitespace. See
|
||||
@@ -947,6 +957,7 @@ Observable <- R6Class(
|
||||
#' @param domain See [domains].
|
||||
#' @param ..stacktraceon Advanced use only. For stack manipulation purposes; see
|
||||
#' [stacktrace()].
|
||||
#' @param ... Not used.
|
||||
#' @return a function, wrapped in a S3 class "reactive"
|
||||
#'
|
||||
#' @examples
|
||||
@@ -968,20 +979,30 @@ Observable <- R6Class(
|
||||
#' isolate(reactiveC())
|
||||
#' isolate(reactiveD())
|
||||
#' @export
|
||||
reactive <- function(x, env = parent.frame(), quoted = FALSE, label = NULL,
|
||||
domain = getDefaultReactiveDomain(),
|
||||
..stacktraceon = TRUE) {
|
||||
fun <- exprToFunction(x, env, quoted)
|
||||
reactive <- function(x, env = parent.frame(), quoted = FALSE,
|
||||
...,
|
||||
label = NULL,
|
||||
domain = getDefaultReactiveDomain(),
|
||||
..stacktraceon = TRUE)
|
||||
{
|
||||
check_dots_empty()
|
||||
|
||||
x <- get_quosure(x, env, quoted)
|
||||
fun <- as_function(x)
|
||||
# as_function returns a function that takes `...`. We need one that takes no
|
||||
# args.
|
||||
formals(fun) <- list()
|
||||
|
||||
# Attach a label and a reference to the original user source for debugging
|
||||
srcref <- attr(substitute(x), "srcref", exact = TRUE)
|
||||
if (is.null(label)) {
|
||||
label <- rexprSrcrefToLabel(srcref[[1]],
|
||||
sprintf('reactive(%s)', paste(deparse(body(fun)), collapse='\n')))
|
||||
}
|
||||
if (length(srcref) >= 2) attr(label, "srcref") <- srcref[[2]]
|
||||
attr(label, "srcfile") <- srcFileOfRef(srcref[[1]])
|
||||
label <- exprToLabel(get_expr(x), "reactive", label)
|
||||
|
||||
o <- Observable$new(fun, label, domain, ..stacktraceon = ..stacktraceon)
|
||||
structure(o$getValue, observable = o, class = c("reactiveExpr", "reactive", "function"))
|
||||
structure(
|
||||
o$getValue,
|
||||
observable = o,
|
||||
cacheHint = list(userExpr = zap_srcref(get_expr(x))),
|
||||
class = c("reactiveExpr", "reactive", "function")
|
||||
)
|
||||
}
|
||||
|
||||
# Given the srcref to a reactive expression, attempts to figure out what the
|
||||
@@ -1050,7 +1071,15 @@ execCount <- function(x) {
|
||||
else if (inherits(x, 'Observer'))
|
||||
return(x$.execCount)
|
||||
else
|
||||
stop('Unexpected argument to execCount')
|
||||
rlang::abort("Unexpected argument to execCount().")
|
||||
}
|
||||
|
||||
# Internal utility functions for extracting things out of reactives.
|
||||
reactive_get_value_func <- function(x) {
|
||||
attr(x, "observable", exact = TRUE)$.origFunc
|
||||
}
|
||||
reactive_get_domain <- function(x) {
|
||||
attr(x, "observable", exact = TRUE)$.domain
|
||||
}
|
||||
|
||||
# Observer ------------------------------------------------------------------
|
||||
@@ -1082,8 +1111,10 @@ Observer <- R6Class(
|
||||
domain = getDefaultReactiveDomain(),
|
||||
autoDestroy = TRUE, ..stacktraceon = TRUE) {
|
||||
if (length(formals(observerFunc)) > 0)
|
||||
stop("Can't make an observer from a function that takes parameters; ",
|
||||
"only functions without parameters can be reactive.")
|
||||
rlang::abort(c(
|
||||
"Can't make an observer from a function that takes arguments.",
|
||||
"Only functions without arguments can become observers."
|
||||
))
|
||||
if (grepl("\\s", label, perl = TRUE)) {
|
||||
funcLabel <- "<observer>"
|
||||
} else {
|
||||
@@ -1313,6 +1344,8 @@ Observer <- R6Class(
|
||||
#' automatically destroyed when its domain (if any) ends.
|
||||
#' @param ..stacktraceon Advanced use only. For stack manipulation purposes; see
|
||||
#' [stacktrace()].
|
||||
#' @param ... Not used.
|
||||
#'
|
||||
#' @return An observer reference class object. This object has the following
|
||||
#' methods:
|
||||
#' \describe{
|
||||
@@ -1367,18 +1400,36 @@ Observer <- R6Class(
|
||||
#' # are at the console, you can force a flush with flushReact()
|
||||
#' shiny:::flushReact()
|
||||
#' @export
|
||||
observe <- function(x, env=parent.frame(), quoted=FALSE, label=NULL,
|
||||
suspended=FALSE, priority=0,
|
||||
domain=getDefaultReactiveDomain(), autoDestroy = TRUE,
|
||||
..stacktraceon = TRUE) {
|
||||
observe <- function(x, env = parent.frame(), quoted = FALSE,
|
||||
...,
|
||||
label = NULL,
|
||||
suspended = FALSE,
|
||||
priority = 0,
|
||||
domain = getDefaultReactiveDomain(),
|
||||
autoDestroy = TRUE,
|
||||
..stacktraceon = TRUE)
|
||||
{
|
||||
check_dots_empty()
|
||||
|
||||
fun <- exprToFunction(x, env, quoted)
|
||||
if (is.null(label))
|
||||
label <- sprintf('observe(%s)', paste(deparse(body(fun)), collapse='\n'))
|
||||
x <- get_quosure(x, env, quoted)
|
||||
fun <- as_function(x)
|
||||
# as_function returns a function that takes `...`. We need one that takes no
|
||||
# args.
|
||||
formals(fun) <- list()
|
||||
|
||||
o <- Observer$new(fun, label=label, suspended=suspended, priority=priority,
|
||||
domain=domain, autoDestroy=autoDestroy,
|
||||
..stacktraceon=..stacktraceon)
|
||||
if (is.null(label)) {
|
||||
label <- sprintf('observe(%s)', paste(deparse(get_expr(x)), collapse='\n'))
|
||||
}
|
||||
|
||||
o <- Observer$new(
|
||||
fun,
|
||||
label = label,
|
||||
suspended = suspended,
|
||||
priority = priority,
|
||||
domain = domain,
|
||||
autoDestroy = autoDestroy,
|
||||
..stacktraceon = ..stacktraceon
|
||||
)
|
||||
invisible(o)
|
||||
}
|
||||
|
||||
@@ -1771,6 +1822,7 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
|
||||
rv <- reactiveValues(cookie = isolate(checkFunc()))
|
||||
|
||||
re_finalized <- FALSE
|
||||
env <- environment()
|
||||
|
||||
o <- observe({
|
||||
# When no one holds a reference to the reactive returned from
|
||||
@@ -1778,7 +1830,7 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
|
||||
# firing and hold onto resources.
|
||||
if (re_finalized) {
|
||||
o$destroy()
|
||||
rm(o, envir = parent.env(environment()))
|
||||
rm(o, envir = env)
|
||||
return()
|
||||
}
|
||||
|
||||
@@ -1982,7 +2034,11 @@ maskReactiveContext <- function(expr) {
|
||||
|
||||
#' Event handler
|
||||
#'
|
||||
#' Respond to "event-like" reactive inputs, values, and expressions.
|
||||
#' Respond to "event-like" reactive inputs, values, and expressions. As of Shiny
|
||||
#' 1.6.0, we recommend using [bindEvent()] instead of `eventReactive()` and
|
||||
#' `observeEvent()`. This is because `bindEvent()` can be composed with
|
||||
#' [bindCache()], and because it can also be used with `render` functions (like
|
||||
#' [renderText()] and [renderPlot()]).
|
||||
#'
|
||||
#' Shiny's reactive programming framework is primarily designed for calculated
|
||||
#' values (reactive expressions) and side-effect-causing actions (observers)
|
||||
@@ -2004,13 +2060,17 @@ maskReactiveContext <- function(expr) {
|
||||
#' response to an event. (Note that "recalculate a value" does not generally
|
||||
#' count as performing an action--see `eventReactive` for that.) The first
|
||||
#' argument is the event you want to respond to, and the second argument is a
|
||||
#' function that should be called whenever the event occurs.
|
||||
#' function that should be called whenever the event occurs. Note that
|
||||
#' `observeEvent()` is equivalent to using `observe() %>% bindEvent()` and as of
|
||||
#' Shiny 1.6.0, we recommend the latter.
|
||||
#'
|
||||
#' Use `eventReactive` to create a *calculated value* that only
|
||||
#' updates in response to an event. This is just like a normal
|
||||
#' [reactive expression][reactive] except it ignores all the usual
|
||||
#' invalidations that come from its reactive dependencies; it only invalidates
|
||||
#' in response to the given event.
|
||||
#' in response to the given event. Note that
|
||||
#' `eventReactive()` is equivalent to using `reactive() %>% bindEvent()` and as of
|
||||
#' Shiny 1.6.0, we recommend the latter.
|
||||
#'
|
||||
#' @section ignoreNULL and ignoreInit:
|
||||
#'
|
||||
@@ -2044,6 +2104,7 @@ maskReactiveContext <- function(expr) {
|
||||
#' Even though `ignoreNULL` and `ignoreInit` can be used for similar
|
||||
#' purposes they are independent from one another. Here's the result of combining
|
||||
#' these:
|
||||
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{`ignoreNULL = TRUE` and `ignoreInit = FALSE`}{
|
||||
@@ -2121,6 +2182,7 @@ maskReactiveContext <- function(expr) {
|
||||
#' after the first time that the code in `handlerExpr` is run. This
|
||||
#' pattern is useful when you want to subscribe to a event that should only
|
||||
#' happen once.
|
||||
#' @param ... Currently not used.
|
||||
#'
|
||||
#' @return `observeEvent` returns an observer reference class object (see
|
||||
#' [observe()]). `eventReactive` returns a reactive expression
|
||||
@@ -2129,7 +2191,7 @@ maskReactiveContext <- function(expr) {
|
||||
#' @seealso [actionButton()]
|
||||
#'
|
||||
#' @examples
|
||||
#' ## Only run this example in interactive R sessions
|
||||
#' ## Only run examples in interactive R sessions
|
||||
#' if (interactive()) {
|
||||
#'
|
||||
#' ## App 1: Sample usage
|
||||
@@ -2148,6 +2210,12 @@ maskReactiveContext <- function(expr) {
|
||||
#' observeEvent(input$button, {
|
||||
#' cat("Showing", input$x, "rows\n")
|
||||
#' })
|
||||
#' # The observeEvent() above is equivalent to:
|
||||
#' # observe({
|
||||
#' # cat("Showing", input$x, "rows\n")
|
||||
#' # }) %>%
|
||||
#' # bindEvent(input$button)
|
||||
#'
|
||||
#' # Take a reactive dependency on input$button, but
|
||||
#' # not on any of the stuff inside the function
|
||||
#' df <- eventReactive(input$button, {
|
||||
@@ -2167,6 +2235,12 @@ maskReactiveContext <- function(expr) {
|
||||
#' print(paste("This will only be printed once; all",
|
||||
#' "subsequent button clicks won't do anything"))
|
||||
#' }, once = TRUE)
|
||||
#' # The observeEvent() above is equivalent to:
|
||||
#' # observe({
|
||||
#' # print(paste("This will only be printed once; all",
|
||||
#' # "subsequent button clicks won't do anything"))
|
||||
#' # }) %>%
|
||||
#' # bindEvent(input$go, once = TRUE)
|
||||
#' }
|
||||
#' )
|
||||
#'
|
||||
@@ -2193,42 +2267,38 @@ maskReactiveContext <- function(expr) {
|
||||
observeEvent <- function(eventExpr, handlerExpr,
|
||||
event.env = parent.frame(), event.quoted = FALSE,
|
||||
handler.env = parent.frame(), handler.quoted = FALSE,
|
||||
...,
|
||||
label = NULL, suspended = FALSE, priority = 0,
|
||||
domain = getDefaultReactiveDomain(), autoDestroy = TRUE,
|
||||
ignoreNULL = TRUE, ignoreInit = FALSE, once = FALSE) {
|
||||
ignoreNULL = TRUE, ignoreInit = FALSE, once = FALSE)
|
||||
{
|
||||
check_dots_empty()
|
||||
|
||||
eventFunc <- exprToFunction(eventExpr, event.env, event.quoted)
|
||||
if (is.null(label))
|
||||
label <- sprintf('observeEvent(%s)', paste(deparse(body(eventFunc)), collapse='\n'))
|
||||
eventFunc <- wrapFunctionLabel(eventFunc, "observeEventExpr", ..stacktraceon = TRUE)
|
||||
eventExpr <- get_quosure(eventExpr, event.env, event.quoted)
|
||||
handlerExpr <- get_quosure(handlerExpr, handler.env, handler.quoted)
|
||||
|
||||
handlerFunc <- exprToFunction(handlerExpr, handler.env, handler.quoted)
|
||||
handlerFunc <- wrapFunctionLabel(handlerFunc, "observeEventHandler", ..stacktraceon = TRUE)
|
||||
if (is.null(label)) {
|
||||
label <- sprintf('observeEvent(%s)', paste(deparse(get_expr(eventExpr)), collapse='\n'))
|
||||
}
|
||||
|
||||
initialized <- FALSE
|
||||
handler <- inject(observe(
|
||||
!!handlerExpr,
|
||||
label = label,
|
||||
suspended = suspended,
|
||||
priority = priority,
|
||||
domain = domain,
|
||||
autoDestroy = TRUE,
|
||||
..stacktraceon = FALSE # TODO: Does this go in the bindEvent?
|
||||
))
|
||||
|
||||
o <- observe({
|
||||
hybrid_chain(
|
||||
{eventFunc()},
|
||||
function(value) {
|
||||
if (ignoreInit && !initialized) {
|
||||
initialized <<- TRUE
|
||||
return()
|
||||
}
|
||||
|
||||
if (ignoreNULL && isNullEvent(value)) {
|
||||
return()
|
||||
}
|
||||
|
||||
if (once) {
|
||||
on.exit(o$destroy())
|
||||
}
|
||||
|
||||
isolate(handlerFunc())
|
||||
}
|
||||
)
|
||||
}, label = label, suspended = suspended, priority = priority, domain = domain,
|
||||
autoDestroy = TRUE, ..stacktraceon = FALSE)
|
||||
o <- inject(bindEvent(
|
||||
ignoreNULL = ignoreNULL,
|
||||
ignoreInit = ignoreInit,
|
||||
once = once,
|
||||
label = label,
|
||||
!!eventExpr,
|
||||
x = handler
|
||||
))
|
||||
|
||||
invisible(o)
|
||||
}
|
||||
@@ -2238,34 +2308,26 @@ observeEvent <- function(eventExpr, handlerExpr,
|
||||
eventReactive <- function(eventExpr, valueExpr,
|
||||
event.env = parent.frame(), event.quoted = FALSE,
|
||||
value.env = parent.frame(), value.quoted = FALSE,
|
||||
...,
|
||||
label = NULL, domain = getDefaultReactiveDomain(),
|
||||
ignoreNULL = TRUE, ignoreInit = FALSE) {
|
||||
ignoreNULL = TRUE, ignoreInit = FALSE)
|
||||
{
|
||||
check_dots_empty()
|
||||
|
||||
eventFunc <- exprToFunction(eventExpr, event.env, event.quoted)
|
||||
if (is.null(label))
|
||||
label <- sprintf('eventReactive(%s)', paste(deparse(body(eventFunc)), collapse='\n'))
|
||||
eventFunc <- wrapFunctionLabel(eventFunc, "eventReactiveExpr", ..stacktraceon = TRUE)
|
||||
eventExpr <- get_quosure(eventExpr, event.env, event.quoted)
|
||||
valueExpr <- get_quosure(valueExpr, value.env, value.quoted)
|
||||
|
||||
handlerFunc <- exprToFunction(valueExpr, value.env, value.quoted)
|
||||
handlerFunc <- wrapFunctionLabel(handlerFunc, "eventReactiveHandler", ..stacktraceon = TRUE)
|
||||
if (is.null(label)) {
|
||||
label <- sprintf('eventReactive(%s)', paste(deparse(get_expr(eventExpr)), collapse='\n'))
|
||||
}
|
||||
|
||||
initialized <- FALSE
|
||||
|
||||
invisible(reactive({
|
||||
hybrid_chain(
|
||||
eventFunc(),
|
||||
function(value) {
|
||||
if (ignoreInit && !initialized) {
|
||||
initialized <<- TRUE
|
||||
req(FALSE)
|
||||
}
|
||||
|
||||
req(!ignoreNULL || !isNullEvent(value))
|
||||
|
||||
isolate(handlerFunc())
|
||||
}
|
||||
)
|
||||
}, label = label, domain = domain, ..stacktraceon = FALSE))
|
||||
invisible(inject(bindEvent(
|
||||
ignoreNULL = ignoreNULL,
|
||||
ignoreInit = ignoreInit,
|
||||
label = label,
|
||||
!!eventExpr,
|
||||
x = reactive(!!valueExpr, domain = domain, label = label)
|
||||
)))
|
||||
}
|
||||
|
||||
isNullEvent <- function(value) {
|
||||
@@ -2425,7 +2487,7 @@ debounce <- function(r, millis, priority = 100, domain = getDefaultReactiveDomai
|
||||
now <- getDomainTimeMs(domain)
|
||||
if (now >= v$when) {
|
||||
# Mod by 999999999 to get predictable overflow behavior
|
||||
v$trigger <- isolate(v$trigger %OR% 0) %% 999999999 + 1
|
||||
v$trigger <- isolate(v$trigger %||% 0) %% 999999999 + 1
|
||||
v$when <- NULL
|
||||
} else {
|
||||
invalidateLater(v$when - now)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#' Plot output with cached images
|
||||
#'
|
||||
#' Renders a reactive plot, with plot images cached to disk.
|
||||
#' Renders a reactive plot, with plot images cached to disk. As of Shiny 1.6.0,
|
||||
#' this is a shortcut for using [bindCache()] with [renderPlot()].
|
||||
#'
|
||||
#' `expr` is an expression that generates a plot, similar to that in
|
||||
#' `renderPlot`. Unlike with `renderPlot`, this expression does not
|
||||
@@ -8,7 +9,7 @@
|
||||
#' changes.
|
||||
#'
|
||||
#' `cacheKeyExpr` is an expression which, when evaluated, returns an object
|
||||
#' which will be serialized and hashed using the [digest::digest()]
|
||||
#' which will be serialized and hashed using the [rlang::hash()]
|
||||
#' function to generate a string that will be used as a cache key. This key is
|
||||
#' used to identify the contents of the plot: if the cache key is the same as a
|
||||
#' previous time, it assumes that the plot is the same and can be retrieved from
|
||||
@@ -32,7 +33,7 @@
|
||||
#' to normal R objects before returning them. Your expression could even
|
||||
#' serialize and hash that information in an efficient way and return a string,
|
||||
#' which will in turn be hashed (very quickly) by the
|
||||
#' [digest::digest()] function.
|
||||
#' [rlang::hash()] function.
|
||||
#'
|
||||
#' Internally, the result from `cacheKeyExpr` is combined with the name of
|
||||
#' the output (if you assign it to `output$plot1`, it will be combined
|
||||
@@ -40,95 +41,6 @@
|
||||
#' if there are multiple plots that have the same `cacheKeyExpr`, they
|
||||
#' will not have cache key collisions.
|
||||
#'
|
||||
#' @section Cache scoping:
|
||||
#'
|
||||
#' There are a number of different ways you may want to scope the cache. For
|
||||
#' example, you may want each user session to have their own plot cache, or
|
||||
#' you may want each run of the application to have a cache (shared among
|
||||
#' possibly multiple simultaneous user sessions), or you may want to have a
|
||||
#' cache that persists even after the application is shut down and started
|
||||
#' again.
|
||||
#'
|
||||
#' To control the scope of the cache, use the `cache` parameter. There
|
||||
#' are two ways of having Shiny automatically create and clean up the disk
|
||||
#' cache.
|
||||
#'
|
||||
#' \describe{
|
||||
#' \item{1}{To scope the cache to one run of a Shiny application (shared
|
||||
#' among possibly multiple user sessions), use `cache="app"`. This
|
||||
#' is the default. The cache will be shared across multiple sessions, so
|
||||
#' there is potentially a large performance benefit if there are many users
|
||||
#' of the application. When the application stops running, the cache will
|
||||
#' be deleted. If plots cannot be safely shared across users, this should
|
||||
#' not be used.}
|
||||
#' \item{2}{To scope the cache to one session, use `cache="session"`.
|
||||
#' When a new user session starts --- in other words, when a web browser
|
||||
#' visits the Shiny application --- a new cache will be created on disk
|
||||
#' for that session. When the session ends, the cache will be deleted.
|
||||
#' The cache will not be shared across multiple sessions.}
|
||||
#' }
|
||||
#'
|
||||
#' If either `"app"` or `"session"` is used, the cache will be 10 MB
|
||||
#' in size, and will be stored stored in memory, using a
|
||||
#' [memoryCache()] object. Note that the cache space will be shared
|
||||
#' among all cached plots within a single application or session.
|
||||
#'
|
||||
#' In some cases, you may want more control over the caching behavior. For
|
||||
#' example, you may want to use a larger or smaller cache, share a cache
|
||||
#' among multiple R processes, or you may want the cache to persist across
|
||||
#' multiple runs of an application, or even across multiple R processes.
|
||||
#'
|
||||
#' To use different settings for an application-scoped cache, you can call
|
||||
#' [shinyOptions()] at the top of your app.R, server.R, or
|
||||
#' global.R. For example, this will create a cache with 20 MB of space
|
||||
#' instead of the default 10 MB:
|
||||
#' \preformatted{
|
||||
#' shinyOptions(cache = memoryCache(size = 20e6))
|
||||
#' }
|
||||
#'
|
||||
#' To use different settings for a session-scoped cache, you can call
|
||||
#' [shinyOptions()] at the top of your server function. To use
|
||||
#' the session-scoped cache, you must also call `renderCachedPlot` with
|
||||
#' `cache="session"`. This will create a 20 MB cache for the session:
|
||||
#' \preformatted{
|
||||
#' function(input, output, session) {
|
||||
#' shinyOptions(cache = memoryCache(size = 20e6))
|
||||
#'
|
||||
#' output$plot <- renderCachedPlot(
|
||||
#' ...,
|
||||
#' cache = "session"
|
||||
#' )
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' If you want to create a cache that is shared across multiple concurrent
|
||||
#' R processes, you can use a [diskCache()]. You can create an
|
||||
#' application-level shared cache by putting this at the top of your app.R,
|
||||
#' server.R, or global.R:
|
||||
#' \preformatted{
|
||||
#' shinyOptions(cache = diskCache(file.path(dirname(tempdir()), "myapp-cache"))
|
||||
#' }
|
||||
#'
|
||||
#' This will create a subdirectory in your system temp directory named
|
||||
#' `myapp-cache` (replace `myapp-cache` with a unique name of
|
||||
#' your choosing). On most platforms, this directory will be removed when
|
||||
#' your system reboots. This cache will persist across multiple starts and
|
||||
#' stops of the R process, as long as you do not reboot.
|
||||
#'
|
||||
#' To have the cache persist even across multiple reboots, you can create the
|
||||
#' cache in a location outside of the temp directory. For example, it could
|
||||
#' be a subdirectory of the application:
|
||||
#' \preformatted{
|
||||
#' shinyOptions(cache = diskCache("./myapp-cache"))
|
||||
#' }
|
||||
#'
|
||||
#' In this case, resetting the cache will have to be done manually, by deleting
|
||||
#' the directory.
|
||||
#'
|
||||
#' You can also scope a cache to just one plot, or selected plots. To do that,
|
||||
#' create a [memoryCache()] or [diskCache()], and pass it
|
||||
#' as the `cache` argument of `renderCachedPlot`.
|
||||
#'
|
||||
#' @section Interactive plots:
|
||||
#'
|
||||
#' `renderCachedPlot` can be used to create interactive plots. See
|
||||
@@ -136,6 +48,7 @@
|
||||
#'
|
||||
#'
|
||||
#' @inheritParams renderPlot
|
||||
#' @inheritParams bindCache
|
||||
#' @param cacheKeyExpr An expression that returns a cache key. This key should
|
||||
#' be a unique identifier for a plot: the assumption is that if the cache key
|
||||
#' is the same, then the plot will be the same.
|
||||
@@ -146,16 +59,13 @@
|
||||
#' possible pixel dimension. See [sizeGrowthRatio()] for more
|
||||
#' information on the default sizing policy.
|
||||
#' @param res The resolution of the PNG, in pixels per inch.
|
||||
#' @param cache The scope of the cache, or a cache object. This can be
|
||||
#' `"app"` (the default), `"session"`, or a cache object like
|
||||
#' a [diskCache()]. See the Cache Scoping section for more
|
||||
#' information.
|
||||
#' @param width,height not used. They are specified via the argument
|
||||
#' `sizePolicy`.
|
||||
#'
|
||||
#' @seealso See [renderPlot()] for the regular, non-cached version of
|
||||
#' this function. For more about configuring caches, see
|
||||
#' [memoryCache()] and [diskCache()].
|
||||
#' @seealso See [renderPlot()] for the regular, non-cached version of this
|
||||
#' function. It can be used with [bindCache()] to get the same effect as
|
||||
#' `renderCachedPlot()`. For more about configuring caches, see
|
||||
#' [cachem::cache_mem()] and [cachem::cache_disk()].
|
||||
#'
|
||||
#'
|
||||
#' @examples
|
||||
@@ -246,7 +156,7 @@
|
||||
#' xlim = range(mtcars$wt), ylim = range(mtcars$mpg))
|
||||
#' },
|
||||
#' cacheKeyExpr = { list(input$n) },
|
||||
#' cache = memoryCache()
|
||||
#' cache = cachem::cache_mem()
|
||||
#' )
|
||||
#' output$plot2 <- renderCachedPlot({
|
||||
#' Sys.sleep(2) # Add an artificial delay
|
||||
@@ -255,7 +165,7 @@
|
||||
#' xlim = range(mtcars$wt), ylim = range(mtcars$mpg))
|
||||
#' },
|
||||
#' cacheKeyExpr = { list(input$n) },
|
||||
#' cache = memoryCache()
|
||||
#' cache = cachem::cache_mem()
|
||||
#' )
|
||||
#' }
|
||||
#' )
|
||||
@@ -266,22 +176,22 @@
|
||||
#' # At the top of app.R, this set the application-scoped cache to be a memory
|
||||
#' # cache that is 20 MB in size, and where cached objects expire after one
|
||||
#' # hour.
|
||||
#' shinyOptions(cache = memoryCache(max_size = 20e6, max_age = 3600))
|
||||
#' shinyOptions(cache = cachem::cache_mem(max_size = 20e6, max_age = 3600))
|
||||
#'
|
||||
#' # At the top of app.R, this set the application-scoped cache to be a disk
|
||||
#' # cache that can be shared among multiple concurrent R processes, and is
|
||||
#' # deleted when the system reboots.
|
||||
#' shinyOptions(cache = diskCache(file.path(dirname(tempdir()), "myapp-cache"))
|
||||
#' shinyOptions(cache = cachem::cache_disk(file.path(dirname(tempdir()), "myapp-cache"))
|
||||
#'
|
||||
#' # At the top of app.R, this set the application-scoped cache to be a disk
|
||||
#' # cache that can be shared among multiple concurrent R processes, and
|
||||
#' # persists on disk across reboots.
|
||||
#' shinyOptions(cache = diskCache("./myapp-cache"))
|
||||
#' shinyOptions(cache = cachem::cache_disk("./myapp-cache"))
|
||||
#'
|
||||
#' # At the top of the server function, this set the session-scoped cache to be
|
||||
#' # a memory cache that is 5 MB in size.
|
||||
#' server <- function(input, output, session) {
|
||||
#' shinyOptions(cache = memoryCache(max_size = 5e6))
|
||||
#' shinyOptions(cache = cachem::cache_mem(max_size = 5e6))
|
||||
#'
|
||||
#' output$plot <- renderCachedPlot(
|
||||
#' ...,
|
||||
@@ -303,275 +213,29 @@ renderCachedPlot <- function(expr,
|
||||
height = NULL
|
||||
) {
|
||||
|
||||
# This ..stacktraceon is matched by a ..stacktraceoff.. when plotFunc
|
||||
# is called
|
||||
installExprFunction(expr, "func", parent.frame(), quoted = FALSE, ..stacktraceon = TRUE)
|
||||
# This is so that the expr doesn't re-execute by itself; it needs to be
|
||||
# triggered by the cache key (or width/height) changing.
|
||||
isolatedFunc <- function() isolate(func())
|
||||
expr <- substitute(expr)
|
||||
if (!is_quosure(expr)) {
|
||||
expr <- new_quosure(expr, env = parent.frame())
|
||||
}
|
||||
|
||||
args <- list(...)
|
||||
cacheKeyExpr <- substitute(cacheKeyExpr)
|
||||
if (!is_quosure(cacheKeyExpr)) {
|
||||
cacheKeyExpr <- new_quosure(cacheKeyExpr, env = parent.frame())
|
||||
}
|
||||
|
||||
if (!is.null(width) || !is.null(height)) {
|
||||
warning("Unused argument(s) 'width' and/or 'height'. ",
|
||||
"'sizePolicy' is used instead.")
|
||||
}
|
||||
|
||||
cacheKeyExpr <- substitute(cacheKeyExpr)
|
||||
# The real cache key we'll use also includes width, height, res, pixelratio.
|
||||
# This is just the part supplied by the user.
|
||||
userCacheKey <- reactive(cacheKeyExpr, env = parent.frame(), quoted = TRUE, label = "userCacheKey")
|
||||
|
||||
ensureCacheSetup <- function() {
|
||||
# For our purposes, cache objects must support these methods.
|
||||
isCacheObject <- function(x) {
|
||||
# Use tryCatch in case the object does not support `$`.
|
||||
tryCatch(
|
||||
is.function(x$get) && is.function(x$set),
|
||||
error = function(e) FALSE
|
||||
)
|
||||
}
|
||||
|
||||
if (isCacheObject(cache)) {
|
||||
# If `cache` is already a cache object, do nothing
|
||||
return()
|
||||
|
||||
} else if (identical(cache, "app")) {
|
||||
cache <<- getShinyOption("cache")
|
||||
|
||||
} else if (identical(cache, "session")) {
|
||||
cache <<- session$cache
|
||||
|
||||
} else {
|
||||
stop('`cache` must either be "app", "session", or a cache object with methods, `$get`, and `$set`.')
|
||||
}
|
||||
}
|
||||
|
||||
# The width and height of the plot to draw, given from sizePolicy. These
|
||||
# values get filled by an observer below.
|
||||
fitDims <- reactiveValues(width = NULL, height = NULL)
|
||||
|
||||
# Make sure alt param to be reactive function
|
||||
if (is.reactive(alt))
|
||||
altWrapper <- alt
|
||||
else if (is.function(alt))
|
||||
altWrapper <- reactive({ alt() })
|
||||
else
|
||||
altWrapper <- function() { alt }
|
||||
|
||||
resizeObserver <- NULL
|
||||
ensureResizeObserver <- function() {
|
||||
if (!is.null(resizeObserver))
|
||||
return()
|
||||
|
||||
# Given the actual width/height of the image in the browser, this gets the
|
||||
# width/height from sizePolicy() and pushes those values into `fitDims`.
|
||||
# It's done this way so that the `fitDims` only change (and cause
|
||||
# invalidations) when the rendered image size changes, and not every time
|
||||
# the browser's <img> tag changes size.
|
||||
doResizeCheck <- function() {
|
||||
width <- session$clientData[[paste0('output_', outputName, '_width')]]
|
||||
height <- session$clientData[[paste0('output_', outputName, '_height')]]
|
||||
|
||||
if (is.null(width)) width <- 0
|
||||
if (is.null(height)) height <- 0
|
||||
|
||||
rect <- sizePolicy(c(width, height))
|
||||
fitDims$width <- rect[1]
|
||||
fitDims$height <- rect[2]
|
||||
}
|
||||
|
||||
# Run it once immediately, then set up the observer
|
||||
isolate(doResizeCheck())
|
||||
|
||||
resizeObserver <<- observe(doResizeCheck())
|
||||
}
|
||||
|
||||
# Vars to store session and output, so that they can be accessed from
|
||||
# the plotObj() reactive.
|
||||
session <- NULL
|
||||
outputName <- NULL
|
||||
|
||||
|
||||
drawReactive <- reactive(label = "plotObj", {
|
||||
hybrid_chain(
|
||||
# Depend on the user cache key, even though we don't use the value. When
|
||||
# it changes, it can cause the drawReactive to re-execute. (Though
|
||||
# drawReactive will not necessarily re-execute --- it must be called from
|
||||
# renderFunc, which happens only if there's a cache miss.)
|
||||
userCacheKey(),
|
||||
function(userCacheKeyValue) {
|
||||
# Get width/height, but don't depend on them.
|
||||
isolate({
|
||||
width <- fitDims$width
|
||||
height <- fitDims$height
|
||||
# Make sure alt text to be reactive function
|
||||
alt <- altWrapper()
|
||||
})
|
||||
|
||||
pixelratio <- session$clientData$pixelratio %OR% 1
|
||||
|
||||
do.call("drawPlot", c(
|
||||
list(
|
||||
name = outputName,
|
||||
session = session,
|
||||
func = isolatedFunc,
|
||||
width = width,
|
||||
height = height,
|
||||
alt = alt,
|
||||
pixelratio = pixelratio,
|
||||
res = res
|
||||
),
|
||||
args
|
||||
))
|
||||
},
|
||||
catch = function(reason) {
|
||||
# Non-isolating read. A common reason for errors in plotting is because
|
||||
# the dimensions are too small. By taking a dependency on width/height,
|
||||
# we can try again if the plot output element changes size.
|
||||
fitDims$width
|
||||
fitDims$height
|
||||
|
||||
# Propagate the error
|
||||
stop(reason)
|
||||
}
|
||||
inject(
|
||||
bindCache(
|
||||
renderPlot(!!expr, res = res, alt = alt, outputArgs = outputArgs, ...),
|
||||
!!cacheKeyExpr,
|
||||
sizePolicy = sizePolicy,
|
||||
cache = cache
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
# This function is the one that's returned from renderPlot(), and gets
|
||||
# wrapped in an observer when the output value is assigned.
|
||||
renderFunc <- function(shinysession, name, ...) {
|
||||
outputName <<- name
|
||||
session <<- shinysession
|
||||
ensureCacheSetup()
|
||||
ensureResizeObserver()
|
||||
|
||||
hybrid_chain(
|
||||
# This use of the userCacheKey() sets up the reactive dependency that
|
||||
# causes plot re-draw events. These may involve pulling from the cache,
|
||||
# replaying a display list, or re-executing user code.
|
||||
userCacheKey(),
|
||||
function(userCacheKeyResult) {
|
||||
width <- fitDims$width
|
||||
height <- fitDims$height
|
||||
alt <- altWrapper()
|
||||
pixelratio <- session$clientData$pixelratio %OR% 1
|
||||
|
||||
key <- digest::digest(list(outputName, userCacheKeyResult, width, height, res, pixelratio), "xxhash64")
|
||||
|
||||
plotObj <- cache$get(key)
|
||||
|
||||
# First look in cache.
|
||||
# Case 1. cache hit.
|
||||
if (!is.key_missing(plotObj)) {
|
||||
return(list(
|
||||
cacheHit = TRUE,
|
||||
key = key,
|
||||
plotObj = plotObj,
|
||||
width = width,
|
||||
height = height,
|
||||
alt = alt,
|
||||
pixelratio = pixelratio
|
||||
))
|
||||
}
|
||||
|
||||
# If not in cache, hybrid_chain call to drawReactive
|
||||
#
|
||||
# Two more possible cases:
|
||||
# 2. drawReactive will re-execute and return a plot that's the
|
||||
# correct size.
|
||||
# 3. It will not re-execute, but it will return the previous value,
|
||||
# which is the wrong size. It will include a valid display list
|
||||
# which can be used by resizeSavedPlot.
|
||||
hybrid_chain(
|
||||
drawReactive(),
|
||||
function(drawReactiveResult) {
|
||||
# Pass along the key for caching in the next stage
|
||||
list(
|
||||
cacheHit = FALSE,
|
||||
key = key,
|
||||
plotObj = drawReactiveResult,
|
||||
width = width,
|
||||
height = height,
|
||||
alt = alt,
|
||||
pixelratio = pixelratio
|
||||
)
|
||||
}
|
||||
)
|
||||
},
|
||||
function(possiblyAsyncResult) {
|
||||
hybrid_chain(possiblyAsyncResult, function(result) {
|
||||
width <- result$width
|
||||
height <- result$height
|
||||
alt <- result$alt
|
||||
pixelratio <- result$pixelratio
|
||||
|
||||
# Three possibilities when we get here:
|
||||
# 1. There was a cache hit. No need to set a value in the cache.
|
||||
# 2. There was a cache miss, and the plotObj is already the correct
|
||||
# size (because drawReactive re-executed). In this case, we need
|
||||
# to cache it.
|
||||
# 3. There was a cache miss, and the plotObj was not the corect size.
|
||||
# In this case, we need to replay the display list, and then cache
|
||||
# the result.
|
||||
if (!result$cacheHit) {
|
||||
# If the image is already the correct size, this just returns the
|
||||
# object unchanged.
|
||||
result$plotObj <- do.call("resizeSavedPlot", c(
|
||||
list(
|
||||
name,
|
||||
shinysession,
|
||||
result$plotObj,
|
||||
width,
|
||||
height,
|
||||
alt,
|
||||
pixelratio,
|
||||
res
|
||||
),
|
||||
args
|
||||
))
|
||||
|
||||
# Save a cached copy of the plotObj. The recorded displaylist for
|
||||
# the plot can't be serialized and restored properly within the same
|
||||
# R session, so we NULL it out before saving. (The image data and
|
||||
# other metadata be saved and restored just fine.) Displaylists can
|
||||
# also be very large (~1.5MB for a basic ggplot), and they would not
|
||||
# be commonly used. Note that displaylist serialization was fixed in
|
||||
# revision 74506 (2e6c669), and should be in R 3.6. A MemoryCache
|
||||
# doesn't need to serialize objects, so it could actually save a
|
||||
# display list, but for the reasons listed previously, it's
|
||||
# generally not worth it.
|
||||
# The plotResult is not the same as the recordedPlot (it is used to
|
||||
# retrieve coordmap information for ggplot2 objects) but it is only
|
||||
# used in conjunction with the recordedPlot, and we'll remove it
|
||||
# because it can be quite large.
|
||||
result$plotObj$plotResult <- NULL
|
||||
result$plotObj$recordedPlot <- NULL
|
||||
cache$set(result$key, result$plotObj)
|
||||
}
|
||||
|
||||
img <- result$plotObj$img
|
||||
# Replace exact pixel dimensions; instead, the max-height and
|
||||
# max-width will be set to 100% from CSS.
|
||||
img$class <- "shiny-scalable"
|
||||
img$width <- NULL
|
||||
img$height <- NULL
|
||||
|
||||
img
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
# If renderPlot isn't going to adapt to the height of the div, then the
|
||||
# div needs to adapt to the height of renderPlot. By default, plotOutput
|
||||
# sets the height to 400px, so to make it adapt we need to override it
|
||||
# with NULL.
|
||||
outputFunc <- plotOutput
|
||||
formals(outputFunc)['height'] <- list(NULL)
|
||||
|
||||
markRenderFunction(outputFunc, renderFunc, outputArgs = outputArgs)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,9 +62,11 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
env = parent.frame(), quoted = FALSE,
|
||||
execOnResize = FALSE, outputArgs = list()
|
||||
) {
|
||||
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
# This ..stacktraceon is matched by a ..stacktraceoff.. when plotFunc
|
||||
# is called
|
||||
installExprFunction(expr, "func", env, quoted, ..stacktraceon = TRUE)
|
||||
func <- quoToFunction(expr, "renderPlot", ..stacktraceon = TRUE)
|
||||
|
||||
args <- list(...)
|
||||
|
||||
@@ -89,7 +91,9 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
else
|
||||
altWrapper <- function() { alt }
|
||||
|
||||
getDims <- function() {
|
||||
# This is the function that will be used as getDims by default, but it can be
|
||||
# overridden (which happens when bindCache() is used).
|
||||
getDimsDefault <- function() {
|
||||
width <- widthWrapper()
|
||||
height <- heightWrapper()
|
||||
|
||||
@@ -108,6 +112,7 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
# the plotObj() reactive.
|
||||
session <- NULL
|
||||
outputName <- NULL
|
||||
getDims <- NULL
|
||||
|
||||
# Calls drawPlot, invoking the user-provided `func` (which may or may not
|
||||
# return a promise). The idea is that the (cached) return value from this
|
||||
@@ -118,7 +123,7 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
{
|
||||
# If !execOnResize, don't invalidate when width/height changes.
|
||||
dims <- if (execOnResize) getDims() else isolate(getDims())
|
||||
pixelratio <- session$clientData$pixelratio %OR% 1
|
||||
pixelratio <- session$clientData$pixelratio %||% 1
|
||||
do.call("drawPlot", c(
|
||||
list(
|
||||
name = outputName,
|
||||
@@ -145,15 +150,19 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
|
||||
# This function is the one that's returned from renderPlot(), and gets
|
||||
# wrapped in an observer when the output value is assigned.
|
||||
renderFunc <- function(shinysession, name, ...) {
|
||||
# The `get_dims` parameter defaults to `getDimsDefault`. However, it can be
|
||||
# overridden, so that `bindCache` can use a different version.
|
||||
renderFunc <- function(shinysession, name, ..., get_dims = getDimsDefault) {
|
||||
|
||||
outputName <<- name
|
||||
session <<- shinysession
|
||||
if (is.null(getDims)) getDims <<- get_dims
|
||||
|
||||
hybrid_chain(
|
||||
drawReactive(),
|
||||
function(result) {
|
||||
dims <- getDims()
|
||||
pixelratio <- session$clientData$pixelratio %OR% 1
|
||||
pixelratio <- session$clientData$pixelratio %||% 1
|
||||
result <- do.call("resizeSavedPlot", c(
|
||||
list(name, shinysession, result, dims$width, dims$height, altWrapper(), pixelratio, res),
|
||||
args
|
||||
@@ -171,7 +180,14 @@ renderPlot <- function(expr, width = 'auto', height = 'auto', res = 72, ...,
|
||||
outputFunc <- plotOutput
|
||||
if (!identical(height, 'auto')) formals(outputFunc)['height'] <- list(NULL)
|
||||
|
||||
markRenderFunction(outputFunc, renderFunc, outputArgs = outputArgs)
|
||||
markedFunc <- markRenderFunction(
|
||||
outputFunc,
|
||||
renderFunc,
|
||||
outputArgs,
|
||||
cacheHint = list(userExpr = get_expr(expr), res = res)
|
||||
)
|
||||
class(markedFunc) <- c("shiny.renderPlot", class(markedFunc))
|
||||
markedFunc
|
||||
}
|
||||
|
||||
resizeSavedPlot <- function(name, session, result, width, height, alt, pixelratio, res, ...) {
|
||||
@@ -237,8 +253,9 @@ drawPlot <- function(name, session, func, width, height, alt, pixelratio, res, .
|
||||
promises::with_promise_domain(domain, {
|
||||
hybrid_chain(
|
||||
func(),
|
||||
function(value, .visible) {
|
||||
if (.visible) {
|
||||
function(value) {
|
||||
res <- withVisible(value)
|
||||
if (res$visible) {
|
||||
# A modified version of print.ggplot which returns the built ggplot object
|
||||
# as well as the gtable grob. This overrides the ggplot::print.ggplot
|
||||
# method, but only within the context of renderPlot. The reason this needs
|
||||
@@ -256,7 +273,7 @@ drawPlot <- function(name, session, func, width, height, alt, pixelratio, res, .
|
||||
# similar to ggplot2. But for base graphics, it would already have
|
||||
# been rendered when func was called above, and the print should
|
||||
# have no effect.
|
||||
result <- ..stacktraceon..(print(value))
|
||||
result <- ..stacktraceon..(print(res$value))
|
||||
# TODO jcheng 2017-04-11: Verify above ..stacktraceon..
|
||||
})
|
||||
result
|
||||
@@ -593,6 +610,10 @@ find_panel_info_api <- function(b) {
|
||||
coord <- ggplot2::summarise_coord(b)
|
||||
layers <- ggplot2::summarise_layers(b)
|
||||
|
||||
`%NA_OR%` <- function(x, y) {
|
||||
if (is_na(x)) y else x
|
||||
}
|
||||
|
||||
# Given x and y scale objects and a coord object, return a list that has
|
||||
# the bases of log transformations for x and y, or NULL if it's not a
|
||||
# log transform.
|
||||
@@ -609,8 +630,8 @@ find_panel_info_api <- function(b) {
|
||||
|
||||
# First look for log base in scale, then coord; otherwise NULL.
|
||||
list(
|
||||
x = get_log_base(xscale$trans) %OR% coord$xlog %OR% NULL,
|
||||
y = get_log_base(yscale$trans) %OR% coord$ylog %OR% NULL
|
||||
x = get_log_base(xscale$trans) %NA_OR% coord$xlog %NA_OR% NULL,
|
||||
y = get_log_base(yscale$trans) %NA_OR% coord$ylog %NA_OR% NULL
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#' Table Output
|
||||
#'
|
||||
#' Creates a reactive table that is suitable for assigning to an `output`
|
||||
#' slot.
|
||||
#' @description
|
||||
#' The `tableOuptut()`/`renderTable()` pair creates a reactive table that is
|
||||
#' suitable for display small matrices and data frames. The columns are
|
||||
#' formatted with [xtable::xtable()].
|
||||
#'
|
||||
#' The corresponding HTML output tag should be `div` and have the CSS
|
||||
#' class name `shiny-html-output`.
|
||||
#' See [renderDataTable()] for data frames that are too big to fit on a single
|
||||
#' page.
|
||||
#'
|
||||
#' @param expr An expression that returns an R object that can be used with
|
||||
#' [xtable::xtable()].
|
||||
@@ -47,14 +49,33 @@
|
||||
#' implicit call to [tableOutput()] when `renderTable` is
|
||||
#' used in an interactive R Markdown document.
|
||||
#' @export
|
||||
#' @examples
|
||||
#' ## Only run this example in interactive R sessions
|
||||
#' if (interactive()) {
|
||||
#' # table example
|
||||
#' shinyApp(
|
||||
#' ui = fluidPage(
|
||||
#' fluidRow(
|
||||
#' column(12,
|
||||
#' tableOutput('table')
|
||||
#' )
|
||||
#' )
|
||||
#' ),
|
||||
#' server = function(input, output) {
|
||||
#' output$table <- renderTable(iris)
|
||||
#' }
|
||||
#' )
|
||||
#' }
|
||||
renderTable <- function(expr, striped = FALSE, hover = FALSE,
|
||||
bordered = FALSE, spacing = c("s", "xs", "m", "l"),
|
||||
width = "auto", align = NULL,
|
||||
rownames = FALSE, colnames = TRUE,
|
||||
digits = NULL, na = "NA", ...,
|
||||
env = parent.frame(), quoted = FALSE,
|
||||
outputArgs=list()) {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
outputArgs=list())
|
||||
{
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderTable")
|
||||
|
||||
if (!is.function(spacing)) spacing <- match.arg(spacing)
|
||||
|
||||
|
||||
10
R/runapp.R
10
R/runapp.R
@@ -83,8 +83,7 @@
|
||||
#' @export
|
||||
runApp <- function(appDir=getwd(),
|
||||
port=getOption('shiny.port'),
|
||||
launch.browser=getOption('shiny.launch.browser',
|
||||
interactive()),
|
||||
launch.browser = getOption('shiny.launch.browser', interactive()),
|
||||
host=getOption('shiny.host', '127.0.0.1'),
|
||||
workerId="", quiet=FALSE,
|
||||
display.mode=c("auto", "normal", "showcase"),
|
||||
@@ -142,8 +141,8 @@ runApp <- function(appDir=getwd(),
|
||||
shinyOptions(appToken = createUniqueId(8))
|
||||
|
||||
# Set up default cache for app.
|
||||
if (is.null(getShinyOption("cache"))) {
|
||||
shinyOptions(cache = MemoryCache$new())
|
||||
if (is.null(getShinyOption("cache", default = NULL))) {
|
||||
shinyOptions(cache = cachem::cache_mem(max_size = 200 * 1024^2))
|
||||
}
|
||||
|
||||
# Extract appOptions (which is a list) and store them as shinyOptions, for
|
||||
@@ -461,8 +460,7 @@ stopApp <- function(returnValue = invisible()) {
|
||||
#' @export
|
||||
runExample <- function(example=NA,
|
||||
port=getOption("shiny.port"),
|
||||
launch.browser=getOption('shiny.launch.browser',
|
||||
interactive()),
|
||||
launch.browser = getOption('shiny.launch.browser', interactive()),
|
||||
host=getOption('shiny.host', '127.0.0.1'),
|
||||
display.mode=c("auto", "normal", "showcase")) {
|
||||
examplesDir <- system.file('examples', package='shiny')
|
||||
|
||||
@@ -80,7 +80,7 @@ addResourcePath <- function(prefix, directoryPath) {
|
||||
|
||||
# If a shiny app is currently running, dynamically register this path with
|
||||
# the corresponding httpuv server object.
|
||||
if (!is.null(getShinyOption("server")))
|
||||
if (!is.null(getShinyOption("server", default = NULL)))
|
||||
{
|
||||
getShinyOption("server")$setStaticPath(.list = stats::setNames(normalizedPath, prefix))
|
||||
}
|
||||
|
||||
19
R/server.R
19
R/server.R
@@ -29,7 +29,9 @@ registerClient <- function(client) {
|
||||
|
||||
#' Define Server Functionality
|
||||
#'
|
||||
#' Defines the server-side logic of the Shiny application. This generally
|
||||
#' @description \lifecycle{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.
|
||||
#' In older versions of Shiny, it was necessary to call `shinyServer()` in
|
||||
#' the `server.R` file, but this is no longer required as of Shiny 0.10.
|
||||
@@ -47,7 +49,7 @@ registerClient <- function(client) {
|
||||
#' optional `session` parameter, which is used when greater control is
|
||||
#' needed.
|
||||
#'
|
||||
#' See the [tutorial](http://rstudio.github.com/shiny/tutorial/) for more
|
||||
#' See the [tutorial](https://rstudio.github.io/shiny/tutorial/) for more
|
||||
#' on how to write a server function.
|
||||
#'
|
||||
#' @param func The server function for this application. See the details section
|
||||
@@ -76,6 +78,17 @@ registerClient <- function(client) {
|
||||
#' @export
|
||||
#' @keywords internal
|
||||
shinyServer <- function(func) {
|
||||
if (in_devmode()) {
|
||||
shinyDeprecated(
|
||||
"0.10.0", "shinyServer()",
|
||||
details = paste0(
|
||||
"When removing `shinyServer()`, ",
|
||||
"ensure that the last expression returned from server.R ",
|
||||
"is the function normally supplied to `shinyServer(func)`."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
.globals$server <- list(func)
|
||||
invisible(func)
|
||||
}
|
||||
@@ -137,7 +150,7 @@ createAppHandlers <- function(httpHandlers, serverFuncSource) {
|
||||
}
|
||||
|
||||
if (identical(ws$request$PATH_INFO, "/autoreload/")) {
|
||||
if (!getOption("shiny.autoreload", FALSE)) {
|
||||
if (!get_devmode_option("shiny.autoreload", FALSE)) {
|
||||
ws$close()
|
||||
return(TRUE)
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ getShinyOption <- function(name, default = NULL) {
|
||||
#' \item{shiny.host (defaults to `"127.0.0.1"`)}{The IP address that Shiny should listen on. See
|
||||
#' [runApp()] for more information.}
|
||||
#' \item{shiny.jquery.version (defaults to `3`)}{The major version of jQuery to use.
|
||||
#' Currently only values of `3` or `1` are supported. If `1`, then jQuery 1.12.4 is used. If `3`,
|
||||
#' then jQuery 3.5.1 is used.}
|
||||
#' Currently only values of `3` or `1` are supported. If `1`, then jQuery 1.12.4 is used. If `3`,
|
||||
#' then jQuery `r version_jquery` is used.}
|
||||
#' \item{shiny.json.digits (defaults to `16`)}{The number of digits to use when converting
|
||||
#' numbers to JSON format to send to the client web browser.}
|
||||
#' \item{shiny.launch.browser (defaults to `interactive()`)}{A boolean which controls the default behavior
|
||||
@@ -136,6 +136,12 @@ getShinyOption <- function(name, default = NULL) {
|
||||
#' \item{shiny.usecairo (defaults to `TRUE`)}{This is used to disable graphical rendering by the
|
||||
#' Cairo package, if it is installed. See [plotPNG()] for more
|
||||
#' information.}
|
||||
#' \item{shiny.devmode (defaults to `NULL`)}{Option to enable Shiny Developer Mode. When set,
|
||||
#' different default `getOption(key)` values will be returned. See [devmode()] for more details.}
|
||||
### Not documenting as 'shiny.devmode.verbose' is for niche use only
|
||||
# ' \item{shiny.devmode.verbose (defaults to `TRUE`)}{If `TRUE`, will display messages printed
|
||||
# ' about which options are being set. See [devmode()] for more details. }
|
||||
### (end not documenting 'shiny.devmode.verbose')
|
||||
#' }
|
||||
#'
|
||||
#'
|
||||
@@ -165,7 +171,8 @@ getShinyOption <- function(name, default = NULL) {
|
||||
#' `shinyOptions()`.
|
||||
#'
|
||||
#' \describe{ \item{cache}{A caching object that will be used by
|
||||
#' [renderCachedPlot()]. If not specified, a [memoryCache()] will be used.} }
|
||||
#' [renderCachedPlot()]. If not specified, a [cachem::cache_mem()] will be
|
||||
#' used.} }
|
||||
#'
|
||||
#' @param ... Options to set, with the form `name = value`.
|
||||
#' @aliases shiny-options
|
||||
|
||||
34
R/shiny-package.R
Normal file
34
R/shiny-package.R
Normal file
@@ -0,0 +1,34 @@
|
||||
# See also R/reexports.R
|
||||
|
||||
## usethis namespace: start
|
||||
## usethis namespace: end
|
||||
#' @importFrom lifecycle deprecated
|
||||
#' @importFrom grDevices dev.set dev.cur
|
||||
#' @importFrom fastmap fastmap
|
||||
#' @importFrom promises %...!%
|
||||
#' @importFrom promises %...>%
|
||||
#' @importFrom promises
|
||||
#' promise promise_resolve promise_reject is.promising
|
||||
#' as.promise
|
||||
#' @importFrom rlang
|
||||
#' quo enquo as_function get_expr get_env new_function enquos
|
||||
#' eval_tidy expr pairlist2 new_quosure enexpr as_quosure is_quosure inject
|
||||
#' enquos0 zap_srcref %||% is_na
|
||||
#' is_false
|
||||
#' missing_arg is_missing maybe_missing
|
||||
#' @importFrom ellipsis
|
||||
#' check_dots_empty check_dots_unnamed
|
||||
#' @import htmltools
|
||||
#' @import httpuv
|
||||
#' @import xtable
|
||||
#' @import R6
|
||||
#' @import mime
|
||||
NULL
|
||||
|
||||
# It's necessary to Depend on methods so Rscript doesn't fail. It's necessary
|
||||
# to import(methods) in NAMESPACE so R CMD check doesn't complain. This
|
||||
# approach isn't foolproof because Rscript -e pkgname::func() doesn't actually
|
||||
# cause methods to be attached, but it's not a problem for shiny::runApp()
|
||||
# since we call require(shiny) as part of loading the app.
|
||||
#' @import methods
|
||||
NULL
|
||||
290
R/shiny.R
290
R/shiny.R
@@ -1,4 +1,4 @@
|
||||
#' @include utils.R stack.R
|
||||
#' @include utils.R
|
||||
NULL
|
||||
|
||||
#' Web Application Framework for R
|
||||
@@ -8,7 +8,7 @@ NULL
|
||||
#' prebuilt widgets make it possible to build beautiful, responsive, and
|
||||
#' powerful applications with minimal effort.
|
||||
#'
|
||||
#' The Shiny tutorial at <http://shiny.rstudio.com/tutorial/> explains
|
||||
#' The Shiny tutorial at <https://shiny.rstudio.com/tutorial/> explains
|
||||
#' the framework in depth, walks you through building a simple application, and
|
||||
#' includes extensive annotated examples.
|
||||
#'
|
||||
@@ -17,15 +17,6 @@ NULL
|
||||
#' @name shiny-package
|
||||
#' @aliases shiny
|
||||
#' @docType package
|
||||
#' @import htmltools httpuv xtable digest R6 mime
|
||||
NULL
|
||||
|
||||
# It's necessary to Depend on methods so Rscript doesn't fail. It's necessary
|
||||
# to import(methods) in NAMESPACE so R CMD check doesn't complain. This
|
||||
# approach isn't foolproof because Rscript -e pkgname::func() doesn't actually
|
||||
# cause methods to be attached, but it's not a problem for shiny::runApp()
|
||||
# since we call require(shiny) as part of loading the app.
|
||||
#' @import methods
|
||||
NULL
|
||||
|
||||
createUniqueId <- function(bytes, prefix = "", suffix = "") {
|
||||
@@ -202,6 +193,14 @@ workerId <- local({
|
||||
#' An environment for app authors and module/package authors to store whatever
|
||||
#' session-specific data they want.
|
||||
#' }
|
||||
#' \item{user}{
|
||||
#' User's log-in information. Useful for identifying users on hosted platforms
|
||||
#' such as RStudio Connect and Shiny Server.
|
||||
#' }
|
||||
#' \item{groups}{
|
||||
#' The `user`'s relevant group information. Useful for determining what
|
||||
#' privileges the user should or shouldn't have.
|
||||
#' }
|
||||
#' \item{resetBrush(brushId)}{
|
||||
#' Resets/clears the brush with the given `brushId`, if it exists on
|
||||
#' any `imageOutput` or `plotOutput` in the app.
|
||||
@@ -269,6 +268,18 @@ workerId <- local({
|
||||
#' character vector, as in `input=c("x", "y")`. The format can be
|
||||
#' "rds" or "json".
|
||||
#' }
|
||||
#' \item{setCurrentTheme(theme)}{
|
||||
#' Sets the current [bootstrapLib()] theme, which updates the value of
|
||||
#' [getCurrentTheme()], invalidates `session$getCurrentTheme()`, and calls
|
||||
#' function(s) registered with [registerThemeDependency()] with provided
|
||||
#' `theme`. If those function calls return [htmltools::htmlDependency()]s with
|
||||
#' `stylesheet`s, then those stylesheets are "refreshed" (i.e., the new
|
||||
#' stylesheets are inserted on the page and the old ones are disabled and
|
||||
#' removed).
|
||||
#' }
|
||||
#' \item{getCurrentTheme()}{
|
||||
#' A reactive read of the current [bootstrapLib()] theme.
|
||||
#' }
|
||||
#'
|
||||
#' @name session
|
||||
NULL
|
||||
@@ -277,7 +288,7 @@ NULL
|
||||
#'
|
||||
#' The `NS` function creates namespaced IDs out of bare IDs, by joining
|
||||
#' them using `ns.sep` as the delimiter. It is intended for use in Shiny
|
||||
#' modules. See <http://shiny.rstudio.com/articles/modules.html>.
|
||||
#' modules. See <https://shiny.rstudio.com/articles/modules.html>.
|
||||
#'
|
||||
#' Shiny applications use IDs to identify inputs and outputs. These IDs must be
|
||||
#' unique within an application, as accidentally using the same input/output ID
|
||||
@@ -294,7 +305,7 @@ NULL
|
||||
#' @param id The id string to be namespaced (optional).
|
||||
#' @return If `id` is missing, returns a function that expects an id string
|
||||
#' as its only argument and returns that id with the namespace prepended.
|
||||
#' @seealso <http://shiny.rstudio.com/articles/modules.html>
|
||||
#' @seealso <https://shiny.rstudio.com/articles/modules.html>
|
||||
#' @export
|
||||
NS <- function(namespace, id = NULL) {
|
||||
if (length(namespace) == 0)
|
||||
@@ -332,8 +343,8 @@ ShinySession <- R6Class(
|
||||
websocket = 'ANY',
|
||||
invalidatedOutputValues = 'Map',
|
||||
invalidatedOutputErrors = 'Map',
|
||||
inputMessageQueue = list(), # A list of inputMessages to send when flushed
|
||||
cycleStartActionQueue = list(), # A list of actions to perform to start a cycle
|
||||
inputMessageQueue = 'fastqueue', # A list of inputMessages to send when flushed
|
||||
cycleStartActionQueue = 'fastqueue', # A list of actions to perform to start a cycle
|
||||
.outputs = list(), # Keeps track of all the output observer objects
|
||||
.outputOptions = list(), # Options for each of the output observer objects
|
||||
progressKeys = 'character',
|
||||
@@ -360,6 +371,7 @@ ShinySession <- R6Class(
|
||||
currentOutputName = NULL, # Name of the currently-running output
|
||||
outputInfo = list(), # List of information for each output
|
||||
testSnapshotUrl = character(0),
|
||||
currentThemeDependency = NULL, # ReactiveVal for taking dependency on theme
|
||||
|
||||
sendResponse = function(requestMsg, value) {
|
||||
if (is.null(requestMsg$tag)) {
|
||||
@@ -465,7 +477,7 @@ ShinySession <- R6Class(
|
||||
# The format of the response that will be sent back. Defaults to
|
||||
# "json" unless requested otherwise. The only other valid value is
|
||||
# "rds".
|
||||
format <- params$format %OR% "json"
|
||||
format <- params$format %||% "json"
|
||||
|
||||
values <- list()
|
||||
|
||||
@@ -596,23 +608,22 @@ ShinySession <- R6Class(
|
||||
# function has been set, return the identity function.
|
||||
getSnapshotPreprocessOutput = function(name) {
|
||||
fun <- attr(private$.outputs[[name]], "snapshotPreprocess", exact = TRUE)
|
||||
fun %OR% identity
|
||||
fun %||% identity
|
||||
},
|
||||
|
||||
# Get the snapshotPreprocessInput function for an input name. If no preprocess
|
||||
# function has been set, return the identity function.
|
||||
getSnapshotPreprocessInput = function(name) {
|
||||
fun <- private$.input$getMeta(name, "shiny.snapshot.preprocess")
|
||||
fun %OR% identity
|
||||
fun %||% identity
|
||||
},
|
||||
|
||||
# See cycleStartAction
|
||||
startCycle = function() {
|
||||
# TODO: This should check for busyCount == 0L, and remove the checks from
|
||||
# the call sites
|
||||
if (length(private$cycleStartActionQueue) > 0) {
|
||||
head <- private$cycleStartActionQueue[[1L]]
|
||||
private$cycleStartActionQueue <- private$cycleStartActionQueue[-1L]
|
||||
if (private$cycleStartActionQueue$size() > 0) {
|
||||
head <- private$cycleStartActionQueue$remove()
|
||||
|
||||
# After we execute the current cycleStartAction (head), there may be
|
||||
# more items left on the queue. If the current busyCount > 0, then that
|
||||
@@ -631,7 +642,7 @@ ShinySession <- R6Class(
|
||||
# busyCount, it's possible we're calling startCycle spuriously; that's
|
||||
# OK, it's essentially a no-op in that case.
|
||||
on.exit({
|
||||
if (private$busyCount == 0L && length(private$cycleStartActionQueue) > 0L) {
|
||||
if (private$busyCount == 0L && private$cycleStartActionQueue$size() > 0L) {
|
||||
later::later(function() {
|
||||
if (private$busyCount == 0L) {
|
||||
private$startCycle()
|
||||
@@ -669,6 +680,8 @@ ShinySession <- R6Class(
|
||||
self$closed <- FALSE
|
||||
# TODO: Put file upload context in user/app-specific dir if possible
|
||||
|
||||
private$inputMessageQueue <- fastmap::fastqueue()
|
||||
private$cycleStartActionQueue <- fastmap::fastqueue()
|
||||
private$invalidatedOutputValues <- Map$new()
|
||||
private$invalidatedOutputErrors <- Map$new()
|
||||
private$fileUploadContext <- FileUploadContext$new()
|
||||
@@ -679,7 +692,7 @@ ShinySession <- R6Class(
|
||||
private$.input <- ReactiveValues$new(dedupe = FALSE, label = "input")
|
||||
private$.clientData <- ReactiveValues$new(dedupe = TRUE, label = "clientData")
|
||||
private$timingRecorder <- ShinyServerTimingRecorder$new()
|
||||
self$progressStack <- Stack$new()
|
||||
self$progressStack <- fastmap::faststack()
|
||||
self$files <- Map$new()
|
||||
self$downloads <- Map$new()
|
||||
self$userData <- new.env(parent = emptyenv())
|
||||
@@ -696,7 +709,7 @@ ShinySession <- R6Class(
|
||||
# Copy app-level options
|
||||
self$options <- getCurrentAppState()$options
|
||||
|
||||
self$cache <- MemoryCache$new()
|
||||
self$cache <- cachem::cache_mem(max_size = 200 * 1024^2)
|
||||
|
||||
private$bookmarkCallbacks <- Callbacks$new()
|
||||
private$bookmarkedCallbacks <- Callbacks$new()
|
||||
@@ -706,6 +719,13 @@ ShinySession <- R6Class(
|
||||
private$testMode <- getShinyOption("testmode", default = FALSE)
|
||||
private$enableTestSnapshot()
|
||||
|
||||
# This `withReactiveDomain` is used only to satisfy the reactlog, so that
|
||||
# it knows to scope this reactiveVal to this session.
|
||||
# https://github.com/rstudio/shiny/pull/3182
|
||||
withReactiveDomain(self,
|
||||
private$currentThemeDependency <- reactiveVal(0, label = "Theme Counter")
|
||||
)
|
||||
|
||||
private$registerSessionEndCallbacks()
|
||||
|
||||
if (!is.null(websocket$request$HTTP_SHINY_SERVER_CREDENTIALS)) {
|
||||
@@ -1158,7 +1178,10 @@ ShinySession <- R6Class(
|
||||
private$.outputOptions[[name]] <- list()
|
||||
}
|
||||
else {
|
||||
stop(paste("Unexpected", class(func), "output for", name))
|
||||
rlang::abort(c(
|
||||
paste0("Unexpected ", class(func)[[1]], " object for output$", name),
|
||||
i = "Did you forget to use a render function?"
|
||||
))
|
||||
}
|
||||
},
|
||||
getOutput = function(name) {
|
||||
@@ -1188,7 +1211,7 @@ ShinySession <- R6Class(
|
||||
length(private$progressKeys) != 0 ||
|
||||
length(private$invalidatedOutputValues) != 0 ||
|
||||
length(private$invalidatedOutputErrors) != 0 ||
|
||||
length(private$inputMessageQueue) != 0
|
||||
private$inputMessageQueue$size() != 0
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1220,8 +1243,8 @@ ShinySession <- R6Class(
|
||||
private$invalidatedOutputValues <- Map$new()
|
||||
errors <- as.list(private$invalidatedOutputErrors)
|
||||
private$invalidatedOutputErrors <- Map$new()
|
||||
inputMessages <- private$inputMessageQueue
|
||||
private$inputMessageQueue <- list()
|
||||
inputMessages <- private$inputMessageQueue$as_list()
|
||||
private$inputMessageQueue$reset()
|
||||
|
||||
if (isTRUE(private$testMode)) {
|
||||
private$storeOutputValues(mergeVectors(values, errors))
|
||||
@@ -1239,7 +1262,7 @@ ShinySession <- R6Class(
|
||||
# does not guarantee) inputs and reactive values from changing underneath
|
||||
# async observers as they run.
|
||||
cycleStartAction = function(callback) {
|
||||
private$cycleStartActionQueue <- c(private$cycleStartActionQueue, list(callback))
|
||||
private$cycleStartActionQueue$add(callback)
|
||||
# If no observers are running in this session, we're safe to proceed.
|
||||
# Otherwise, startCycle() will be called later, via decrementBusyCount().
|
||||
if (private$busyCount == 0L) {
|
||||
@@ -1280,16 +1303,41 @@ ShinySession <- R6Class(
|
||||
)
|
||||
},
|
||||
|
||||
getCurrentTheme = function() {
|
||||
private$currentThemeDependency()
|
||||
getCurrentTheme()
|
||||
},
|
||||
|
||||
setCurrentTheme = function(theme) {
|
||||
# This function does three things: (1) sets theme as the current
|
||||
# bootstrapTheme, (2) re-executes any registered theme dependencies, and
|
||||
# (3) sends the resulting dependencies to the client.
|
||||
|
||||
if (!is_bs_theme(theme)) {
|
||||
stop("`session$setCurrentTheme()` expects a `bslib::bs_theme()` object.", call. = FALSE)
|
||||
}
|
||||
|
||||
# Switching Bootstrap versions has weird & complex consequences
|
||||
# for the JS logic, so we forbid it
|
||||
current_version <- bslib::theme_version(getCurrentTheme())
|
||||
next_version <- bslib::theme_version(theme)
|
||||
if (!identical(current_version, next_version)) {
|
||||
stop(
|
||||
"session$setCurrentTheme() cannot be used to change the Bootstrap version ",
|
||||
"from ", current_version, " to ", next_version, ". ",
|
||||
"Try using `bs_theme(version = ", next_version, ")` for initial theme.",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
# Note that this will automatically scope to the session.
|
||||
shinyOptions(bootstrapTheme = theme)
|
||||
setCurrentTheme(theme)
|
||||
|
||||
# Invalidate
|
||||
private$currentThemeDependency(isolate(private$currentThemeDependency()) + 1)
|
||||
|
||||
# Call any theme dependency functions and make sure we get a list of deps back
|
||||
funcs <- getShinyOption("themeDependencyFuncs")
|
||||
funcs <- getShinyOption("themeDependencyFuncs", default = list())
|
||||
deps <- lapply(funcs, function(func) {
|
||||
deps <- func(theme)
|
||||
if (length(deps) == 0) return(NULL)
|
||||
@@ -1345,8 +1393,7 @@ ShinySession <- R6Class(
|
||||
sendInputMessage = function(inputId, message) {
|
||||
data <- list(id = inputId, message = message)
|
||||
|
||||
# Add to input message queue
|
||||
private$inputMessageQueue[[length(private$inputMessageQueue) + 1]] <- data
|
||||
private$inputMessageQueue$add(data)
|
||||
# Needed so that Shiny knows to actually flush the input message queue
|
||||
self$requestFlush()
|
||||
},
|
||||
@@ -1379,82 +1426,97 @@ ShinySession <- R6Class(
|
||||
return(NULL)
|
||||
}
|
||||
|
||||
tmp_info <- private$outputInfo[[name]] %OR% list(name = name)
|
||||
if (!is.null(private$outputInfo[[name]])) {
|
||||
return(private$outputInfo[[name]])
|
||||
}
|
||||
|
||||
# The following code will only run the first time this function has been
|
||||
# called for this output.
|
||||
|
||||
tmp_info <- list(name = name)
|
||||
|
||||
# cd_names() returns names of all items in clientData, without taking a
|
||||
# reactive dependency. It is a function and it's memoized, so that we do
|
||||
# the (relatively) expensive isolate(names(...)) call only when needed,
|
||||
# and at most one time in this function.
|
||||
.cd_names <- NULL
|
||||
cd_names <- function() {
|
||||
if (is.null(.cd_names)) {
|
||||
.cd_names <<- isolate(names(self$clientData))
|
||||
}
|
||||
.cd_names
|
||||
}
|
||||
|
||||
# If we don't already have width for this output info, see if it's
|
||||
# present, and if so, add it.
|
||||
|
||||
# Note that all the following clientData values (which are reactiveValues)
|
||||
# are wrapped in reactive() so that users can take a dependency on particular
|
||||
# output info (i.e., just depend on width/height, or just depend on bg, fg, etc).
|
||||
# To put it another way, if getCurrentOutputInfo() simply returned a list of values
|
||||
# from self$clientData, than anything that calls getCurrentOutputInfo() would take
|
||||
# a reactive dependency on all of these values.
|
||||
if (! ("width" %in% names(tmp_info)) ) {
|
||||
width_name <- paste0("output_", name, "_width")
|
||||
if (width_name %in% cd_names()) {
|
||||
tmp_info$width <- reactive({
|
||||
self$clientData[[width_name]]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (! ("height" %in% names(tmp_info)) ) {
|
||||
height_name <- paste0("output_", name, "_height")
|
||||
if (height_name %in% cd_names()) {
|
||||
tmp_info$height <- reactive({
|
||||
self$clientData[[height_name]]
|
||||
})
|
||||
}
|
||||
}
|
||||
cd_names <- isolate(names(self$clientData))
|
||||
|
||||
# parseCssColors() currently errors out if you hand it any NAs
|
||||
# This'll make sure we're always working with a string (and if
|
||||
# that string isn't a valid CSS color, will return NA)
|
||||
# https://github.com/rstudio/htmltools/issues/161
|
||||
parse_css_colors <- function(x) {
|
||||
htmltools::parseCssColors(x %OR% "", mustWork = FALSE)
|
||||
htmltools::parseCssColors(x %||% "", mustWork = FALSE)
|
||||
}
|
||||
|
||||
bg <- paste0("output_", name, "_bg")
|
||||
if (bg %in% cd_names()) {
|
||||
tmp_info$bg <- reactive({
|
||||
parse_css_colors(self$clientData[[bg]])
|
||||
})
|
||||
|
||||
# This function conditionally adds an item to tmp_info (for "width", it
|
||||
# would create tmp_info$width). It is added _if_ there is an entry in
|
||||
# clientData like "output_foo_width", where "foo" is the name of the
|
||||
# output. The first time `tmp_info$width()` is called, it creates a
|
||||
# reactive expression that reads `clientData$output_foo_width`, saves it,
|
||||
# then invokes that reactive. On subsequent calls, the reactive already
|
||||
# exists, so it simply invokes it.
|
||||
#
|
||||
# The reason it creates the reactive only on first use is so that it
|
||||
# doesn't spuriously create reactives.
|
||||
#
|
||||
# This function essentially generalizes the code below for names other
|
||||
# than just "width".
|
||||
#
|
||||
# width_name <- paste0("output_", name, "_width")
|
||||
# if (width_name %in% cd_names()) {
|
||||
# width_r <- NULL
|
||||
# tmp_info$width <- function() {
|
||||
# if (is.null(width_r)) {
|
||||
# width_r <<- reactive({
|
||||
# parse_css_colors(self$clientData[[width_name]])
|
||||
# })
|
||||
# }
|
||||
#
|
||||
# width_r()
|
||||
# }
|
||||
# }
|
||||
add_conditional_reactive <- function(prop, wrapfun = identity) {
|
||||
force(prop)
|
||||
force(wrapfun)
|
||||
|
||||
prop_name <- paste0("output_", name, "_", prop)
|
||||
|
||||
# Only add tmp_info$width if clientData has "output_foo_width"
|
||||
if (prop_name %in% cd_names) {
|
||||
r <- NULL
|
||||
|
||||
# Turn it into a function that creates a reactive on the first
|
||||
# invocation of getCurrentOutputInfo()$width() and saves it; future
|
||||
# invocations of getCurrentOutputInfo()$width() use the existing
|
||||
# reactive and save it.
|
||||
tmp_info[[prop]] <<- function() {
|
||||
if (is.null(r)) {
|
||||
r <<- reactive(label = prop_name, {
|
||||
wrapfun(self$clientData[[prop_name]])
|
||||
})
|
||||
}
|
||||
|
||||
r()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fg <- paste0("output_", name, "_fg")
|
||||
if (fg %in% cd_names()) {
|
||||
tmp_info$fg <- reactive({
|
||||
parse_css_colors(self$clientData[[fg]])
|
||||
})
|
||||
}
|
||||
|
||||
accent <- paste0("output_", name, "_accent")
|
||||
if (accent %in% cd_names()) {
|
||||
tmp_info$accent <- reactive({
|
||||
parse_css_colors(self$clientData[[accent]])
|
||||
})
|
||||
}
|
||||
|
||||
font <- paste0("output_", name, "_font")
|
||||
if (font %in% cd_names()) {
|
||||
tmp_info$font <- reactive({
|
||||
self$clientData[[font]]
|
||||
})
|
||||
}
|
||||
# Note that all the following clientData values (which are reactiveValues)
|
||||
# are wrapped in reactive() so that users can take a dependency on
|
||||
# particular output info (i.e., just depend on width/height, or just
|
||||
# depend on bg, fg, etc). To put it another way, if getCurrentOutputInfo()
|
||||
# simply returned a list of values from self$clientData, than anything
|
||||
# that calls getCurrentOutputInfo() would take a reactive dependency on
|
||||
# all of these values.
|
||||
add_conditional_reactive("width")
|
||||
add_conditional_reactive("height")
|
||||
add_conditional_reactive("bg", parse_css_colors)
|
||||
add_conditional_reactive("fg", parse_css_colors)
|
||||
add_conditional_reactive("accent", parse_css_colors)
|
||||
add_conditional_reactive("font")
|
||||
|
||||
private$outputInfo[[name]] <- tmp_info
|
||||
private$outputInfo[[name]]
|
||||
@@ -1471,7 +1533,7 @@ ShinySession <- R6Class(
|
||||
# Warn if trying to enable save-to-server bookmarking on a version of SS,
|
||||
# SSP, or Connect that doesn't support it.
|
||||
if (store == "server" && inShinyServer() &&
|
||||
is.null(getShinyOption("save.interface")))
|
||||
is.null(getShinyOption("save.interface", default = NULL)))
|
||||
{
|
||||
showNotification(
|
||||
"This app tried to enable saved-to-server bookmarking, but it is not supported by the hosting environment.",
|
||||
@@ -1887,15 +1949,17 @@ ShinySession <- R6Class(
|
||||
}
|
||||
return(httpResponse(
|
||||
200,
|
||||
download$contentType %OR% getContentType(filename),
|
||||
download$contentType %||% getContentType(filename),
|
||||
# owned=TRUE means tmpdata will be deleted after response completes
|
||||
list(file=tmpdata, owned=TRUE),
|
||||
c(
|
||||
'Content-Disposition' = ifelse(
|
||||
dlmatches[3] == '',
|
||||
'attachment; filename="' %.%
|
||||
gsub('(["\\\\])', '\\\\\\1', filename) %.% # yes, that many \'s
|
||||
'"',
|
||||
paste0(
|
||||
'attachment; filename="',
|
||||
gsub('(["\\\\])', '\\\\\\1', filename),
|
||||
'"'
|
||||
),
|
||||
'attachment'
|
||||
),
|
||||
'Cache-Control'='no-cache')))
|
||||
@@ -2067,9 +2131,11 @@ ShinySession <- R6Class(
|
||||
active = list(
|
||||
session = function() {
|
||||
shinyDeprecated(
|
||||
msg = paste("Attempted to access deprecated shinysession$session object.",
|
||||
"Please just access the shinysession object directly."),
|
||||
version = "0.11.1"
|
||||
"0.11.1", "shinysession$session",
|
||||
details = paste0(
|
||||
"Attempted to access deprecated shinysession$session object. ",
|
||||
"Please just access the shinysession object directly."
|
||||
)
|
||||
)
|
||||
self
|
||||
}
|
||||
@@ -2109,7 +2175,7 @@ ShinySession <- R6Class(
|
||||
if (getOption("shiny.allowoutputreads", FALSE)) {
|
||||
.subset2(x, 'impl')$getOutput(name)
|
||||
} else {
|
||||
stop("Reading from shinyoutput object is not allowed.")
|
||||
rlang::abort(paste0("Can't read output '", output, "'"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2118,12 +2184,12 @@ ShinySession <- R6Class(
|
||||
|
||||
#' @export
|
||||
`[.shinyoutput` <- function(values, name) {
|
||||
stop("Single-bracket indexing of shinyoutput object is not allowed.")
|
||||
rlang::abort("Can't index shinyoutput with `[`.")
|
||||
}
|
||||
|
||||
#' @export
|
||||
`[<-.shinyoutput` <- function(values, name, value) {
|
||||
stop("Single-bracket indexing of shinyoutput object is not allowed.")
|
||||
rlang::abort("Can't index shinyoutput with `[[`.")
|
||||
}
|
||||
|
||||
#' Set options for an output object.
|
||||
@@ -2475,3 +2541,19 @@ markdown <- function(mds, extensions = TRUE, .noWS = NULL, ...) {
|
||||
html <- rlang::exec(commonmark::markdown_html, glue::trim(mds), extensions = extensions, ...)
|
||||
htmltools::HTML(html, .noWS = .noWS)
|
||||
}
|
||||
|
||||
|
||||
# Check that an object is a ShinySession object, and give an informative error.
|
||||
# The default label is the caller function's name.
|
||||
validate_session_object <- function(session, label = as.character(sys.call(sys.parent())[[1]])) {
|
||||
if (missing(session) ||
|
||||
!inherits(session, c("ShinySession", "MockShinySession", "session_proxy")))
|
||||
{
|
||||
stop(call. = FALSE,
|
||||
sprintf(
|
||||
"`session` must be a 'ShinySession' object. Did you forget to pass `session` to `%s()`?",
|
||||
label
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
23
R/shinyapp.R
23
R/shinyapp.R
@@ -113,7 +113,10 @@ shinyApp <- function(ui, server, onStart=NULL, options=list(),
|
||||
#' @export
|
||||
shinyAppDir <- function(appDir, options=list()) {
|
||||
if (!utils::file_test('-d', appDir)) {
|
||||
stop("No Shiny application exists at the path \"", appDir, "\"")
|
||||
rlang::abort(
|
||||
paste0("No Shiny application exists at the path \"", appDir, "\""),
|
||||
class = "invalidShinyAppDir"
|
||||
)
|
||||
}
|
||||
|
||||
# In case it's a relative path, convert to absolute (so we're not adversely
|
||||
@@ -125,7 +128,10 @@ shinyAppDir <- function(appDir, options=list()) {
|
||||
} else if (file.exists.ci(appDir, "app.R")) {
|
||||
shinyAppDir_appR("app.R", appDir, options = options)
|
||||
} else {
|
||||
stop("App dir must contain either app.R or server.R.")
|
||||
rlang::abort(
|
||||
"App dir must contain either app.R or server.R.",
|
||||
class = "invalidShinyAppDir"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,6 +351,17 @@ loadSupport <- function(appDir=NULL, renv=new.env(parent=globalenv()), globalren
|
||||
appDir <- findEnclosingApp(".")
|
||||
}
|
||||
|
||||
descFile <- file.path.ci(appDir, "DESCRIPTION")
|
||||
if (file.exists(file.path.ci(appDir, "NAMESPACE")) ||
|
||||
(file.exists(descFile) &&
|
||||
identical(as.character(read.dcf(descFile, fields = "Type")), "Package")))
|
||||
{
|
||||
warning(
|
||||
"Loading R/ subdirectory for Shiny application, but this directory appears ",
|
||||
"to contain an R package. Sourcing files in R/ may cause unexpected behavior."
|
||||
)
|
||||
}
|
||||
|
||||
if (!is.null(globalrenv)){
|
||||
# Evaluate global.R, if it exists.
|
||||
globalPath <- file.path.ci(appDir, "global.R")
|
||||
@@ -558,7 +575,7 @@ as.tags.shiny.appobj <- function(x, ...) {
|
||||
# jcheng 06/06/2014: Unfortunate copy/paste between this function and
|
||||
# knit_print.shiny.appobj, but I am trying to make the most conservative
|
||||
# change possible due to upcoming release.
|
||||
opts <- x$options %OR% list()
|
||||
opts <- x$options %||% list()
|
||||
width <- if (is.null(opts$width)) "100%" else opts$width
|
||||
height <- if (is.null(opts$height)) "400" else opts$height
|
||||
|
||||
|
||||
41
R/shinyui.R
41
R/shinyui.R
@@ -51,7 +51,7 @@ renderPage <- function(ui, showcase=0, testMode=FALSE) {
|
||||
version <- getOption("shiny.jquery.version", 3)
|
||||
if (version == 3) {
|
||||
return(htmlDependency(
|
||||
"jquery", "3.5.1",
|
||||
"jquery", version_jquery,
|
||||
c(href = "shared"),
|
||||
script = "jquery.min.js"
|
||||
))
|
||||
@@ -74,7 +74,7 @@ renderPage <- function(ui, showcase=0, testMode=FALSE) {
|
||||
if (testMode) {
|
||||
# Add code injection listener if in test mode
|
||||
shiny_deps[[length(shiny_deps) + 1]] <-
|
||||
htmlDependency("shiny-testmode", utils::packageVersion("shiny"),
|
||||
htmlDependency("shiny-testmode", shinyPackageVersion(),
|
||||
c(href="shared"), script = "shiny-testmode.js")
|
||||
}
|
||||
|
||||
@@ -83,20 +83,28 @@ renderPage <- function(ui, showcase=0, testMode=FALSE) {
|
||||
}
|
||||
|
||||
shinyDependencies <- function() {
|
||||
version <- utils::packageVersion("shiny")
|
||||
list(
|
||||
bootstraplib::bs_dependency_defer(shinyDependencyCSS),
|
||||
bslib::bs_dependency_defer(shinyDependencyCSS),
|
||||
htmlDependency(
|
||||
name = "shiny-javascript",
|
||||
version = version,
|
||||
version = shinyPackageVersion(),
|
||||
src = c(href = "shared"),
|
||||
script = if (getOption("shiny.minified", TRUE)) "shiny.min.js" else "shiny.js"
|
||||
script =
|
||||
if (isTRUE(
|
||||
get_devmode_option(
|
||||
"shiny.minified",
|
||||
TRUE
|
||||
)
|
||||
))
|
||||
"shiny.min.js"
|
||||
else
|
||||
"shiny.js"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
shinyDependencyCSS <- function(theme) {
|
||||
version <- utils::packageVersion("shiny")
|
||||
version <- shinyPackageVersion()
|
||||
|
||||
if (!is_bs_theme(theme)) {
|
||||
return(htmlDependency(
|
||||
@@ -111,7 +119,7 @@ shinyDependencyCSS <- function(theme) {
|
||||
scss_files <- file.path(scss_home, c("bootstrap.scss", "shiny.scss"))
|
||||
scss_files <- lapply(scss_files, sass::sass_file)
|
||||
|
||||
bootstraplib::bs_dependency(
|
||||
bslib::bs_dependency(
|
||||
input = scss_files,
|
||||
theme = theme,
|
||||
name = "shiny-sass",
|
||||
@@ -122,7 +130,9 @@ shinyDependencyCSS <- function(theme) {
|
||||
|
||||
#' Create a Shiny UI handler
|
||||
#'
|
||||
#' Historically this function was used in ui.R files to register a user
|
||||
#' @description \lifecycle{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
|
||||
#' ensure that the last expression to be returned from ui.R is a user interface.
|
||||
#' This function is kept for backwards compatibility with older applications. It
|
||||
@@ -133,6 +143,17 @@ shinyDependencyCSS <- function(theme) {
|
||||
#' @keywords internal
|
||||
#' @export
|
||||
shinyUI <- function(ui) {
|
||||
if (in_devmode()) {
|
||||
shinyDeprecated(
|
||||
"0.10.0", "shinyUI()",
|
||||
details = paste0(
|
||||
"When removing `shinyUI()`, ",
|
||||
"ensure that the last expression returned from ui.R is a user interface ",
|
||||
"normally supplied to `shinyUI(ui)`."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
.globals$ui <- list(ui)
|
||||
ui
|
||||
}
|
||||
@@ -143,7 +164,7 @@ uiHttpHandler <- function(ui, uiPattern = "^/$") {
|
||||
|
||||
allowed_methods <- "GET"
|
||||
if (is.function(ui)) {
|
||||
allowed_methods <- attr(ui, "http_methods_supported", exact = TRUE) %OR% allowed_methods
|
||||
allowed_methods <- attr(ui, "http_methods_supported", exact = TRUE) %||% allowed_methods
|
||||
}
|
||||
|
||||
function(req) {
|
||||
|
||||
@@ -1,34 +1,105 @@
|
||||
utils::globalVariables('func')
|
||||
utils::globalVariables('func', add = TRUE)
|
||||
|
||||
#' Mark a function as a render function
|
||||
#'
|
||||
#' Should be called by implementers of `renderXXX` functions in order to
|
||||
#' mark their return values as Shiny render functions, and to provide a hint to
|
||||
#' Shiny regarding what UI function is most commonly used with this type of
|
||||
#' render function. This can be used in R Markdown documents to create complete
|
||||
#' output widgets out of just the render function.
|
||||
#' Should be called by implementers of `renderXXX` functions in order to mark
|
||||
#' their return values as Shiny render functions, and to provide a hint to Shiny
|
||||
#' regarding what UI function is most commonly used with this type of render
|
||||
#' function. This can be used in R Markdown documents to create complete output
|
||||
#' widgets out of just the render function.
|
||||
#'
|
||||
#' @param uiFunc A function that renders Shiny UI. Must take a single argument:
|
||||
#' an output ID.
|
||||
#' @param renderFunc A function that is suitable for assigning to a Shiny output
|
||||
#' slot.
|
||||
#' @param outputArgs A list of arguments to pass to the `uiFunc`. Render
|
||||
#' functions should include `outputArgs = list()` in their own parameter
|
||||
#' list, and pass through the value to `markRenderFunction`, to allow
|
||||
#' app authors to customize outputs. (Currently, this is only supported for
|
||||
#' dynamically generated UIs, such as those created by Shiny code snippets
|
||||
#' embedded in R Markdown documents).
|
||||
#' functions should include `outputArgs = list()` in their own parameter list,
|
||||
#' and pass through the value to `markRenderFunction`, to allow app authors to
|
||||
#' customize outputs. (Currently, this is only supported for dynamically
|
||||
#' generated UIs, such as those created by Shiny code snippets embedded in R
|
||||
#' Markdown documents).
|
||||
#' @param cacheHint One of `"auto"`, `FALSE`, or some other information to
|
||||
#' identify this instance for caching using [bindCache()]. If `"auto"`, it
|
||||
#' will try to automatically infer caching information. If `FALSE`, do not
|
||||
#' allow caching for the object. Some render functions (such as [renderPlot])
|
||||
#' contain internal state that makes them unsuitable for caching.
|
||||
#' @param cacheWriteHook Used if the render function is passed to `bindCache()`.
|
||||
#' This is an optional callback function to invoke before saving the value
|
||||
#' from the render function to the cache. This function must accept one
|
||||
#' argument, the value returned from `renderFunc`, and should return the value
|
||||
#' to store in the cache.
|
||||
#' @param cacheReadHook Used if the render function is passed to `bindCache()`.
|
||||
#' This is an optional callback function to invoke after reading a value from
|
||||
#' the cache (if there is a cache hit). The function will be passed one
|
||||
#' argument, the value retrieved from the cache. This can be useful when some
|
||||
#' side effect needs to occur for a render function to behave correctly. For
|
||||
#' example, some render functions call [createWebDependency()] so that Shiny
|
||||
#' is able to serve JS and CSS resources.
|
||||
#' @return The `renderFunc` function, with annotations.
|
||||
#'
|
||||
#' @seealso [createRenderFunction()], [quoToFunction()]
|
||||
#' @export
|
||||
markRenderFunction <- function(uiFunc, renderFunc, outputArgs = list()) {
|
||||
markRenderFunction <- function(
|
||||
uiFunc,
|
||||
renderFunc,
|
||||
outputArgs = list(),
|
||||
cacheHint = "auto",
|
||||
cacheWriteHook = NULL,
|
||||
cacheReadHook = NULL
|
||||
) {
|
||||
force(renderFunc)
|
||||
|
||||
# a mutable object that keeps track of whether `useRenderFunction` has been
|
||||
# executed (this usually only happens when rendering Shiny code snippets in
|
||||
# an interactive R Markdown document); its initial value is FALSE
|
||||
hasExecuted <- Mutable$new()
|
||||
hasExecuted$set(FALSE)
|
||||
|
||||
origRenderFunc <- renderFunc
|
||||
renderFunc <- function(...) {
|
||||
if (is.null(uiFunc)) {
|
||||
uiFunc <- function(id) {
|
||||
pre(
|
||||
"No UI/output function provided for render function. ",
|
||||
"Please see ?shiny::markRenderFunction and ?shiny::createRenderFunction."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (identical(cacheHint, "auto")) {
|
||||
origUserFunc <- attr(renderFunc, "wrappedFunc", exact = TRUE)
|
||||
# The result could be NULL, but don't warn now because it'll only affect
|
||||
# users if they try to use caching. We'll warn when someone calls
|
||||
# bindCache() on this object.
|
||||
if (is.null(origUserFunc)) {
|
||||
cacheHint <- NULL
|
||||
} else {
|
||||
# Add in the wrapper render function and they output function, because
|
||||
# they can be useful for distinguishing two renderX functions that receive
|
||||
# the same user expression but do different things with them (like
|
||||
# renderText and renderPrint).
|
||||
cacheHint <- list(
|
||||
origUserFunc = origUserFunc,
|
||||
renderFunc = renderFunc,
|
||||
outputFunc = uiFunc
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (!is.null(cacheHint) && !is_false(cacheHint)) {
|
||||
if (!is.list(cacheHint)) {
|
||||
cacheHint <- list(cacheHint)
|
||||
}
|
||||
# For functions, remove the env and source refs because they can cause
|
||||
# spurious differences.
|
||||
# For expressions, remove source refs.
|
||||
# For everything else, do nothing.
|
||||
cacheHint <- lapply(cacheHint, function(x) {
|
||||
if (is.function(x)) formalsAndBody(x)
|
||||
else if (is.language(x)) zap_srcref(x)
|
||||
else x
|
||||
})
|
||||
}
|
||||
|
||||
wrappedRenderFunc <- function(...) {
|
||||
# if the user provided something through `outputArgs` BUT the
|
||||
# `useRenderFunction` was not executed, then outputArgs will be ignored,
|
||||
# so throw a warning to let user know the correct usage
|
||||
@@ -41,15 +112,20 @@ markRenderFunction <- function(uiFunc, renderFunc, outputArgs = list()) {
|
||||
# stop warning from happening again for the same object
|
||||
hasExecuted$set(TRUE)
|
||||
}
|
||||
if (is.null(formals(origRenderFunc))) origRenderFunc()
|
||||
else origRenderFunc(...)
|
||||
if (is.null(formals(renderFunc))) renderFunc()
|
||||
else renderFunc(...)
|
||||
}
|
||||
|
||||
structure(renderFunc,
|
||||
class = c("shiny.render.function", "function"),
|
||||
outputFunc = uiFunc,
|
||||
outputArgs = outputArgs,
|
||||
hasExecuted = hasExecuted)
|
||||
structure(
|
||||
wrappedRenderFunc,
|
||||
class = c("shiny.render.function", "function"),
|
||||
outputFunc = uiFunc,
|
||||
outputArgs = outputArgs,
|
||||
hasExecuted = hasExecuted,
|
||||
cacheHint = cacheHint,
|
||||
cacheWriteHook = cacheWriteHook,
|
||||
cacheReadHook = cacheReadHook
|
||||
)
|
||||
}
|
||||
|
||||
#' @export
|
||||
@@ -59,6 +135,9 @@ print.shiny.render.function <- function(x, ...) {
|
||||
|
||||
#' Implement render functions
|
||||
#'
|
||||
#' This function is a wrapper for [markRenderFunction()] which provides support
|
||||
#' for async computation via promises.
|
||||
#'
|
||||
#' @param func A function without parameters, that returns user data. If the
|
||||
#' returned value is a promise, then the render function will proceed in async
|
||||
#' mode.
|
||||
@@ -70,34 +149,63 @@ print.shiny.render.function <- function(x, ...) {
|
||||
#' @param outputFunc The UI function that is used (or most commonly used) with
|
||||
#' this render function. This can be used in R Markdown documents to create
|
||||
#' complete output widgets out of just the render function.
|
||||
#' @param outputArgs A list of arguments to pass to the `outputFunc`.
|
||||
#' Render functions should include `outputArgs = list()` in their own
|
||||
#' parameter list, and pass through the value as this argument, to allow app
|
||||
#' authors to customize outputs. (Currently, this is only supported for
|
||||
#' dynamically generated UIs, such as those created by Shiny code snippets
|
||||
#' embedded in R Markdown documents).
|
||||
#' @inheritParams markRenderFunction
|
||||
#' @return An annotated render function, ready to be assigned to an
|
||||
#' `output` slot.
|
||||
#'
|
||||
#' @seealso [quoToFunction()], [markRenderFunction()].
|
||||
#'
|
||||
#' @examples
|
||||
#' # A very simple render function
|
||||
#' renderTriple <- function(x) {
|
||||
#' x <- substitute(x)
|
||||
#' if (!rlang::is_quosure(x)) {
|
||||
#' x <- rlang::new_quosure(x, env = parent.frame())
|
||||
#' }
|
||||
#' func <- quoToFunction(x, "renderTriple")
|
||||
#'
|
||||
#' createRenderFunction(
|
||||
#' func,
|
||||
#' transform = function(value, session, name, ...) {
|
||||
#' paste(rep(value, 3), collapse=", ")
|
||||
#' },
|
||||
#' outputFunc = textOutput
|
||||
#' )
|
||||
#' }
|
||||
#'
|
||||
#' # Test render function from the console
|
||||
#' a <- 1
|
||||
#' r <- renderTriple({ a + 1 })
|
||||
#' a <- 2
|
||||
#' r()
|
||||
#' @export
|
||||
createRenderFunction <- function(
|
||||
func, transform = function(value, session, name, ...) value,
|
||||
outputFunc = NULL, outputArgs = NULL
|
||||
func,
|
||||
transform = function(value, session, name, ...) value,
|
||||
outputFunc = NULL,
|
||||
outputArgs = NULL,
|
||||
cacheHint = "auto",
|
||||
cacheWriteHook = NULL,
|
||||
cacheReadHook = NULL
|
||||
) {
|
||||
|
||||
renderFunc <- function(shinysession, name, ...) {
|
||||
hybrid_chain(
|
||||
func(),
|
||||
function(value, .visible) {
|
||||
transform(setVisible(value, .visible), shinysession, name, ...)
|
||||
function(value) {
|
||||
transform(value, shinysession, name, ...)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (!is.null(outputFunc))
|
||||
markRenderFunction(outputFunc, renderFunc, outputArgs = outputArgs)
|
||||
else
|
||||
renderFunc
|
||||
# Hoist func's wrappedFunc attribute into renderFunc, so that when we pass
|
||||
# renderFunc on to markRenderFunction, it is able to find the original user
|
||||
# function.
|
||||
if (identical(cacheHint, "auto")) {
|
||||
attr(renderFunc, "wrappedFunc") <- attr(func, "wrappedFunc", exact = TRUE)
|
||||
}
|
||||
|
||||
markRenderFunction(outputFunc, renderFunc, outputArgs, cacheHint,
|
||||
cacheWriteHook, cacheReadHook)
|
||||
}
|
||||
|
||||
useRenderFunction <- function(renderFunc, inline = FALSE) {
|
||||
@@ -140,6 +248,22 @@ as.tags.shiny.render.function <- function(x, ..., inline = FALSE) {
|
||||
useRenderFunction(x, inline = inline)
|
||||
}
|
||||
|
||||
# Get relevant attributes from a render function object.
|
||||
renderFunctionAttributes <- function(x) {
|
||||
attrs <- c("outputFunc", "outputArgs", "hasExecuted", "cacheHint")
|
||||
names(attrs) <- attrs
|
||||
lapply(attrs, function(name) attr(x, name, exact = TRUE))
|
||||
}
|
||||
|
||||
# Add a named list of attributes to an object
|
||||
addAttributes <- function(x, attrs) {
|
||||
nms <- names(attrs)
|
||||
for (i in seq_along(attrs)) {
|
||||
attr(x, nms[i]) <- attrs[[i]]
|
||||
}
|
||||
x
|
||||
}
|
||||
|
||||
|
||||
#' Mark a render function with attributes that will be used by the output
|
||||
#'
|
||||
@@ -274,8 +398,10 @@ markOutputAttrs <- function(renderFunc, snapshotExclude = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
renderImage <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
deleteFile, outputArgs=list()) {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
deleteFile, outputArgs=list())
|
||||
{
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderImage")
|
||||
|
||||
# missing() must be used directly within the function with the given arg
|
||||
if (missing(deleteFile)) {
|
||||
@@ -324,7 +450,7 @@ renderImage <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
}
|
||||
|
||||
# If contentType not specified, autodetect based on extension
|
||||
contentType <- imageinfo$contentType %OR% getContentType(imageinfo$src)
|
||||
contentType <- imageinfo$contentType %||% getContentType(imageinfo$src)
|
||||
|
||||
# Extra values are everything in imageinfo except 'src' and 'contentType'
|
||||
extra_attr <- imageinfo[!names(imageinfo) %in% c('src', 'contentType')]
|
||||
@@ -333,7 +459,10 @@ renderImage <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
c(src = session$fileUrl(name, file=imageinfo$src, contentType=contentType),
|
||||
extra_attr)
|
||||
},
|
||||
imageOutput, outputArgs)
|
||||
imageOutput,
|
||||
outputArgs,
|
||||
cacheHint = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
# TODO: If we ever take a dependency on fs, it'd be great to replace this with
|
||||
@@ -405,8 +534,10 @@ isTemp <- function(path, tempDir = tempdir(), mustExist) {
|
||||
#' @example res/text-example.R
|
||||
#' @export
|
||||
renderPrint <- function(expr, env = parent.frame(), quoted = FALSE,
|
||||
width = getOption('width'), outputArgs=list()) {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
width = getOption('width'), outputArgs=list())
|
||||
{
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderPrint")
|
||||
|
||||
# Set a promise domain that sets the console width
|
||||
# and captures output
|
||||
@@ -419,12 +550,12 @@ renderPrint <- function(expr, env = parent.frame(), quoted = FALSE,
|
||||
{
|
||||
promises::with_promise_domain(domain, func())
|
||||
},
|
||||
function(value, .visible) {
|
||||
if (.visible) {
|
||||
cat(file = domain$conn, paste(utils::capture.output(value, append = TRUE), collapse = "\n"))
|
||||
function(value) {
|
||||
res <- withVisible(value)
|
||||
if (res$visible) {
|
||||
cat(file = domain$conn, paste(utils::capture.output(res$value, append = TRUE), collapse = "\n"))
|
||||
}
|
||||
res <- paste(readLines(domain$conn, warn = FALSE), collapse = "\n")
|
||||
res
|
||||
paste(readLines(domain$conn, warn = FALSE), collapse = "\n")
|
||||
},
|
||||
finally = function() {
|
||||
close(domain$conn)
|
||||
@@ -432,7 +563,15 @@ renderPrint <- function(expr, env = parent.frame(), quoted = FALSE,
|
||||
)
|
||||
}
|
||||
|
||||
markRenderFunction(verbatimTextOutput, renderFunc, outputArgs = outputArgs)
|
||||
markRenderFunction(
|
||||
verbatimTextOutput,
|
||||
renderFunc,
|
||||
outputArgs,
|
||||
cacheHint = list(
|
||||
label = "renderPrint",
|
||||
origUserExpr = get_expr(expr)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
createRenderPrintPromiseDomain <- function(width) {
|
||||
@@ -482,14 +621,17 @@ createRenderPrintPromiseDomain <- function(width) {
|
||||
#' @rdname renderPrint
|
||||
renderText <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
outputArgs=list(), sep=" ") {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderText")
|
||||
|
||||
createRenderFunction(
|
||||
func,
|
||||
function(value, session, name, ...) {
|
||||
paste(utils::capture.output(cat(value, sep=sep)), collapse="\n")
|
||||
},
|
||||
textOutput, outputArgs
|
||||
textOutput,
|
||||
outputArgs
|
||||
)
|
||||
}
|
||||
|
||||
@@ -530,9 +672,11 @@ renderText <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#'
|
||||
renderUI <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
outputArgs=list()) {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
renderUI <- function(expr, env = parent.frame(), quoted = FALSE,
|
||||
outputArgs = list())
|
||||
{
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderUI")
|
||||
|
||||
createRenderFunction(
|
||||
func,
|
||||
@@ -542,7 +686,8 @@ renderUI <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
|
||||
processDeps(result, shinysession)
|
||||
},
|
||||
uiOutput, outputArgs
|
||||
uiOutput,
|
||||
outputArgs
|
||||
)
|
||||
}
|
||||
|
||||
@@ -565,7 +710,7 @@ renderUI <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
#' that file path. (Reactive values and functions may be used from this
|
||||
#' function.)
|
||||
#' @param contentType A string of the download's
|
||||
#' [content type](http://en.wikipedia.org/wiki/Internet_media_type), for
|
||||
#' [content type](https://en.wikipedia.org/wiki/Internet_media_type), for
|
||||
#' example `"text/csv"` or `"image/png"`. If `NULL` or
|
||||
#' `NA`, the content type will be guessed based on the filename
|
||||
#' extension, or `application/octet-stream` if the extension is unknown.
|
||||
@@ -603,32 +748,41 @@ downloadHandler <- function(filename, content, contentType=NA, outputArgs=list()
|
||||
shinysession$registerDownload(name, filename, contentType, content)
|
||||
}
|
||||
snapshotExclude(
|
||||
markRenderFunction(downloadButton, renderFunc, outputArgs = outputArgs)
|
||||
markRenderFunction(downloadButton, renderFunc, outputArgs, cacheHint = FALSE)
|
||||
)
|
||||
}
|
||||
|
||||
#' Table output with the JavaScript library DataTables
|
||||
#' Table output with the JavaScript DataTables library
|
||||
#'
|
||||
#' @description
|
||||
#' Makes a reactive version of the given function that returns a data frame (or
|
||||
#' matrix), which will be rendered with the DataTables library. Paging,
|
||||
#' searching, filtering, and sorting can be done on the R side using Shiny as
|
||||
#' the server infrastructure.
|
||||
#' matrix), which will be rendered with the [DataTables](https://datatables.net)
|
||||
#' library. Paging, searching, filtering, and sorting can be done on the R side
|
||||
#' using Shiny as the server infrastructure.
|
||||
#'
|
||||
#' This function only provides the server-side version of DataTables (using R
|
||||
#' to process the data object on the server side). There is a separate
|
||||
#' [DT](https://github.com/rstudio/DT) that allows you to create both
|
||||
#' server-side and client-side DataTables, and supports additional features.
|
||||
#' Learn more at <https://rstudio.github.io/DT/shiny.html>.
|
||||
#'
|
||||
#' For the `options` argument, the character elements that have the class
|
||||
#' `"AsIs"` (usually returned from [base::I()]) will be evaluated in
|
||||
#' JavaScript. This is useful when the type of the option value is not supported
|
||||
#' in JSON, e.g., a JavaScript function, which can be obtained by evaluating a
|
||||
#' character string. Note this only applies to the root-level elements of the
|
||||
#' options list, and the `I()` notation does not work for lower-level
|
||||
#' elements in the list.
|
||||
#' @param expr An expression that returns a data frame or a matrix.
|
||||
#' @inheritParams renderTable
|
||||
#' @param options A list of initialization options to be passed to DataTables,
|
||||
#' or a function to return such a list.
|
||||
#' or a function to return such a list. You can find a complete list of
|
||||
#' options at <https://datatables.net/reference/option/>.
|
||||
#'
|
||||
#' Any top-level strings with class `"AsIs"` (as created by [I()]) will be
|
||||
#' evaluated in JavaScript. This is useful when the type of the option value
|
||||
#' is not supported in JSON, e.g., a JavaScript function, which can be
|
||||
#' obtained by evaluating a character string. This only applies to the
|
||||
#' root-level elements of options list, and does not worked for lower-level
|
||||
#' elements in the list.
|
||||
#' @param searchDelay The delay for searching, in milliseconds (to avoid too
|
||||
#' frequent search requests).
|
||||
#' @param callback A JavaScript function to be applied to the DataTable object.
|
||||
#' This is useful for DataTables plug-ins, which often require the DataTable
|
||||
#' instance to be available (<http://datatables.net/extensions/>).
|
||||
#' instance to be available.
|
||||
#' @param escape Whether to escape HTML entities in the table: `TRUE` means
|
||||
#' to escape the whole table, and `FALSE` means not to escape it.
|
||||
#' Alternatively, you can specify numeric column indices or column names to
|
||||
@@ -636,17 +790,8 @@ downloadHandler <- function(filename, content, contentType=NA, outputArgs=list()
|
||||
#' `c(1, 3, 4)`, or `c(-1, -3)` (all columns except the first and
|
||||
#' third), or `c('Species', 'Sepal.Length')`.
|
||||
#' @param outputArgs A list of arguments to be passed through to the implicit
|
||||
#' call to [dataTableOutput()] when `renderDataTable` is used
|
||||
#' call to `dataTableOutput()` when `renderDataTable()` is used
|
||||
#' in an interactive R Markdown document.
|
||||
#'
|
||||
#' @references <http://datatables.net>
|
||||
#' @note This function only provides the server-side version of DataTables
|
||||
#' (using R to process the data object on the server side). There is a
|
||||
#' separate package \pkg{DT} (<https://github.com/rstudio/DT>) that allows
|
||||
#' you to create both server-side and client-side DataTables, and supports
|
||||
#' additional DataTables features. Consider using `DT::renderDataTable()`
|
||||
#' and `DT::dataTableOutput()` (see
|
||||
#' <http://rstudio.github.io/DT/shiny.html> for more information).
|
||||
#' @export
|
||||
#' @inheritParams renderPlot
|
||||
#' @examples
|
||||
@@ -674,8 +819,18 @@ downloadHandler <- function(filename, content, contentType=NA, outputArgs=list()
|
||||
renderDataTable <- function(expr, options = NULL, searchDelay = 500,
|
||||
callback = 'function(oTable) {}', escape = TRUE,
|
||||
env = parent.frame(), quoted = FALSE,
|
||||
outputArgs=list()) {
|
||||
installExprFunction(expr, "func", env, quoted)
|
||||
outputArgs=list())
|
||||
{
|
||||
|
||||
if (in_devmode()) {
|
||||
shinyDeprecated(
|
||||
"0.11.1", "shiny::renderDataTable()", "DT::renderDataTable()",
|
||||
details = "See <https://rstudio.github.io/DT/shiny.html> for more information"
|
||||
)
|
||||
}
|
||||
|
||||
expr <- get_quosure(expr, env, quoted)
|
||||
func <- quoToFunction(expr, "renderDataTable")
|
||||
|
||||
renderFunc <- function(shinysession, name, ...) {
|
||||
if (is.function(options)) options <- options()
|
||||
@@ -709,7 +864,8 @@ renderDataTable <- function(expr, options = NULL, searchDelay = 500,
|
||||
)
|
||||
}
|
||||
|
||||
renderFunc <- markRenderFunction(dataTableOutput, renderFunc, outputArgs = outputArgs)
|
||||
renderFunc <- markRenderFunction(dataTableOutput, renderFunc, outputArgs,
|
||||
cacheHint = FALSE)
|
||||
|
||||
renderFunc <- snapshotPreprocessOutput(renderFunc, function(value) {
|
||||
# Remove the action field so that it's not saved in test snapshots. It
|
||||
@@ -766,6 +922,9 @@ checkDT9 <- function(options) {
|
||||
# Deprecated functions ------------------------------------------------------
|
||||
|
||||
#' Deprecated reactive functions
|
||||
#'
|
||||
#' @description \lifecycle{superseded}
|
||||
#'
|
||||
#' @name deprecatedReactives
|
||||
#' @keywords internal
|
||||
NULL
|
||||
@@ -780,7 +939,7 @@ NULL
|
||||
#' @rdname deprecatedReactives
|
||||
#' @export
|
||||
reactivePlot <- function(func, width='auto', height='auto', ...) {
|
||||
shinyDeprecated(new="renderPlot")
|
||||
shinyDeprecated("0.4.0", "reactivePlot()", "renderPlot()")
|
||||
renderPlot({ func() }, width=width, height=height, ...)
|
||||
}
|
||||
|
||||
@@ -790,7 +949,7 @@ reactivePlot <- function(func, width='auto', height='auto', ...) {
|
||||
#' @rdname deprecatedReactives
|
||||
#' @export
|
||||
reactiveTable <- function(func, ...) {
|
||||
shinyDeprecated(new="renderTable")
|
||||
shinyDeprecated("0.4.0", "reactiveTable()", "renderTable()")
|
||||
renderTable({ func() })
|
||||
}
|
||||
|
||||
@@ -800,7 +959,7 @@ reactiveTable <- function(func, ...) {
|
||||
#' @rdname deprecatedReactives
|
||||
#' @export
|
||||
reactivePrint <- function(func) {
|
||||
shinyDeprecated(new="renderPrint")
|
||||
shinyDeprecated("0.4.0", "reactivePrint()", "renderPrint()")
|
||||
renderPrint({ func() })
|
||||
}
|
||||
|
||||
@@ -810,7 +969,7 @@ reactivePrint <- function(func) {
|
||||
#' @rdname deprecatedReactives
|
||||
#' @export
|
||||
reactiveUI <- function(func) {
|
||||
shinyDeprecated(new="renderUI")
|
||||
shinyDeprecated("0.4.0", "reactiveUI()", "renderUI()")
|
||||
renderUI({ func() })
|
||||
}
|
||||
|
||||
@@ -820,6 +979,6 @@ reactiveUI <- function(func) {
|
||||
#' @rdname deprecatedReactives
|
||||
#' @export
|
||||
reactiveText <- function(func) {
|
||||
shinyDeprecated(new="renderText")
|
||||
shinyDeprecated("0.4.0", "reactiveText()", "renderText()")
|
||||
renderText({ func() })
|
||||
}
|
||||
|
||||
70
R/stack.R
70
R/stack.R
@@ -1,70 +0,0 @@
|
||||
# A Stack object backed by a list. The backing list will grow or shrink as
|
||||
# the stack changes in size.
|
||||
Stack <- R6Class(
|
||||
'Stack',
|
||||
portable = FALSE,
|
||||
class = FALSE,
|
||||
public = list(
|
||||
|
||||
initialize = function(init = 20L) {
|
||||
# init is the initial size of the list. It is also used as the minimum
|
||||
# size of the list as it shrinks.
|
||||
private$stack <- vector("list", init)
|
||||
private$init <- init
|
||||
},
|
||||
|
||||
push = function(..., .list = NULL) {
|
||||
args <- c(list(...), .list)
|
||||
new_size <- count + length(args)
|
||||
|
||||
# Grow if needed; double in size
|
||||
while (new_size > length(stack)) {
|
||||
stack[length(stack) * 2] <<- list(NULL)
|
||||
}
|
||||
stack[count + seq_along(args)] <<- args
|
||||
count <<- new_size
|
||||
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
pop = function() {
|
||||
if (count == 0L)
|
||||
return(NULL)
|
||||
|
||||
value <- stack[[count]]
|
||||
stack[count] <<- list(NULL)
|
||||
count <<- count - 1L
|
||||
|
||||
# Shrink list if < 1/4 of the list is used, down to a minimum size of `init`
|
||||
len <- length(stack)
|
||||
if (len > init && count < len/4) {
|
||||
new_len <- max(init, ceiling(len/2))
|
||||
stack <<- stack[seq_len(new_len)]
|
||||
}
|
||||
|
||||
value
|
||||
},
|
||||
|
||||
peek = function() {
|
||||
if (count == 0L)
|
||||
return(NULL)
|
||||
stack[[count]]
|
||||
},
|
||||
|
||||
size = function() {
|
||||
count
|
||||
},
|
||||
|
||||
# Return the entire stack as a list, where the first item in the list is the
|
||||
# oldest item in the stack, and the last item is the most recently added.
|
||||
as_list = function() {
|
||||
stack[seq_len(count)]
|
||||
}
|
||||
),
|
||||
|
||||
private = list(
|
||||
stack = NULL, # A list that holds the items
|
||||
count = 0L, # Current number of items in the stack
|
||||
init = 20L # Initial and minimum size of the stack
|
||||
)
|
||||
)
|
||||
@@ -34,7 +34,9 @@
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateTextInput <- function(session, inputId, label = NULL, value = NULL, placeholder = NULL) {
|
||||
updateTextInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, placeholder = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
message <- dropNulls(list(label=label, value=value, placeholder=placeholder))
|
||||
session$sendInputMessage(inputId, message)
|
||||
}
|
||||
@@ -106,7 +108,9 @@ updateTextAreaInput <- updateTextInput
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateCheckboxInput <- function(session, inputId, label = NULL, value = NULL) {
|
||||
updateCheckboxInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
message <- dropNulls(list(label=label, value=value))
|
||||
session$sendInputMessage(inputId, message)
|
||||
}
|
||||
@@ -165,7 +169,9 @@ updateCheckboxInput <- function(session, inputId, label = NULL, value = NULL) {
|
||||
#' }
|
||||
#' @rdname updateActionButton
|
||||
#' @export
|
||||
updateActionButton <- function(session, inputId, label = NULL, icon = NULL) {
|
||||
updateActionButton <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, icon = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
if (!is.null(icon)) icon <- as.character(validateIcon(icon))
|
||||
message <- dropNulls(list(label=label, icon=icon))
|
||||
session$sendInputMessage(inputId, message)
|
||||
@@ -206,8 +212,10 @@ updateActionLink <- updateActionButton
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateDateInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
min = NULL, max = NULL) {
|
||||
updateDateInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL,
|
||||
min = NULL, max = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
value <- dateYMD(value, "value")
|
||||
min <- dateYMD(min, "min")
|
||||
@@ -251,9 +259,11 @@ updateDateInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
updateDateRangeInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL,
|
||||
start = NULL, end = NULL, min = NULL,
|
||||
max = NULL) {
|
||||
max = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
start <- dateYMD(start, "start")
|
||||
end <- dateYMD(end, "end")
|
||||
@@ -273,7 +283,7 @@ updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
#' Change the selected tab on the client
|
||||
#'
|
||||
#' @param session The `session` object passed to function given to
|
||||
#' `shinyServer`.
|
||||
#' `shinyServer`. Default is `getDefaultReactiveDomain()`.
|
||||
#' @param inputId The id of the `tabsetPanel`, `navlistPanel`,
|
||||
#' or `navbarPage` object.
|
||||
#' @inheritParams tabsetPanel
|
||||
@@ -309,7 +319,9 @@ updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateTabsetPanel <- function(session, inputId, selected = NULL) {
|
||||
updateTabsetPanel <- function(session = getDefaultReactiveDomain(), inputId, selected = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
message <- dropNulls(list(value = selected))
|
||||
session$sendInputMessage(inputId, message)
|
||||
}
|
||||
@@ -357,9 +369,11 @@ updateNavlistPanel <- updateTabsetPanel
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateNumericInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
updateNumericInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL,
|
||||
min = NULL, max = NULL, step = NULL) {
|
||||
|
||||
validate_session_object(session)
|
||||
|
||||
message <- dropNulls(list(
|
||||
label = label, value = formatNoSci(value),
|
||||
min = formatNoSci(min), max = formatNoSci(max), step = formatNoSci(step)
|
||||
@@ -404,9 +418,11 @@ updateNumericInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
#' )
|
||||
#' }
|
||||
#' @export
|
||||
updateSliderInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
updateSliderInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL,
|
||||
min = NULL, max = NULL, step = NULL, timeFormat = NULL, timezone = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
# If no min/max/value is provided, we won't know the
|
||||
# type, and this will return an empty string
|
||||
dataType <- getSliderType(min, max, value)
|
||||
@@ -439,6 +455,8 @@ updateSliderInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
updateInputOptions <- function(session, inputId, label = NULL, choices = NULL,
|
||||
selected = NULL, inline = FALSE, type = NULL,
|
||||
choiceNames = NULL, choiceValues = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
if (is.null(type)) stop("Please specify the type ('checkbox' or 'radio')")
|
||||
|
||||
args <- normalizeChoicesArgs(choices, choiceNames, choiceValues, mustExist = FALSE)
|
||||
@@ -496,9 +514,12 @@ updateInputOptions <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateCheckboxGroupInput <- function(session, inputId, label = NULL,
|
||||
updateCheckboxGroupInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL,
|
||||
choices = NULL, selected = NULL, inline = FALSE,
|
||||
choiceNames = NULL, choiceValues = NULL) {
|
||||
choiceNames = NULL, choiceValues = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
updateInputOptions(session, inputId, label, choices, selected,
|
||||
inline, "checkbox", choiceNames, choiceValues)
|
||||
}
|
||||
@@ -539,9 +560,12 @@ updateCheckboxGroupInput <- function(session, inputId, label = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
updateRadioButtons <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL,
|
||||
selected = NULL, inline = FALSE,
|
||||
choiceNames = NULL, choiceValues = NULL) {
|
||||
choiceNames = NULL, choiceValues = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
# you must select at least one radio button
|
||||
if (is.null(selected)) {
|
||||
if (!is.null(choices)) selected <- choices[[1]]
|
||||
@@ -591,8 +615,11 @@ updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' shinyApp(ui, server)
|
||||
#' }
|
||||
#' @export
|
||||
updateSelectInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
selected = NULL) {
|
||||
updateSelectInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL,
|
||||
selected = NULL)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
choices <- if (!is.null(choices)) choicesWithNames(choices)
|
||||
if (!is.null(selected)) selected <- as.character(selected)
|
||||
options <- if (!is.null(choices)) selectOptions(choices, selected, inputId, FALSE)
|
||||
@@ -607,9 +634,12 @@ updateSelectInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' `choices` into the page at once (i.e., only use the client-side
|
||||
#' version of \pkg{selectize.js})
|
||||
#' @export
|
||||
updateSelectizeInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
updateSelectizeInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL,
|
||||
selected = NULL, options = list(),
|
||||
server = FALSE) {
|
||||
server = FALSE)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
if (length(options)) {
|
||||
res <- checkAsIs(options)
|
||||
cfg <- tags$script(
|
||||
@@ -722,12 +752,15 @@ updateSelectizeInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' @rdname updateSelectInput
|
||||
#' @inheritParams varSelectInput
|
||||
#' @export
|
||||
updateVarSelectInput <- function(session, inputId, label = NULL, data = NULL, selected = NULL) {
|
||||
updateVarSelectInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, data = NULL, selected = NULL) {
|
||||
validate_session_object(session)
|
||||
|
||||
if (is.null(data)) {
|
||||
choices <- NULL
|
||||
} else {
|
||||
choices <- colnames(data)
|
||||
}
|
||||
|
||||
updateSelectInput(
|
||||
session = session,
|
||||
inputId = inputId,
|
||||
@@ -738,7 +771,11 @@ updateVarSelectInput <- function(session, inputId, label = NULL, data = NULL, se
|
||||
}
|
||||
#' @rdname updateSelectInput
|
||||
#' @export
|
||||
updateVarSelectizeInput <- function(session, inputId, label = NULL, data = NULL, selected = NULL, options = list(), server = FALSE) {
|
||||
updateVarSelectizeInput <- function(session = getDefaultReactiveDomain(), inputId, label = NULL,
|
||||
data = NULL, selected = NULL, options = list(), server = FALSE)
|
||||
{
|
||||
validate_session_object(session)
|
||||
|
||||
if (is.null(data)) {
|
||||
choices <- NULL
|
||||
} else {
|
||||
|
||||
110
R/utils-lang.R
Normal file
110
R/utils-lang.R
Normal file
@@ -0,0 +1,110 @@
|
||||
# Given a list of quosures, return a function that will evaluate them and return
|
||||
# a list of resulting values. If the list contains a single expression, unwrap
|
||||
# it from the list.
|
||||
quos_to_func <- function(qs) {
|
||||
if (length(qs) == 0) {
|
||||
stop("Need at least one item in `...` to use as cache key or event.")
|
||||
}
|
||||
|
||||
if (length(qs) == 1) {
|
||||
# Special case for one quosure. This is needed for async to work -- that is,
|
||||
# when the quosure returns a promise. It needs to not be wrapped into a list
|
||||
# for the hybrid_chain stuff to detect that it's a promise. (Plus, it's not
|
||||
# even clear what it would mean to mix promises and non-promises in the
|
||||
# key.)
|
||||
qs <- qs[[1]]
|
||||
function() {
|
||||
eval_tidy(qs)
|
||||
}
|
||||
|
||||
} else {
|
||||
function() {
|
||||
lapply(qs, eval_tidy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Given a list of quosures, return a string representation of the expressions.
|
||||
#
|
||||
# qs <- list(quo(a+1), quo({ b+2; b + 3 }))
|
||||
# quos_to_label(qs)
|
||||
# #> [1] "a + 1, {\n b + 2\n b + 3\n}"
|
||||
quos_to_label <- function(qs) {
|
||||
res <- lapply(qs, function(q) {
|
||||
paste(deparse(get_expr(q)), collapse = "\n")
|
||||
})
|
||||
|
||||
paste(res, collapse = ", ")
|
||||
}
|
||||
|
||||
# Get the formals and body for a function, without source refs. This is used for
|
||||
# consistent hashing of the function.
|
||||
formalsAndBody <- function(x) {
|
||||
if (is.null(x)) {
|
||||
return(list())
|
||||
}
|
||||
|
||||
list(
|
||||
formals = formals(x),
|
||||
body = body(zap_srcref(x))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
# This function is to be called from functions like `reactive()`, `observe()`,
|
||||
# and the various render functions. It handles the following cases:
|
||||
# - The typical case where x is an unquoted expression, and `env` and `quoted`
|
||||
# are not used.
|
||||
# - New-style metaprogramming cases, where rlang::inject() is used to inline a
|
||||
# quosure into the AST, as in `inject(reactive(!!x))`.
|
||||
# - Old-style metaprogramming cases, where `env` and/or `quoted` are used.
|
||||
#
|
||||
# Much of the complexity is handling old-style metaprogramming cases. The code
|
||||
# in this function is more complicated because it needs to look at unevaluated
|
||||
# expressions in the _calling_ function. If this code were put directly in the
|
||||
# calling function, it would look like this:
|
||||
#
|
||||
# if (!missing(env) || !missing(quoted)) {
|
||||
# deprecatedEnvQuotedMessage()
|
||||
# if (!quoted) x <- substitute(x)
|
||||
# x <- new_quosure(x, env)
|
||||
#
|
||||
# } else {
|
||||
# x <- substitute(x)
|
||||
# if (!is_quosure(x)) {
|
||||
# x <- new_quosure(x, env = parent.frame())
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# In the future, the calling functions will not need to have the `env` and
|
||||
# `quoted` arguments -- `rlang::inject()` and quosures can be used instead.
|
||||
# Instead of using this function, `get_quosure()`, the caller can instead use
|
||||
# just the following code:
|
||||
#
|
||||
# x <- substitute(x)
|
||||
# if (!is_quosure(x)) {
|
||||
# x <- new_quosure(x, env = parent.frame())
|
||||
# }
|
||||
#
|
||||
get_quosure <- function(x, env, quoted) {
|
||||
if (!eval(substitute(missing(env)), parent.frame()) ||
|
||||
!eval(substitute(missing(quoted)), parent.frame()))
|
||||
{
|
||||
deprecatedEnvQuotedMessage()
|
||||
if (!quoted) {
|
||||
x <- eval(substitute(substitute(x)), parent.frame())
|
||||
}
|
||||
x <- new_quosure(x, env)
|
||||
|
||||
} else {
|
||||
x <- eval(substitute(substitute(x)), parent.frame())
|
||||
|
||||
# At this point, x can be a quosure if rlang::inject() is used, but the
|
||||
# typical case is that x is not a quosure.
|
||||
if (!is_quosure(x)) {
|
||||
x <- new_quosure(x, env = parent.frame(2L))
|
||||
}
|
||||
}
|
||||
|
||||
x
|
||||
}
|
||||
366
R/utils.R
366
R/utils.R
@@ -113,24 +113,6 @@ isWholeNum <- function(x, tol = .Machine$double.eps^0.5) {
|
||||
abs(x - round(x)) < tol
|
||||
}
|
||||
|
||||
`%OR%` <- function(x, y) {
|
||||
if (is.null(x) || isTRUE(is.na(x)))
|
||||
y
|
||||
else
|
||||
x
|
||||
}
|
||||
|
||||
`%AND%` <- function(x, y) {
|
||||
if (!is.null(x) && !isTRUE(is.na(x)))
|
||||
if (!is.null(y) && !isTRUE(is.na(y)))
|
||||
return(y)
|
||||
return(NULL)
|
||||
}
|
||||
|
||||
`%.%` <- function(x, y) {
|
||||
paste(x, y, sep='')
|
||||
}
|
||||
|
||||
# Given a vector or list, drop all the NULL items in it
|
||||
dropNulls <- function(x) {
|
||||
x[!vapply(x, is.null, FUN.VALUE=logical(1))]
|
||||
@@ -182,6 +164,10 @@ asNamed <- function(x) {
|
||||
x
|
||||
}
|
||||
|
||||
empty_named_list <- function() {
|
||||
list(a = 1)[0]
|
||||
}
|
||||
|
||||
# Given two named vectors, join them together, and keep only the last element
|
||||
# with a given name in the resulting vector. If b has any elements with the same
|
||||
# name as elements in a, the element in a is dropped. Also, if there are any
|
||||
@@ -220,6 +206,7 @@ sort_c <- function(x, ...) {
|
||||
sort(x, method = "radix", ...)
|
||||
}
|
||||
|
||||
|
||||
# Wrapper around list2env with a NULL check. In R <3.2.0, if an empty unnamed
|
||||
# list is passed to list2env(), it errors. But an empty named list is OK. For
|
||||
# R >=3.2.0, this wrapper is not necessary.
|
||||
@@ -427,7 +414,8 @@ makeFunction <- function(args = pairlist(), body, env = parent.frame()) {
|
||||
#' Convert an expression to a function
|
||||
#'
|
||||
#' This is to be called from another function, because it will attempt to get
|
||||
#' an unquoted expression from two calls back.
|
||||
#' an unquoted expression from two calls back. Note: as of Shiny 1.6.0, it is
|
||||
#' recommended to use [quoToFunction()] instead.
|
||||
#'
|
||||
#' If expr is a quoted expression, then this just converts it to a function.
|
||||
#' If expr is a function, then this simply returns expr (and prints a
|
||||
@@ -485,7 +473,8 @@ exprToFunction <- function(expr, env=parent.frame(), quoted=FALSE) {
|
||||
#' Install an expression as a function
|
||||
#'
|
||||
#' Installs an expression in the given environment as a function, and registers
|
||||
#' debug hooks so that breakpoints may be set in the function.
|
||||
#' debug hooks so that breakpoints may be set in the function. Note: as of
|
||||
#' Shiny 1.6.0, it is recommended to use [quoToFunction()] instead.
|
||||
#'
|
||||
#' This function can replace `exprToFunction` as follows: we may use
|
||||
#' `func <- exprToFunction(expr)` if we do not want the debug hooks, or
|
||||
@@ -531,6 +520,48 @@ installExprFunction <- function(expr, name, eval.env = parent.frame(2),
|
||||
assign(name, func, envir = assign.env)
|
||||
}
|
||||
|
||||
#' Convert a quosure to a function for a Shiny render function
|
||||
#'
|
||||
#' This takes a quosure and label, and wraps them into a function that should be
|
||||
#' passed to [createRenderFunction()] or [markRenderFunction()].
|
||||
#'
|
||||
#' This function was added in Shiny 1.6.0. Previously, it was recommended to use
|
||||
#' [installExprFunction()] or [exprToFunction()] in render functions, but now we
|
||||
#' recommend using [quoToFunction()], because it does not require `env` and
|
||||
#' `quoted` arguments -- that information is captured by quosures provided by
|
||||
#' \pkg{rlang}.
|
||||
#'
|
||||
#' @param q A quosure.
|
||||
#' @inheritParams installExprFunction
|
||||
#' @seealso [createRenderFunction()] for example usage.
|
||||
#'
|
||||
#' @export
|
||||
quoToFunction <- function(q, label, ..stacktraceon = FALSE) {
|
||||
q <- as_quosure(q)
|
||||
# Use new_function() instead of as_function(), because as_function() adds an
|
||||
# extra parent environment. (This may not actually be a problem, though.)
|
||||
func <- new_function(NULL, get_expr(q), get_env(q))
|
||||
wrapFunctionLabel(func, label, ..stacktraceon = ..stacktraceon)
|
||||
}
|
||||
|
||||
|
||||
# Utility function for creating a debugging label, given an expression.
|
||||
# `expr` is a quoted expression.
|
||||
# `function_name` is the name of the calling function.
|
||||
# `label` is an optional user-provided label. If NULL, it will be inferred.
|
||||
exprToLabel <- function(expr, function_name, label = NULL) {
|
||||
srcref <- attr(expr, "srcref", exact = TRUE)
|
||||
if (is.null(label)) {
|
||||
label <- rexprSrcrefToLabel(
|
||||
srcref[[1]],
|
||||
sprintf('%s(%s)', function_name, paste(deparse(expr), collapse = '\n'))
|
||||
)
|
||||
}
|
||||
if (length(srcref) >= 2) attr(label, "srcref") <- srcref[[2]]
|
||||
attr(label, "srcfile") <- srcFileOfRef(srcref[[1]])
|
||||
label
|
||||
}
|
||||
|
||||
#' Parse a GET query string from a URL
|
||||
#'
|
||||
#' Returns a named list of key-value pairs.
|
||||
@@ -631,37 +662,6 @@ shinyCallingHandlers <- function(expr) {
|
||||
)
|
||||
}
|
||||
|
||||
#' Print message for deprecated functions in Shiny
|
||||
#'
|
||||
#' To disable these messages, use `options(shiny.deprecation.messages=FALSE)`.
|
||||
#'
|
||||
#' @param new Name of replacement function.
|
||||
#' @param msg Message to print. If used, this will override the default message.
|
||||
#' @param old Name of deprecated function.
|
||||
#' @param version The last version of Shiny before the item was deprecated.
|
||||
#' @keywords internal
|
||||
shinyDeprecated <- function(new=NULL, msg=NULL,
|
||||
old=as.character(sys.call(sys.parent()))[1L],
|
||||
version = NULL) {
|
||||
|
||||
if (getOption("shiny.deprecation.messages") %OR% TRUE == FALSE)
|
||||
return(invisible())
|
||||
|
||||
if (is.null(msg)) {
|
||||
msg <- paste(old, "is deprecated.")
|
||||
if (!is.null(new)) {
|
||||
msg <- paste(msg, "Please use", new, "instead.",
|
||||
"To disable this message, run options(shiny.deprecation.messages=FALSE)")
|
||||
}
|
||||
}
|
||||
|
||||
if (!is.null(version)) {
|
||||
msg <- paste0(msg, " (Last used in version ", version, ")")
|
||||
}
|
||||
|
||||
# Similar to .Deprecated(), but print a message instead of warning
|
||||
message(msg)
|
||||
}
|
||||
|
||||
#' Register a function with the debugger (if one is active).
|
||||
#'
|
||||
@@ -1111,52 +1111,39 @@ reactiveStop <- function(message = "", class = NULL) {
|
||||
|
||||
#' Validate input values and other conditions
|
||||
#'
|
||||
#' For an output rendering function (e.g. [renderPlot()]), you may
|
||||
#' need to check that certain input values are available and valid before you
|
||||
#' can render the output. `validate` gives you a convenient mechanism for
|
||||
#' doing so.
|
||||
#' @description
|
||||
#' `validate()` provides convenient mechanism for validating that an output
|
||||
#' has all the inputs necessary for successful rendering. It takes any number
|
||||
#' of (unnamed) arguments, each representing a condition to test. If any
|
||||
#' of condition fails (i.e. is not ["truthy"][isTruthy]), a special type of
|
||||
#' error is signaled to stop execution. If this error is not handled by
|
||||
#' application-specific code, it is displayed to the user by Shiny.
|
||||
#'
|
||||
#' The `validate` function takes any number of (unnamed) arguments, each of
|
||||
#' which represents a condition to test. If any of the conditions represent
|
||||
#' failure, then a special type of error is signaled which stops execution. If
|
||||
#' this error is not handled by application-specific code, it is displayed to
|
||||
#' the user by Shiny.
|
||||
#' If you use `validate()` in a [reactive()] validation failures will
|
||||
#' automatically propagate to outputs that use the reactive.
|
||||
#'
|
||||
#' An easy way to provide arguments to `validate` is to use the `need`
|
||||
#' function, which takes an expression and a string; if the expression is
|
||||
#' considered a failure, then the string will be used as the error message. The
|
||||
#' `need` function considers its expression to be a failure if it is any of
|
||||
#' the following:
|
||||
#' @section `need()`:
|
||||
#' An easy way to provide arguments to `validate()` is to use `need()`, which
|
||||
#' takes an expression and a string. If the expression is not
|
||||
#' ["truthy"][isTruthy] then the string will be used as the error message.
|
||||
#'
|
||||
#' \itemize{
|
||||
#' \item{`FALSE`}
|
||||
#' \item{`NULL`}
|
||||
#' \item{`""`}
|
||||
#' \item{An empty atomic vector}
|
||||
#' \item{An atomic vector that contains only missing values}
|
||||
#' \item{A logical vector that contains all `FALSE` or missing values}
|
||||
#' \item{An object of class `"try-error"`}
|
||||
#' \item{A value that represents an unclicked [actionButton()]}
|
||||
#' If "truthiness" is flexible for your use case, you'll need to explicitly
|
||||
#' generate a logical values. For example, if you want allow `NA` but not
|
||||
#' `NULL`, you can `!is.null(input$foo)`.
|
||||
#'
|
||||
#' If you need validation logic that differs significantly from `need()`, you
|
||||
#' can create your own validation test functions. A passing test should return
|
||||
#' `NULL`. A failing test should return either a string providing the error
|
||||
#' to display to the user, or if the failure should happen silently, `FALSE`.
|
||||
#'
|
||||
#' Alternatively you can use `validate()` within an `if` statement, which is
|
||||
#' particularly useful for more complex conditions:
|
||||
#'
|
||||
#' ```
|
||||
#' if (input$x < 0 && input$choice == "positive") {
|
||||
#' validate("If choice is positive then x must be greater than 0")
|
||||
#' }
|
||||
#'
|
||||
#' If any of these values happen to be valid, you can explicitly turn them to
|
||||
#' logical values. For example, if you allow `NA` but not `NULL`, you
|
||||
#' can use the condition `!is.null(input$foo)`, because `!is.null(NA)
|
||||
#' == TRUE`.
|
||||
#'
|
||||
#' If you need validation logic that differs significantly from `need`, you
|
||||
#' can create other validation test functions. A passing test should return
|
||||
#' `NULL`. A failing test should return an error message as a
|
||||
#' single-element character vector, or if the failure should happen silently,
|
||||
#' `FALSE`.
|
||||
#'
|
||||
#' Because validation failure is signaled as an error, you can use
|
||||
#' `validate` in reactive expressions, and validation failures will
|
||||
#' automatically propagate to outputs that use the reactive expression. In
|
||||
#' other words, if reactive expression `a` needs `input$x`, and two
|
||||
#' outputs use `a` (and thus depend indirectly on `input$x`), it's
|
||||
#' not necessary for the outputs to validate `input$x` explicitly, as long
|
||||
#' as `a` does validate it.
|
||||
#' ```
|
||||
#'
|
||||
#' @param ... A list of tests. Each test should equal `NULL` for success,
|
||||
#' `FALSE` for silent failure, or a string for failure with an error
|
||||
@@ -1233,7 +1220,7 @@ need <- function(expr, message = paste(label, "must be provided"), label) {
|
||||
|
||||
#' Check for required values
|
||||
#'
|
||||
#' Ensure that values are available ("truthy"--see Details) before proceeding
|
||||
#' Ensure that values are available (["truthy"][isTruthy]) before proceeding
|
||||
#' with a calculation or action. If any of the given values is not truthy, the
|
||||
#' operation is stopped by raising a "silent" exception (not logged by Shiny,
|
||||
#' nor displayed in the Shiny app's UI).
|
||||
@@ -1242,11 +1229,13 @@ need <- function(expr, message = paste(label, "must be provided"), label) {
|
||||
#' is to call it like a statement (ignoring its return value) before attempting
|
||||
#' operations using the required values:
|
||||
#'
|
||||
#' \preformatted{rv <- reactiveValues(state = FALSE)
|
||||
#' ```
|
||||
#' rv <- reactiveValues(state = FALSE)
|
||||
#' r <- reactive({
|
||||
#' req(input$a, input$b, rv$state)
|
||||
#' # Code that uses input$a, input$b, and/or rv$state...
|
||||
#' })}
|
||||
#' })
|
||||
#' ```
|
||||
#'
|
||||
#' In this example, if `r()` is called and any of `input$a`,
|
||||
#' `input$b`, and `rv$state` are `NULL`, `FALSE`, `""`,
|
||||
@@ -1255,54 +1244,21 @@ need <- function(expr, message = paste(label, "must be provided"), label) {
|
||||
#'
|
||||
#' The second is to use it to wrap an expression that must be truthy:
|
||||
#'
|
||||
#' \preformatted{output$plot <- renderPlot({
|
||||
#' ```
|
||||
#' output$plot <- renderPlot({
|
||||
#' if (req(input$plotType) == "histogram") {
|
||||
#' hist(dataset())
|
||||
#' } else if (input$plotType == "scatter") {
|
||||
#' qplot(dataset(), aes(x = x, y = y))
|
||||
#' }
|
||||
#' })}
|
||||
#' })
|
||||
#' ```
|
||||
#'
|
||||
#' In this example, `req(input$plotType)` first checks that
|
||||
#' `input$plotType` is truthy, and if so, returns it. This is a convenient
|
||||
#' way to check for a value "inline" with its first use.
|
||||
#'
|
||||
#' **Truthy and falsy values**
|
||||
#'
|
||||
#' The terms "truthy" and "falsy" generally indicate whether a value, when
|
||||
#' coerced to a [base::logical()], is `TRUE` or `FALSE`. We use
|
||||
#' the term a little loosely here; our usage tries to match the intuitive
|
||||
#' notions of "Is this value missing or available?", or "Has the user provided
|
||||
#' an answer?", or in the case of action buttons, "Has the button been
|
||||
#' clicked?".
|
||||
#'
|
||||
#' For example, a `textInput` that has not been filled out by the user has
|
||||
#' a value of `""`, so that is considered a falsy value.
|
||||
#'
|
||||
#' To be precise, `req` considers a value truthy *unless* it is one
|
||||
#' of:
|
||||
#'
|
||||
#' \itemize{
|
||||
#' \item{`FALSE`}
|
||||
#' \item{`NULL`}
|
||||
#' \item{`""`}
|
||||
#' \item{An empty atomic vector}
|
||||
#' \item{An atomic vector that contains only missing values}
|
||||
#' \item{A logical vector that contains all `FALSE` or missing values}
|
||||
#' \item{An object of class `"try-error"`}
|
||||
#' \item{A value that represents an unclicked [actionButton()]}
|
||||
#' }
|
||||
#'
|
||||
#' Note in particular that the value `0` is considered truthy, even though
|
||||
#' `as.logical(0)` is `FALSE`.
|
||||
#'
|
||||
#' If the built-in rules for truthiness do not match your requirements, you can
|
||||
#' always work around them. Since `FALSE` is falsy, you can simply provide
|
||||
#' the results of your own checks to `req`:
|
||||
#'
|
||||
#' `req(input$a != 0)`
|
||||
#'
|
||||
#' **Using `req(FALSE)`**
|
||||
#' @section Using `req(FALSE)`:
|
||||
#'
|
||||
#' You can use `req(FALSE)` (i.e. no condition) if you've already performed
|
||||
#' all the checks you needed to by that point and just want to stop the reactive
|
||||
@@ -1310,7 +1266,7 @@ need <- function(expr, message = paste(label, "must be provided"), label) {
|
||||
#' if you have a complicated condition to check for (or perhaps if you'd like to
|
||||
#' divide your condition into nested `if` statements).
|
||||
#'
|
||||
#' **Using `cancelOutput = TRUE`**
|
||||
#' @section Using `cancelOutput = TRUE`:
|
||||
#'
|
||||
#' When `req(..., cancelOutput = TRUE)` is used, the "silent" exception is
|
||||
#' also raised, but it is treated slightly differently if one or more outputs are
|
||||
@@ -1329,7 +1285,6 @@ need <- function(expr, message = paste(label, "must be provided"), label) {
|
||||
#' @param cancelOutput If `TRUE` and an output is being evaluated, stop
|
||||
#' processing as usual but instead of clearing the output, leave it in
|
||||
#' whatever state it happens to be in.
|
||||
#' @param x An expression whose truthiness value we want to determine
|
||||
#' @return The first value that was passed in.
|
||||
#' @export
|
||||
#' @examples
|
||||
@@ -1419,14 +1374,40 @@ cancelOutput <- function() {
|
||||
#
|
||||
# Can be used to facilitate short-circuit eval on dots.
|
||||
dotloop <- function(fun_, ...) {
|
||||
for (i in 1:(nargs()-1)) {
|
||||
for (i in seq_len(nargs() - 1)) {
|
||||
fun_(eval(as.symbol(paste0("..", i))))
|
||||
}
|
||||
invisible()
|
||||
}
|
||||
|
||||
#' Truthy and falsy values
|
||||
#'
|
||||
#' The terms "truthy" and "falsy" generally indicate whether a value, when
|
||||
#' coerced to a [base::logical()], is `TRUE` or `FALSE`. We use
|
||||
#' the term a little loosely here; our usage tries to match the intuitive
|
||||
#' notions of "Is this value missing or available?", or "Has the user provided
|
||||
#' an answer?", or in the case of action buttons, "Has the button been
|
||||
#' clicked?".
|
||||
#'
|
||||
#' For example, a `textInput` that has not been filled out by the user has
|
||||
#' a value of `""`, so that is considered a falsy value.
|
||||
#'
|
||||
#' To be precise, a value is truthy *unless* it is one of:
|
||||
#'
|
||||
#' * `FALSE`
|
||||
#' * `NULL`
|
||||
#' * `""`
|
||||
#' * An empty atomic vector
|
||||
#' * An atomic vector that contains only missing values
|
||||
#' * A logical vector that contains all `FALSE` or missing values
|
||||
#' * An object of class `"try-error"`
|
||||
#' * A value that represents an unclicked [actionButton()]
|
||||
#'
|
||||
#' Note in particular that the value `0` is considered truthy, even though
|
||||
#' `as.logical(0)` is `FALSE`.
|
||||
#'
|
||||
#' @param x An expression whose truthiness value we want to determine
|
||||
#' @export
|
||||
#' @rdname req
|
||||
isTruthy <- function(x) {
|
||||
if (inherits(x, 'try-error'))
|
||||
return(FALSE)
|
||||
@@ -1503,7 +1484,7 @@ checkEncoding <- function(file) {
|
||||
if (identical(charToRaw(readChar(file, 3L, TRUE)), charToRaw('\UFEFF'))) {
|
||||
warning('You should not include the Byte Order Mark (BOM) in ', file, '. ',
|
||||
'Please re-save it in UTF-8 without BOM. See ',
|
||||
'http://shiny.rstudio.com/articles/unicode.html for more info.')
|
||||
'https://shiny.rstudio.com/articles/unicode.html for more info.')
|
||||
return('UTF-8-BOM')
|
||||
}
|
||||
x <- readChar(file, size, useBytes = TRUE)
|
||||
@@ -1587,14 +1568,19 @@ URLencode <- function(value, reserved = FALSE) {
|
||||
if (reserved) encodeURIComponent(value) else encodeURI(value)
|
||||
}
|
||||
|
||||
# Make user-supplied dates are either NULL or can be coerced
|
||||
# to a yyyy-mm-dd formatted string. If a date is specified, this
|
||||
# function returns a string for consistency across locales.
|
||||
# Also, `as.Date()` is used to coerce strings to date objects
|
||||
# so that strings like "2016-08-9" are expanded to "2016-08-09"
|
||||
# Make sure user-supplied dates are either NULL or can be coerced to a
|
||||
# yyyy-mm-dd formatted string. If a date is specified, this function returns a
|
||||
# string for consistency across locales. Also, `as.Date()` is used to coerce
|
||||
# strings to date objects so that strings like "2016-08-9" are expanded to
|
||||
# "2016-08-09". If any of the values result in error or NA, then the input
|
||||
# `date` is returned unchanged.
|
||||
dateYMD <- function(date = NULL, argName = "value") {
|
||||
if (!length(date)) return(NULL)
|
||||
tryCatch(date <- format(as.Date(date), "%Y-%m-%d"),
|
||||
tryCatch({
|
||||
res <- format(as.Date(date), "%Y-%m-%d")
|
||||
if (any(is.na(res))) stop()
|
||||
date <- res
|
||||
},
|
||||
error = function(e) {
|
||||
warning(
|
||||
"Couldn't coerce the `", argName,
|
||||
@@ -1617,18 +1603,17 @@ wrapFunctionLabel <- function(func, name, ..stacktraceon = FALSE) {
|
||||
assign(name, func, environment())
|
||||
registerDebugHook(name, environment(), name)
|
||||
|
||||
relabelWrapper <- eval(substitute(
|
||||
function(...) {
|
||||
# This `f` gets renamed to the value of `name`. Note that it may not
|
||||
# print as the new name, because of source refs stored in the function.
|
||||
if (..stacktraceon)
|
||||
..stacktraceon..(f(...))
|
||||
else
|
||||
f(...)
|
||||
},
|
||||
list(f = as.name(name))
|
||||
))
|
||||
if (..stacktraceon) {
|
||||
# We need to wrap the `...` in `!!quote(...)` so that R CMD check won't
|
||||
# complain about "... may be used in an incorrect context"
|
||||
body <- expr({ ..stacktraceon..((!!name)(!!quote(...))) })
|
||||
} else {
|
||||
body <- expr({ (!!name)(!!quote(...)) })
|
||||
}
|
||||
relabelWrapper <- new_function(pairlist2(... =), body, environment())
|
||||
|
||||
# Preserve the original function that was passed in; is used for caching.
|
||||
attr(relabelWrapper, "wrappedFunc") <- func
|
||||
relabelWrapper
|
||||
}
|
||||
|
||||
@@ -1688,19 +1673,23 @@ hybrid_chain <- function(expr, ..., catch = NULL, finally = NULL,
|
||||
if (promises::is.promising(result$value)) {
|
||||
# Purposefully NOT including domain (nor replace), as we're already in
|
||||
# the domain at this point
|
||||
p <- promise_chain(setVisible(result), ..., catch = catch, finally = finally)
|
||||
p <- promise_chain(valueWithVisible(result), ..., catch = catch, finally = finally)
|
||||
runFinally <- FALSE
|
||||
p
|
||||
} else {
|
||||
result <- Reduce(function(v, func) {
|
||||
if (".visible" %in% names(formals(func))) {
|
||||
withVisible(func(v$value, .visible = v$visible))
|
||||
} else {
|
||||
withVisible(func(v$value))
|
||||
}
|
||||
}, list(...), result)
|
||||
result <- Reduce(
|
||||
function(v, func) {
|
||||
if (v$visible) {
|
||||
withVisible(func(v$value))
|
||||
} else {
|
||||
withVisible(func(invisible(v$value)))
|
||||
}
|
||||
},
|
||||
list(...),
|
||||
result
|
||||
)
|
||||
|
||||
setVisible(result)
|
||||
valueWithVisible(result)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -1721,24 +1710,13 @@ hybrid_chain <- function(expr, ..., catch = NULL, finally = NULL,
|
||||
}
|
||||
}
|
||||
|
||||
# Returns `value` with either `invisible()` applied or not, depending on the
|
||||
# value of `visible`.
|
||||
#
|
||||
# If the `visible` is missing, then `value` should be a list as returned from
|
||||
# `withVisible()`, and that visibility will be applied.
|
||||
setVisible <- function(value, visible) {
|
||||
if (missing(visible)) {
|
||||
visible <- value$visible
|
||||
value <- value$value
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
invisible(value)
|
||||
} else {
|
||||
(value)
|
||||
}
|
||||
# Given a list with items named `value` and `visible`, return `x$value` either
|
||||
# visibly, or invisibly, depending on the value of `x$visible`.
|
||||
valueWithVisible <- function(x) {
|
||||
if (x$visible) x$value else invisible(x$value)
|
||||
}
|
||||
|
||||
|
||||
createVarPromiseDomain <- function(env, name, value) {
|
||||
force(env)
|
||||
force(name)
|
||||
@@ -1773,20 +1751,6 @@ createVarPromiseDomain <- function(env, name, value) {
|
||||
)
|
||||
}
|
||||
|
||||
getSliderType <- function(min, max, value) {
|
||||
vals <- dropNulls(list(value, min, max))
|
||||
if (length(vals) == 0) return("")
|
||||
type <- unique(lapply(vals, function(x) {
|
||||
if (inherits(x, "Date")) "date"
|
||||
else if (inherits(x, "POSIXt")) "datetime"
|
||||
else "number"
|
||||
}))
|
||||
if (length(type) > 1) {
|
||||
stop("Type mismatch for `min`, `max`, and `value`. Each must be Date, POSIXt, or number.")
|
||||
}
|
||||
type[[1]]
|
||||
}
|
||||
|
||||
# Reads the `shiny.sharedSecret` global option, and returns a function that can
|
||||
# be used to test header values for a match.
|
||||
loadSharedSecret <- function() {
|
||||
@@ -1892,3 +1856,15 @@ is_available <- function(package, version = NULL) {
|
||||
}
|
||||
installed && isTRUE(utils::packageVersion(package) >= version)
|
||||
}
|
||||
|
||||
|
||||
# cached version of utils::packageVersion("shiny")
|
||||
shinyPackageVersion <- local({
|
||||
version <- NULL
|
||||
function() {
|
||||
if (is.null(version)) {
|
||||
version <<- utils::packageVersion("shiny")
|
||||
}
|
||||
version
|
||||
}
|
||||
})
|
||||
|
||||
2
R/version_jquery.R
Normal file
2
R/version_jquery.R
Normal file
@@ -0,0 +1,2 @@
|
||||
# Generated by tools/updatejQuery.R; do not edit by hand
|
||||
version_jquery <- "3.6.0"
|
||||
65
README.md
65
README.md
@@ -7,62 +7,51 @@
|
||||
|
||||
<!-- badges: end -->
|
||||
|
||||
Shiny is a new package from RStudio that makes it incredibly easy to build interactive web applications with R.
|
||||
|
||||
For an introduction and examples, visit the [Shiny Dev Center](http://shiny.rstudio.com/).
|
||||
|
||||
If you have general questions about using Shiny, please use the [RStudio Community website](https://community.rstudio.com). For bug reports, please use the [issue tracker](https://github.com/rstudio/shiny/issues).
|
||||
Easily build rich and productive interactive web apps in R — no HTML/CSS/JavaScript required.
|
||||
|
||||
## Features
|
||||
|
||||
* Build useful web applications with only a few lines of code—no JavaScript required.
|
||||
* Shiny applications are automatically "live" in the same way that spreadsheets are live. Outputs change instantly as users modify inputs, without requiring a reload of the browser.
|
||||
* Shiny user interfaces can be built entirely using R, or can be written directly in HTML, CSS, and JavaScript for more flexibility.
|
||||
* Works in any R environment (Console R, Rgui for Windows or Mac, ESS, StatET, RStudio, etc.).
|
||||
* Attractive default UI theme based on [Bootstrap](http://getbootstrap.com/).
|
||||
* A highly customizable slider widget with built-in support for animation.
|
||||
* Prebuilt output widgets for displaying plots, tables, and printed output of R objects.
|
||||
* Fast bidirectional communication between the web browser and R using the [httpuv](https://github.com/rstudio/httpuv) package.
|
||||
* Uses a [reactive](http://en.wikipedia.org/wiki/Reactive_programming) programming model that eliminates messy event handling code, so you can focus on the code that really matters.
|
||||
* Develop and redistribute your own Shiny widgets that other developers can easily drop into their own applications (coming soon!).
|
||||
* An intuitive and extensible [reactive programming](https://en.wikipedia.org/wiki/Reactive_programming) model which makes it easy to transform existing R code into a "live app" where outputs automatically react to new user input.
|
||||
* Compared to event-based programming, reactivity allows Shiny to do the minimum amount of work when input(s) change, and allows humans to more easily reason about complex [MVC logic](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller).
|
||||
* A prebuilt set of highly sophisticated, customizable, and easy-to-use widgets (e.g., plots, tables, sliders, dropdowns, date pickers, and more).
|
||||
* An attractive default look based on [Bootstrap](https://getbootstrap.com/) which can also be easily customized with the [bslib](https://github.com/rstudio/bslib) package or avoided entirely with more direct R bindings to HTML/CSS/JavaScript.
|
||||
* Seamless integration with [R Markdown](https://shiny.rstudio.com/articles/interactive-docs.html), making it easy to embed numerous applications natively within a larger dynamic document.
|
||||
* Tools for improving and monitoring performance, including native support for [async programming](https://blog.rstudio.com/2018/06/26/shiny-1-1-0/), [caching](https://talks.cpsievert.me/20201117), [load testing](https://rstudio.github.io/shinyloadtest/), and [more](https://support.rstudio.com/hc/en-us/articles/231874748-Scaling-and-Performance-Tuning-in-RStudio-Connect).
|
||||
* [Modules](https://shiny.rstudio.com/articles/modules.html): a framework for reducing code duplication and complexity.
|
||||
* An ability to [bookmark application state](https://shiny.rstudio.com/articles/bookmarking-state.html) and/or [generate code to reproduce output(s)](https://github.com/rstudio/shinymeta).
|
||||
* A rich ecosystem of extension packages for more [custom widgets](http://www.htmlwidgets.org/), [input validation](https://github.com/rstudio/shinyvalidate), [unit testing](https://github.com/rstudio/shinytest), and more.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the stable version from CRAN, simply run the following from an R console:
|
||||
To install the stable version from CRAN:
|
||||
|
||||
```r
|
||||
install.packages("shiny")
|
||||
```
|
||||
|
||||
To install the latest development builds directly from GitHub, run this instead:
|
||||
|
||||
```r
|
||||
if (!require("remotes"))
|
||||
install.packages("remotes")
|
||||
remotes::install_github("rstudio/shiny")
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
To learn more we highly recommend you check out the [Shiny Tutorial](http://shiny.rstudio.com/tutorial/). The tutorial explains the framework in-depth, walks you through building a simple application, and includes extensive annotated examples.
|
||||
Once installed, load the library and run an example:
|
||||
|
||||
## Bootstrap 3 migration
|
||||
|
||||
Shiny versions 0.10.2.2 and below used the Bootstrap 2 web framework. After 0.10.2.2, Shiny switched to Bootstrap 3. For most users, the upgrade should be seamless. However, if you have have customized your HTML-generating code to use features specific to Bootstrap 2, you may need to update your code to work with Bootstrap 3.
|
||||
|
||||
If you do not wish to update your code at this time, you can use the [shinybootstrap2](https://github.com/rstudio/shinybootstrap2) package for backward compatibility.
|
||||
|
||||
If you prefer to install an older version of Shiny, you can do it using the devtools package:
|
||||
|
||||
```R
|
||||
devtools::install_version("shiny", version = "0.10.2.2")
|
||||
```r
|
||||
library(shiny)
|
||||
# Launches an app, with the app's source code included
|
||||
runExample("06_tabsets")
|
||||
# Lists more prepackaged examples
|
||||
runExample()
|
||||
```
|
||||
|
||||
## Development notes
|
||||
For more examples and inspiration, check out the [Shiny User Gallery](https://shiny.rstudio.com/gallery/).
|
||||
|
||||
The Javascript code in Shiny is minified using tools that run on Node.js. See the tools/ directory for more information.
|
||||
For help with learning fundamental Shiny programming concepts, check out the [Mastering Shiny](https://mastering-shiny.org/) book and the [Shiny Tutorial](https://shiny.rstudio.com/tutorial/). The former is currently more up-to-date with modern Shiny features, whereas the latter takes a deeper, more visual, dive into fundamental concepts.
|
||||
|
||||
## Guidelines for contributing
|
||||
## Getting Help
|
||||
|
||||
To ask a question about Shiny, please use the [RStudio Community website](https://community.rstudio.com/new-topic?category=shiny&tags=shiny).
|
||||
|
||||
For bug reports, please use the [issue tracker](https://github.com/rstudio/shiny/issues) and also keep in mind that by [writing a good bug report](https://github.com/rstudio/shiny/wiki/Writing-Good-Bug-Reports), you're more likely to get help with your problem.
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions to the **shiny** package. Please see our [CONTRIBUTING.md](https://github.com/rstudio/shiny/blob/master/.github/CONTRIBUTING.md) file for detailed guidelines of how to contribute.
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
library(shinytest)
|
||||
shinytest::testApp("../")
|
||||
|
||||
expect_pass(testApp("../", suffix = osName()))
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
context("exampleModuleServer")
|
||||
|
||||
# See ?testServer for more information
|
||||
testServer(exampleModuleServer, {
|
||||
# Set initial value of a button
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
context("app")
|
||||
|
||||
testServer(expr = {
|
||||
# Set the `size` slider and check the output
|
||||
session$setInputs(size = 6)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# Test the lexical_sort function from R/example.R
|
||||
context("sort")
|
||||
|
||||
test_that("Lexical sorting works", {
|
||||
expect_equal(lexical_sort(c(1, 2, 3)), c(1, 2, 3))
|
||||
expect_equal(lexical_sort(c(1, 2, 3, 13, 11, 21)), c(1, 11, 13, 2, 21, 3))
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.btn:focus{outline:dotted 2px #000}div.active:focus{outline:dotted 1px #000}a:focus{outline:dotted 1px #000}.close:hover,.close:focus{outline:dotted 1px #000}.nav>li>a:hover,.nav>li>a:focus{outline:dotted 1px #000}.carousel-indicators li,.carousel-indicators li.active{height:18px;width:18px;border-width:2px;position:relative;box-shadow:0px 0px 0px 1px #808080}.carousel-indicators.active li{background-color:rgba(100,149,253,0.6)}.carousel-indicators.active li.active{background-color:white}.carousel-tablist-highlight{display:block;position:absolute;outline:2px solid transparent;background-color:transparent;box-shadow:0px 0px 0px 1px transparent}.carousel-tablist-highlight.focus{outline:2px solid #6495ED;background-color:rgba(0,0,0,0.4)}a.carousel-control:focus{outline:2px solid #6495ED;background-image:linear-gradient(to right, transparent 0px, rgba(0,0,0,0.5) 100%);box-shadow:0px 0px 0px 1px #000000}.carousel-pause-button{position:absolute;top:-30em;left:-300em;display:block}.carousel-pause-button.focus{top:0.5em;left:0.5em}.carousel:hover .carousel-caption,.carousel.contrast .carousel-caption{background-color:rgba(0,0,0,0.5);z-index:10}.alert-success{color:#2d4821}.alert-info{color:#214c62}.alert-warning{color:#6c4a00;background-color:#f9f1c6}.alert-danger{color:#d2322d}.alert-danger:hover{color:#a82824}
|
||||
1
inst/www/shared/bootstrap/accessibility/css/bootstrap-accessibility.min.css
vendored
Normal file
1
inst/www/shared/bootstrap/accessibility/css/bootstrap-accessibility.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.btn:focus{outline:none 2px #000}.btn:focus-visible{outline:auto 2px #000}div.active:focus{outline:none 1px #000}div.active:focus-visible{outline:auto 1px #000}a:focus{outline:none 1px #000}a:focus-visible{outline:auto 1px #000}.close:hover,.close:focus{outline:none 1px #000}.close:focus-visible{outline:auto 1px #000}.nav>li>a:hover,.nav>li>a:focus{outline:none 1px #000}.nav>li>a:focus-visible{outline:auto 1px #000}.carousel-indicators li,.carousel-indicators li.active{height:18px;width:18px;border-width:2px;position:relative;box-shadow:0px 0px 0px 1px #808080}.carousel-indicators.active li{background-color:rgba(100,149,253,0.6)}.carousel-indicators.active li.active{background-color:white}.carousel-tablist-highlight{display:block;position:absolute;outline:2px solid transparent;background-color:transparent;box-shadow:0px 0px 0px 1px transparent}.carousel-tablist-highlight.focus{outline:2px solid #6495ED;background-color:rgba(0,0,0,0.4)}a.carousel-control:focus{outline:2px solid #6495ED;background-image:linear-gradient(to right, transparent 0px, rgba(0,0,0,0.5) 100%);box-shadow:0px 0px 0px 1px #000000}.carousel-pause-button{position:absolute;top:-30em;left:-300em;display:block}.carousel-pause-button.focus{top:0.5em;left:0.5em}.carousel:hover .carousel-caption,.carousel.contrast .carousel-caption{background-color:rgba(0,0,0,0.5);z-index:10}.alert-success{color:#2d4821}.alert-info{color:#214c62}.alert-warning{color:#6c4a00;background-color:#f9f1c6}.alert-danger{color:#d2322d}.alert-danger:hover{color:#a82824}
|
||||
File diff suppressed because one or more lines are too long
@@ -109,7 +109,7 @@
|
||||
}
|
||||
|
||||
.datepicker table tr td.day:hover, .datepicker table tr td.focused {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background: #e9e9ea;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -121,40 +121,37 @@
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background-color: #d1ecf1;
|
||||
border-color: #83ccd9;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted:focus, .datepicker table tr td.highlighted.focus {
|
||||
color: #212529;
|
||||
background-color: #bfd8dd;
|
||||
border-color: #6aa2ad;
|
||||
color: #000;
|
||||
background-color: #bcd4d9;
|
||||
border-color: #6299a3;
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted:hover {
|
||||
color: #212529;
|
||||
background-color: #79898d;
|
||||
border-color: #77b8c4;
|
||||
color: #000;
|
||||
background-color: #697679;
|
||||
border-color: #73b3bf;
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted:active, .datepicker table tr td.highlighted.active {
|
||||
color: #212529;
|
||||
background-color: #bfd8dd;
|
||||
border-color: #77b8c4;
|
||||
color: #000;
|
||||
background-color: #bcd4d9;
|
||||
border-color: #73b3bf;
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted:active:hover, .datepicker table tr td.highlighted:active:focus, .datepicker table tr td.highlighted:active.focus, .datepicker table tr td.highlighted.active:hover, .datepicker table tr td.highlighted.active:focus, .datepicker table tr td.highlighted.active.focus {
|
||||
color: #212529;
|
||||
background-color: #b3cacf;
|
||||
border-color: #6aa2ad;
|
||||
.datepicker table tr td.highlighted:active:hover, .datepicker table tr td.highlighted:active:focus, .datepicker table tr td.highlighted.focus:active, .datepicker table tr td.highlighted.active:hover, .datepicker table tr td.highlighted.active:focus, .datepicker table tr td.highlighted.active.focus {
|
||||
color: #000;
|
||||
background-color: #adc4c8;
|
||||
border-color: #6299a3;
|
||||
}
|
||||
|
||||
.datepicker table tr td.highlighted.disabled:hover, .datepicker table tr td.highlighted.disabled:focus, .datepicker table tr td.highlighted.disabled.focus, .datepicker table tr td.highlighted[disabled]:hover, .datepicker table tr td.highlighted[disabled]:focus, .datepicker table tr td.highlighted[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.highlighted:hover,
|
||||
fieldset[disabled] .datepicker table tr td.highlighted:focus,
|
||||
fieldset[disabled] .datepicker table tr td.highlighted.focus {
|
||||
.datepicker table tr td.highlighted.disabled:hover, .datepicker table tr td.highlighted.disabled:focus, .datepicker table tr td.highlighted.disabled.focus, .datepicker table tr td.highlighted[disabled]:hover, .datepicker table tr td.highlighted[disabled]:focus, .datepicker table tr td.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.highlighted:hover, fieldset[disabled] .datepicker table tr td.highlighted:focus, fieldset[disabled] .datepicker table tr td.highlighted.focus {
|
||||
background-color: #d1ecf1;
|
||||
border-color: #83ccd9;
|
||||
}
|
||||
@@ -169,39 +166,36 @@ fieldset[disabled] .datepicker table tr td.highlighted.focus {
|
||||
}
|
||||
|
||||
.datepicker table tr td.today {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background-color: #ffdb99;
|
||||
border-color: #ffb733;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:focus, .datepicker table tr td.today.focus {
|
||||
color: #212529;
|
||||
background-color: #e9c98e;
|
||||
border-color: #c89331;
|
||||
color: #000;
|
||||
background-color: #e6c58a;
|
||||
border-color: #bf8926;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:hover {
|
||||
color: #212529;
|
||||
background-color: #908061;
|
||||
border-color: #e4a532;
|
||||
color: #000;
|
||||
background-color: #806e4d;
|
||||
border-color: #e0a12d;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:active, .datepicker table tr td.today.active {
|
||||
color: #212529;
|
||||
background-color: #e9c98e;
|
||||
border-color: #e4a532;
|
||||
color: #000;
|
||||
background-color: #e6c58a;
|
||||
border-color: #e0a12d;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:active:hover, .datepicker table tr td.today:active:focus, .datepicker table tr td.today:active.focus, .datepicker table tr td.today.active:hover, .datepicker table tr td.today.active:focus, .datepicker table tr td.today.active.focus {
|
||||
color: #212529;
|
||||
background-color: #d9bc86;
|
||||
border-color: #c89331;
|
||||
.datepicker table tr td.today:active:hover, .datepicker table tr td.today:active:focus, .datepicker table tr td.today.focus:active, .datepicker table tr td.today.active:hover, .datepicker table tr td.today.active:focus, .datepicker table tr td.today.active.focus {
|
||||
color: #000;
|
||||
background-color: #d4b67f;
|
||||
border-color: #bf8926;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today.disabled.focus, .datepicker table tr td.today[disabled]:hover, .datepicker table tr td.today[disabled]:focus, .datepicker table tr td.today[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.today:hover,
|
||||
fieldset[disabled] .datepicker table tr td.today:focus,
|
||||
fieldset[disabled] .datepicker table tr td.today.focus {
|
||||
.datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today.disabled.focus, .datepicker table tr td.today[disabled]:hover, .datepicker table tr td.today[disabled]:focus, .datepicker table tr td.today.focus[disabled], fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today:focus, fieldset[disabled] .datepicker table tr td.today.focus {
|
||||
background-color: #ffdb99;
|
||||
border-color: #ffb733;
|
||||
}
|
||||
@@ -216,40 +210,37 @@ fieldset[disabled] .datepicker table tr td.today.focus {
|
||||
}
|
||||
|
||||
.datepicker table tr td.range {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background-color: #e9e9ea;
|
||||
border-color: #b5b5b8;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range:focus, .datepicker table tr td.range.focus {
|
||||
color: #212529;
|
||||
background-color: #d5d5d7;
|
||||
border-color: #909194;
|
||||
color: #000;
|
||||
background-color: #d2d2d3;
|
||||
border-color: #88888a;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range:hover {
|
||||
color: #212529;
|
||||
background-color: #85878a;
|
||||
border-color: #a3a4a7;
|
||||
color: #000;
|
||||
background-color: #757575;
|
||||
border-color: #9f9fa2;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range:active, .datepicker table tr td.range.active {
|
||||
color: #212529;
|
||||
background-color: #d5d5d7;
|
||||
border-color: #a3a4a7;
|
||||
color: #000;
|
||||
background-color: #d2d2d3;
|
||||
border-color: #9f9fa2;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range:active:hover, .datepicker table tr td.range:active:focus, .datepicker table tr td.range:active.focus, .datepicker table tr td.range.active:hover, .datepicker table tr td.range.active:focus, .datepicker table tr td.range.active.focus {
|
||||
color: #212529;
|
||||
background-color: #c7c8c9;
|
||||
border-color: #909194;
|
||||
.datepicker table tr td.range:active:hover, .datepicker table tr td.range:active:focus, .datepicker table tr td.range.focus:active, .datepicker table tr td.range.active:hover, .datepicker table tr td.range.active:focus, .datepicker table tr td.range.active.focus {
|
||||
color: #000;
|
||||
background-color: #c1c1c2;
|
||||
border-color: #88888a;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.disabled:hover, .datepicker table tr td.range.disabled:focus, .datepicker table tr td.range.disabled.focus, .datepicker table tr td.range[disabled]:hover, .datepicker table tr td.range[disabled]:focus, .datepicker table tr td.range[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.range:hover,
|
||||
fieldset[disabled] .datepicker table tr td.range:focus,
|
||||
fieldset[disabled] .datepicker table tr td.range.focus {
|
||||
.datepicker table tr td.range.disabled:hover, .datepicker table tr td.range.disabled:focus, .datepicker table tr td.range.disabled.focus, .datepicker table tr td.range[disabled]:hover, .datepicker table tr td.range[disabled]:focus, .datepicker table tr td.range.focus[disabled], fieldset[disabled] .datepicker table tr td.range:hover, fieldset[disabled] .datepicker table tr td.range:focus, fieldset[disabled] .datepicker table tr td.range.focus {
|
||||
background-color: #e9e9ea;
|
||||
border-color: #b5b5b8;
|
||||
}
|
||||
@@ -264,39 +255,36 @@ fieldset[disabled] .datepicker table tr td.range.focus {
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background-color: #ddebee;
|
||||
border-color: #99c3cc;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted:focus, .datepicker table tr td.range.highlighted.focus {
|
||||
color: #212529;
|
||||
background-color: #cad7da;
|
||||
border-color: #7b9ca3;
|
||||
color: #000;
|
||||
background-color: #c7d4d6;
|
||||
border-color: #739299;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted:hover {
|
||||
color: #212529;
|
||||
background-color: #7f888c;
|
||||
border-color: #8bb0b8;
|
||||
color: #000;
|
||||
background-color: #6f7677;
|
||||
border-color: #87acb4;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted:active, .datepicker table tr td.range.highlighted.active {
|
||||
color: #212529;
|
||||
background-color: #cad7da;
|
||||
border-color: #8bb0b8;
|
||||
color: #000;
|
||||
background-color: #c7d4d6;
|
||||
border-color: #87acb4;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted:active:hover, .datepicker table tr td.range.highlighted:active:focus, .datepicker table tr td.range.highlighted:active.focus, .datepicker table tr td.range.highlighted.active:hover, .datepicker table tr td.range.highlighted.active:focus, .datepicker table tr td.range.highlighted.active.focus {
|
||||
color: #212529;
|
||||
background-color: #bdc9cd;
|
||||
border-color: #7b9ca3;
|
||||
.datepicker table tr td.range.highlighted:active:hover, .datepicker table tr td.range.highlighted:active:focus, .datepicker table tr td.range.highlighted.focus:active, .datepicker table tr td.range.highlighted.active:hover, .datepicker table tr td.range.highlighted.active:focus, .datepicker table tr td.range.highlighted.active.focus {
|
||||
color: #000;
|
||||
background-color: #b7c3c6;
|
||||
border-color: #739299;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.highlighted.disabled:hover, .datepicker table tr td.range.highlighted.disabled:focus, .datepicker table tr td.range.highlighted.disabled.focus, .datepicker table tr td.range.highlighted[disabled]:hover, .datepicker table tr td.range.highlighted[disabled]:focus, .datepicker table tr td.range.highlighted[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.range.highlighted:hover,
|
||||
fieldset[disabled] .datepicker table tr td.range.highlighted:focus,
|
||||
fieldset[disabled] .datepicker table tr td.range.highlighted.focus {
|
||||
.datepicker table tr td.range.highlighted.disabled:hover, .datepicker table tr td.range.highlighted.disabled:focus, .datepicker table tr td.range.highlighted.disabled.focus, .datepicker table tr td.range.highlighted[disabled]:hover, .datepicker table tr td.range.highlighted[disabled]:focus, .datepicker table tr td.range.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.range.highlighted:hover, fieldset[disabled] .datepicker table tr td.range.highlighted:focus, fieldset[disabled] .datepicker table tr td.range.highlighted.focus {
|
||||
background-color: #ddebee;
|
||||
border-color: #99c3cc;
|
||||
}
|
||||
@@ -311,39 +299,36 @@ fieldset[disabled] .datepicker table tr td.range.highlighted.focus {
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background-color: #f4c775;
|
||||
border-color: #eca117;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:focus, .datepicker table tr td.range.today.focus {
|
||||
color: #212529;
|
||||
background-color: #dfb76d;
|
||||
border-color: #ba821b;
|
||||
color: #000;
|
||||
background-color: #dcb369;
|
||||
border-color: #b17811;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:hover {
|
||||
color: #212529;
|
||||
background-color: #8b764f;
|
||||
border-color: #d49219;
|
||||
color: #000;
|
||||
background-color: #7a643b;
|
||||
border-color: #d08d14;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:active, .datepicker table tr td.range.today.active {
|
||||
color: #212529;
|
||||
background-color: #dfb76d;
|
||||
border-color: #d49219;
|
||||
color: #000;
|
||||
background-color: #dcb369;
|
||||
border-color: #d08d14;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:active:hover, .datepicker table tr td.range.today:active:focus, .datepicker table tr td.range.today:active.focus, .datepicker table tr td.range.today.active:hover, .datepicker table tr td.range.today.active:focus, .datepicker table tr td.range.today.active.focus {
|
||||
color: #212529;
|
||||
background-color: #d0ab68;
|
||||
border-color: #ba821b;
|
||||
.datepicker table tr td.range.today:active:hover, .datepicker table tr td.range.today:active:focus, .datepicker table tr td.range.today.focus:active, .datepicker table tr td.range.today.active:hover, .datepicker table tr td.range.today.active:focus, .datepicker table tr td.range.today.active.focus {
|
||||
color: #000;
|
||||
background-color: #cba561;
|
||||
border-color: #b17811;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today.disabled.focus, .datepicker table tr td.range.today[disabled]:hover, .datepicker table tr td.range.today[disabled]:focus, .datepicker table tr td.range.today[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.range.today:hover,
|
||||
fieldset[disabled] .datepicker table tr td.range.today:focus,
|
||||
fieldset[disabled] .datepicker table tr td.range.today.focus {
|
||||
.datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today.disabled.focus, .datepicker table tr td.range.today[disabled]:hover, .datepicker table tr td.range.today[disabled]:focus, .datepicker table tr td.range.today.focus[disabled], fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today:focus, fieldset[disabled] .datepicker table tr td.range.today.focus {
|
||||
background-color: #f4c775;
|
||||
border-color: #eca117;
|
||||
}
|
||||
@@ -378,19 +363,13 @@ fieldset[disabled] .datepicker table tr td.range.today.focus {
|
||||
border-color: #7d7f82;
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected:active:hover, .datepicker table tr td.selected:active:focus, .datepicker table tr td.selected:active.focus, .datepicker table tr td.selected.active:hover, .datepicker table tr td.selected.active:focus, .datepicker table tr td.selected.active.focus, .datepicker table tr td.selected.highlighted:active:hover, .datepicker table tr td.selected.highlighted:active:focus, .datepicker table tr td.selected.highlighted:active.focus, .datepicker table tr td.selected.highlighted.active:hover, .datepicker table tr td.selected.highlighted.active:focus, .datepicker table tr td.selected.highlighted.active.focus {
|
||||
.datepicker table tr td.selected:active:hover, .datepicker table tr td.selected:active:focus, .datepicker table tr td.selected.focus:active, .datepicker table tr td.selected.active:hover, .datepicker table tr td.selected.active:focus, .datepicker table tr td.selected.active.focus, .datepicker table tr td.selected.highlighted:active:hover, .datepicker table tr td.selected.highlighted:active:focus, .datepicker table tr td.selected.highlighted.focus:active, .datepicker table tr td.selected.highlighted.active:hover, .datepicker table tr td.selected.highlighted.active:focus, .datepicker table tr td.selected.highlighted.active.focus {
|
||||
color: #fff;
|
||||
background-color: #9d9fa0;
|
||||
border-color: #909295;
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected.disabled.focus, .datepicker table tr td.selected[disabled]:hover, .datepicker table tr td.selected[disabled]:focus, .datepicker table tr td.selected[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.selected:hover,
|
||||
fieldset[disabled] .datepicker table tr td.selected:focus,
|
||||
fieldset[disabled] .datepicker table tr td.selected.focus, .datepicker table tr td.selected.highlighted.disabled:hover, .datepicker table tr td.selected.highlighted.disabled:focus, .datepicker table tr td.selected.highlighted.disabled.focus, .datepicker table tr td.selected.highlighted[disabled]:hover, .datepicker table tr td.selected.highlighted[disabled]:focus, .datepicker table tr td.selected.highlighted[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.selected.highlighted:hover,
|
||||
fieldset[disabled] .datepicker table tr td.selected.highlighted:focus,
|
||||
fieldset[disabled] .datepicker table tr td.selected.highlighted.focus {
|
||||
.datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected.disabled.focus, .datepicker table tr td.selected[disabled]:hover, .datepicker table tr td.selected[disabled]:focus, .datepicker table tr td.selected.focus[disabled], fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected:focus, fieldset[disabled] .datepicker table tr td.selected.focus, .datepicker table tr td.selected.highlighted.disabled:hover, .datepicker table tr td.selected.highlighted.disabled:focus, .datepicker table tr td.selected.highlighted.disabled.focus, .datepicker table tr td.selected.highlighted[disabled]:hover, .datepicker table tr td.selected.highlighted[disabled]:focus, .datepicker table tr td.selected.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.selected.highlighted:hover, fieldset[disabled] .datepicker table tr td.selected.highlighted:focus, fieldset[disabled] .datepicker table tr td.selected.highlighted.focus {
|
||||
background-color: #898b8d;
|
||||
border-color: #6b6e71;
|
||||
}
|
||||
@@ -420,19 +399,13 @@ fieldset[disabled] .datepicker table tr td.selected.highlighted.focus {
|
||||
border-color: #2087f5;
|
||||
}
|
||||
|
||||
.datepicker table tr td.active:active:hover, .datepicker table tr td.active:active:focus, .datepicker table tr td.active:active.focus, .datepicker table tr td.active.active:hover, .datepicker table tr td.active.active:focus, .datepicker table tr td.active.active.focus, .datepicker table tr td.active.highlighted:active:hover, .datepicker table tr td.active.highlighted:active:focus, .datepicker table tr td.active.highlighted:active.focus, .datepicker table tr td.active.highlighted.active:hover, .datepicker table tr td.active.highlighted.active:focus, .datepicker table tr td.active.highlighted.active.focus {
|
||||
.datepicker table tr td.active:active:hover, .datepicker table tr td.active:active:focus, .datepicker table tr td.active.focus:active, .datepicker table tr td.active.active:hover, .datepicker table tr td.active.active:focus, .datepicker table tr td.active.active.focus, .datepicker table tr td.active.highlighted:active:hover, .datepicker table tr td.active.highlighted:active:focus, .datepicker table tr td.active.highlighted.focus:active, .datepicker table tr td.active.highlighted.active:hover, .datepicker table tr td.active.highlighted.active:focus, .datepicker table tr td.active.highlighted.active.focus {
|
||||
color: #fff;
|
||||
background-color: #2b91ff;
|
||||
border-color: #4199f7;
|
||||
}
|
||||
|
||||
.datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled.focus, .datepicker table tr td.active[disabled]:hover, .datepicker table tr td.active[disabled]:focus, .datepicker table tr td.active[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.active:hover,
|
||||
fieldset[disabled] .datepicker table tr td.active:focus,
|
||||
fieldset[disabled] .datepicker table tr td.active.focus, .datepicker table tr td.active.highlighted.disabled:hover, .datepicker table tr td.active.highlighted.disabled:focus, .datepicker table tr td.active.highlighted.disabled.focus, .datepicker table tr td.active.highlighted[disabled]:hover, .datepicker table tr td.active.highlighted[disabled]:focus, .datepicker table tr td.active.highlighted[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td.active.highlighted:hover,
|
||||
fieldset[disabled] .datepicker table tr td.active.highlighted:focus,
|
||||
fieldset[disabled] .datepicker table tr td.active.highlighted.focus {
|
||||
.datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled.focus, .datepicker table tr td.active[disabled]:hover, .datepicker table tr td.active[disabled]:focus, .datepicker table tr td.active.focus[disabled], fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active:focus, fieldset[disabled] .datepicker table tr td.active.focus, .datepicker table tr td.active.highlighted.disabled:hover, .datepicker table tr td.active.highlighted.disabled:focus, .datepicker table tr td.active.highlighted.disabled.focus, .datepicker table tr td.active.highlighted[disabled]:hover, .datepicker table tr td.active.highlighted[disabled]:focus, .datepicker table tr td.active.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.active.highlighted:hover, fieldset[disabled] .datepicker table tr td.active.highlighted:focus, fieldset[disabled] .datepicker table tr td.active.highlighted.focus {
|
||||
background-color: #007bff;
|
||||
border-color: #0277f4;
|
||||
}
|
||||
@@ -449,7 +422,7 @@ fieldset[disabled] .datepicker table tr td.active.highlighted.focus {
|
||||
}
|
||||
|
||||
.datepicker table tr td span:hover, .datepicker table tr td span.focused {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background: #e9e9ea;
|
||||
}
|
||||
|
||||
@@ -466,7 +439,7 @@ fieldset[disabled] .datepicker table tr td.active.highlighted.focus {
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active:focus, .datepicker table tr td span.active.focus, .datepicker table tr td span.active:hover:focus, .datepicker table tr td span.active:hover.focus, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled:hover.focus {
|
||||
.datepicker table tr td span.active:focus, .datepicker table tr td span.active.focus, .datepicker table tr td span.active:hover:focus, .datepicker table tr td span.active.focus:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled.focus:hover {
|
||||
color: #fff;
|
||||
background-color: #1a88ff;
|
||||
border-color: #4199f7;
|
||||
@@ -478,31 +451,19 @@ fieldset[disabled] .datepicker table tr td.active.highlighted.focus {
|
||||
border-color: #2087f5;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active:hover.active, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.disabled:hover.active {
|
||||
.datepicker table tr td span.active:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.active:hover, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.disabled.active:hover {
|
||||
color: #fff;
|
||||
background-color: #1a88ff;
|
||||
border-color: #2087f5;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active:active:hover, .datepicker table tr td span.active:active:focus, .datepicker table tr td span.active:active.focus, .datepicker table tr td span.active.active:hover, .datepicker table tr td span.active.active:focus, .datepicker table tr td span.active.active.focus, .datepicker table tr td span.active:hover:active:hover, .datepicker table tr td span.active:hover:active:focus, .datepicker table tr td span.active:hover:active.focus, .datepicker table tr td span.active:hover.active:hover, .datepicker table tr td span.active:hover.active:focus, .datepicker table tr td span.active:hover.active.focus, .datepicker table tr td span.active.disabled:active:hover, .datepicker table tr td span.active.disabled:active:focus, .datepicker table tr td span.active.disabled:active.focus, .datepicker table tr td span.active.disabled.active:hover, .datepicker table tr td span.active.disabled.active:focus, .datepicker table tr td span.active.disabled.active.focus, .datepicker table tr td span.active.disabled:hover:active:hover, .datepicker table tr td span.active.disabled:hover:active:focus, .datepicker table tr td span.active.disabled:hover:active.focus, .datepicker table tr td span.active.disabled:hover.active:hover, .datepicker table tr td span.active.disabled:hover.active:focus, .datepicker table tr td span.active.disabled:hover.active.focus {
|
||||
.datepicker table tr td span.active:active:hover, .datepicker table tr td span.active:active:focus, .datepicker table tr td span.active.focus:active, .datepicker table tr td span.active.active:hover, .datepicker table tr td span.active.active:focus, .datepicker table tr td span.active.active.focus, .datepicker table tr td span.active:hover:active:hover, .datepicker table tr td span.active:hover:active:focus, .datepicker table tr td span.active.focus:hover:active, .datepicker table tr td span.active.active:hover:hover, .datepicker table tr td span.active.active:hover:focus, .datepicker table tr td span.active.active.focus:hover, .datepicker table tr td span.active.disabled:active:hover, .datepicker table tr td span.active.disabled:active:focus, .datepicker table tr td span.active.disabled.focus:active, .datepicker table tr td span.active.disabled.active:hover, .datepicker table tr td span.active.disabled.active:focus, .datepicker table tr td span.active.disabled.active.focus, .datepicker table tr td span.active.disabled:hover:active:hover, .datepicker table tr td span.active.disabled:hover:active:focus, .datepicker table tr td span.active.disabled.focus:hover:active, .datepicker table tr td span.active.disabled.active:hover:hover, .datepicker table tr td span.active.disabled.active:hover:focus, .datepicker table tr td span.active.disabled.active.focus:hover {
|
||||
color: #fff;
|
||||
background-color: #2b91ff;
|
||||
border-color: #4199f7;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active[disabled]:hover, .datepicker table tr td span.active[disabled]:focus, .datepicker table tr td span.active[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active:hover,
|
||||
fieldset[disabled] .datepicker table tr td span.active:focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active.focus, .datepicker table tr td span.active:hover.disabled:hover, .datepicker table tr td span.active:hover.disabled:focus, .datepicker table tr td span.active:hover.disabled.focus, .datepicker table tr td span.active:hover[disabled]:hover, .datepicker table tr td span.active:hover[disabled]:focus, .datepicker table tr td span.active:hover[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active:hover:hover,
|
||||
fieldset[disabled] .datepicker table tr td span.active:hover:focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active:hover.focus, .datepicker table tr td span.active.disabled.disabled:hover, .datepicker table tr td span.active.disabled.disabled:focus, .datepicker table tr td span.active.disabled.disabled.focus, .datepicker table tr td span.active.disabled[disabled]:hover, .datepicker table tr td span.active.disabled[disabled]:focus, .datepicker table tr td span.active.disabled[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled:hover,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled:focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled:hover.disabled:hover, .datepicker table tr td span.active.disabled:hover.disabled:focus, .datepicker table tr td span.active.disabled:hover.disabled.focus, .datepicker table tr td span.active.disabled:hover[disabled]:hover, .datepicker table tr td span.active.disabled:hover[disabled]:focus, .datepicker table tr td span.active.disabled:hover[disabled].focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus,
|
||||
fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus {
|
||||
.datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active[disabled]:hover, .datepicker table tr td span.active[disabled]:focus, .datepicker table tr td span.active.focus[disabled], fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active:focus, fieldset[disabled] .datepicker table tr td span.active.focus, .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled.focus:hover, .datepicker table tr td span.active[disabled]:hover:hover, .datepicker table tr td span.active[disabled]:hover:focus, .datepicker table tr td span.active.focus[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active:hover:hover, fieldset[disabled] .datepicker table tr td span.active:hover:focus, fieldset[disabled] .datepicker table tr td span.active.focus:hover, .datepicker table tr td span.active.disabled.disabled:hover, .datepicker table tr td span.active.disabled.disabled:focus, .datepicker table tr td span.active.disabled.disabled.focus, .datepicker table tr td span.active.disabled[disabled]:hover, .datepicker table tr td span.active.disabled[disabled]:focus, .datepicker table tr td span.active.disabled.focus[disabled], fieldset[disabled] .datepicker table tr td span.active.disabled:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:focus, fieldset[disabled] .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled.disabled:hover:hover, .datepicker table tr td span.active.disabled.disabled:hover:focus, .datepicker table tr td span.active.disabled.disabled.focus:hover, .datepicker table tr td span.active.disabled[disabled]:hover:hover, .datepicker table tr td span.active.disabled[disabled]:hover:focus, .datepicker table tr td span.active.disabled.focus[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus, fieldset[disabled] .datepicker table tr td span.active.disabled.focus:hover {
|
||||
background-color: #007bff;
|
||||
border-color: #0277f4;
|
||||
}
|
||||
@@ -526,7 +487,7 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus {
|
||||
.datepicker .prev:hover,
|
||||
.datepicker .next:hover,
|
||||
.datepicker tfoot tr th:hover {
|
||||
color: #212529;
|
||||
color: #000;
|
||||
background: #e9e9ea;
|
||||
}
|
||||
|
||||
@@ -570,4 +531,3 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus {
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@
|
||||
// Variables and mixins copied from Bootstrap 3.3.5
|
||||
|
||||
// These are BS3 variables that are used in datepicker3.scss. So, when compiling against
|
||||
// a BS3 bootstraplib theme, these variables should already be defined. Here we set
|
||||
// a BS3 bslib theme, these variables should already be defined. Here we set
|
||||
// *defaults* for these variables based on BS4 variables, so this scss can work for
|
||||
// both BS3 and BS4
|
||||
$gray: mix($body-bg, $body-color, 33.5%) !default;
|
||||
@@ -26,27 +26,12 @@ $dropdown-border: $dropdown-border-color !default;
|
||||
//$btn-link-disabled-color: $gray-light;
|
||||
//$dropdown-bg: #fff;
|
||||
|
||||
// Setup BS4 style color contrasting
|
||||
$yiq-contrasted-threshold: 150 !default;
|
||||
$yiq-text-dark: #212529 !default;
|
||||
$yiq-text-light: #fff !default;
|
||||
|
||||
@function color-yiq($color, $dark: $yiq-text-dark, $light: $yiq-text-light) {
|
||||
$r: red($color);
|
||||
$g: green($color);
|
||||
$b: blue($color);
|
||||
|
||||
$yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
|
||||
|
||||
@if ($yiq >= $yiq-contrasted-threshold) {
|
||||
@return $dark;
|
||||
} @else {
|
||||
@return $light;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin button-variant($background, $border) {
|
||||
$color: color-yiq($background);
|
||||
$color: color-contrast($background);
|
||||
|
||||
color: $color;
|
||||
background-color: $background;
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
// Both BS3 and BS4 define a border radius mixin, but just in case
|
||||
// we're trying to compile this without bootstrapSass
|
||||
@mixin border-radius-shim($radius) {
|
||||
@if mixin-exists("border-radius") {
|
||||
@include border-radius($radius);
|
||||
} @else {
|
||||
border-radius: $radius;
|
||||
}
|
||||
}
|
||||
|
||||
.datepicker {
|
||||
border-radius: $border-radius-base;
|
||||
@include border-radius-shim($border-radius-base);
|
||||
&-inline {
|
||||
width: 220px;
|
||||
}
|
||||
@@ -64,7 +74,7 @@
|
||||
text-align: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 4px;
|
||||
@include border-radius-shim(4px);
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +93,7 @@
|
||||
}
|
||||
&.day:hover,
|
||||
&.focused {
|
||||
color: color-yiq($gray-lighter);
|
||||
color: color-contrast($gray-lighter);
|
||||
background: $gray-lighter;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -179,10 +189,10 @@
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
@include border-radius-shim(4px);
|
||||
&:hover,
|
||||
&.focused {
|
||||
color: color-yiq($gray-lighter);
|
||||
color: color-contrast($gray-lighter);
|
||||
background: $gray-lighter;
|
||||
}
|
||||
&.disabled,
|
||||
@@ -215,7 +225,7 @@
|
||||
tfoot tr th {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: color-yiq($gray-lighter);
|
||||
color: color-contrast($gray-lighter);
|
||||
background: $gray-lighter;
|
||||
}
|
||||
}
|
||||
@@ -243,10 +253,10 @@
|
||||
text-align: center;
|
||||
}
|
||||
input:first-child {
|
||||
border-radius: 3px 0 0 3px;
|
||||
@include border-radius-shim(3px 0 0 3px);
|
||||
}
|
||||
input:last-child {
|
||||
border-radius: 0 3px 3px 0;
|
||||
@include border-radius-shim(0 3px 3px 0);
|
||||
}
|
||||
.input-group-addon {
|
||||
width: auto;
|
||||
|
||||
145
inst/www/shared/fontawesome/css/all.css
vendored
145
inst/www/shared/fontawesome/css/all.css
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
|
||||
* Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
*/
|
||||
.fa,
|
||||
@@ -216,9 +216,6 @@ readers do not read off random characters that represent icons */
|
||||
.fa-adn:before {
|
||||
content: "\f170"; }
|
||||
|
||||
.fa-adobe:before {
|
||||
content: "\f778"; }
|
||||
|
||||
.fa-adversal:before {
|
||||
content: "\f36a"; }
|
||||
|
||||
@@ -441,6 +438,12 @@ readers do not read off random characters that represent icons */
|
||||
.fa-bacon:before {
|
||||
content: "\f7e5"; }
|
||||
|
||||
.fa-bacteria:before {
|
||||
content: "\e059"; }
|
||||
|
||||
.fa-bacterium:before {
|
||||
content: "\e05a"; }
|
||||
|
||||
.fa-bahai:before {
|
||||
content: "\f666"; }
|
||||
|
||||
@@ -631,7 +634,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f49e"; }
|
||||
|
||||
.fa-box-tissue:before {
|
||||
content: "\f95b"; }
|
||||
content: "\e05b"; }
|
||||
|
||||
.fa-boxes:before {
|
||||
content: "\f468"; }
|
||||
@@ -1002,6 +1005,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-cloud-upload-alt:before {
|
||||
content: "\f382"; }
|
||||
|
||||
.fa-cloudflare:before {
|
||||
content: "\e07d"; }
|
||||
|
||||
.fa-cloudscale:before {
|
||||
content: "\f383"; }
|
||||
|
||||
@@ -1207,7 +1213,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f6ca"; }
|
||||
|
||||
.fa-dailymotion:before {
|
||||
content: "\f952"; }
|
||||
content: "\e052"; }
|
||||
|
||||
.fa-dashcube:before {
|
||||
content: "\f210"; }
|
||||
@@ -1218,6 +1224,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-deaf:before {
|
||||
content: "\f2a4"; }
|
||||
|
||||
.fa-deezer:before {
|
||||
content: "\e077"; }
|
||||
|
||||
.fa-delicious:before {
|
||||
content: "\f1a5"; }
|
||||
|
||||
@@ -1401,6 +1410,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-edge:before {
|
||||
content: "\f282"; }
|
||||
|
||||
.fa-edge-legacy:before {
|
||||
content: "\e078"; }
|
||||
|
||||
.fa-edit:before {
|
||||
content: "\f044"; }
|
||||
|
||||
@@ -1531,7 +1543,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f050"; }
|
||||
|
||||
.fa-faucet:before {
|
||||
content: "\f905"; }
|
||||
content: "\e005"; }
|
||||
|
||||
.fa-fax:before {
|
||||
content: "\f1ac"; }
|
||||
@@ -1654,7 +1666,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f269"; }
|
||||
|
||||
.fa-firefox-browser:before {
|
||||
content: "\f907"; }
|
||||
content: "\e007"; }
|
||||
|
||||
.fa-first-aid:before {
|
||||
content: "\f479"; }
|
||||
@@ -1893,6 +1905,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-google-drive:before {
|
||||
content: "\f3aa"; }
|
||||
|
||||
.fa-google-pay:before {
|
||||
content: "\e079"; }
|
||||
|
||||
.fa-google-play:before {
|
||||
content: "\f3ab"; }
|
||||
|
||||
@@ -1986,6 +2001,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-grunt:before {
|
||||
content: "\f3ad"; }
|
||||
|
||||
.fa-guilded:before {
|
||||
content: "\e07e"; }
|
||||
|
||||
.fa-guitar:before {
|
||||
content: "\f7a6"; }
|
||||
|
||||
@@ -2020,7 +2038,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f4be"; }
|
||||
|
||||
.fa-hand-holding-medical:before {
|
||||
content: "\f95c"; }
|
||||
content: "\e05c"; }
|
||||
|
||||
.fa-hand-holding-usd:before {
|
||||
content: "\f4c0"; }
|
||||
@@ -2062,7 +2080,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f257"; }
|
||||
|
||||
.fa-hand-sparkles:before {
|
||||
content: "\f95d"; }
|
||||
content: "\e05d"; }
|
||||
|
||||
.fa-hand-spock:before {
|
||||
content: "\f259"; }
|
||||
@@ -2074,16 +2092,16 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f4c4"; }
|
||||
|
||||
.fa-hands-wash:before {
|
||||
content: "\f95e"; }
|
||||
content: "\e05e"; }
|
||||
|
||||
.fa-handshake:before {
|
||||
content: "\f2b5"; }
|
||||
|
||||
.fa-handshake-alt-slash:before {
|
||||
content: "\f95f"; }
|
||||
content: "\e05f"; }
|
||||
|
||||
.fa-handshake-slash:before {
|
||||
content: "\f960"; }
|
||||
content: "\e060"; }
|
||||
|
||||
.fa-hanukiah:before {
|
||||
content: "\f6e6"; }
|
||||
@@ -2107,16 +2125,16 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f0a0"; }
|
||||
|
||||
.fa-head-side-cough:before {
|
||||
content: "\f961"; }
|
||||
content: "\e061"; }
|
||||
|
||||
.fa-head-side-cough-slash:before {
|
||||
content: "\f962"; }
|
||||
content: "\e062"; }
|
||||
|
||||
.fa-head-side-mask:before {
|
||||
content: "\f963"; }
|
||||
content: "\e063"; }
|
||||
|
||||
.fa-head-side-virus:before {
|
||||
content: "\f964"; }
|
||||
content: "\e064"; }
|
||||
|
||||
.fa-heading:before {
|
||||
content: "\f1dc"; }
|
||||
@@ -2160,6 +2178,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-history:before {
|
||||
content: "\f1da"; }
|
||||
|
||||
.fa-hive:before {
|
||||
content: "\e07f"; }
|
||||
|
||||
.fa-hockey-puck:before {
|
||||
content: "\f453"; }
|
||||
|
||||
@@ -2221,7 +2242,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f6f1"; }
|
||||
|
||||
.fa-house-user:before {
|
||||
content: "\f965"; }
|
||||
content: "\e065"; }
|
||||
|
||||
.fa-houzz:before {
|
||||
content: "\f27c"; }
|
||||
@@ -2257,7 +2278,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f47f"; }
|
||||
|
||||
.fa-ideal:before {
|
||||
content: "\f913"; }
|
||||
content: "\e013"; }
|
||||
|
||||
.fa-igloo:before {
|
||||
content: "\f7ae"; }
|
||||
@@ -2289,11 +2310,17 @@ readers do not read off random characters that represent icons */
|
||||
.fa-info-circle:before {
|
||||
content: "\f05a"; }
|
||||
|
||||
.fa-innosoft:before {
|
||||
content: "\e080"; }
|
||||
|
||||
.fa-instagram:before {
|
||||
content: "\f16d"; }
|
||||
|
||||
.fa-instagram-square:before {
|
||||
content: "\f955"; }
|
||||
content: "\e055"; }
|
||||
|
||||
.fa-instalod:before {
|
||||
content: "\e081"; }
|
||||
|
||||
.fa-intercom:before {
|
||||
content: "\f7af"; }
|
||||
@@ -2410,7 +2437,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f5fc"; }
|
||||
|
||||
.fa-laptop-house:before {
|
||||
content: "\f966"; }
|
||||
content: "\e066"; }
|
||||
|
||||
.fa-laptop-medical:before {
|
||||
content: "\f812"; }
|
||||
@@ -2533,7 +2560,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f604"; }
|
||||
|
||||
.fa-lungs-virus:before {
|
||||
content: "\f967"; }
|
||||
content: "\e067"; }
|
||||
|
||||
.fa-lyft:before {
|
||||
content: "\f3c3"; }
|
||||
@@ -2662,7 +2689,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f753"; }
|
||||
|
||||
.fa-microblog:before {
|
||||
content: "\f91a"; }
|
||||
content: "\e01a"; }
|
||||
|
||||
.fa-microchip:before {
|
||||
content: "\f2db"; }
|
||||
@@ -2704,7 +2731,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f289"; }
|
||||
|
||||
.fa-mixer:before {
|
||||
content: "\f956"; }
|
||||
content: "\e056"; }
|
||||
|
||||
.fa-mizuni:before {
|
||||
content: "\f3cc"; }
|
||||
@@ -2814,6 +2841,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-object-ungroup:before {
|
||||
content: "\f248"; }
|
||||
|
||||
.fa-octopus-deploy:before {
|
||||
content: "\e082"; }
|
||||
|
||||
.fa-odnoklassniki:before {
|
||||
content: "\f263"; }
|
||||
|
||||
@@ -2944,7 +2974,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f704"; }
|
||||
|
||||
.fa-people-arrows:before {
|
||||
content: "\f968"; }
|
||||
content: "\e068"; }
|
||||
|
||||
.fa-people-carry:before {
|
||||
content: "\f4ce"; }
|
||||
@@ -2952,6 +2982,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-pepper-hot:before {
|
||||
content: "\f816"; }
|
||||
|
||||
.fa-perbyte:before {
|
||||
content: "\e083"; }
|
||||
|
||||
.fa-percent:before {
|
||||
content: "\f295"; }
|
||||
|
||||
@@ -3010,7 +3043,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f1a7"; }
|
||||
|
||||
.fa-pied-piper-square:before {
|
||||
content: "\f91e"; }
|
||||
content: "\e01e"; }
|
||||
|
||||
.fa-piggy-bank:before {
|
||||
content: "\f4d3"; }
|
||||
@@ -3043,7 +3076,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f5b0"; }
|
||||
|
||||
.fa-plane-slash:before {
|
||||
content: "\f969"; }
|
||||
content: "\e069"; }
|
||||
|
||||
.fa-play:before {
|
||||
content: "\f04b"; }
|
||||
@@ -3121,10 +3154,10 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f542"; }
|
||||
|
||||
.fa-pump-medical:before {
|
||||
content: "\f96a"; }
|
||||
content: "\e06a"; }
|
||||
|
||||
.fa-pump-soap:before {
|
||||
content: "\f96b"; }
|
||||
content: "\e06b"; }
|
||||
|
||||
.fa-pushed:before {
|
||||
content: "\f3e1"; }
|
||||
@@ -3315,6 +3348,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-rupee-sign:before {
|
||||
content: "\f156"; }
|
||||
|
||||
.fa-rust:before {
|
||||
content: "\e07a"; }
|
||||
|
||||
.fa-sad-cry:before {
|
||||
content: "\f5b3"; }
|
||||
|
||||
@@ -3412,7 +3448,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f3ed"; }
|
||||
|
||||
.fa-shield-virus:before {
|
||||
content: "\f96c"; }
|
||||
content: "\e06c"; }
|
||||
|
||||
.fa-ship:before {
|
||||
content: "\f21a"; }
|
||||
@@ -3427,7 +3463,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f54b"; }
|
||||
|
||||
.fa-shopify:before {
|
||||
content: "\f957"; }
|
||||
content: "\e057"; }
|
||||
|
||||
.fa-shopping-bag:before {
|
||||
content: "\f290"; }
|
||||
@@ -3471,6 +3507,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-simplybuilt:before {
|
||||
content: "\f215"; }
|
||||
|
||||
.fa-sink:before {
|
||||
content: "\e06d"; }
|
||||
|
||||
.fa-sistrix:before {
|
||||
content: "\f3ee"; }
|
||||
|
||||
@@ -3565,7 +3604,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f7d2"; }
|
||||
|
||||
.fa-soap:before {
|
||||
content: "\f96e"; }
|
||||
content: "\e06e"; }
|
||||
|
||||
.fa-socks:before {
|
||||
content: "\f696"; }
|
||||
@@ -3733,7 +3772,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f2f2"; }
|
||||
|
||||
.fa-stopwatch-20:before {
|
||||
content: "\f96f"; }
|
||||
content: "\e06f"; }
|
||||
|
||||
.fa-store:before {
|
||||
content: "\f54e"; }
|
||||
@@ -3742,10 +3781,10 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f54f"; }
|
||||
|
||||
.fa-store-alt-slash:before {
|
||||
content: "\f970"; }
|
||||
content: "\e070"; }
|
||||
|
||||
.fa-store-slash:before {
|
||||
content: "\f971"; }
|
||||
content: "\e071"; }
|
||||
|
||||
.fa-strava:before {
|
||||
content: "\f428"; }
|
||||
@@ -3957,6 +3996,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-ticket-alt:before {
|
||||
content: "\f3ff"; }
|
||||
|
||||
.fa-tiktok:before {
|
||||
content: "\e07b"; }
|
||||
|
||||
.fa-times:before {
|
||||
content: "\f00d"; }
|
||||
|
||||
@@ -3985,7 +4027,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f71e"; }
|
||||
|
||||
.fa-toilet-paper-slash:before {
|
||||
content: "\f972"; }
|
||||
content: "\e072"; }
|
||||
|
||||
.fa-toolbox:before {
|
||||
content: "\f552"; }
|
||||
@@ -4015,7 +4057,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f637"; }
|
||||
|
||||
.fa-trailer:before {
|
||||
content: "\f941"; }
|
||||
content: "\e041"; }
|
||||
|
||||
.fa-train:before {
|
||||
content: "\f238"; }
|
||||
@@ -4113,6 +4155,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-umbrella-beach:before {
|
||||
content: "\f5ca"; }
|
||||
|
||||
.fa-uncharted:before {
|
||||
content: "\e084"; }
|
||||
|
||||
.fa-underline:before {
|
||||
content: "\f0cd"; }
|
||||
|
||||
@@ -4126,7 +4171,7 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f404"; }
|
||||
|
||||
.fa-unity:before {
|
||||
content: "\f949"; }
|
||||
content: "\e049"; }
|
||||
|
||||
.fa-universal-access:before {
|
||||
content: "\f29a"; }
|
||||
@@ -4143,6 +4188,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-unlock-alt:before {
|
||||
content: "\f13e"; }
|
||||
|
||||
.fa-unsplash:before {
|
||||
content: "\e07c"; }
|
||||
|
||||
.fa-untappd:before {
|
||||
content: "\f405"; }
|
||||
|
||||
@@ -4233,6 +4281,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-users-cog:before {
|
||||
content: "\f509"; }
|
||||
|
||||
.fa-users-slash:before {
|
||||
content: "\e073"; }
|
||||
|
||||
.fa-usps:before {
|
||||
content: "\f7e1"; }
|
||||
|
||||
@@ -4260,6 +4311,12 @@ readers do not read off random characters that represent icons */
|
||||
.fa-venus-mars:before {
|
||||
content: "\f228"; }
|
||||
|
||||
.fa-vest:before {
|
||||
content: "\e085"; }
|
||||
|
||||
.fa-vest-patches:before {
|
||||
content: "\e086"; }
|
||||
|
||||
.fa-viacoin:before {
|
||||
content: "\f237"; }
|
||||
|
||||
@@ -4300,13 +4357,13 @@ readers do not read off random characters that represent icons */
|
||||
content: "\f1ca"; }
|
||||
|
||||
.fa-virus:before {
|
||||
content: "\f974"; }
|
||||
content: "\e074"; }
|
||||
|
||||
.fa-virus-slash:before {
|
||||
content: "\f975"; }
|
||||
content: "\e075"; }
|
||||
|
||||
.fa-viruses:before {
|
||||
content: "\f976"; }
|
||||
content: "\e076"; }
|
||||
|
||||
.fa-vk:before {
|
||||
content: "\f189"; }
|
||||
@@ -4350,6 +4407,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-warehouse:before {
|
||||
content: "\f494"; }
|
||||
|
||||
.fa-watchman-monitoring:before {
|
||||
content: "\e087"; }
|
||||
|
||||
.fa-water:before {
|
||||
content: "\f773"; }
|
||||
|
||||
@@ -4425,6 +4485,9 @@ readers do not read off random characters that represent icons */
|
||||
.fa-wizards-of-the-coast:before {
|
||||
content: "\f730"; }
|
||||
|
||||
.fa-wodu:before {
|
||||
content: "\e088"; }
|
||||
|
||||
.fa-wolf-pack-battalion:before {
|
||||
content: "\f514"; }
|
||||
|
||||
|
||||
4
inst/www/shared/fontawesome/css/all.min.css
vendored
4
inst/www/shared/fontawesome/css/all.min.css
vendored
File diff suppressed because one or more lines are too long
2
inst/www/shared/fontawesome/css/v4-shims.css
vendored
2
inst/www/shared/fontawesome/css/v4-shims.css
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
|
||||
* Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
*/
|
||||
.fa.fa-glass:before {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 699 KiB After Width: | Height: | Size: 730 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,16 +1,12 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!--
|
||||
Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
|
||||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
-->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
||||
<metadata>
|
||||
Created by FontForge 20190801 at Mon Mar 23 10:45:51 2020
|
||||
Created by FontForge 20200314 at Wed Jan 13 11:57:54 2021
|
||||
By Robert Madole
|
||||
Copyright (c) Font Awesome
|
||||
</metadata>
|
||||
<defs>
|
||||
<!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
|
||||
<font id="FontAwesome5Free-Regular" horiz-adv-x="512" >
|
||||
<font-face
|
||||
font-family="Font Awesome 5 Free Regular"
|
||||
@@ -20,7 +16,7 @@ Copyright (c) Font Awesome
|
||||
panose-1="2 0 5 3 0 0 0 0 0 0"
|
||||
ascent="448"
|
||||
descent="-64"
|
||||
bbox="-0.0663408 -64.0662 640.01 448.1"
|
||||
bbox="-0.0663408 -64.0662 640.004 448.1"
|
||||
underline-thickness="25"
|
||||
underline-position="-50"
|
||||
unicode-range="U+0020-F5C8"
|
||||
@@ -50,7 +46,7 @@ s-36 16.1182 -36 36s16.1182 36 36 36s36 -16.1182 36 -36zM164 192c0 -19.8818 -16.
|
||||
<glyph glyph-name="flag" unicode=""
|
||||
d="M336.174 368c35.4668 0 73.0195 12.6914 108.922 28.1797c31.6406 13.6514 66.9043 -9.65723 66.9043 -44.1162v-239.919c0 -16.1953 -8.1543 -31.3057 -21.7129 -40.1631c-26.5762 -17.3643 -70.0693 -39.9814 -128.548 -39.9814c-68.6084 0 -112.781 32 -161.913 32
|
||||
c-56.5674 0 -89.957 -11.2803 -127.826 -28.5566v-83.4434c0 -8.83691 -7.16309 -16 -16 -16h-16c-8.83691 0 -16 7.16309 -16 16v406.438c-14.3428 8.2998 -24 23.7979 -24 41.5615c0 27.5693 23.2422 49.71 51.2012 47.8965
|
||||
c22.9658 -1.49023 41.8662 -19.4717 44.4805 -42.3379c0.177734 -1.52441 0.321289 -4.00781 0.321289 -5.54199c0 -4.30176 -1.10352 -11.1035 -2.46289 -15.1846c22.418 8.68555 49.4199 15.168 80.7207 15.168c68.6084 0 112.781 -32 161.913 -32zM464 112v240
|
||||
c22.9658 -1.49023 41.8662 -19.4717 44.4805 -42.3379c0.213867 -1.83398 0.308594 -3.65918 0.308594 -5.5498c0 -5.30273 -0.860352 -10.4053 -2.4502 -15.1768c22.418 8.68555 49.4199 15.168 80.7207 15.168c68.6084 0 112.781 -32 161.913 -32zM464 112v240
|
||||
c-31.5059 -14.6338 -84.5547 -32 -127.826 -32c-59.9111 0 -101.968 32 -161.913 32c-41.4365 0 -80.4766 -16.5879 -102.261 -32v-232c31.4473 14.5967 84.4648 24 127.826 24c59.9111 0 101.968 -32 161.913 -32c41.4365 0 80.4775 16.5879 102.261 32z" />
|
||||
<glyph glyph-name="bookmark" unicode="" horiz-adv-x="384"
|
||||
d="M336 448c26.5098 0 48 -21.4902 48 -48v-464l-192 112l-192 -112v464c0 26.5098 21.4902 48 48 48h288zM336 19.5703v374.434c0 3.31348 -2.68555 5.99609 -6 5.99609h-276c-3.31152 0 -6 -2.68848 -6 -6v-374.43l144 84z" />
|
||||
@@ -77,17 +73,17 @@ c0 -110.569 89.4678 -200 200 -200zM363.244 247.2c0 -67.0518 -72.4209 -68.084 -72
|
||||
c17.5615 9.84473 28.3242 16.541 28.3242 29.5791c0 17.2461 -21.999 28.6934 -39.7842 28.6934c-23.1885 0 -33.8936 -10.9775 -48.9424 -29.9697c-4.05664 -5.11914 -11.46 -6.07031 -16.666 -2.12402l-27.8232 21.0986
|
||||
c-5.10742 3.87207 -6.25098 11.0654 -2.64453 16.3633c23.627 34.6934 53.7217 54.1846 100.575 54.1846c49.0713 0 101.45 -38.3037 101.45 -88.7998zM298 80c0 -23.1592 -18.8408 -42 -42 -42s-42 18.8408 -42 42s18.8408 42 42 42s42 -18.8408 42 -42z" />
|
||||
<glyph glyph-name="eye" unicode="" horiz-adv-x="576"
|
||||
d="M288 304c0.0927734 0 0.244141 0.000976562 0.336914 0.000976562c61.6641 0 111.71 -50.0469 111.71 -111.711c0 -61.6631 -50.0459 -111.71 -111.71 -111.71s-111.71 50.0469 -111.71 111.71c0 8.71289 1.95898 22.5781 4.37305 30.9502
|
||||
c6.93066 -3.94141 19.0273 -7.18457 27 -7.24023c30.9121 0 56 25.0879 56 56c-0.0556641 7.97266 -3.29883 20.0693 -7.24023 27c8.42383 2.62207 22.4189 4.8623 31.2402 5zM572.52 206.6c1.9209 -3.79883 3.47949 -10.3379 3.47949 -14.5947
|
||||
s-1.55859 -10.7959 -3.47949 -14.5947c-54.1992 -105.771 -161.59 -177.41 -284.52 -177.41s-230.29 71.5898 -284.52 177.4c-1.9209 3.79883 -3.47949 10.3379 -3.47949 14.5947s1.55859 10.7959 3.47949 14.5947c54.1992 105.771 161.59 177.41 284.52 177.41
|
||||
s230.29 -71.5898 284.52 -177.4zM288 48c98.6602 0 189.1 55 237.93 144c-48.8398 89 -139.27 144 -237.93 144s-189.09 -55 -237.93 -144c48.8398 -89 139.279 -144 237.93 -144z" />
|
||||
d="M288 304c0.114258 0 0.240234 -0.0175781 0.354492 -0.0175781c61.6543 0 111.71 -50.0557 111.71 -111.71s-50.0557 -111.71 -111.71 -111.71s-111.71 50.0557 -111.71 111.71c0 10.7422 1.51953 21.1328 4.35547 30.9678
|
||||
c7.95898 -4.52637 17.2129 -7.17188 27 -7.24023c30.9072 0 56 25.0928 56 56c-0.0683594 9.78711 -2.71387 19.041 -7.24023 27c9.88379 3.07617 20.3896 4.83008 31.2402 5zM572.52 206.6c2.21387 -4.37793 3.46094 -9.38965 3.46094 -14.626
|
||||
c0 -5.2373 -1.24707 -10.1855 -3.46094 -14.5635c-54.1992 -105.771 -161.59 -177.41 -284.52 -177.41s-230.29 71.5898 -284.52 177.4c-2.21387 4.37793 -3.46094 9.38965 -3.46094 14.626c0 5.2373 1.24707 10.1855 3.46094 14.5635
|
||||
c54.1992 105.771 161.59 177.41 284.52 177.41s230.29 -71.5898 284.52 -177.4zM288 48c98.6602 0 189.1 55 237.93 144c-48.8398 89 -139.27 144 -237.93 144s-189.09 -55 -237.93 -144c48.8398 -89 139.279 -144 237.93 -144z" />
|
||||
<glyph glyph-name="eye-slash" unicode="" horiz-adv-x="640"
|
||||
d="M634 -23c3.31738 -2.65137 6.00977 -8.25098 6.00977 -12.498c0 -3.10449 -1.57715 -7.58984 -3.51953 -10.0117l-10 -12.4902c-2.65234 -3.31152 -8.24707 -6 -12.4902 -6c-3.09961 0 -7.58008 1.57227 -10 3.50977l-598 467.49
|
||||
c-3.31738 2.65137 -6.00977 8.25098 -6.00977 12.498c0 3.10449 1.57715 7.58984 3.51953 10.0117l10 12.4902c2.65234 3.31152 8.24707 6 12.4902 6c3.09961 0 7.58008 -1.57227 10 -3.50977zM296.79 301.53c6.33496 1.35059 16.7324 2.45801 23.21 2.46973
|
||||
c60.4805 0 109.36 -47.9102 111.58 -107.85zM343.21 82.46c-6.33496 -1.34375 -16.7334 -2.44629 -23.21 -2.45996c-60.4697 0 -109.35 47.9102 -111.58 107.84zM320 336c-19.8799 0 -39.2803 -2.7998 -58.2197 -7.09961l-46.4102 36.29
|
||||
c32.9199 11.8096 67.9297 18.8096 104.63 18.8096c122.93 0 230.29 -71.5898 284.57 -177.4c1.91992 -3.79883 3.47949 -10.3379 3.47949 -14.5947s-1.55957 -10.7959 -3.47949 -14.5947c-11.7197 -22.7598 -35.4189 -56.4092 -52.9004 -75.1104l-37.7402 29.5
|
||||
c14.333 15.0156 34.0449 41.9854 44 60.2002c-48.8398 89 -139.279 144 -237.93 144zM320 48c19.8896 0 39.2803 2.7998 58.2197 7.08984l46.4102 -36.2803c-32.9199 -11.7598 -67.9297 -18.8096 -104.63 -18.8096c-122.92 0 -230.28 71.5898 -284.51 177.4
|
||||
c-1.9209 3.79883 -3.47949 10.3379 -3.47949 14.5947s1.55859 10.7959 3.47949 14.5947c11.7168 22.7568 35.4111 56.4014 52.8896 75.1006l37.7402 -29.5c-14.3467 -15.0107 -34.0811 -41.9756 -44.0498 -60.1904c48.8496 -89 139.279 -144 237.93 -144z" />
|
||||
d="M634 -23c3.66895 -2.93262 6.00391 -7.45117 6.00391 -12.5088c0 -3.7832 -1.31543 -7.26074 -3.51367 -10.001l-10 -12.4902c-2.93359 -3.66309 -7.44824 -5.99414 -12.502 -5.99414c-3.77637 0 -7.25 1.31152 -9.98828 3.50391l-598 467.49
|
||||
c-3.66895 2.93262 -6.00391 7.45117 -6.00391 12.5088c0 3.7832 1.31543 7.26074 3.51367 10.001l10 12.4902c2.93359 3.66309 7.44824 5.99414 12.502 5.99414c3.77637 0 7.25 -1.31152 9.98828 -3.50391zM296.79 301.53c7.51172 1.60254 15.2266 2.45508 23.21 2.46973
|
||||
c60.4805 0 109.36 -47.9102 111.58 -107.85zM343.21 82.46c-7.51367 -1.59375 -15.2285 -2.44336 -23.21 -2.45996c-60.4697 0 -109.35 47.9102 -111.58 107.84zM320 336c-19.8799 0 -39.2803 -2.7998 -58.2197 -7.09961l-46.4102 36.29
|
||||
c32.9199 11.8096 67.9297 18.8096 104.63 18.8096c122.93 0 230.29 -71.5898 284.57 -177.4c2.21289 -4.37793 3.45996 -9.38965 3.45996 -14.626c0 -5.2373 -1.24707 -10.1855 -3.45996 -14.5635c-14.1924 -27.5625 -31.9229 -52.6689 -52.9004 -75.1104l-37.7402 29.5
|
||||
c17.2305 18.0527 31.9385 38.1318 44 60.2002c-48.8398 89 -139.279 144 -237.93 144zM320 48c19.8896 0 39.2803 2.7998 58.2197 7.08984l46.4102 -36.2803c-32.9199 -11.7598 -67.9297 -18.8096 -104.63 -18.8096c-122.92 0 -230.28 71.5898 -284.51 177.4
|
||||
c-2.21387 4.37793 -3.46094 9.38965 -3.46094 14.626c0 5.2373 1.24707 10.1855 3.46094 14.5635c14.1885 27.5586 31.916 52.6621 52.8896 75.1006l37.7402 -29.5c-17.249 -18.0469 -31.9727 -38.1221 -44.0498 -60.1904c48.8496 -89 139.279 -144 237.93 -144z" />
|
||||
<glyph glyph-name="calendar-alt" unicode="" horiz-adv-x="448"
|
||||
d="M148 160h-40c-6.59961 0 -12 5.40039 -12 12v40c0 6.59961 5.40039 12 12 12h40c6.59961 0 12 -5.40039 12 -12v-40c0 -6.59961 -5.40039 -12 -12 -12zM256 172c0 -6.59961 -5.40039 -12 -12 -12h-40c-6.59961 0 -12 5.40039 -12 12v40c0 6.59961 5.40039 12 12 12h40
|
||||
c6.59961 0 12 -5.40039 12 -12v-40zM352 172c0 -6.59961 -5.40039 -12 -12 -12h-40c-6.59961 0 -12 5.40039 -12 12v40c0 6.59961 5.40039 12 12 12h40c6.59961 0 12 -5.40039 12 -12v-40zM256 76c0 -6.59961 -5.40039 -12 -12 -12h-40c-6.59961 0 -12 5.40039 -12 12v40
|
||||
@@ -131,47 +127,47 @@ d="M527.9 416c26.5996 0 48.0996 -21.5 48.0996 -48v-352c0 -26.5 -21.5 -48 -48.099
|
||||
h-467.801zM521.9 16c3.2998 0 6 2.7002 6 6v170h-479.801v-170c0 -3.2998 2.7002 -6 6 -6h467.801zM192 116v-40c0 -6.59961 -5.40039 -12 -12 -12h-72c-6.59961 0 -12 5.40039 -12 12v40c0 6.59961 5.40039 12 12 12h72c6.59961 0 12 -5.40039 12 -12zM384 116v-40
|
||||
c0 -6.59961 -5.40039 -12 -12 -12h-136c-6.59961 0 -12 5.40039 -12 12v40c0 6.59961 5.40039 12 12 12h136c6.59961 0 12 -5.40039 12 -12z" />
|
||||
<glyph glyph-name="hdd" unicode="" horiz-adv-x="576"
|
||||
d="M567.403 212.358c5.59668 -8.04688 8.59668 -17.6113 8.59668 -27.4121v-136.946c0 -26.5098 -21.4902 -48 -48 -48h-480c-26.5098 0 -48 21.4902 -48 48v136.946c0 8.30957 3.85156 20.5898 8.59668 27.4121l105.08 151.053
|
||||
c7.90625 11.3652 25.5596 20.5889 39.4033 20.5889h0.000976562h269.838h0.000976562c13.8438 0 31.4971 -9.22363 39.4033 -20.5889zM153.081 336l-77.9131 -112h425.664l-77.9131 112h-269.838zM528 48v128h-480v-128h480zM496 112c0 -17.6729 -14.3271 -32 -32 -32
|
||||
s-32 14.3271 -32 32s14.3271 32 32 32s32 -14.3271 32 -32zM400 112c0 -17.6729 -14.3271 -32 -32 -32s-32 14.3271 -32 32s14.3271 32 32 32s32 -14.3271 32 -32z" />
|
||||
d="M567.403 212.358c5.59668 -8.04688 8.59668 -17.6113 8.59668 -27.4121v-136.946c0 -26.5098 -21.4902 -48 -48 -48h-480c-26.5098 0 -48 21.4902 -48 48v136.946c0 10.167 3.19531 19.6465 8.59668 27.4121l105.08 151.053
|
||||
c8.67383 12.4678 23.0791 20.5889 39.4043 20.5889h269.838c16.3252 0 30.7305 -8.12109 39.4043 -20.5889zM153.081 336l-77.9131 -112h425.664l-77.9131 112h-269.838zM528 48v128h-480v-128h480zM496 112c0 -17.6729 -14.3271 -32 -32 -32s-32 14.3271 -32 32
|
||||
s14.3271 32 32 32s32 -14.3271 32 -32zM400 112c0 -17.6729 -14.3271 -32 -32 -32s-32 14.3271 -32 32s14.3271 32 32 32s32 -14.3271 32 -32z" />
|
||||
<glyph glyph-name="hand-point-right" unicode=""
|
||||
d="M428.8 310.4c45.0996 0 83.2002 -38.1016 83.2002 -83.2002c0 -45.6162 -37.7646 -83.2002 -83.2002 -83.2002h-35.6475c-1.41602 -6.36719 -4.96875 -16.252 -7.92969 -22.0645c2.50586 -22.0059 -3.50293 -44.9775 -15.9844 -62.791
|
||||
d="M428.8 310.4c45.0996 0 83.2002 -38.1016 83.2002 -83.2002c0 -45.6162 -37.7646 -83.2002 -83.2002 -83.2002h-35.6475c-1.71387 -7.70605 -4.43555 -15.2051 -7.92969 -22.0645c2.50586 -22.0059 -3.50293 -44.9775 -15.9844 -62.791
|
||||
c-1.14062 -52.4863 -37.3984 -91.1445 -99.9404 -91.1445h-21.2988c-60.0635 0 -98.5117 40 -127.2 40h-2.67871c-5.74707 -4.95215 -13.5361 -8 -22.1201 -8h-64c-17.6729 0 -32 12.8936 -32 28.7998v230.4c0 15.9062 14.3271 28.7998 32 28.7998h64.001
|
||||
c8.58398 0 16.373 -3.04785 22.1201 -8h2.67871c6.96387 0 14.8623 6.19336 30.1816 23.6689l0.128906 0.148438l0.130859 0.145508c8.85645 9.93652 18.1162 20.8398 25.8506 33.2529c18.7051 30.2471 30.3936 78.7842 75.707 78.7842c56.9277 0 92 -35.2861 92 -83.2002
|
||||
v-0.0839844c0 -6.21777 -0.974609 -16.2148 -2.17578 -22.3154h86.1768zM428.8 192c18.9756 0 35.2002 16.2246 35.2002 35.2002c0 18.7002 -16.7754 35.2002 -35.2002 35.2002h-158.399c0 17.3242 26.3994 35.1992 26.3994 70.3994c0 26.4004 -20.625 35.2002 -44 35.2002
|
||||
c-8.79395 0 -20.4443 -32.7119 -34.9258 -56.0996c-9.07422 -14.5752 -19.5244 -27.2256 -30.7988 -39.875c-16.1094 -18.374 -33.8359 -36.6328 -59.0752 -39.5967v-176.753c42.79 -3.7627 74.5088 -39.6758 120 -39.6758h21.2988
|
||||
c0 -0.0283203 0 0.0361328 0 0.0078125c0 -7.66602 -0.748047 -15.1582 -2.17578 -22.4072h86.1768zM428.8 192c18.9756 0 35.2002 16.2246 35.2002 35.2002c0 18.7002 -16.7754 35.2002 -35.2002 35.2002h-158.399c0 17.3242 26.3994 35.1992 26.3994 70.3994
|
||||
c0 26.4004 -20.625 35.2002 -44 35.2002c-8.79395 0 -20.4443 -32.7119 -34.9258 -56.0996c-9.07422 -14.5752 -19.5244 -27.2256 -30.7988 -39.875c-16.1094 -18.374 -33.8359 -36.6328 -59.0752 -39.5967v-176.753c42.79 -3.7627 74.5088 -39.6758 120 -39.6758h21.2988
|
||||
c40.5244 0 57.124 22.1973 50.6006 61.3252c14.6113 8.00098 24.1514 33.9785 12.9248 53.625c19.3652 18.2246 17.7871 46.3809 4.9502 61.0498h91.0254zM88 64c0 13.2549 -10.7451 24 -24 24s-24 -10.7451 -24 -24s10.7451 -24 24 -24s24 10.7451 24 24z" />
|
||||
<glyph glyph-name="hand-point-left" unicode=""
|
||||
d="M0 227.2c0 45.0986 38.1006 83.2002 83.2002 83.2002h86.1758c-1.3623 6.91016 -2.17578 14.374 -2.17578 22.3994c0 47.9141 35.0723 83.2002 92 83.2002c45.3135 0 57.002 -48.5371 75.7061 -78.7852c7.73438 -12.4121 16.9951 -23.3154 25.8506 -33.2529
|
||||
l0.130859 -0.145508l0.128906 -0.148438c15.3213 -17.4746 23.2197 -23.668 30.1836 -23.668h2.67871c5.74707 4.95215 13.5361 8 22.1201 8h64c17.6729 0 32 -12.8936 32 -28.7998v-230.4c0 -15.9062 -14.3271 -28.7998 -32 -28.7998h-64
|
||||
c-8.58398 0 -16.373 3.04785 -22.1201 8h-2.67871c-28.6885 0 -67.1367 -40 -127.2 -40h-21.2988c-62.542 0 -98.8008 38.6582 -99.9404 91.1445c-12.4814 17.8135 -18.4922 40.7852 -15.9844 62.791c-2.96094 5.8125 -6.51367 15.6973 -7.92969 22.0645h-35.6465
|
||||
c-8.58398 0 -16.373 3.04785 -22.1201 8h-2.67871c-28.6885 0 -67.1367 -40 -127.2 -40h-21.2988c-62.542 0 -98.8008 38.6582 -99.9404 91.1445c-12.4814 17.8135 -18.4922 40.7852 -15.9844 62.791c-3.49414 6.85938 -6.21582 14.3584 -7.92969 22.0645h-35.6465
|
||||
c-45.4355 0 -83.2002 37.584 -83.2002 83.2002zM48 227.2c0 -18.9756 16.2246 -35.2002 35.2002 -35.2002h91.0244c-12.8369 -14.6689 -14.415 -42.8252 4.9502 -61.0498c-11.2256 -19.6465 -1.68652 -45.624 12.9248 -53.625
|
||||
c-6.52246 -39.1279 10.0771 -61.3252 50.6016 -61.3252h21.2988c45.4912 0 77.21 35.9131 120 39.6768v176.752c-25.2393 2.96289 -42.9658 21.2227 -59.0752 39.5967c-11.2744 12.6494 -21.7246 25.2998 -30.7988 39.875
|
||||
c-14.4814 23.3877 -26.1318 56.0996 -34.9258 56.0996c-23.375 0 -44 -8.7998 -44 -35.2002c0 -35.2002 26.3994 -53.0752 26.3994 -70.3994h-158.399c-18.4248 0 -35.2002 -16.5 -35.2002 -35.2002zM448 88c-13.2549 0 -24 -10.7451 -24 -24s10.7451 -24 24 -24
|
||||
s24 10.7451 24 24s-10.7451 24 -24 24z" />
|
||||
<glyph glyph-name="hand-point-up" unicode="" horiz-adv-x="448"
|
||||
d="M105.6 364.8c0 45.0996 38.1016 83.2002 83.2002 83.2002c45.6162 0 83.2002 -37.7646 83.2002 -83.2002v-35.6465c6.36719 -1.41602 16.252 -4.96875 22.0645 -7.92969c22.0059 2.50684 44.9775 -3.50293 62.791 -15.9844
|
||||
d="M105.6 364.8c0 45.0996 38.1016 83.2002 83.2002 83.2002c45.6162 0 83.2002 -37.7646 83.2002 -83.2002v-35.6465c7.70605 -1.71387 15.2051 -4.43555 22.0645 -7.92969c22.0059 2.50684 44.9775 -3.50293 62.791 -15.9844
|
||||
c52.4863 -1.14062 91.1445 -37.3984 91.1445 -99.9404v-21.2988c0 -60.0635 -40 -98.5117 -40 -127.2v-2.67871c4.95215 -5.74707 8 -13.5361 8 -22.1201v-64c0 -17.6729 -12.8936 -32 -28.7998 -32h-230.4c-15.9062 0 -28.7998 14.3271 -28.7998 32v64
|
||||
c0 8.58398 3.04785 16.373 8 22.1201v2.67871c0 6.96387 -6.19336 14.8623 -23.6689 30.1816l-0.148438 0.128906l-0.145508 0.130859c-9.93652 8.85645 -20.8398 18.1162 -33.2529 25.8506c-30.2471 18.7051 -78.7842 30.3936 -78.7842 75.707
|
||||
c0 56.9277 35.2861 92 83.2002 92h0.0839844c6.21777 0 16.2148 -0.974609 22.3154 -2.17578v86.1768zM224 364.8c0 18.9756 -16.2246 35.2002 -35.2002 35.2002c-18.7002 0 -35.2002 -16.7754 -35.2002 -35.2002v-158.399c-17.3242 0 -35.1992 26.3994 -70.3994 26.3994
|
||||
c-26.4004 0 -35.2002 -20.625 -35.2002 -44c0 -8.79395 32.7119 -20.4443 56.0996 -34.9258c14.5752 -9.07422 27.2256 -19.5244 39.875 -30.7988c18.374 -16.1094 36.6328 -33.8359 39.5967 -59.0752h176.753c3.7627 42.79 39.6758 74.5088 39.6758 120v21.2988
|
||||
c0 40.5244 -22.1973 57.124 -61.3252 50.6006c-8.00098 14.6113 -33.9785 24.1514 -53.625 12.9248c-18.2246 19.3652 -46.3809 17.7871 -61.0498 4.9502v91.0254zM352 24c-13.2549 0 -24 -10.7451 -24 -24s10.7451 -24 24 -24s24 10.7451 24 24s-10.7451 24 -24 24z" />
|
||||
c0 56.9277 35.2861 92 83.2002 92c0.0283203 0 -0.0361328 0 -0.0078125 0c7.66602 0 15.1582 -0.748047 22.4072 -2.17578v86.1768zM224 364.8c0 18.9756 -16.2246 35.2002 -35.2002 35.2002c-18.7002 0 -35.2002 -16.7754 -35.2002 -35.2002v-158.399
|
||||
c-17.3242 0 -35.1992 26.3994 -70.3994 26.3994c-26.4004 0 -35.2002 -20.625 -35.2002 -44c0 -8.79395 32.7119 -20.4443 56.0996 -34.9258c14.5752 -9.07422 27.2256 -19.5244 39.875 -30.7988c18.374 -16.1094 36.6328 -33.8359 39.5967 -59.0752h176.753
|
||||
c3.7627 42.79 39.6758 74.5088 39.6758 120v21.2988c0 40.5244 -22.1973 57.124 -61.3252 50.6006c-8.00098 14.6113 -33.9785 24.1514 -53.625 12.9248c-18.2246 19.3652 -46.3809 17.7871 -61.0498 4.9502v91.0254zM352 24c-13.2549 0 -24 -10.7451 -24 -24
|
||||
s10.7451 -24 24 -24s24 10.7451 24 24s-10.7451 24 -24 24z" />
|
||||
<glyph glyph-name="hand-point-down" unicode="" horiz-adv-x="448"
|
||||
d="M188.8 -64c-45.0986 0 -83.2002 38.1006 -83.2002 83.2002v86.1758c-6.91016 -1.3623 -14.374 -2.17578 -22.3994 -2.17578c-47.9141 0 -83.2002 35.0723 -83.2002 92c0 45.3135 48.5371 57.002 78.7852 75.707c12.4121 7.73438 23.3154 16.9951 33.2529 25.8506
|
||||
l0.145508 0.130859l0.148438 0.128906c17.4746 15.3213 23.668 23.2197 23.668 30.1836v2.67871c-4.95215 5.74707 -8 13.5361 -8 22.1201v64c0 17.6729 12.8936 32 28.7998 32h230.4c15.9062 0 28.7998 -14.3271 28.7998 -32v-64.001
|
||||
c0 -8.58398 -3.04785 -16.373 -8 -22.1201v-2.67871c0 -28.6885 40 -67.1367 40 -127.2v-21.2988c0 -62.542 -38.6582 -98.8008 -91.1445 -99.9404c-17.8135 -12.4814 -40.7852 -18.4922 -62.791 -15.9844c-5.8125 -2.96094 -15.6973 -6.51367 -22.0645 -7.92969v-35.6465
|
||||
c0 -8.58398 -3.04785 -16.373 -8 -22.1201v-2.67871c0 -28.6885 40 -67.1367 40 -127.2v-21.2988c0 -62.542 -38.6582 -98.8008 -91.1445 -99.9404c-17.8135 -12.4814 -40.7852 -18.4922 -62.791 -15.9844c-6.85938 -3.49414 -14.3584 -6.21582 -22.0645 -7.92969v-35.6465
|
||||
c0 -45.4355 -37.584 -83.2002 -83.2002 -83.2002zM188.8 -16c18.9756 0 35.2002 16.2246 35.2002 35.2002v91.0244c14.6689 -12.8369 42.8252 -14.415 61.0498 4.9502c19.6465 -11.2256 45.624 -1.68652 53.625 12.9248c39.1279 -6.52246 61.3252 10.0771 61.3252 50.6016
|
||||
v21.2988c0 45.4912 -35.9131 77.21 -39.6768 120h-176.752c-2.96289 -25.2393 -21.2227 -42.9658 -39.5967 -59.0752c-12.6494 -11.2744 -25.2998 -21.7246 -39.875 -30.7988c-23.3877 -14.4814 -56.0996 -26.1318 -56.0996 -34.9258c0 -23.375 8.7998 -44 35.2002 -44
|
||||
c35.2002 0 53.0752 26.3994 70.3994 26.3994v-158.399c0 -18.4248 16.5 -35.2002 35.2002 -35.2002zM328 384c0 -13.2549 10.7451 -24 24 -24s24 10.7451 24 24s-10.7451 24 -24 24s-24 -10.7451 -24 -24z" />
|
||||
<glyph glyph-name="copy" unicode="" horiz-adv-x="448"
|
||||
d="M433.941 382.059c7.75977 -7.75977 14.0586 -22.9658 14.0586 -33.9404v-268.118c0 -26.5098 -21.4902 -48 -48 -48h-80v-48c0 -26.5098 -21.4902 -48 -48 -48h-224c-26.5098 0 -48 21.4902 -48 48v320c0 26.5098 21.4902 48 48 48h80v48c0 26.5098 21.4902 48 48 48
|
||||
h172.118c10.9746 0 26.1807 -6.29883 33.9404 -14.0586zM266 -16c3.31152 0 6 2.68848 6 6v42h-96c-26.5098 0 -48 21.4902 -48 48v224h-74c-3.31152 0 -6 -2.68848 -6 -6v-308c0 -3.31152 2.68848 -6 6 -6h212zM394 80c3.31152 0 6 2.68848 6 6v202h-88
|
||||
c-13.2549 0 -24 10.7451 -24 24v88h-106c-3.31152 0 -6 -2.68848 -6 -6v-308c0 -3.31152 2.68848 -6 6 -6h212zM400 336v9.63184v0.000976562c0 1.37207 -0.787109 3.27246 -1.75684 4.24219l-48.3682 48.3682c-1.12598 1.125 -2.65234 1.75684 -4.24316 1.75684h-9.63184
|
||||
v-64h64z" />
|
||||
d="M433.941 382.059c8.68848 -8.68848 14.0586 -20.6943 14.0586 -33.9404v-268.118c0 -26.5098 -21.4902 -48 -48 -48h-80v-48c0 -26.5098 -21.4902 -48 -48 -48h-224c-26.5098 0 -48 21.4902 -48 48v320c0 26.5098 21.4902 48 48 48h80v48c0 26.5098 21.4902 48 48 48
|
||||
h172.118c13.2461 0 25.252 -5.37012 33.9404 -14.0586zM266 -16c3.31152 0 6 2.68848 6 6v42h-96c-26.5098 0 -48 21.4902 -48 48v224h-74c-3.31152 0 -6 -2.68848 -6 -6v-308c0 -3.31152 2.68848 -6 6 -6h212zM394 80c3.31152 0 6 2.68848 6 6v202h-88
|
||||
c-13.2549 0 -24 10.7451 -24 24v88h-106c-3.31152 0 -6 -2.68848 -6 -6v-308c0 -3.31152 2.68848 -6 6 -6h212zM400 336v9.63184c0 1.65527 -0.670898 3.15723 -1.75684 4.24316l-48.3682 48.3682c-1.12598 1.125 -2.65234 1.75684 -4.24316 1.75684h-9.63184v-64h64z" />
|
||||
<glyph glyph-name="save" unicode="" horiz-adv-x="448"
|
||||
d="M433.941 318.059c7.75977 -7.75977 14.0586 -22.9658 14.0586 -33.9404v-268.118c0 -26.5098 -21.4902 -48 -48 -48h-352c-26.5098 0 -48 21.4902 -48 48v352c0 26.5098 21.4902 48 48 48h268.118c10.9746 0 26.1807 -6.29883 33.9404 -14.0586zM272 368h-128v-80h128v80
|
||||
zM394 16c3.31152 0 6 2.68848 6 6v259.632v0.000976562c0 1.37207 -0.787109 3.27246 -1.75684 4.24219l-78.2432 78.2432v-100.118c0 -13.2549 -10.7451 -24 -24 -24h-176c-13.2549 0 -24 10.7451 -24 24v104h-42c-3.31152 0 -6 -2.68848 -6 -6v-340
|
||||
c0 -3.31152 2.68848 -6 6 -6h340zM224 216c48.5234 0 88 -39.4766 88 -88s-39.4766 -88 -88 -88s-88 39.4766 -88 88s39.4766 88 88 88zM224 88c22.0557 0 40 17.9443 40 40s-17.9443 40 -40 40s-40 -17.9443 -40 -40s17.9443 -40 40 -40z" />
|
||||
d="M433.941 318.059c8.68848 -8.68848 14.0586 -20.6943 14.0586 -33.9404v-268.118c0 -26.5098 -21.4902 -48 -48 -48h-352c-26.5098 0 -48 21.4902 -48 48v352c0 26.5098 21.4902 48 48 48h268.118c13.2461 0 25.252 -5.37012 33.9404 -14.0586zM272 368h-128v-80h128v80z
|
||||
M394 16c3.31152 0 6 2.68848 6 6v259.632c0 1.65527 -0.670898 3.15723 -1.75684 4.24316l-78.2432 78.2432v-100.118c0 -13.2549 -10.7451 -24 -24 -24h-176c-13.2549 0 -24 10.7451 -24 24v104h-42c-3.31152 0 -6 -2.68848 -6 -6v-340c0 -3.31152 2.68848 -6 6 -6h340z
|
||||
M224 216c48.5234 0 88 -39.4766 88 -88s-39.4766 -88 -88 -88s-88 39.4766 -88 88s39.4766 88 88 88zM224 88c22.0557 0 40 17.9443 40 40s-17.9443 40 -40 40s-40 -17.9443 -40 -40s17.9443 -40 40 -40z" />
|
||||
<glyph glyph-name="square" unicode="" horiz-adv-x="448"
|
||||
d="M400 416c26.5 0 48 -21.5 48 -48v-352c0 -26.5 -21.5 -48 -48 -48h-352c-26.5 0 -48 21.5 -48 48v352c0 26.5 21.5 48 48 48h352zM394 16c3.2998 0 6 2.7002 6 6v340c0 3.2998 -2.7002 6 -6 6h-340c-3.2998 0 -6 -2.7002 -6 -6v-340c0 -3.2998 2.7002 -6 6 -6h340z" />
|
||||
<glyph glyph-name="envelope" unicode=""
|
||||
@@ -181,7 +177,7 @@ c-22.5439 -17.748 -60.3359 -55.1787 -103.053 -54.9473c-42.9277 -0.231445 -81.205
|
||||
<glyph glyph-name="lightbulb" unicode="" horiz-adv-x="352"
|
||||
d="M176 368c8.83984 0 16 -7.16016 16 -16s-7.16016 -16 -16 -16c-35.2803 0 -64 -28.7002 -64 -64c0 -8.83984 -7.16016 -16 -16 -16s-16 7.16016 -16 16c0 52.9404 43.0596 96 96 96zM96.0596 -11.1699l-0.0400391 43.1797h159.961l-0.0507812 -43.1797
|
||||
c-0.00976562 -3.13965 -0.939453 -6.21973 -2.67969 -8.83984l-24.5098 -36.8398c-2.95996 -4.45996 -7.95996 -7.14062 -13.3203 -7.14062h-78.8496c-5.35059 0 -10.3506 2.68066 -13.3203 7.14062l-24.5098 36.8398c-1.75 2.62012 -2.68066 5.68945 -2.68066 8.83984z
|
||||
M176 448c97.2002 0 176 -78.7998 176 -176c0 -44.3701 -16.4502 -84.8496 -43.5498 -115.79c-16.6406 -18.9795 -42.7402 -58.79 -52.4199 -92.1602v-0.0498047h-48v0.0996094c0.00390625 4.04199 0.999023 10.4482 2.21973 14.3008
|
||||
M176 448c97.2002 0 176 -78.7998 176 -176c0 -44.3701 -16.4502 -84.8496 -43.5498 -115.79c-16.6406 -18.9795 -42.7402 -58.79 -52.4199 -92.1602v-0.0498047h-48v0.0996094c0.00488281 4.98145 0.790039 9.78809 2.21973 14.3008
|
||||
c5.67969 17.9893 22.9902 64.8496 62.0996 109.46c20.4102 23.29 31.6504 53.1699 31.6504 84.1396c0 70.5801 -57.4199 128 -128 128c-68.2803 0 -128.15 -54.3604 -127.95 -128c0.0898438 -30.9902 11.0703 -60.71 31.6104 -84.1396
|
||||
c39.3496 -44.9004 56.5801 -91.8604 62.1699 -109.67c1.42969 -4.56055 2.13965 -9.30078 2.15039 -14.0703v-0.120117h-48v0.0595703c-9.68066 33.3604 -35.7803 73.1709 -52.4209 92.1602c-27.1094 30.9307 -43.5596 71.4102 -43.5596 115.78
|
||||
c0 93.0303 73.7197 176 176 176z" />
|
||||
@@ -241,13 +237,13 @@ c4.70508 4.66699 12.3027 4.63672 16.9697 -0.0683594l22.5361 -22.7178c4.66699 -4.
|
||||
<glyph glyph-name="share-square" unicode="" horiz-adv-x="576"
|
||||
d="M561.938 289.94c18.75 -18.7402 18.75 -49.1406 0 -67.8809l-143.998 -144c-29.9727 -29.9727 -81.9404 -9.05273 -81.9404 33.9404v53.7998c-101.266 -7.83691 -99.625 -31.6406 -84.1104 -78.7598c14.2285 -43.0889 -33.4736 -79.248 -71.0195 -55.7402
|
||||
c-51.6924 32.3057 -84.8701 83.0635 -84.8701 144.76c0 39.3408 12.2197 72.7402 36.3301 99.3008c19.8398 21.8398 47.7402 38.4697 82.9102 49.4199c36.7295 11.4395 78.3096 16.1094 120.76 17.9893v57.1982c0 42.9355 51.9258 63.9541 81.9404 33.9404zM384 112l144 144
|
||||
l-144 144v-104.09c-110.86 -0.90332 -240 -10.5166 -240 -119.851c0 -52.1396 32.79 -85.6094 62.3096 -104.06c-39.8174 120.65 48.999 141.918 177.69 143.84v-103.84zM408.74 27.5068c6.14844 1.75684 15.5449 5.92383 20.9736 9.30273
|
||||
l-144 144v-104.09c-110.86 -0.90332 -240 -10.5166 -240 -119.851c0 -52.1396 32.79 -85.6094 62.3096 -104.06c-39.8174 120.65 48.999 141.918 177.69 143.84v-103.84zM408.74 27.5068c7.4375 2.125 14.5508 5.30566 20.9736 9.30273
|
||||
c7.97656 4.95215 18.2861 -0.825195 18.2861 -10.2139v-42.5957c0 -26.5098 -21.4902 -48 -48 -48h-352c-26.5098 0 -48 21.4902 -48 48v352c0 26.5098 21.4902 48 48 48h132c6.62695 0 12 -5.37305 12 -12v-4.48633c0 -4.91699 -2.9873 -9.36914 -7.56934 -11.1514
|
||||
c-13.7021 -5.33105 -26.3955 -11.5371 -38.0498 -18.585c-1.59668 -0.974609 -4.41016 -1.77051 -6.28027 -1.77734h-86.1006c-3.31152 0 -6 -2.68848 -6 -6v-340c0 -3.31152 2.68848 -6 6 -6h340c3.31152 0 6 2.68848 6 6v25.9658c0 5.37012 3.5791 10.0596 8.74023 11.541
|
||||
z" />
|
||||
c-13.7021 -5.33105 -26.3955 -11.5371 -38.0498 -18.585c-1.82715 -1.11523 -3.98633 -1.76953 -6.28027 -1.77734h-86.1006c-3.31152 0 -6 -2.68848 -6 -6v-340c0 -3.31152 2.68848 -6 6 -6h340c3.31152 0 6 2.68848 6 6v25.9658c0 5.37012 3.5791 10.0596 8.74023 11.541z
|
||||
" />
|
||||
<glyph glyph-name="compass" unicode="" horiz-adv-x="496"
|
||||
d="M347.94 318.14c16.6592 7.61035 33.8096 -9.54004 26.1992 -26.1992l-65.9697 -144.341c-2.73047 -5.97363 -9.7959 -13.0391 -15.7695 -15.7695l-144.341 -65.9697c-16.6592 -7.61035 -33.8096 9.5498 -26.1992 26.1992l65.9697 144.341
|
||||
c2.73047 5.97363 9.7959 13.0391 15.7695 15.7695zM270.58 169.42c12.4697 12.4697 12.4697 32.6904 0 45.1602s-32.6904 12.4697 -45.1602 0s-12.4697 -32.6904 0 -45.1602s32.6904 -12.4697 45.1602 0zM248 440c136.97 0 248 -111.03 248 -248s-111.03 -248 -248 -248
|
||||
d="M347.94 318.14c16.6592 7.61035 33.8096 -9.54004 26.1992 -26.1992l-65.9697 -144.341c-3.19238 -6.9834 -8.78613 -12.5771 -15.7695 -15.7695l-144.341 -65.9697c-16.6592 -7.61035 -33.8096 9.5498 -26.1992 26.1992l65.9697 144.341
|
||||
c3.19238 6.9834 8.78613 12.5771 15.7695 15.7695zM270.58 169.42c12.4697 12.4697 12.4697 32.6904 0 45.1602s-32.6904 12.4697 -45.1602 0s-12.4697 -32.6904 0 -45.1602s32.6904 -12.4697 45.1602 0zM248 440c136.97 0 248 -111.03 248 -248s-111.03 -248 -248 -248
|
||||
s-248 111.03 -248 248s111.03 248 248 248zM248 -8c110.28 0 200 89.7197 200 200s-89.7197 200 -200 200s-200 -89.7197 -200 -200s89.7197 -200 200 -200z" />
|
||||
<glyph glyph-name="caret-square-down" unicode="" horiz-adv-x="448"
|
||||
d="M125.1 240h197.801c10.6992 0 16.0996 -13 8.5 -20.5l-98.9004 -98.2998c-4.7002 -4.7002 -12.2002 -4.7002 -16.9004 0l-98.8994 98.2998c-7.7002 7.5 -2.2998 20.5 8.39941 20.5zM448 368v-352c0 -26.5 -21.5 -48 -48 -48h-352c-26.5 0 -48 21.5 -48 48v352
|
||||
@@ -287,7 +283,7 @@ l40.4004 -59.8994l70.8994 13.6992c13 2.60059 26.6006 -1.59961 36.2002 -11.0996c9
|
||||
l-91 17.5996l17.5996 -91.2002l-76.7998 -52l76.7998 -52l-17.5996 -91.1992l90.8994 17.5996l51.9004 -77l51.9004 76.9004l91 -17.6006zM256 296c57.2998 0 104 -46.7002 104 -104s-46.7002 -104 -104 -104s-104 46.7002 -104 104s46.7002 104 104 104zM256 136
|
||||
c30.9004 0 56 25.0996 56 56s-25.0996 56 -56 56s-56 -25.0996 -56 -56s25.0996 -56 56 -56z" />
|
||||
<glyph glyph-name="moon" unicode=""
|
||||
d="M279.135 -64c-141.424 0 -256 114.64 -256 256c0 141.425 114.641 256 256 256c13.0068 -0.00195312 33.9443 -1.91797 46.7354 -4.27734c44.0205 -8.13086 53.7666 -66.8691 15.0215 -88.9189c-41.374 -23.5439 -67.4336 -67.4121 -67.4336 -115.836
|
||||
d="M279.135 -64c-141.424 0 -256 114.64 -256 256c0 141.425 114.641 256 256 256c16.0342 -0.00292969 31.5078 -1.46875 46.7354 -4.27734c44.0205 -8.13086 53.7666 -66.8691 15.0215 -88.9189c-41.374 -23.5439 -67.4336 -67.4121 -67.4336 -115.836
|
||||
c0 -83.5234 75.9238 -146.475 158.272 -130.792c43.6904 8.32129 74.5186 -42.5693 46.248 -77.4004c-47.8613 -58.9717 -120.088 -94.7754 -198.844 -94.7754zM279.135 400c-114.875 0 -208 -93.125 -208 -208s93.125 -208 208 -208
|
||||
c65.2314 0 123.439 30.0361 161.575 77.0244c-111.611 -21.2568 -215.252 64.0957 -215.252 177.943c0 67.5127 36.9326 126.392 91.6934 157.555c-12.3271 2.27637 -25.0312 3.47754 -38.0166 3.47754z" />
|
||||
<glyph glyph-name="caret-square-left" unicode="" horiz-adv-x="448"
|
||||
@@ -334,12 +330,12 @@ c12.7002 0 24.9004 -5.09961 33.9004 -14.0996zM256 396.1v-76.0996h76.0996zM336 -1
|
||||
c-33.2002 0 -58 30.4004 -51.4004 62.9004l19.7002 97.0996v32h32v-32h22.1006c5.7998 0 10.6992 -4.09961 11.7998 -9.7002zM160.3 57.9004c17.9004 0 32.4004 12.0996 32.4004 27c0 14.8994 -14.5 27 -32.4004 27c-17.8994 0 -32.3994 -12.1006 -32.3994 -27
|
||||
c0 -14.9004 14.5 -27 32.3994 -27zM192.3 256v-32h-32v32h32z" />
|
||||
<glyph glyph-name="file-audio" unicode="" horiz-adv-x="384"
|
||||
d="M369.941 350.059c7.75977 -7.75977 14.0586 -22.9658 14.0586 -33.9404v-332.118c0 -26.5098 -21.4902 -48 -48 -48h-288c-26.5098 0 -48 21.4902 -48 48v416c0 26.5098 21.4902 48 48 48h204.118c10.9746 0 26.1807 -6.29883 33.9404 -14.0586zM332.118 320
|
||||
d="M369.941 350.059c8.68848 -8.68848 14.0586 -20.6943 14.0586 -33.9404v-332.118c0 -26.5098 -21.4902 -48 -48 -48h-288c-26.5098 0 -48 21.4902 -48 48v416c0 26.5098 21.4902 48 48 48h204.118c13.2461 0 25.252 -5.37012 33.9404 -14.0586zM332.118 320
|
||||
l-76.1182 76.1182v-76.1182h76.1182zM48 -16h288v288h-104c-13.2549 0 -24 10.7451 -24 24v104h-160v-416zM192 60.0244c0 -10.6914 -12.9258 -16.0459 -20.4854 -8.48535l-35.5146 35.9746h-28c-6.62695 0 -12 5.37305 -12 12v56c0 6.62695 5.37305 12 12 12h28
|
||||
l35.5146 36.9473c7.56055 7.56055 20.4854 2.20605 20.4854 -8.48535v-135.951zM233.201 107.154c9.05078 9.29688 9.05957 24.1328 0.000976562 33.4385c-22.1494 22.752 12.2344 56.2461 34.3945 33.4814c27.1982 -27.9404 27.2119 -72.4443 0.000976562 -100.401
|
||||
c-21.793 -22.3857 -56.9463 10.3154 -34.3965 33.4814z" />
|
||||
<glyph glyph-name="file-video" unicode="" horiz-adv-x="384"
|
||||
d="M369.941 350.059c7.75977 -7.75977 14.0586 -22.9658 14.0586 -33.9404v-332.118c0 -26.5098 -21.4902 -48 -48 -48h-288c-26.5098 0 -48 21.4902 -48 48v416c0 26.5098 21.4902 48 48 48h204.118c10.9746 0 26.1807 -6.29883 33.9404 -14.0586zM332.118 320
|
||||
d="M369.941 350.059c8.68848 -8.68848 14.0586 -20.6943 14.0586 -33.9404v-332.118c0 -26.5098 -21.4902 -48 -48 -48h-288c-26.5098 0 -48 21.4902 -48 48v416c0 26.5098 21.4902 48 48 48h204.118c13.2461 0 25.252 -5.37012 33.9404 -14.0586zM332.118 320
|
||||
l-76.1182 76.1182v-76.1182h76.1182zM48 -16h288v288h-104c-13.2549 0 -24 10.7451 -24 24v104h-160v-416zM276.687 195.303c10.0049 10.0049 27.3135 2.99707 27.3135 -11.3135v-111.976c0 -14.2939 -17.2959 -21.332 -27.3135 -11.3135l-52.6865 52.6738v-37.374
|
||||
c0 -11.0459 -8.9541 -20 -20 -20h-104c-11.0459 0 -20 8.9541 -20 20v104c0 11.0459 8.9541 20 20 20h104c11.0459 0 20 -8.9541 20 -20v-37.374z" />
|
||||
<glyph glyph-name="file-code" unicode="" horiz-adv-x="384"
|
||||
@@ -376,9 +372,9 @@ c73.46 -15.2598 127.939 -77.46 127.939 -155.16c0 -41.3604 6.03027 -70.7197 14.33
|
||||
c-35.3203 0 -63.9697 28.6504 -63.9697 64h127.939c0 -35.3496 -28.6494 -64 -63.9697 -64z" />
|
||||
<glyph glyph-name="copyright" unicode=""
|
||||
d="M256 440c136.967 0 248 -111.033 248 -248s-111.033 -248 -248 -248s-248 111.033 -248 248s111.033 248 248 248zM256 -8c110.549 0 200 89.4678 200 200c0 110.549 -89.4678 200 -200 200c-110.549 0 -200 -89.4688 -200 -200c0 -110.549 89.4678 -200 200 -200z
|
||||
M363.351 93.0645c-9.61328 -9.71289 -45.5293 -41.3965 -104.064 -41.3965c-82.4297 0 -140.484 61.4248 -140.484 141.567c0 79.1514 60.2754 139.4 139.763 139.4c55.5303 0 88.7373 -26.6201 97.5928 -34.7783c2.13379 -1.96289 3.86523 -5.9082 3.86523 -8.80762
|
||||
c0 -1.95508 -0.864258 -4.87402 -1.92969 -6.51465l-18.1543 -28.1133c-3.8418 -5.9502 -11.9668 -7.28223 -17.499 -2.9209c-8.5957 6.77637 -31.8145 22.5381 -61.708 22.5381c-48.3037 0 -77.916 -35.3301 -77.916 -80.082c0 -41.5889 26.8877 -83.6924 78.2764 -83.6924
|
||||
c32.6572 0 56.8428 19.0391 65.7266 27.2256c5.26953 4.85645 13.5957 4.03906 17.8193 -1.73828l19.8652 -27.1699c1.28613 -1.74512 2.33008 -4.91992 2.33008 -7.08789c0 -2.72363 -1.56055 -6.5 -3.48242 -8.42969z" />
|
||||
M363.351 93.0645c-9.61328 -9.71289 -45.5293 -41.3965 -104.064 -41.3965c-82.4297 0 -140.484 61.4248 -140.484 141.567c0 79.1514 60.2754 139.4 139.763 139.4c55.5303 0 88.7373 -26.6201 97.5928 -34.7783c2.37793 -2.1875 3.86914 -5.3252 3.86914 -8.80762
|
||||
c0 -2.39746 -0.717773 -4.64258 -1.93359 -6.51465l-18.1543 -28.1133c-3.8418 -5.9502 -11.9668 -7.28223 -17.499 -2.9209c-8.5957 6.77637 -31.8145 22.5381 -61.708 22.5381c-48.3037 0 -77.916 -35.3301 -77.916 -80.082c0 -41.5889 26.8877 -83.6924 78.2764 -83.6924
|
||||
c32.6572 0 56.8428 19.0391 65.7266 27.2256c5.26953 4.85645 13.5957 4.03906 17.8193 -1.73828l19.8652 -27.1699c1.45996 -1.98145 2.32422 -4.42969 2.32422 -7.07715c0 -3.28809 -1.32422 -6.2793 -3.47656 -8.44043z" />
|
||||
<glyph glyph-name="closed-captioning" unicode=""
|
||||
d="M464 384c26.5 0 48 -21.5 48 -48v-288c0 -26.5 -21.5 -48 -48 -48h-416c-26.5 0 -48 21.5 -48 48v288c0 26.5 21.5 48 48 48h416zM458 48c3.2998 0 6 2.7002 6 6v276c0 3.2998 -2.7002 6 -6 6h-404c-3.2998 0 -6 -2.7002 -6 -6v-276c0 -3.2998 2.7002 -6 6 -6h404z
|
||||
M246.9 133.7c1.69922 -2.40039 1.5 -5.60059 -0.5 -7.7002c-53.6006 -56.7998 -172.801 -32.0996 -172.801 67.9004c0 97.2998 121.7 119.5 172.5 70.0996c2.10059 -2 2.5 -3.2002 1 -5.7002l-17.5 -30.5c-1.89941 -3.09961 -6.19922 -4 -9.09961 -1.7002
|
||||
@@ -398,7 +394,7 @@ c6.62695 0 12 -5.37305 12 -12v-72c0 -6.62695 -5.37305 -12 -12 -12h-12v-24h88v12c
|
||||
h-32v-32h32zM96 136h224v12c0 6.62695 5.37305 12 12 12h12v160h-12c-6.62695 0 -12 5.37305 -12 12v12h-224v-12c0 -6.62695 -5.37305 -12 -12 -12h-12v-160h12c6.62695 0 12 -5.37305 12 -12v-12zM224 0v32h-32v-32h32zM504 64v160h-12c-6.62695 0 -12 5.37305 -12 12v12
|
||||
h-88v-88h12c6.62695 0 12 -5.37305 12 -12v-72c0 -6.62695 -5.37305 -12 -12 -12h-72c-6.62695 0 -12 5.37305 -12 12v12h-88v-24h12c6.62695 0 12 -5.37305 12 -12v-12h224v12c0 6.62695 5.37305 12 12 12h12zM544 0v32h-32v-32h32zM544 256v32h-32v-32h32z" />
|
||||
<glyph glyph-name="sticky-note" unicode="" horiz-adv-x="448"
|
||||
d="M448 99.8936c0 -10.9746 -6.29883 -26.1797 -14.0586 -33.9404l-83.8828 -83.8818c-7.75977 -7.76074 -22.9658 -14.0596 -33.9404 -14.0596h-268.118c-26.5098 0 -48 21.4902 -48 48v351.988c0 26.5098 21.4902 48 48 48h352c26.5098 0 48 -21.4902 48 -48v-268.106z
|
||||
d="M448 99.8936c0 -13.2451 -5.37012 -25.252 -14.0586 -33.9404l-83.8828 -83.8818c-8.68848 -8.68848 -20.6943 -14.0596 -33.9404 -14.0596h-268.118c-26.5098 0 -48 21.4902 -48 48v351.988c0 26.5098 21.4902 48 48 48h352c26.5098 0 48 -21.4902 48 -48v-268.106z
|
||||
M320 19.8936l76.1182 76.1182h-76.1182v-76.1182zM400 368h-352v-351.988h224v104c0 13.2549 10.7451 24 24 24h104v223.988z" />
|
||||
<glyph glyph-name="clone" unicode=""
|
||||
d="M464 448c26.5098 0 48 -21.4902 48 -48v-320c0 -26.5098 -21.4902 -48 -48 -48h-48v-48c0 -26.5098 -21.4902 -48 -48 -48h-320c-26.5098 0 -48 21.4902 -48 48v320c0 26.5098 21.4902 48 48 48h48v48c0 26.5098 21.4902 48 48 48h320zM362 -16c3.31152 0 6 2.68848 6 6
|
||||
@@ -412,11 +408,11 @@ d="M408.864 368.948c48.8213 20.751 103.136 -15.0723 103.136 -67.9111v-114.443c0
|
||||
c-17.6729 0 -32 14.3271 -32 32c0 27.3301 1.1416 29.2012 -3.11035 32.9033l-97.71 85.0811c-24.8994 21.6797 -39.1797 52.8926 -39.1797 85.6338v56.9531c0 47.4277 44.8457 82.0215 91.0459 71.1807c1.96094 55.751 63.5107 87.8262 110.671 60.8057
|
||||
c29.1895 31.0713 78.8604 31.4473 108.334 -0.0214844c32.7051 18.6846 76.4121 10.3096 98.8135 -23.5879zM464 186.594v114.445c0 34.29 -52 33.8232 -52 0.676758c0 -8.83594 -7.16309 -16 -16 -16h-7c-8.83691 0 -16 7.16406 -16 16v26.751
|
||||
c0 34.457 -52 33.707 -52 0.676758v-27.4287c0 -8.83594 -7.16309 -16 -16 -16h-7c-8.83691 0 -16 7.16406 -16 16v40.4658c0 34.3525 -52 33.8115 -52 0.677734v-41.1436c0 -8.83594 -7.16406 -16 -16 -16h-7c-8.83594 0 -16 7.16406 -16 16v26.751
|
||||
c0 34.4023 -52 33.7744 -52 0.676758v-116.571c0 -8.83203 -7.16797 -16 -16 -16c-3.30664 0 -8.01367 1.7627 -10.5068 3.93359l-7 6.09473c-3.03223 2.64062 -5.49316 8.04688 -5.49316 12.0674v0v41.2275c0 34.2148 -52 33.8857 -52 0.677734v-56.9531
|
||||
c0 -18.8555 8.27441 -36.874 22.7002 -49.4365l97.71 -85.0801c12.4502 -10.8398 19.5898 -26.4463 19.5898 -42.8164v-10.2861h220v7.07617c0 13.21 2.65332 26.0791 7.88281 38.25l42.835 99.6553c2.91602 6.75391 5.28223 18.207 5.28223 25.5635v0.0488281z" />
|
||||
c0 34.4023 -52 33.7744 -52 0.676758v-116.571c0 -8.83105 -7.17773 -15.9961 -16.0078 -15.9961c-4.0166 0 -7.68848 1.48242 -10.499 3.92969l-7 6.09473c-3.37012 2.93457 -5.49316 7.25293 -5.49316 12.0674v41.2275c0 34.2148 -52 33.8857 -52 0.677734v-56.9531
|
||||
c0 -18.8555 8.27441 -36.874 22.7002 -49.4365l97.71 -85.0801c12.4502 -10.8398 19.5898 -26.4463 19.5898 -42.8164v-10.2861h220v7.07617c0 13.21 2.65332 26.0791 7.88281 38.25l42.835 99.6553c3.37891 7.82715 5.28223 16.501 5.28223 25.5625v0.0498047z" />
|
||||
<glyph glyph-name="hand-paper" unicode="" horiz-adv-x="448"
|
||||
d="M372.57 335.359c39.9062 5.63281 75.4297 -25.7393 75.4297 -66.3594v-131.564c-0.00195312 -12.7666 -2.33008 -33.2246 -5.19531 -45.666l-30.1836 -130.958c-3.34668 -14.5234 -16.2783 -24.8125 -31.1816 -24.8125h-222.897
|
||||
c-9.10352 0 -20.7793 6.01758 -26.0615 13.4316l-119.97 168.415c-21.2441 29.8203 -14.8047 71.3574 14.5498 93.1533c18.7754 13.9395 42.1309 16.2979 62.083 8.87109v126.13c0 44.0547 41.125 75.5439 82.4053 64.9834c23.8926 48.1963 92.3535 50.2471 117.982 0.74707
|
||||
d="M372.57 335.359c39.9062 5.63281 75.4297 -25.7393 75.4297 -66.3594v-131.564c-0.00292969 -15.7393 -1.80566 -30.9482 -5.19531 -45.666l-30.1836 -130.958c-3.34668 -14.5234 -16.2783 -24.8125 -31.1816 -24.8125h-222.897
|
||||
c-10.7539 0 -20.2588 5.28613 -26.0615 13.4316l-119.97 168.415c-21.2441 29.8203 -14.8047 71.3574 14.5498 93.1533c18.7754 13.9395 42.1309 16.2979 62.083 8.87109v126.13c0 44.0547 41.125 75.5439 82.4053 64.9834c23.8926 48.1963 92.3535 50.2471 117.982 0.74707
|
||||
c42.5186 11.1445 83.0391 -21.9346 83.0391 -65.5469v-10.8242zM399.997 137.437l-0.00195312 131.563c0 24.9492 -36.5703 25.5508 -36.5703 -0.691406v-76.3086c0 -8.83691 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16309 -16 16v154.184
|
||||
c0 25.501 -36.5703 26.3633 -36.5703 0.691406v-154.875c0 -8.83691 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16309 -16 16v188.309c0 25.501 -36.5703 26.3545 -36.5703 0.691406v-189c0 -8.83691 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16309 -16 16
|
||||
v153.309c0 25.501 -36.5713 26.3359 -36.5713 0.691406v-206.494c0 -15.5703 -20.0352 -21.9092 -29.0303 -9.2832l-27.1279 38.0791c-14.3711 20.1709 -43.833 -2.33496 -29.3945 -22.6045l115.196 -161.697h201.92l27.3252 118.551
|
||||
@@ -424,45 +420,46 @@ c2.63086 11.417 3.96484 23.1553 3.96484 34.8857z" />
|
||||
<glyph glyph-name="hand-scissors" unicode=""
|
||||
d="M256 -32c-44.9561 0 -77.3428 43.2627 -64.0244 85.8535c-21.6484 13.71 -34.0156 38.7617 -30.3408 65.0068h-87.6348c-40.8037 0 -74 32.8105 -74 73.1406c0 40.3291 33.1963 73.1396 74 73.1396l94 -9.14062l-78.8496 18.6787
|
||||
c-38.3076 14.7422 -57.04 57.4707 -41.9424 95.1123c15.0303 37.4736 57.7549 55.7803 95.6416 41.2012l144.929 -55.7568c24.9551 30.5566 57.8086 43.9932 92.2178 24.7324l97.999 -54.8525c20.9746 -11.7393 34.0049 -33.8457 34.0049 -57.6904v-205.702
|
||||
c0 -30.7422 -21.4404 -57.5576 -51.7979 -64.5537l-118.999 -27.4268c-4.97168 -1.14648 -10.0889 -1.72949 -15.2031 -1.72949zM256 16.0127l70 -0.000976562c1.23633 0 3.21777 0.225586 4.42285 0.501953l119.001 27.4277
|
||||
c8.58203 1.97754 14.5762 9.29102 14.5762 17.7812v205.701c0 6.4873 -3.62109 12.542 -9.44922 15.8047l-98 54.8545c-8.13965 4.55566 -18.668 2.61914 -24.4873 -4.50781l-21.7646 -26.6475c-2.65039 -3.24512 -8.20215 -5.87891 -12.3926 -5.87891
|
||||
c-1.64062 0 -4.21484 0.477539 -5.74609 1.06738l-166.549 64.0908c-32.6543 12.5664 -50.7744 -34.5771 -19.2227 -46.7168l155.357 -59.7852c5.66016 -2.17773 10.2539 -8.86816 10.2539 -14.9326v0v-11.6328c0 -8.83691 -7.16309 -16 -16 -16h-182
|
||||
c0 -30.7422 -21.4404 -57.5576 -51.7979 -64.5537l-118.999 -27.4268c-4.97168 -1.14648 -10.0889 -1.72949 -15.2031 -1.72949zM256 16.0127l70 -0.000976562c1.52441 0 2.99707 0.174805 4.42285 0.501953l119.001 27.4277
|
||||
c8.58203 1.97754 14.5762 9.29102 14.5762 17.7812v205.701c0 6.4873 -3.62109 12.542 -9.44922 15.8047l-98 54.8545c-8.13965 4.55566 -18.668 2.61914 -24.4873 -4.50781l-21.7646 -26.6475c-2.93457 -3.59375 -7.40332 -5.87305 -12.4004 -5.87305
|
||||
c-2.02246 0 -3.95703 0.375977 -5.73828 1.06152l-166.549 64.0908c-32.6543 12.5664 -50.7744 -34.5771 -19.2227 -46.7168l155.357 -59.7852c6 -2.30859 10.2539 -8.12402 10.2539 -14.9326v-11.6328c0 -8.83691 -7.16309 -16 -16 -16h-182
|
||||
c-34.375 0 -34.4297 -50.2803 0 -50.2803h182c8.83691 0 16 -7.16309 16 -16v-6.85645c0 -8.83691 -7.16309 -16 -16 -16h-28c-25.1221 0 -25.1592 -36.5674 0 -36.5674h28c8.83691 0 16 -7.16211 16 -16v-6.85547c0 -8.83691 -7.16309 -16 -16 -16
|
||||
c-25.1201 0 -25.1602 -36.5674 0 -36.5674z" />
|
||||
<glyph glyph-name="hand-lizard" unicode="" horiz-adv-x="576"
|
||||
d="M556.686 157.458c12.6357 -19.4863 19.3145 -42.0615 19.3145 -65.2871v-124.171h-224v71.582l-99.751 38.7871c-2.7832 1.08203 -5.70996 1.63086 -8.69727 1.63086h-131.552c-30.8789 0 -56 25.1211 -56 56c0 48.5234 39.4766 88 88 88h113.709l18.333 48h-196.042
|
||||
c-44.1123 0 -80 35.8877 -80 80v8c0 30.8779 25.1211 56 56 56h293.917c24.5 0 47.084 -12.2725 60.4111 -32.8291zM528 16v76.1709v0.0478516c0 11.7461 -5.19141 29.2734 -11.5879 39.124l-146.358 225.715c-4.44336 6.85254 -11.9707 10.9424 -20.1367 10.9424h-293.917
|
||||
c-4.41113 0 -8 -3.58887 -8 -8v-8c0 -17.6445 14.3555 -32 32 -32h213.471c25.2021 0 42.626 -25.293 33.6299 -48.8457l-24.5518 -64.2812c-7.05371 -18.4658 -25.0732 -30.873 -44.8398 -30.873h-113.709c-22.0557 0 -40 -17.9443 -40 -40c0 -4.41113 3.58887 -8 8 -8
|
||||
h131.552h0.0517578c7.44141 0 19.1074 -2.19238 26.041 -4.89355l99.752 -38.7881c18.5898 -7.22852 30.6035 -24.7881 30.6035 -44.7363v-23.582h128z" />
|
||||
c-44.1123 0 -80 35.8877 -80 80v8c0 30.8779 25.1211 56 56 56h293.917c24.5 0 47.084 -12.2725 60.4111 -32.8291zM528 16v76.1709c0 0.0166016 -0.0439453 0.106445 -0.0439453 0.12207c0 14.3945 -4.24219 27.8057 -11.5439 39.0498l-146.358 225.715
|
||||
c-4.44336 6.85254 -11.9707 10.9424 -20.1367 10.9424h-293.917c-4.41113 0 -8 -3.58887 -8 -8v-8c0 -17.6445 14.3555 -32 32 -32h213.471c25.2021 0 42.626 -25.293 33.6299 -48.8457l-24.5518 -64.2812c-7.05371 -18.4658 -25.0732 -30.873 -44.8398 -30.873h-113.709
|
||||
c-22.0557 0 -40 -17.9443 -40 -40c0 -4.41113 3.58887 -8 8 -8h131.552c0.0175781 0 0.0712891 -0.0273438 0.0888672 -0.0273438c9.16992 0 17.9404 -1.72461 26.0039 -4.86621l99.752 -38.7881c18.5898 -7.22852 30.6035 -24.7881 30.6035 -44.7363v-23.582h128z" />
|
||||
<glyph glyph-name="hand-spock" unicode=""
|
||||
d="M501.03 331.824c6.05762 -9.77832 10.9746 -27.0498 10.9746 -38.5518c0 -4.80664 -0.915039 -12.499 -2.04297 -17.1709l-57.623 -241.963c-12.748 -54.1729 -68.2627 -98.1387 -123.915 -98.1387h-0.345703h-107.455h-0.224609
|
||||
c-33.8135 0 -81.2148 18.834 -105.807 42.041l-91.3652 85.9766c-12.8213 12.0469 -23.2266 36.1016 -23.2266 53.6943c0 16.1299 8.97266 38.7529 20.0273 50.499c5.31836 5.66406 29.875 29.3926 68.1152 21.8477l-24.3594 82.1973
|
||||
c-1.68164 5.66406 -3.0459 15.0576 -3.0459 20.9668c0 37.5938 30.417 70.502 67.8955 73.4551c-0.204102 2.03125 -0.369141 5.33691 -0.369141 7.37891c0 31.627 24.8594 63.6895 55.4902 71.5684c43.248 10.9785 80.5645 -17.7012 89.6602 -53.0723l13.6836 -53.207
|
||||
l4.64648 22.6602c6.76074 32.417 39.123 58.8115 72.2373 58.916c8.73438 0 56.625 -3.26953 70.7383 -54.0801c15.0664 0.710938 46.9199 -3.50977 66.3105 -35.0176zM463.271 287.219c7.86914 32.9844 -42.1211 45.2695 -50.0859 11.9219l-24.8008 -104.146
|
||||
c-4.38867 -18.4141 -31.7783 -11.8926 -28.0557 6.2168l28.5479 139.166c7.39844 36.0703 -43.3076 45.0703 -50.1182 11.9629l-31.791 -154.971c-3.54883 -17.3086 -28.2832 -18.0469 -32.7109 -0.804688l-47.3262 184.035
|
||||
c-8.43359 32.8105 -58.3691 20.2676 -49.8652 -12.8359l42.4414 -165.039c4.81641 -18.7207 -23.3711 -26.9121 -28.9648 -8.00781l-31.3438 105.779c-9.6875 32.6465 -59.1191 18.2578 -49.3867 -14.625l36.0137 -121.539
|
||||
c5.61816 -18.9521 10.1777 -50.377 10.1777 -70.1436v-0.00878906c0 -6.54297 -8.05664 -10.9355 -13.4824 -5.82617l-51.123 48.1074c-24.7852 23.4082 -60.0527 -14.1875 -35.2793 -37.4902l91.3691 -85.9805c16.9629 -16.0068 49.6592 -28.998 72.9824 -28.998h0.154297
|
||||
h107.455h0.216797c34.7402 0 69.3936 27.4443 77.3525 61.2598z" />
|
||||
d="M501.03 331.824c6.92773 -11.1826 10.9697 -24.4053 10.9697 -38.5146c0 -5.92676 -0.706055 -11.6885 -2.03809 -17.208l-57.623 -241.963c-13.2236 -56.1904 -63.707 -98.1387 -123.908 -98.1387h-0.352539h-107.455
|
||||
c-0.0761719 0 -0.193359 0.00195312 -0.270508 0.00195312c-40.9248 0 -78.1475 15.9814 -105.761 42.0391l-91.3652 85.9766c-14.3076 13.4434 -23.2246 32.5547 -23.2246 53.7168c0 19.5254 7.61035 37.2861 20.0254 50.4766
|
||||
c5.31836 5.66406 29.875 29.3926 68.1152 21.8477l-24.3594 82.1973c-1.97363 6.64844 -2.97656 13.6836 -2.97656 20.9688c0 38.6953 29.8926 70.4639 67.8262 73.4531c-0.246094 2.45117 -0.34082 4.85547 -0.34082 7.37207c0 34.4199 23.585 63.376 55.4619 71.5752
|
||||
c43.248 10.9785 80.5645 -17.7012 89.6602 -53.0723l13.6836 -53.207l4.64648 22.6602c6.99023 33.5186 36.6826 58.8037 72.2373 58.916c8.73438 0 56.625 -3.26953 70.7383 -54.0801c15.0664 0.710938 46.9199 -3.50977 66.3105 -35.0176zM463.271 287.219
|
||||
c7.86914 32.9844 -42.1211 45.2695 -50.0859 11.9219l-24.8008 -104.146c-4.38867 -18.4141 -31.7783 -11.8926 -28.0557 6.2168l28.5479 139.166c7.39844 36.0703 -43.3076 45.0703 -50.1182 11.9629l-31.791 -154.971
|
||||
c-3.54883 -17.3086 -28.2832 -18.0469 -32.7109 -0.804688l-47.3262 184.035c-8.43359 32.8105 -58.3691 20.2676 -49.8652 -12.8359l42.4414 -165.039c4.81641 -18.7207 -23.3711 -26.9121 -28.9648 -8.00781l-31.3438 105.779
|
||||
c-9.6875 32.6465 -59.1191 18.2578 -49.3867 -14.625l36.0137 -121.539c6.59375 -22.2441 10.1777 -45.7803 10.1777 -70.1523c0 -6.54297 -8.05664 -10.9355 -13.4824 -5.82617l-51.123 48.1074c-24.7852 23.4082 -60.0527 -14.1875 -35.2793 -37.4902l91.3691 -85.9805
|
||||
c19.0469 -17.9736 44.75 -28.998 72.9795 -28.998h0.157227h107.455c0.0732422 0 0.138672 0.0429688 0.212891 0.0429688c37.5791 0 69.1016 26.1416 77.3564 61.2168z" />
|
||||
<glyph glyph-name="hand-pointer" unicode="" horiz-adv-x="448"
|
||||
d="M358.182 268.639c43.1934 16.6348 89.8184 -15.7949 89.8184 -62.6387v-84c-0.000976562 -4.25 -0.775391 -11.0615 -1.72754 -15.2041l-27.4297 -118.999c-6.98242 -30.2969 -33.7549 -51.7969 -64.5566 -51.7969h-178.286c-21.2588 0 -41.3682 10.4102 -53.791 27.8457
|
||||
l-109.699 154.001c-21.2432 29.8193 -14.8047 71.3574 14.5498 93.1523c18.8115 13.9658 42.1748 16.2822 62.083 8.87207v161.129c0 36.9443 29.7363 67 66.2861 67s66.2861 -30.0557 66.2861 -67v-73.6338c20.4131 2.85742 41.4678 -3.94238 56.5947 -19.6289
|
||||
c27.1934 12.8467 60.3799 5.66992 79.8721 -19.0986zM80.9854 168.303c-14.4004 20.2119 -43.8008 -2.38281 -29.3945 -22.6055l109.712 -154c3.43457 -4.81934 8.92871 -7.69727 14.6973 -7.69727h178.285c8.49219 0 15.8037 5.99414 17.7822 14.5762l27.4297 119.001
|
||||
c0.333008 1.44629 0.501953 2.93457 0.501953 4.42285v84c0 25.1602 -36.5713 25.1211 -36.5713 0c0 -8.83594 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16406 -16 16v21c0 25.1602 -36.5713 25.1201 -36.5713 0v-21c0 -8.83594 -7.16309 -16 -16 -16h-6.85938
|
||||
c-8.83691 0 -16 7.16406 -16 16v35c0 25.1602 -36.5703 25.1201 -36.5703 0v-35c0 -8.83594 -7.16309 -16 -16 -16h-6.85742c-8.83691 0 -16 7.16406 -16 16v175c0 25.1602 -36.5713 25.1201 -36.5713 0v-241.493c0 -15.5703 -20.0352 -21.9092 -29.0303 -9.2832z
|
||||
M176.143 48v96c0 8.83691 6.26855 16 14 16h6c7.73242 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26758 -16 -14 -16h-6c-7.73242 0 -14 7.16309 -14 16zM251.571 48v96c0 8.83691 6.26758 16 14 16h6c7.73145 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26855 -16 -14 -16h-6
|
||||
c-7.73242 0 -14 7.16309 -14 16zM327 48v96c0 8.83691 6.26758 16 14 16h6c7.73242 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26758 -16 -14 -16h-6c-7.73242 0 -14 7.16309 -14 16z" />
|
||||
d="M358.182 268.639c43.1934 16.6348 89.8184 -15.7949 89.8184 -62.6387v-84c-0.000976562 -5.24023 -0.600586 -10.3037 -1.72754 -15.2041l-27.4297 -118.999c-6.98242 -30.2969 -33.7549 -51.7969 -64.5566 -51.7969h-178.286
|
||||
c-21.2588 0 -41.3682 10.4102 -53.791 27.8457l-109.699 154.001c-21.2432 29.8193 -14.8047 71.3574 14.5498 93.1523c18.8115 13.9658 42.1748 16.2822 62.083 8.87207v161.129c0 36.9443 29.7363 67 66.2861 67s66.2861 -30.0557 66.2861 -67v-73.6338
|
||||
c20.4131 2.85742 41.4678 -3.94238 56.5947 -19.6289c27.1934 12.8467 60.3799 5.66992 79.8721 -19.0986zM80.9854 168.303c-14.4004 20.2119 -43.8008 -2.38281 -29.3945 -22.6055l109.712 -154c3.43457 -4.81934 8.92871 -7.69727 14.6973 -7.69727h178.285
|
||||
c8.49219 0 15.8037 5.99414 17.7822 14.5762l27.4297 119.001c0.333008 1.44629 0.501953 2.93457 0.501953 4.42285v84c0 25.1602 -36.5713 25.1211 -36.5713 0c0 -8.83594 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16406 -16 16v21
|
||||
c0 25.1602 -36.5713 25.1201 -36.5713 0v-21c0 -8.83594 -7.16309 -16 -16 -16h-6.85938c-8.83691 0 -16 7.16406 -16 16v35c0 25.1602 -36.5703 25.1201 -36.5703 0v-35c0 -8.83594 -7.16309 -16 -16 -16h-6.85742c-8.83691 0 -16 7.16406 -16 16v175
|
||||
c0 25.1602 -36.5713 25.1201 -36.5713 0v-241.493c0 -15.5703 -20.0352 -21.9092 -29.0303 -9.2832zM176.143 48v96c0 8.83691 6.26855 16 14 16h6c7.73242 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26758 -16 -14 -16h-6c-7.73242 0 -14 7.16309 -14 16zM251.571 48v96
|
||||
c0 8.83691 6.26758 16 14 16h6c7.73145 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26855 -16 -14 -16h-6c-7.73242 0 -14 7.16309 -14 16zM327 48v96c0 8.83691 6.26758 16 14 16h6c7.73242 0 14 -7.16309 14 -16v-96c0 -8.83691 -6.26758 -16 -14 -16h-6
|
||||
c-7.73242 0 -14 7.16309 -14 16z" />
|
||||
<glyph glyph-name="hand-peace" unicode="" horiz-adv-x="448"
|
||||
d="M362.146 256.024c42.5908 13.3184 85.8535 -19.0684 85.8535 -64.0244l-0.0117188 -70.001c-0.000976562 -4.25 -0.775391 -11.0615 -1.72949 -15.2031l-27.4268 -118.999c-6.99707 -30.3564 -33.8105 -51.7969 -64.5547 -51.7969h-205.702
|
||||
d="M362.146 256.024c42.5908 13.3184 85.8535 -19.0684 85.8535 -64.0244l-0.0117188 -70.001c-0.000976562 -5.24023 -0.600586 -10.3027 -1.72949 -15.2031l-27.4268 -118.999c-6.99707 -30.3564 -33.8105 -51.7969 -64.5547 -51.7969h-205.702
|
||||
c-23.8447 0 -45.9502 13.0303 -57.6904 34.0059l-54.8525 97.999c-19.2607 34.4092 -5.82422 67.2617 24.7324 92.2178l-55.7568 144.928c-14.5791 37.8867 3.72754 80.6113 41.2012 95.6416c37.6406 15.0977 80.3691 -3.63477 95.1123 -41.9424l18.6787 -78.8496
|
||||
l-9.14062 94c0 40.8037 32.8096 74 73.1396 74s73.1406 -33.1963 73.1406 -74v-87.6348c26.2451 3.6748 51.2959 -8.69238 65.0068 -30.3408zM399.987 122l-0.000976562 70c0 25.1602 -36.5674 25.1201 -36.5674 0c0 -8.83691 -7.16309 -16 -16 -16h-6.85547
|
||||
c-8.83789 0 -16 7.16309 -16 16v28c0 25.1592 -36.5674 25.1221 -36.5674 0v-28c0 -8.83691 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16309 -16 16v182c0 34.4297 -50.2803 34.375 -50.2803 0v-182c0 -8.83691 -7.16309 -16 -16 -16h-11.6328v0
|
||||
c-6.06445 0 -12.7549 4.59375 -14.9326 10.2539l-59.7842 155.357c-12.1396 31.5518 -59.2842 13.4326 -46.7168 -19.2227l64.0898 -166.549c0.589844 -1.53125 1.06738 -4.10547 1.06738 -5.74609c0 -4.19043 -2.63379 -9.74219 -5.87891 -12.3926l-26.6475 -21.7646
|
||||
c-8.83789 0 -16 7.16309 -16 16v28c0 25.1592 -36.5674 25.1221 -36.5674 0v-28c0 -8.83691 -7.16309 -16 -16 -16h-6.85645c-8.83691 0 -16 7.16309 -16 16v182c0 34.4297 -50.2803 34.375 -50.2803 0v-182c0 -8.83691 -7.16309 -16 -16 -16h-11.6328
|
||||
c-6.80859 0 -12.624 4.25391 -14.9326 10.2539l-59.7842 155.357c-12.1396 31.5518 -59.2842 13.4326 -46.7168 -19.2227l64.0898 -166.549c0.685547 -1.78125 1.07812 -3.71875 1.07812 -5.74121c0 -4.99707 -2.2959 -9.46289 -5.88965 -12.3975l-26.6475 -21.7646
|
||||
c-7.12695 -5.81934 -9.06445 -16.3467 -4.50781 -24.4873l54.8535 -98c3.26367 -5.82812 9.31934 -9.44922 15.8057 -9.44922h205.701c8.49121 0 15.8037 5.99414 17.7812 14.5762l27.4277 119.001c0.333008 1.44629 0.501953 2.93457 0.501953 4.42285z" />
|
||||
<glyph glyph-name="registered" unicode=""
|
||||
d="M256 440c136.967 0 248 -111.033 248 -248s-111.033 -248 -248 -248s-248 111.033 -248 248s111.033 248 248 248zM256 -8c110.549 0 200 89.4678 200 200c0 110.549 -89.4678 200 -200 200c-110.549 0 -200 -89.4688 -200 -200c0 -110.549 89.4678 -200 200 -200z
|
||||
M366.442 73.791c4.40332 -7.99219 -1.37012 -17.791 -10.5107 -17.791h-42.8096h-0.0126953c-3.97559 0 -8.71582 2.84961 -10.5801 6.36035l-47.5156 89.3027h-31.958v-83.6631c0 -6.61719 -5.38281 -12 -12 -12h-38.5674c-6.61719 0 -12 5.38281 -12 12v248.304
|
||||
c0 6.61719 5.38281 12 12 12h78.667c71.251 0 101.498 -32.749 101.498 -85.252c0 -31.6123 -15.2148 -59.2969 -39.4824 -73.1758c3.02148 -4.61719 0.225586 0.199219 53.2715 -96.085zM256.933 208.094c20.9131 0 32.4307 11.5186 32.4316 32.4316
|
||||
c0 19.5752 -6.5127 31.709 -38.9297 31.709h-27.377v-64.1406h33.875z" />
|
||||
M366.442 73.791c4.40332 -7.99219 -1.37012 -17.791 -10.5107 -17.791h-42.8096c-0.00488281 0 -0.000976562 -0.0126953 -0.00585938 -0.0126953c-4.58594 0 -8.57422 2.58301 -10.5869 6.37305l-47.5156 89.3027h-31.958v-83.6631c0 -6.61719 -5.38281 -12 -12 -12
|
||||
h-38.5674c-6.61719 0 -12 5.38281 -12 12v248.304c0 6.61719 5.38281 12 12 12h78.667c71.251 0 101.498 -32.749 101.498 -85.252c0 -31.6123 -15.2148 -59.2969 -39.4824 -73.1758c3.02148 -4.61719 0.225586 0.199219 53.2715 -96.085zM256.933 208.094
|
||||
c20.9131 0 32.4307 11.5186 32.4316 32.4316c0 19.5752 -6.5127 31.709 -38.9297 31.709h-27.377v-64.1406h33.875z" />
|
||||
<glyph glyph-name="calendar-plus" unicode="" horiz-adv-x="448"
|
||||
d="M336 156v-24c0 -6.59961 -5.40039 -12 -12 -12h-76v-76c0 -6.59961 -5.40039 -12 -12 -12h-24c-6.59961 0 -12 5.40039 -12 12v76h-76c-6.59961 0 -12 5.40039 -12 12v24c0 6.59961 5.40039 12 12 12h76v76c0 6.59961 5.40039 12 12 12h24c6.59961 0 12 -5.40039 12 -12
|
||||
v-76h76c6.59961 0 12 -5.40039 12 -12zM448 336v-352c0 -26.5 -21.5 -48 -48 -48h-352c-26.5 0 -48 21.5 -48 48v352c0 26.5 21.5 48 48 48h48v52c0 6.59961 5.40039 12 12 12h40c6.59961 0 12 -5.40039 12 -12v-52h128v52c0 6.59961 5.40039 12 12 12h40
|
||||
@@ -481,9 +478,9 @@ c6.62695 0 12 -5.37305 12 -12v-52h48zM394 -16c3.31152 0 6 2.68848 6 6v298h-352v-
|
||||
c-4.66699 4.70508 -4.6377 12.3027 0.0673828 16.9707l22.7197 22.5361c4.70508 4.66699 12.3027 4.63672 16.9697 -0.0693359l44.1035 -44.4609l111.072 110.182c4.70508 4.66699 12.3027 4.63672 16.9707 -0.0683594l22.5361 -22.7178
|
||||
c4.66699 -4.70508 4.63672 -12.3027 -0.0683594 -16.9697z" />
|
||||
<glyph glyph-name="map" unicode="" horiz-adv-x="576"
|
||||
d="M560.02 416c8.4502 0 15.9805 -6.83008 15.9805 -16.0195v-346.32c0 -11.9609 -9.01367 -25.2705 -20.1201 -29.71l-151.83 -52.8105c-5.32617 -1.7334 -14.1953 -3.13965 -19.7969 -3.13965c-5.7373 0 -14.8105 1.47363 -20.2529 3.29004l-172 60.71l-170.05 -62.8398
|
||||
c-1.99023 -0.790039 -4 -1.16016 -5.95996 -1.16016c-8.45996 0 -15.9902 6.83008 -15.9902 16.0195v346.32c0.00292969 11.959 9.0166 25.2686 20.1201 29.71l151.83 52.8105c6.43945 2.08984 13.1201 3.13965 19.8096 3.13965
|
||||
c5.73242 -0.00195312 14.8008 -1.47168 20.2402 -3.28027l172 -60.7197h0.00976562l170.05 62.8398c1.98047 0.790039 4 1.16016 5.95996 1.16016zM224 357.58v-285.97l128 -45.1904v285.97zM48 29.9502l127.36 47.0801l0.639648 0.229492v286.2l-128 -44.5303v-288.979z
|
||||
d="M560.02 416c8.4502 0 15.9805 -6.83008 15.9805 -16.0195v-346.32c0 -13.4707 -8.32422 -24.9951 -20.1201 -29.71l-151.83 -52.8105c-6.23242 -2.02832 -12.9023 -3.12305 -19.8076 -3.12305c-7.07324 0 -13.8799 1.15039 -20.2422 3.27344l-172 60.71l-170.05 -62.8398
|
||||
c-1.99023 -0.790039 -4 -1.16016 -5.95996 -1.16016c-8.45996 0 -15.9902 6.83008 -15.9902 16.0195v346.32c0.00292969 13.4697 8.32617 24.9932 20.1201 29.71l151.83 52.8105c6.43945 2.08984 13.1201 3.13965 19.8096 3.13965
|
||||
c7.06641 -0.00292969 13.8789 -1.16602 20.2402 -3.28027l172 -60.7197h0.00976562l170.05 62.8398c1.98047 0.790039 4 1.16016 5.95996 1.16016zM224 357.58v-285.97l128 -45.1904v285.97zM48 29.9502l127.36 47.0801l0.639648 0.229492v286.2l-128 -44.5303v-288.979z
|
||||
M528 65.0801v288.97l-127.36 -47.0693l-0.639648 -0.240234v-286.19z" />
|
||||
<glyph glyph-name="comment-alt" unicode=""
|
||||
d="M448 448c35.2998 0 64 -28.7002 64 -64v-288c0 -35.2998 -28.7002 -64 -64 -64h-144l-124.9 -93.5996c-2.19922 -1.7002 -4.69922 -2.40039 -7.09961 -2.40039c-6.2002 0 -12 4.90039 -12 12v84h-96c-35.2998 0 -64 28.7002 -64 64v288c0 35.2998 28.7002 64 64 64h384z
|
||||
@@ -497,16 +494,16 @@ c-8.7998 0 -16 7.2002 -16 16v160c0 8.7998 7.2002 16 16 16h160c8.7998 0 16 -7.200
|
||||
<glyph glyph-name="handshake" unicode="" horiz-adv-x="640"
|
||||
d="M519.2 320.1h120.8v-255.699h-64c-17.5 0 -31.7998 14.1992 -31.9004 31.6992h-57.8994c-1.7998 -8.19922 -5.2998 -16.0996 -10.9004 -23l-26.2002 -32.2998c-15.7998 -19.3994 -41.8994 -25.5 -64 -16.7998c-13.5 -16.5996 -30.5996 -24 -48.7998 -24
|
||||
c-15.0996 0 -28.5996 5.09961 -41.0996 15.9004c-31.7998 -21.9004 -74.7002 -21.3008 -105.601 3.7998l-84.5996 76.3994h-9.09961c-0.100586 -17.5 -14.3008 -31.6992 -31.9004 -31.6992h-64v255.699h118l47.5996 47.6006c10.5 10.3994 24.8008 16.2998 39.6006 16.2998
|
||||
h226.8v0c12.7812 0 30.5225 -7.30273 39.5996 -16.2998zM48 96.4004c8.7998 0 16 7.09961 16 16c0 8.7998 -7.2002 16 -16 16s-16 -7.2002 -16 -16c0 -8.80078 7.2002 -16 16 -16zM438 103.3c2.7002 3.40039 2.2002 8.5 -1.2002 11.2998l-108.2 87.8008l-8.19922 -7.5
|
||||
h226.8c15.4326 0 29.4326 -6.22168 39.5996 -16.2998zM48 96.4004c8.7998 0 16 7.09961 16 16c0 8.7998 -7.2002 16 -16 16s-16 -7.2002 -16 -16c0 -8.80078 7.2002 -16 16 -16zM438 103.3c2.7002 3.40039 2.2002 8.5 -1.2002 11.2998l-108.2 87.8008l-8.19922 -7.5
|
||||
c-40.3008 -36.8008 -86.7002 -11.8008 -101.5 4.39941c-26.7002 29 -25 74.4004 4.39941 101.3l38.7002 35.5h-56.7002c-2 -0.799805 -3.7002 -1.5 -5.7002 -2.2998l-61.6992 -61.5996h-41.9004v-128.101h27.7002l97.2998 -88
|
||||
c16.0996 -13.0996 41.4004 -10.5 55.2998 6.60059l15.6006 19.2002l36.7998 -31.5c3 -2.40039 12 -4.90039 18 2.39941l30 36.5l23.8994 -19.3994c3.5 -2.80078 8.5 -2.2002 11.3008 1.19922zM544 144.1v128h-44.7002l-61.7002 61.6006
|
||||
c-1.39941 1.5 -3.39941 2.2998 -5.5 2.2998l-83.6992 -0.200195c-10 0 -19.6006 -3.7002 -27 -10.5l-65.6006 -60.0996c-9.7002 -8.7998 -10.5 -24 -1.2002 -33.9004c8.90039 -9.39941 25.1006 -8.7002 34.6006 0l55.2002 50.6006c6.5 5.89941 16.5996 5.5 22.5996 -1
|
||||
l10.9004 -11.7002c6 -6.5 5.5 -16.6006 -1 -22.6006l-12.5 -11.3994l102.699 -83.4004c2.80078 -2.2998 5.40039 -4.89941 7.7002 -7.7002h69.2002zM592 96.4004c8.7998 0 16 7.09961 16 16c0 8.7998 -7.2002 16 -16 16s-16 -7.2002 -16 -16c0 -8.80078 7.2002 -16 16 -16z
|
||||
" />
|
||||
<glyph glyph-name="envelope-open" unicode=""
|
||||
d="M494.586 283.484c9.6123 -7.94824 17.4141 -24.5205 17.4141 -36.9932v-262.491c0 -26.5098 -21.4902 -48 -48 -48h-416c-26.5098 0 -48 21.4902 -48 48v262.515c0 12.5166 7.84668 29.1279 17.5146 37.0771c4.08008 3.35449 110.688 89.0996 135.15 108.549
|
||||
c22.6992 18.1426 60.1299 55.8594 103.335 55.8594c43.4365 0 81.2314 -38.1914 103.335 -55.8594c23.5283 -18.707 130.554 -104.773 135.251 -108.656zM464 -10v253.632v0.00488281c0 1.5791 -0.996094 3.66602 -2.22363 4.6582
|
||||
c-15.8633 12.8232 -108.793 87.5752 -132.366 106.316c-17.5527 14.0195 -49.7168 45.3887 -73.4102 45.3887c-23.6016 0 -55.2451 -30.8799 -73.4102 -45.3887c-23.5713 -18.7393 -116.494 -93.4795 -132.364 -106.293
|
||||
d="M494.586 283.484c10.6523 -8.80762 17.4141 -22.1064 17.4141 -36.9932v-262.491c0 -26.5098 -21.4902 -48 -48 -48h-416c-26.5098 0 -48 21.4902 -48 48v262.515c0 14.9355 6.80469 28.2705 17.5146 37.0771c4.08008 3.35449 110.688 89.0996 135.15 108.549
|
||||
c22.6992 18.1426 60.1299 55.8594 103.335 55.8594c43.4365 0 81.2314 -38.1914 103.335 -55.8594c23.5283 -18.707 130.554 -104.773 135.251 -108.656zM464 -10v253.632c0 0.00195312 0.00390625 0.000976562 0.00390625 0.00292969
|
||||
c0 1.88184 -0.869141 3.56152 -2.22754 4.66016c-15.8633 12.8232 -108.793 87.5752 -132.366 106.316c-17.5527 14.0195 -49.7168 45.3887 -73.4102 45.3887c-23.6016 0 -55.2451 -30.8799 -73.4102 -45.3887c-23.5713 -18.7393 -116.494 -93.4795 -132.364 -106.293
|
||||
c-1.40918 -1.13965 -2.22559 -2.85254 -2.22559 -4.66504v-253.653c0 -3.31152 2.68848 -6 6 -6h404c3.31152 0 6 2.68848 6 6zM432.009 177.704c4.24902 -5.15918 3.46484 -12.7949 -1.74512 -16.9814c-28.9746 -23.2822 -59.2734 -47.5967 -70.9287 -56.8623
|
||||
c-22.6992 -18.1436 -60.1299 -55.8604 -103.335 -55.8604c-43.4521 0 -81.2871 38.2373 -103.335 55.8604c-11.2793 8.9668 -41.7441 33.4131 -70.9268 56.8643c-5.20996 4.1875 -5.99316 11.8223 -1.74512 16.9814l15.2578 18.5283
|
||||
c4.17773 5.07227 11.6572 5.84277 16.7793 1.72559c28.6182 -23.001 58.5654 -47.0352 70.5596 -56.5713c17.5527 -14.0195 49.7168 -45.3887 73.4102 -45.3887c23.6016 0 55.2461 30.8799 73.4102 45.3887c11.9941 9.53516 41.9434 33.5703 70.5625 56.5684
|
||||
@@ -555,10 +552,11 @@ c6.09961 -6.2002 6.09961 -16.4004 0 -22.6006l-58.2998 -59.2998v-84.5l71.8994 42.
|
||||
c7.5 4.39941 17.2002 1.7998 21.5 -5.90039l7.90039 -13.9004c4.2998 -7.69922 1.7002 -17.5 -5.7998 -21.8994l-39.2002 -23l34.0996 -9.2998c8.40039 -2.30078 13.3008 -11.1006 11.1006 -19.6006l-4.10059 -15.5c-2.2998 -8.5 -10.8994 -13.5996 -19.2998 -11.2998
|
||||
l-79.7002 21.7002l-71.8994 -42.2002l71.7998 -42.2002l79.7002 21.7002c8.39941 2.2998 17.0996 -2.7998 19.2998 -11.2998l4.09961 -15.5c2.30078 -8.5 -2.69922 -17.2998 -11.0996 -19.6006l-34.0996 -9.2998z" />
|
||||
<glyph glyph-name="trash-alt" unicode="" horiz-adv-x="448"
|
||||
d="M268 32c-6.62402 0 -12 5.37598 -12 12v216c0 6.62402 5.37598 12 12 12h24c6.62402 0 12 -5.37598 12 -12v-216c0 -6.62402 -5.37598 -12 -12 -12h-24zM432 368c8.83203 0 16 -7.16797 16 -16v-16c0 -8.83203 -7.16797 -16 -16 -16h-16v-336
|
||||
c0 -26.4961 -21.5039 -48 -48 -48h-288c-26.4961 0 -48 21.5039 -48 48v336h-16c-8.83203 0 -16 7.16797 -16 16v16c0 8.83203 7.16797 16 16 16h82.4102l34.0195 56.7002c7.71875 12.8613 26.1572 23.2998 41.1572 23.2998h0.00292969h100.82h0.0224609
|
||||
c15 0 33.4385 -10.4385 41.1572 -23.2998l34 -56.7002h82.4102zM171.84 397.09l-17.4502 -29.0898h139.221l-17.46 29.0898c-0.96582 1.60645 -3.26953 2.91016 -5.14355 2.91016h-0.00683594h-94h-0.0166016c-1.87402 0 -4.17871 -1.30371 -5.14355 -2.91016zM368 -16v336
|
||||
h-288v-336h288zM156 32c-6.62402 0 -12 5.37598 -12 12v216c0 6.62402 5.37598 12 12 12h24c6.62402 0 12 -5.37598 12 -12v-216c0 -6.62402 -5.37598 -12 -12 -12h-24z" />
|
||||
d="M268 32c-6.62305 0 -12 5.37695 -12 12v216c0 6.62305 5.37695 12 12 12h24c6.62305 0 12 -5.37695 12 -12v-216c0 -6.62305 -5.37695 -12 -12 -12h-24zM432 368c8.83105 0 16 -7.16895 16 -16v-16c0 -8.83105 -7.16895 -16 -16 -16h-16v-336
|
||||
c0 -26.4922 -21.5078 -48 -48 -48h-288c-26.4922 0 -48 21.5078 -48 48v336h-16c-8.83105 0 -16 7.16895 -16 16v16c0 8.83105 7.16895 16 16 16h82.4102l34.0195 56.7002c8.39258 13.9844 23.6777 23.2998 41.1602 23.2998h100.82
|
||||
c0.0078125 0 -0.015625 0.0517578 -0.0078125 0.0517578c17.4824 0 32.7949 -9.36719 41.1875 -23.3516l34 -56.7002h82.4102zM171.84 397.09l-17.4502 -29.0898h139.221l-17.46 29.0898c-1.0498 1.74707 -2.95898 2.91016 -5.14355 2.91016h-0.00683594h-94
|
||||
c-0.00585938 0 -0.00683594 0.00683594 -0.0126953 0.00683594c-2.18457 0 -4.09766 -1.16992 -5.14746 -2.91699zM368 -16v336h-288v-336h288zM156 32c-6.62305 0 -12 5.37695 -12 12v216c0 6.62305 5.37695 12 12 12h24c6.62305 0 12 -5.37695 12 -12v-216
|
||||
c0 -6.62305 -5.37695 -12 -12 -12h-24z" />
|
||||
<glyph glyph-name="images" unicode="" horiz-adv-x="576"
|
||||
d="M480 32v-16c0 -26.5098 -21.4902 -48 -48 -48h-384c-26.5098 0 -48 21.4902 -48 48v256c0 26.5098 21.4902 48 48 48h16v-48h-10c-3.31152 0 -6 -2.68848 -6 -6v-244c0 -3.31152 2.68848 -6 6 -6h372c3.31152 0 6 2.68848 6 6v10h48zM522 368h-372
|
||||
c-3.31152 0 -6 -2.68848 -6 -6v-244c0 -3.31152 2.68848 -6 6 -6h372c3.31152 0 6 2.68848 6 6v244c0 3.31152 -2.68848 6 -6 6zM528 416c26.5098 0 48 -21.4902 48 -48v-256c0 -26.5098 -21.4902 -48 -48 -48h-384c-26.5098 0 -48 21.4902 -48 48v256
|
||||
@@ -584,9 +582,9 @@ d="M464 448c4.09961 0 7.7998 -2 10.0996 -5.40039l99.9004 -147.199c2.90039 -4.400
|
||||
c2.2002 3.40039 6 5.40039 10 5.40039h352zM444.7 400h-56.7998l51.6992 -96h68.4004zM242.6 400l-51.5996 -96h194l-51.7002 96h-90.7002zM131.3 400l-63.2998 -96h68.4004l51.6992 96h-56.7998zM88.2998 256l119.7 -160l-68.2998 160h-51.4004zM191.2 256l96.7998 -243.3
|
||||
l96.7998 243.3h-193.6zM368 96l119.6 160h-51.3994z" />
|
||||
<glyph glyph-name="money-bill-alt" unicode="" horiz-adv-x="640"
|
||||
d="M320 304c53.0195 0 96 -50.1396 96 -112c0 -61.8701 -43 -112 -96 -112c-53.0195 0 -96 50.1504 -96 112c0 61.8604 42.9805 112 96 112zM360 136v16c0 4.41992 -3.58008 8 -8 8h-16v88c0 4.41992 -3.58008 8 -8 8h-13.5801h-0.000976562
|
||||
c-4.01074 0 -9.97266 -1.80566 -13.3086 -4.03027l-15.3301 -10.2197c-1.96777 -1.30957 -3.56445 -4.29004 -3.56445 -6.65332c0 -1.33691 0.601562 -3.32422 1.34375 -4.43652l8.88086 -13.3105c1.30859 -1.9668 4.29004 -3.56445 6.65332 -3.56445
|
||||
c1.33691 0 3.32422 0.602539 4.43652 1.34473l0.469727 0.310547v-55.4404h-16c-4.41992 0 -8 -3.58008 -8 -8v-16c0 -4.41992 3.58008 -8 8 -8h64c4.41992 0 8 3.58008 8 8zM608 384c17.6699 0 32 -14.3301 32 -32v-320c0 -17.6699 -14.3301 -32 -32 -32h-576
|
||||
d="M320 304c53.0195 0 96 -50.1396 96 -112c0 -61.8701 -43 -112 -96 -112c-53.0195 0 -96 50.1504 -96 112c0 61.8604 42.9805 112 96 112zM360 136v16c0 4.41992 -3.58008 8 -8 8h-16v88c0 4.41992 -3.58008 8 -8 8h-13.5801
|
||||
c-4.91113 0 -9.50586 -1.49316 -13.3096 -4.03027l-15.3301 -10.2197c-2.15332 -1.43262 -3.55957 -3.88379 -3.55957 -6.66113c0 -1.6377 0.493164 -3.16113 1.33887 -4.42871l8.88086 -13.3105c1.43164 -2.15234 3.88379 -3.55957 6.66113 -3.55957
|
||||
c1.6377 0 3.16016 0.494141 4.42871 1.33984l0.469727 0.310547v-55.4404h-16c-4.41992 0 -8 -3.58008 -8 -8v-16c0 -4.41992 3.58008 -8 8 -8h64c4.41992 0 8 3.58008 8 8zM608 384c17.6699 0 32 -14.3301 32 -32v-320c0 -17.6699 -14.3301 -32 -32 -32h-576
|
||||
c-17.6699 0 -32 14.3301 -32 32v320c0 17.6699 14.3301 32 32 32h576zM592 112v160c-35.3496 0 -64 28.6504 -64 64h-416c0 -35.3496 -28.6504 -64 -64 -64v-160c35.3496 0 64 -28.6504 64 -64h416c0 35.3496 28.6504 64 64 64z" />
|
||||
<glyph glyph-name="window-close" unicode=""
|
||||
d="M464 416c26.5 0 48 -21.5 48 -48v-352c0 -26.5 -21.5 -48 -48 -48h-416c-26.5 0 -48 21.5 -48 48v352c0 26.5 21.5 48 48 48h416zM464 22v340c0 3.2998 -2.7002 6 -6 6h-404c-3.2998 0 -6 -2.7002 -6 -6v-340c0 -3.2998 2.7002 -6 6 -6h404c3.2998 0 6 2.7002 6 6z
|
||||
|
||||
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 876 KiB After Width: | Height: | Size: 896 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -261,4 +261,3 @@
|
||||
.irs--shiny .irs-grid-pol.small {
|
||||
background-color: #999999;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user