Skip to content

Commit 2966bf6

Browse files
authored
Merge branch 'master' into window-move-to-and-move-by
2 parents 4bb6f16 + 6b2733a commit 2966bf6

35 files changed

+1095
-1750
lines changed

.github/workflows/ci.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
scalaversion: ["2.11.12", "2.12.12", "2.13.4", "3.0.1"]
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: olafurpg/setup-scala@v10
19+
with:
20+
java-version: "[email protected]"
21+
- uses: coursier/cache-action@v5
22+
- name: Build
23+
run: sbt "++${{ matrix.scalaversion }}" package
24+
- name: Test generate documentation
25+
run: sbt "++${{ matrix.scalaversion }}" doc
26+
- name: Build examples
27+
run: sbt "++${{ matrix.scalaversion }}" example/compile
28+
- name: scalafmt
29+
run: sbt "++${{ matrix.scalaversion }}" scalafmtCheck
30+
readme:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: olafurpg/setup-scala@v10
35+
with:
36+
java-version: "[email protected]"
37+
- uses: coursier/cache-action@v5
38+
- name: Readme generation
39+
run: sbt readme/run

.github/workflows/ghpages.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: Build and Deploy GhPages docs
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: olafurpg/setup-scala@v10
15+
with:
16+
java-version: "[email protected]"
17+
- uses: coursier/cache-action@v5
18+
19+
- name: Build
20+
run: sbt readme/run
21+
22+
- name: Deploy
23+
uses: JamesIves/[email protected]
24+
with:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
BRANCH: gh-pages
27+
FOLDER: readme/target/scalatex

.scalafmt.conf

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
version = 2.0.0-RC5
12
project.git = true
23
style = Scala.js
34
project.includeFilters = ["src/main/scala/org/scalajs/.*\\.scala"]
4-
bestEffortInDeeplyNestedCode = true
5+
maxColumn = 79
6+
docstrings = JavaDoc

.travis.yml

-32
This file was deleted.

build.sbt

+10-14
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ lazy val root = project.in(file(".")).
55

66
name := "Scala.js DOM"
77

8-
crossScalaVersions in ThisBuild := {
9-
if (scalaJSVersion.startsWith("1.")) Seq("2.12.6", "2.11.12", "2.13.0-M3")
10-
else Seq("2.12.6", "2.11.12", "2.10.7", "2.13.0-M3", "2.13.0-M4")
11-
}
12-
scalaVersion in ThisBuild := crossScalaVersions.value.head
8+
ThisBuild / crossScalaVersions := Seq("2.12.12", "2.11.12", "2.13.4", "3.0.1")
9+
ThisBuild / scalaVersion := crossScalaVersions.value.head
1310

1411
val commonSettings = Seq(
15-
version := "0.9.7-SNAPSHOT",
12+
version := "2.0.0-SNAPSHOT",
1613
organization := "org.scala-js",
1714
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
1815
)
@@ -36,14 +33,12 @@ scalacOptions ++= {
3633
}
3734

3835
def hasNewCollections(version: String): Boolean = {
39-
!version.startsWith("2.10.") &&
4036
!version.startsWith("2.11.") &&
41-
!version.startsWith("2.12.") &&
42-
version != "2.13.0-M3"
37+
!version.startsWith("2.12.")
4338
}
4439

