Skip to content

Commit ff31903

Browse files
committed
New: Add <dialog> tag. Fixes #85
1 parent 1d66ba6 commit ff31903

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Scala DOM Types
2-
[![Build Status](https://circleci.com/gh/raquo/scala-dom-types.svg?style=svg)](https://circleci.com/gh/raquo/Airstream)
2+
[![Build Status](https://circleci.com/gh/raquo/scala-dom-types.svg?style=svg)](https://circleci.com/gh/raquo/scala-dom-types)
33
![Maven Central](https://img.shields.io/maven-central/v/com.raquo/domtypes_sjs1_2.13.svg)
44

55
_Scala DOM Types_ provides listings of Javascript HTML and SVG tags as well as their attributes, DOM properties, and CSS styles, including the corresponding type information.
66

7-
"com.raquo" %%% "domtypes" % "<version>" // Scala.js 1.7.1+
8-
"com.raquo" %% "domtypes" % "<version>" // JVM
7+
"com.raquo" %% "domtypes" % "<version>" // JVM & SBT
8+
"com.raquo" %%% "domtypes" % "<version>" // Scala.js 1.9.0+
99

1010
_Scala DOM Types_ is used by the following Scala.js UI libraries:
1111

@@ -40,20 +40,20 @@ As well as by:
4040

4141
## Community
4242

43-
Please use [Github issues](https://github.com/raquo/scala-dom-types/issues) for bugs, feature requests, as well as all kinds of discussions, including questions on usage and integrations. You can _watch_ this project on github to get issue updates if you're interested in following discussions.
43+
Please use [Github issues](https://github.com/raquo/scala-dom-types/issues) for bugs, feature requests, as well as all kinds of discussions, including questions on usage and integrations. You can _watch_ this project on Github to get issue updates if you're interested in following discussions.
4444

4545

4646
## Contributing
4747

4848
**Q: I want to add an element tag / attribute / prop / etc.**
4949

50-
**A:** Awesome! Please open an issue, and we will either add it, ask you to PR it, or explain why adding this particular key might not be a good idea.
50+
**A:** Awesome! Please open an issue, and we will either ask you to PR it, add it ourselves, or discuss why adding this particular key might not be a good idea.
5151

5252
So far we are focused on HTML5 attributes and read-writeable DOM props, but it doesn't have to stay that way. There is value in providing listings for popular non-standard attributes as well (e.g. `autoCapitalize`, `unSelectable`) but we haven't decided how to deal with those yet. Don't hesitate to trigger this discussion though.
5353

5454
The raw definitions that you need to update are found in the [shared/main/.../defs](#TODO) folder. The sample code generated from those definitions is found in [js/test/.../defs](#TODO).
5555

56-
If making a PR, make sure to run the GeneratorSpec test locally, so that the sample generated code is updated before you commit.
56+
If making a PR, please make sure to run the `GeneratorSpec` test locally, so that the sample generated code is updated before you commit.
5757

5858

5959
## Why use _Scala DOM Types_
@@ -295,8 +295,8 @@ Here is what the DOM attributes / props / etc. are called in `scalaName`:
295295
* `content` prop is named `contentCss` to avoid using a common name
296296

297297
#### Tags
298-
* Scala tags names used to free up good names for end user code:
299-
* `style` -> `styleTag`, `link` -> `linkTag`, `param` -> `paramTag`, `map` -> `mapTag`
298+
* Scala tag names used to free up good names for end user code:
299+
* `style` -> `styleTag`, `link` -> `linkTag`, `param` -> `paramTag`, `map` -> `mapTag`, `dialog` -> `dialogTag`
300300
* Other tag renamings:
301301
* `title` -> `titleTag` to avoid conflict with `title` reflected attribute
302302
* `object` -> `objectTag` to avoid Scala reserved word

js/src/test/scala/com/thirdparty/defs/tags/HtmlTags.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,4 +1023,15 @@ trait HtmlTags {
10231023
lazy val menu: HtmlTag[dom.html.Menu] = htmlTag("menu")
10241024

10251025

1026+
/**
1027+
* Dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.
1028+
*
1029+
* Note: The tabindex attribute must not be used on the <dialog> element
1030+
*
1031+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
1032+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
1033+
*/
1034+
lazy val dialogTag: HtmlTag[dom.HTMLDialogElement] = htmlTag("dialog")
1035+
1036+
10261037
}

shared/src/main/scala/com/raquo/domtypes/defs/tags/MiscTagDefs.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,25 @@ object MiscTagDefs {
501501
),
502502
),
503503

504+
TagDef(
505+
tagType = HtmlTagType,
506+
scalaName = "dialogTag",
507+
scalaAliases = Nil,
508+
domName = "dialog",
509+
isVoid = false,
510+
scalaJsElementType = "dom.HTMLDialogElement", // #TODO this should be dom.html.Dialog once the alias is added to scalajs-dom
511+
javascriptElementType = "HTMLDialogElement",
512+
commentLines = List(
513+
"Dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.",
514+
"",
515+
"Note: The tabindex attribute must not be used on the <dialog> element"
516+
),
517+
docUrls = List(
518+
"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog",
519+
"https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement"
520+
)
521+
),
522+
504523
)
505524

506525
}

0 commit comments

Comments
 (0)