Skip to content

Commit 67b880a

Browse files
committed
Merge branch 'input-binding' of github.com:react-R/reactR into input-binding
2 parents da8986a + e3e5b35 commit 67b880a

File tree

10 files changed

+56
-51
lines changed

10 files changed

+56
-51
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ node_modules
99
reactR.Rcheck
1010
reactR_*.tar.gz
1111
*.swp
12+
.DS_Store

R/reacttools.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# A robust name string is a valid
2+
# - CSS class
3+
# - JavaScript variable name
4+
# - R variable name
5+
robustName <- "^[[:alpha:]_][[:alnum:]_]*$"
6+
17
isUpper <- function(s) {
28
grepl("^[[:upper:]]+$", s)
39
}

R/scaffold_input.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ scaffoldReactShinyInput <- function(name, npmPkgs = NULL, edit = interactive())
6868
)
6969
)
7070

71-
usethis::use_build_ignore(c("node_modules", "srcjs"))
71+
usethis::use_build_ignore(c("node_modules", "srcjs", "app.R", "package.json", "webpack.config.js", "yarn.lock"))
7272
usethis::use_git_ignore(c("node_modules"))
73-
lapply(c("htmltools", "htmlwidgets", "reactR"), usethis::use_package)
73+
lapply(c("htmltools", "shiny", "reactR"), usethis::use_package)
7474

7575
message("To install dependencies from npm run: yarn install")
7676
message("To build JavaScript run: yarn run webpack --mode=development")

R/scaffold_utils.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,10 @@ getPackage <- function() {
5353
read.dcf('DESCRIPTION')[[1,"Package"]]
5454
}
5555

56-
validName <- function(name) {
57-
grepl("^[[:alpha:]_][[:alnum:]_]*$", name)
58-
}
59-
6056
# Constraining names prevents the user from encountering obscure CSS problems
6157
# and JavaScript errors after scaffolding.
6258
assertNameValid <- function(name) {
63-
if (!validName(name)) {
59+
if (!grepl(robustName, name)) {
6460
msg <- sprintf("Name '%s' is invalid, names must begin with an alphabetic character and must contain only alphabetic and numeric characters", name)
6561
stop(msg, call. = FALSE)
6662
}

R/scaffold_widget.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ scaffoldReactWidget <- function(name, npmPkgs = NULL, edit = interactive()){
2626
addWidgetJS(name, edit)
2727
addExampleApp(name)
2828

29-
usethis::use_build_ignore(c("node_modules", "srcjs"))
29+
usethis::use_build_ignore(c("node_modules", "srcjs", "app.R", "package.json", "webpack.config.js", "yarn.lock"))
3030
usethis::use_git_ignore(c("node_modules"))
3131
lapply(c("htmltools", "htmlwidgets", "reactR"), usethis::use_package)
3232

inst/www/react-tools/react-tools.js

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/react-tools/react-tools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/input_sketchpicker.gif

-234 KB
Binary file not shown.

vignettes/input_sketchpicker.mp4

61.7 KB
Binary file not shown.

vignettes/intro_inputs.Rmd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ devtools::document()
120120
devtools::install(quick = TRUE)
121121
```
122122

123-
In RStudio, you can use the keyboard shortcuts `Ctrl+Shift+D` and
123+
In RStudio, you can use the keyboard shortcuts `Ctrl-Shift-D` and
124124
`Ctrl-Shift-B` to document and build the package. (On macOS, the shortcuts are
125-
`Cmd+Shift+D` and `Cmd+Shift+B`)
125+
`Cmd-Shift-D` and `Cmd-Shift-B`)
126126

127127
## Run the included demo
128128

@@ -235,7 +235,9 @@ package.
235235
After rebuilding the JavaScript and the package, try running `app.R` again. You
236236
should see something like this:
237237

238-
![](./input_sketchpicker.gif)
238+
<video autoplay muted>
239+
<source src="./input_sketchpicker.mp4"/>
240+
</video>
239241

240242
When you select new colors, you should see the `textOutput` update accordingly.
241243

0 commit comments

Comments
 (0)