Skip to content

Commit 1d721bf

Browse files
committed
Update R package to 1.0.1 (#133)
1 parent d0c5536 commit 1d721bf

File tree

139 files changed

+512
-667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+512
-667
lines changed
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Package: dashHtmlComponents
2-
Title: Vanilla HTML components for Dash
3-
Version: 1.0.0
4-
Authors @R: as.person(c(Chris Parmer <[email protected]>))
5-
Description: Vanilla HTML components for Dash
2+
Title: Vanilla HTML Components for Dash
3+
Version: 1.0.1
4+
Description: A web application framework that provides pure Python and R abstraction around HTML, CSS, and JavaScript, Dash offers a pleasant and productive development experience. Instead of writing HTML or using an HTML templating engine, you compose your layout using R functions within the 'dashHtmlComponents' package. The source for this package is on GitHub: 'plotly/dash-html-components'.
65
Depends: R (>= 3.0.2)
76
Imports:
8-
Suggests:
7+
Suggests: knitr, rmarkdown
8+
VignetteBuilder: knitr
99
License: MIT + file LICENSE
1010
URL: https://github.com/plotly/dash-html-components
1111
BugReports: https://github.com/plotly/dash-html-components/issues
1212
Encoding: UTF-8
1313
LazyData: true
1414
Author: Chris Parmer [aut]
15-
Maintainer: Chris Parmer <chris@plot.ly>
15+
Maintainer: Ryan Patrick Kyle <ryan@plot.ly>

packages/dash-html-components/R/internal.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.dashHtmlComponents_js_metadata <- function() {
22
deps_metadata <- list(`dash_html_components` = structure(list(name = "dash_html_components",
3-
version = "1.0.0", src = list(href = NULL,
3+
version = "1.0.1", src = list(href = NULL,
44
file = "deps"), meta = NULL,
55
script = 'dash_html_components.min.js',
66
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashHtmlComponents",
77
all_files = FALSE), class = "html_dependency"),
88
`dash_html_components` = structure(list(name = "dash_html_components",
9-
version = "1.0.0", src = list(href = NULL,
9+
version = "1.0.1", src = list(href = NULL,
1010
file = "deps"), meta = NULL,
1111
script = 'dash_html_components.min.js.map',
1212
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashHtmlComponents",
@@ -18,11 +18,11 @@ dash_assert_valid_wildcards <- function (attrib = list("data", "aria"), ...)
1818
{
1919
args <- list(...)
2020
validation_results <- lapply(names(args), function(x) {
21-
grepl(paste0("^", attrib, "-[a-zA-Z0-9]{1,}$", collapse = "|"),
21+
grepl(paste0("^(", paste0(attrib, collapse="|"), ")-[a-zA-Z0-9_-]+$"),
2222
x)
2323
})
2424
if (FALSE %in% validation_results) {
25-
stop(sprintf("The following wildcards are not currently valid in Dash: '%s'",
25+
stop(sprintf("The following props are not valid in this component: '%s'",
2626
paste(names(args)[grepl(FALSE, unlist(validation_results))],
2727
collapse = ", ")), call. = FALSE)
2828
}

packages/dash-html-components/inst/deps/dash_html_components.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: "Dash HTML Components"
3+
output: rmarkdown::html_vignette
4+
vignette: >
5+
%\VignetteIndexEntry{Dash HTML Components}
6+
%\VignetteEngine{knitr::knitr}
7+
%\usepackage[UTF-8]{inputenc}
8+
---
9+
10+
Dash is a web application framework that provides pure R and Python abstraction around HTML, CSS, and JavaScript. Instead of writing HTML or using an HTML templating engine, you compose your layout using R functions within the `dashHtmlComponents` package. The source is on GitHub at [plotly/dash-html-components](https://github.com/plotly/dash-html-components).
11+
12+
Please visit our online documentation, which is interactive and frequently updated: https://dashr.plot.ly.
13+
14+
The components in this package are all simple wrappers for HTML5 elements. Extensive documentation for these elements is available online: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/
15+
16+
Here is an example of a simple HTML structure:
17+
18+
```r
19+
library(dashHtmlComponents)
20+
library(dash)
21+
22+
htmlDiv(list(
23+
htmlH1('Hello Dash'),
24+
htmlDiv(list(
25+
htmlP('Dash converts R classes into HTML'),
26+
htmlP("This conversion happens behind the scenes by Dash's JavaScript front-end")
27+
))
28+
))
29+
```
30+
31+
which gets converted (behind the scenes) into the following HTML in your web application:
32+
33+
```html
34+
<div>
35+
<h1>Hello Dash</h1>
36+
<div>
37+
<p>Dash converts Python classes into HTML</p>
38+
<p>This conversion happens behind the scenes by Dash's JavaScript front-end</p>
39+
</div>
40+
</div>
41+
```
42+
43+
If you're not comfortable with HTML, don't worry! You can get 95% of the way there with just a few elements and attributes. Dash's core component library also supports [Markdown](https://daringfireball.net/projects/markdown/).
44+
45+
```r
46+
library(dashHtmlComponents)
47+
library(dash)
48+
dccMarkdown('''
49+
#### Dash and Markdown
50+
Dash supports [Markdown](https://daringfireball.net/projects/markdown/).
51+
Markdown is a simple way to write and format text.
52+
It includes a syntax for things like **bold text** and *italics*,
53+
[links](https://daringfireball.net/projects/markdown/), inline `code` snippets, lists,
54+
quotes, and more.
55+
''')
56+
```
57+
58+
which renders the following:
59+
60+
> #### Dash and Markdown
61+
Dash supports [Markdown](https://daringfireball.net/projects/markdown/) Markdown is a simple way to write and format text. It includes a syntax for things like **bold text** and *italics*, [links](https://daringfireball.net/projects/markdown/), inline `code` snippets, lists, quotes, and more.
62+
63+
If you're using HTML components, then you also have access to properties like `style`, `class`, and `id`.
64+
65+
All of these attributes are available in the R functions. The HTML elements and Dash classes are mostly the same but there are a few key differences:
66+
67+
* The `style` property is a named list
68+
* Properties in the `style` dictionary are camelCased
69+
* The class key is renamed as `className`
70+
* Style properties in pixel units can be supplied as just numbers without the `px` unit
71+
72+
Let's take a look at an example.
73+
74+
```r
75+
library(dashHtmlComponents)
76+
library(dash)
77+
htmlDiv(list(
78+
htmlDiv('Example Div', style=list('color' = 'blue', 'fontSize' = 14)),
79+
htmlP('Example P', className='my-class', id='my-p-element')
80+
), style=list('marginBottom' = 50, 'marginTop' = 25))
81+
```
82+
83+
That Dash code will render this HTML markup:
84+
85+
```html
86+
<div style="margin-bottom: 50px; margin-top: 25px;">
87+
88+
<div style="color: blue; font-size: 14px">
89+
Example Div
90+
</div>
91+
92+
<p class="my-class", id="my-p-element">
93+
Example P
94+
</p>
95+
</div>
96+
```

0 commit comments

Comments
 (0)