Skip to content

Commit f7b4f72

Browse files
authored
Merge branch 'master' into imageCapture
2 parents 37c1412 + 6b2733a commit f7b4f72

File tree

15 files changed

+128
-92
lines changed

15 files changed

+128
-92
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

.travis.yml

-33
This file was deleted.

build.sbt

+4-8
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.10", "2.11.12", "2.13.1")
10-
else Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1")
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 := "1.0.1-SNAPSHOT",
12+
version := "2.0.0-SNAPSHOT",
1613
organization := "org.scala-js",
1714
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
1815
)
@@ -36,7 +33,6 @@ scalacOptions ++= {
3633
}
3734

3835
def hasNewCollections(version: String): Boolean = {
39-
!version.startsWith("2.10.") &&
4036
!version.startsWith("2.11.") &&
4137
!version.startsWith("2.12.")
4238
}
@@ -104,7 +100,7 @@ lazy val readme = ScalatexReadme(
104100
).settings(
105101
scalaVersion := "2.12.10",
106102
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
107-
(resources in Compile) += (fullOptJS in (example, Compile)).value.data
103+
(Compile / resources) += (example / Compile / fullOptJS).value.data
108104
)
109105

110106
lazy val example = project.

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ 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) {
@@ -142,7 +141,7 @@ 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) =>
@@ -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=1.2.8
1+
sbt.version=1.5.5

project/build.sbt

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

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

readme/Index.scalatex

+4-4
Original file line numberDiff line numberDiff line change
@@ -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" % "1.0.0"
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 1.0.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.
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
}

src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala

+29-29
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ object CollatorOptions {
123123
): CollatorOptions = {
124124
js.Dynamic
125125
.literal(
126-
localeMatcher = localeMatcher,
127-
usage = usage,
128-
sensitivity = sensitivity,
129-
ignorePunctuation = ignorePunctuation,
130-
numeric = numeric,
131-
caseFirst = caseFirst
126+
localeMatcher = localeMatcher.asInstanceOf[js.Any],
127+
usage = usage.asInstanceOf[js.Any],
128+
sensitivity = sensitivity.asInstanceOf[js.Any],
129+
ignorePunctuation = ignorePunctuation.asInstanceOf[js.Any],
130+
numeric = numeric.asInstanceOf[js.Any],
131+
caseFirst = caseFirst.asInstanceOf[js.Any]
132132
)
133133
.asInstanceOf[CollatorOptions]
134134
}
@@ -200,19 +200,19 @@ object DateTimeFormatOptions {
200200
// format: off
201201
js.Dynamic
202202
.literal(
203-
localeMatcher = localeMatcher,
204-
timeZone = timeZone,
205-
hour12 = hour12,
206-
formatMatcher = formatMatcher,
207-
weekday = weekday,
208-
era = era,
209-
year = year,
210-
month = month,
211-
day = day,
212-
hour = hour,
213-
minute = minute,
214-
second = second,
215-
timeZoneName = timeZoneName
203+
localeMatcher = localeMatcher.asInstanceOf[js.Any],
204+
timeZone = timeZone.asInstanceOf[js.Any],
205+
hour12 = hour12.asInstanceOf[js.Any],
206+
formatMatcher = formatMatcher.asInstanceOf[js.Any],
207+
weekday = weekday.asInstanceOf[js.Any],
208+
era = era.asInstanceOf[js.Any],
209+
year = year.asInstanceOf[js.Any],
210+
month = month.asInstanceOf[js.Any],
211+
day = day.asInstanceOf[js.Any],
212+
hour = hour.asInstanceOf[js.Any],
213+
minute = minute.asInstanceOf[js.Any],
214+
second = second.asInstanceOf[js.Any],
215+
timeZoneName = timeZoneName.asInstanceOf[js.Any]
216216
)
217217
.asInstanceOf[DateTimeFormatOptions]
218218
// format: on
@@ -300,16 +300,16 @@ object NumberFormatOptions {
300300
): NumberFormatOptions = {
301301
js.Dynamic
302302
.literal(
303-
localeMatcher = localeMatcher,
304-
style = style,
305-
currency = currency,
306-
currencyDisplay = currencyDisplay,
307-
useGrouping = useGrouping,
308-
minimumIntegerDigits = minimumIntegerDigits,
309-
minimumFractionDigits = minimumFractionDigits,
310-
maximumFractionDigits = maximumFractionDigits,
311-
minimumSignificantDigits = minimumSignificantDigits,
312-
maximumSignificantDigits = maximumSignificantDigits
303+
localeMatcher = localeMatcher.asInstanceOf[js.Any],
304+
style = style.asInstanceOf[js.Any],
305+
currency = currency.asInstanceOf[js.Any],
306+
currencyDisplay = currencyDisplay.asInstanceOf[js.Any],
307+
useGrouping = useGrouping.asInstanceOf[js.Any],
308+
minimumIntegerDigits = minimumIntegerDigits.asInstanceOf[js.Any],
309+
minimumFractionDigits = minimumFractionDigits.asInstanceOf[js.Any],
310+
maximumFractionDigits = maximumFractionDigits.asInstanceOf[js.Any],
311+
minimumSignificantDigits = minimumSignificantDigits.asInstanceOf[js.Any],
312+
maximumSignificantDigits = maximumSignificantDigits.asInstanceOf[js.Any]
313313
)
314314
.asInstanceOf[NumberFormatOptions]
315315
}

src/main/scala/org/scalajs/dom/experimental/sharedworkers/SharedWorkerGlobalScope.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trait SharedWorkerGlobalScope extends WorkerGlobalScope {
4444
*
4545
* MDN
4646
*/
47-
var onconnect: Function1[ExtendableMessageEvent, _] = js.native
47+
var onconnect: js.Function1[ExtendableMessageEvent, _] = js.native
4848
}
4949

5050
@js.native

src/main/scala/org/scalajs/dom/ext/Extensions.scala

+6
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ object Ajax {
243243
apply("PUT", url, data, timeout, headers, withCredentials, responseType)
244244
}
245245

246+
def patch(url: String, data: InputData = null, timeout: Int = 0,
247+
headers: Map[String, String] = Map.empty,
248+
withCredentials: Boolean = false, responseType: String = "") = {
249+
apply("PATCH", url, data, timeout, headers, withCredentials, responseType)
250+
}
251+
246252
def delete(url: String, data: InputData = null, timeout: Int = 0,
247253
headers: Map[String, String] = Map.empty,
248254
withCredentials: Boolean = false, responseType: String = "") = {

src/main/scala/org/scalajs/dom/ext/package.scala

+8-5
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@ package object ext {
2222
def cast[T] = x.asInstanceOf[T]
2323
}
2424

25-
implicit def pimpAnimatedNumber(x: svg.AnimatedNumber) = x.baseVal
25+
implicit def pimpAnimatedNumber(x: svg.AnimatedNumber): Double = x.baseVal
2626

27-
implicit def pimpRichAnimatedNumber(x: svg.AnimatedNumber) =
27+
implicit def pimpRichAnimatedNumber(
28+
x: svg.AnimatedNumber): runtime.RichDouble =
2829
x.baseVal: runtime.RichDouble
2930

30-
implicit def pimpAnimatedLength(x: svg.AnimatedLength) = x.baseVal.value
31+
implicit def pimpAnimatedLength(x: svg.AnimatedLength): Double =
32+
x.baseVal.value
3133

32-
implicit def pimpRichAnimatedLength(x: svg.AnimatedLength) =
34+
implicit def pimpRichAnimatedLength(
35+
x: svg.AnimatedLength): runtime.RichDouble =
3336
x.baseVal.value: runtime.RichDouble
3437

35-
implicit def color2String(c: Color) = c.toString
38+
implicit def color2String(c: Color): String = c.toString
3639
implicit class pimpedContext(val ctx: CanvasRenderingContext2D) {
3740
def prepCircle(x: Double, y: Double, r: Double) = {
3841
ctx.beginPath()

src/main/scala/org/scalajs/dom/package.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,5 @@ package object dom {
219219
lazy val window: Window = js.Dynamic.global.window.asInstanceOf[Window]
220220
lazy val document: html.Document = window.document
221221

222-
lazy val console: Console = window.console
222+
lazy val console: Console = js.Dynamic.global.console.asInstanceOf[Console] // #411
223223
}

src/main/scala/org/scalajs/dom/raw/lib.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,8 @@ class Window
25662566
*/
25672567
def close(): Unit = js.native
25682568

2569+
def closed: Boolean = js.native
2570+
25692571
/**
25702572
* The window.postMessage method safely enables cross-origin communication.
25712573
* Normally, scripts on different pages are allowed to access each other if and only if
@@ -5677,7 +5679,7 @@ class StyleSheetList extends js.Object {
56775679
}
56785680

56795681
trait CustomEventInit extends EventInit {
5680-
var detailArg: js.UndefOr[Any] = js.undefined
5682+
var detail: js.UndefOr[Any] = js.undefined
56815683
}
56825684

56835685
/**

0 commit comments

Comments
 (0)