Skip to content

Commit 15e732b

Browse files
authored
Merge pull request #450 from armanbilge/support-scala3
Support Scala 3
2 parents 22e4a70 + 7788a04 commit 15e732b

File tree

7 files changed

+45
-42
lines changed

7 files changed

+45
-42
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
include:
1818
- scalaversion: "2.10.7"
1919
scalajsversion: "0.6.x"
20+
- scalaversion: "3.0.1"
21+
scalajsversion: "1.x"
2022
env:
2123
SCALAJS_VERSION: "${{ matrix.scalajsversion == '0.6.x' && '0.6.28' || '' }}"
2224
steps:

build.sbt

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +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")
8+
ThisBuild / crossScalaVersions := {
9+
if (scalaJSVersion.startsWith("1.")) Seq("2.12.10", "2.11.12", "2.13.1", "3.0.1")
1010
else Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1")
1111
}
12-
scalaVersion in ThisBuild := crossScalaVersions.value.head
12+
ThisBuild / scalaVersion := crossScalaVersions.value.head
1313

1414
val commonSettings = Seq(
1515
version := "1.2.0-SNAPSHOT",
@@ -104,7 +104,7 @@ lazy val readme = ScalatexReadme(
104104
).settings(
105105
scalaVersion := "2.12.10",
106106
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
107-
(resources in Compile) += (fullOptJS in (example, Compile)).value.data
107+
(Compile / resources) += (example / Compile / fullOptJS).value.data
108108
)
109109

110110
lazy val example = project.

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")).filter(_ != "").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

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/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()

0 commit comments

Comments
 (0)