4540
/** Returns the appropriate subdirectory of `sourceDir` depending on whether
46-
* the `scalaV` uses the new collections (introduced in 2.13.0-M4) or not.
41+
* the `scalaV` uses the new collections (introduced in 2.13) or not.
4742
*/
4843
def collectionsEraDependentDirectory(scalaV: String, sourceDir: File): File =
4944
if (hasNewCollections(scalaV)) sourceDir / "scala-new-collections"
@@ -97,14 +92,15 @@ pomExtra := (
9792
pomIncludeRepository := { _ => false }
9893

9994
lazy val readme = ScalatexReadme(
100-
folder = "readme",
95+
projectId = "readme",
96+
wd = file(""),
10197
url = "https://github.com/scala-js/scala-js-dom/tree/master",
10298
source = "Index",
103-
targetFolder = "target/site",
10499
autoResources = Seq("example-opt.js")
105100
).settings(
106-
scalaVersion := "2.11.12",
107-
(resources in Compile) += (fullOptJS in (example, Compile)).value.data
101+
scalaVersion := "2.12.10",
102+
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
103+
(Compile / resources) += (example / Compile / fullOptJS).value.data
108104
)
109105

110106
lazy val example = project.

example/src/main/scala/example/Example.scala

+14-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.scalajs.js.annotation._
55
import org.scalajs.dom
66
import dom.html
77

8-
@JSExportTopLevel("example.Alert")
8+
@JSExportTopLevel("ExampleAlert")
99
object Alert {
1010
@JSExport
1111
def main() = {
@@ -14,7 +14,7 @@ object Alert {
1414
}
1515
}
1616

17-
@JSExportTopLevel("example.NodeAppendChild")
17+
@JSExportTopLevel("ExampleNodeAppendChild")
1818
object NodeAppendChild {
1919
@JSExport
2020
def main(div: html.Div) = {
@@ -28,7 +28,7 @@ object NodeAppendChild {
2828
}
2929
}
3030

31-
@JSExportTopLevel("example.ElementStyle")
31+
@JSExportTopLevel("ExampleElementStyle")
3232
object ElementStyle {
3333
@JSExport
3434
def main(div: html.Div) = {
@@ -43,7 +43,7 @@ object ElementStyle {
4343
}
4444
}
4545

46-
@JSExportTopLevel("example.LocalStorage")
46+
@JSExportTopLevel("ExampleLocalStorage")
4747
object LocalStorage {
4848
@JSExport
4949
def main(in: html.Input, box: html.Div) = {
@@ -62,7 +62,7 @@ object LocalStorage {
6262
}
6363
}
6464

65-
@JSExportTopLevel("example.Canvas")
65+
@JSExportTopLevel("ExampleCanvas")
6666
object Canvas {
6767
@JSExport
6868
def main(c: html.Canvas) = {
@@ -88,7 +88,7 @@ object Canvas {
8888
}
8989
}
9090

91-
@JSExportTopLevel("example.Base64")
91+
@JSExportTopLevel("ExampleBase64")
9292
object Base64 {
9393
@JSExport
9494
def main(in: html.Input,
@@ -100,7 +100,7 @@ object Base64 {
100100
}
101101
}
102102

103-
@JSExportTopLevel("example.EventHandler")
103+
@JSExportTopLevel("ExampleEventHandler")
104104
object EventHandler{
105105
@JSExport
106106
def main(pre: html.Pre) = {
@@ -118,14 +118,13 @@ object EventHandler{
118118
}
119119
}
120120

121-
@JSExportTopLevel("example.XMLHttpRequest")
121+
@JSExportTopLevel("ExampleXMLHttpRequest")
122122
object XMLHttpRequest{
123123
@JSExport
124124
def main(pre: html.Pre) = {
125125
val xhr = new dom.XMLHttpRequest()
126-
xhr.open("GET",
127-
"http://api.openweathermap.org/" +
128-
"data/2.5/weather?q=Singapore"
126+
xhr.open("GET",
127+
"https://www.boredapi.com/api/activity"
129128
)
130129
xhr.onload = { (e: dom.Event) =>
131130
if (xhr.status == 200) {
@@ -137,12 +136,12 @@ object XMLHttpRequest{
137136
}
138137
}
139138

140-
@JSExportTopLevel("example.Websocket")
139+
@JSExportTopLevel("ExampleWebsocket")
141140
object Websocket {
142141
@JSExport
143142
def main(in: html.Input,
144143
pre: html.Pre) = {
145-
val echo = "ws://echo.websocket.org"
144+
val echo = "wss://echo.websocket.org"
146145
val socket = new dom.WebSocket(echo)
147146
socket.onmessage = {
148147
(e: dom.MessageEvent) =>
@@ -157,7 +156,7 @@ object Websocket {
157156
}
158157
}
159158

160-
@JSExportTopLevel("example.AjaxExtension")
159+
@JSExportTopLevel("ExampleAjaxExtension")
161160
object AjaxExtension {
162161
@JSExport
163162
def main(pre: html.Pre) = {
@@ -167,8 +166,7 @@ object AjaxExtension {
167166
.Implicits
168167
.global
169168
val url =
170-
"http://api.openweathermap.org/" +
171-
"data/2.5/weather?q=Singapore"
169+
"https://www.boredapi.com/api/activity"
172170
Ajax.get(url).foreach { case xhr =>
173171
pre.textContent = xhr.responseText
174172
}

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.17
1+
sbt.version=1.5.5

project/build.sbt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
val scalaJSVersion =
2-
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.23")
2+
Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.5.0")
33

44
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
55

6-
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.2.1")
6+
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.11")
77

8-
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.5.1")
8+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0")

readme/Index.scalatex

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
div(
1818
div(width:="50%", float.left)(
1919
hl.ref(
20-
cwd/'example/'src/'main/'scala/'example/"Example.scala",
20+
pwd/'example/'src/'main/'scala/'example/"Example.scala",
2121
Seq(s"object $example", "main")
2222
)
2323
),
2424
div(width:="50%", float.left, padding:="8px", boxSizing.`border-box`)(
2525
if (!autorun)
26-
a(cls:="pure-button", onclick:=s"example.$example.main($queries)", "Run"),
26+
a(cls:="pure-button", onclick:=s"Example$example.main($queries)", "Run"),
2727
div(
2828
frags.zip(ids).map{case (f, i) => f(id:=i, backgroundColor:="#fafafa")}
2929
),
3030
if (autorun)
31-
script(s"example.$example.main($queries)")
31+
script(s"Example$example.main($queries)")
3232
),
3333
div(clear.both)
3434
)
@@ -48,17 +48,17 @@
4848
@pair("Alert", Nil)
4949

5050
@p
51-
Will cause a javascript alert box saying `HAI` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
51+
Will cause a javascript alert box saying `Hi from Scala-js-dom` to appear. Other javascript classes and objects can be similarly accessed e.g. @hl.scala{new dom.XMLHttpRequest()} to perform a new Ajax request, @hl.scala{dom.document} to access the global @hl.scala{document} object, or @hl.scala{html.Div} to to refer to the type of a @hl.scala{<div>} element.
5252

5353
@sect{Usage}
5454
@p
5555
Add the following to your sbt build definition:
5656

5757
@hl.scala
58-
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.6"
58+
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.1.0"
5959

6060
@p
61-
then enjoy the types available in @hl.scala{org.scalajs.dom}. scalajs-dom 0.9.6 is built and published for Scala.js 0.6.17 and later, Scala.js 1.0.0-M3, with Scala 2.10, 2.11, 2.12, 2.13.0-M3 and 2.13.0-M4.
61+
then enjoy the types available in @hl.scala{org.scalajs.dom}. scalajs-dom 1.1.0 is built and published for Scala.js 0.6.17+ and Scala.js 1.0.0+, with Scala 2.10, 2.11, 2.12 and 2.13.
6262

6363
@p
6464
To begin with, @code{scala-js-dom} organizes the full-list of DOM APIs into a number of buckets:
@@ -90,7 +90,7 @@
9090
@sect{Node.onmousemove}
9191
@pair(
9292
"EventHandler",
93-
Seq(pre("pre")),
93+
Seq(pre("Hover this box!")),
9494
autorun=true
9595
)
9696

src/main/scala/org/scalajs/dom/crypto/Crypto.scala

-2
Original file line numberDiff line numberDiff line change
@@ -930,10 +930,8 @@ object KeyFormat {
930930
trait RSAPublicKey extends js.Object {
931931

932932
/* modulus, as a base64 URL encoded String */
933-
@js.native
934933
def n: String = js.native
935934

936935
/* exponent, as a base64 URL encoded String */
937-
@js.native
938936
def e: String = js.native
939937
}

0 commit comments

Comments
 (0)