diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5dfa54c7f..d34a5189e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ jobs: include: - scalaversion: "2.10.7" scalajsversion: "0.6.x" + - scalaversion: "3.0.1" + scalajsversion: "1.x" env: SCALAJS_VERSION: "${{ matrix.scalajsversion == '0.6.x' && '0.6.28' || '' }}" steps: @@ -26,11 +28,11 @@ jobs: java-version: "adopt@1.8" - uses: coursier/cache-action@v5 - name: Build - run: sbt "++${{ matrix.scalaversion }}" package + run: sbt "++${{ matrix.scalaversion }} package" - name: Test generate documentation run: sbt "++${{ matrix.scalaversion }}" doc - name: Build examples - run: sbt "++${{ matrix.scalaversion }}" example/compile + run: sbt "++${{ matrix.scalaversion }} clean;example/compile" - name: scalafmt run: sbt "++${{ matrix.scalaversion }}" scalafmtCheck readme: diff --git a/build.sbt b/build.sbt index 371ebc4c8..3d2c3bb57 100644 --- a/build.sbt +++ b/build.sbt @@ -5,13 +5,14 @@ lazy val root = project.in(file(".")). name := "Scala.js DOM" -crossScalaVersions in ThisBuild := { - if (scalaJSVersion.startsWith("1.")) Seq("2.12.10", "2.11.12", "2.13.1") +ThisBuild / crossScalaVersions := { + if (scalaJSVersion.startsWith("1.")) Seq("2.12.10", "2.11.12", "2.13.1", "3.0.1") else Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1") } -scalaVersion in ThisBuild := crossScalaVersions.value.head +ThisBuild / scalaVersion := crossScalaVersions.value.head val commonSettings = Seq( + resolvers += Resolver.JCenterRepository, version := "1.2.0-SNAPSHOT", organization := "org.scala-js", scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings") @@ -104,7 +105,7 @@ lazy val readme = ScalatexReadme( ).settings( scalaVersion := "2.12.10", scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"), - (resources in Compile) += (fullOptJS in (example, Compile)).value.data + (Compile / resources) += (example / Compile / fullOptJS).value.data, ) lazy val example = project. diff --git a/project/build.properties b/project/build.properties index c0bab0494..67d27a1df 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.8 +sbt.version=1.5.3 diff --git a/project/build.sbt b/project/build.sbt index bc96d108b..91d1d968a 100644 --- a/project/build.sbt +++ b/project/build.sbt @@ -1,5 +1,5 @@ val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.0.0") + Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.5.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) diff --git a/src/main/scala/org/scalajs/dom/crypto/Crypto.scala b/src/main/scala/org/scalajs/dom/crypto/Crypto.scala index e411dfc51..b3732ebc1 100644 --- a/src/main/scala/org/scalajs/dom/crypto/Crypto.scala +++ b/src/main/scala/org/scalajs/dom/crypto/Crypto.scala @@ -930,10 +930,8 @@ object KeyFormat { trait RSAPublicKey extends js.Object { /* modulus, as a base64 URL encoded String */ - @js.native def n: String = js.native /* exponent, as a base64 URL encoded String */ - @js.native def e: String = js.native } diff --git a/src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala b/src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala index e80f410c8..f0c99b381 100644 --- a/src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala +++ b/src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala @@ -123,12 +123,12 @@ object CollatorOptions { ): CollatorOptions = { js.Dynamic .literal( - localeMatcher = localeMatcher, - usage = usage, - sensitivity = sensitivity, - ignorePunctuation = ignorePunctuation, - numeric = numeric, - caseFirst = caseFirst + localeMatcher = localeMatcher.asInstanceOf[js.Any], + usage = usage.asInstanceOf[js.Any], + sensitivity = sensitivity.asInstanceOf[js.Any], + ignorePunctuation = ignorePunctuation.asInstanceOf[js.Any], + numeric = numeric.asInstanceOf[js.Any], + caseFirst = caseFirst.asInstanceOf[js.Any] ) .asInstanceOf[CollatorOptions] } @@ -200,19 +200,19 @@ object DateTimeFormatOptions { // format: off js.Dynamic .literal( - localeMatcher = localeMatcher, - timeZone = timeZone, - hour12 = hour12, - formatMatcher = formatMatcher, - weekday = weekday, - era = era, - year = year, - month = month, - day = day, - hour = hour, - minute = minute, - second = second, - timeZoneName = timeZoneName + localeMatcher = localeMatcher.asInstanceOf[js.Any], + timeZone = timeZone.asInstanceOf[js.Any], + hour12 = hour12.asInstanceOf[js.Any], + formatMatcher = formatMatcher.asInstanceOf[js.Any], + weekday = weekday.asInstanceOf[js.Any], + era = era.asInstanceOf[js.Any], + year = year.asInstanceOf[js.Any], + month = month.asInstanceOf[js.Any], + day = day.asInstanceOf[js.Any], + hour = hour.asInstanceOf[js.Any], + minute = minute.asInstanceOf[js.Any], + second = second.asInstanceOf[js.Any], + timeZoneName = timeZoneName.asInstanceOf[js.Any] ) .asInstanceOf[DateTimeFormatOptions] // format: on @@ -300,16 +300,16 @@ object NumberFormatOptions { ): NumberFormatOptions = { js.Dynamic .literal( - localeMatcher = localeMatcher, - style = style, - currency = currency, - currencyDisplay = currencyDisplay, - useGrouping = useGrouping, - minimumIntegerDigits = minimumIntegerDigits, - minimumFractionDigits = minimumFractionDigits, - maximumFractionDigits = maximumFractionDigits, - minimumSignificantDigits = minimumSignificantDigits, - maximumSignificantDigits = maximumSignificantDigits + localeMatcher = localeMatcher.asInstanceOf[js.Any], + style = style.asInstanceOf[js.Any], + currency = currency.asInstanceOf[js.Any], + currencyDisplay = currencyDisplay.asInstanceOf[js.Any], + useGrouping = useGrouping.asInstanceOf[js.Any], + minimumIntegerDigits = minimumIntegerDigits.asInstanceOf[js.Any], + minimumFractionDigits = minimumFractionDigits.asInstanceOf[js.Any], + maximumFractionDigits = maximumFractionDigits.asInstanceOf[js.Any], + minimumSignificantDigits = minimumSignificantDigits.asInstanceOf[js.Any], + maximumSignificantDigits = maximumSignificantDigits.asInstanceOf[js.Any] ) .asInstanceOf[NumberFormatOptions] } diff --git a/src/main/scala/org/scalajs/dom/experimental/webrtc/WebRTC.scala b/src/main/scala/org/scalajs/dom/experimental/webrtc/WebRTC.scala index 5c8db2d6c..368b3e3cf 100644 --- a/src/main/scala/org/scalajs/dom/experimental/webrtc/WebRTC.scala +++ b/src/main/scala/org/scalajs/dom/experimental/webrtc/WebRTC.scala @@ -5,9 +5,8 @@ package org.scalajs.dom.experimental.webrtc import scala.scalajs.js import scala.scalajs.js.annotation._ -import scala.scalajs.js.typedarray.{ArrayBufferView, ArrayBuffer} -import scala.scalajs.js.| - +import scala.scalajs.js.typedarray.{ArrayBuffer, ArrayBufferView} +import scala.scalajs.js.{undefined, |} import org.scalajs.dom.Blob import org.scalajs.dom.raw.{ DOMException, Event, EventInit, EventTarget, MessageEvent @@ -503,7 +502,8 @@ trait RTCDataChannelInit extends js.Object { class RTCDataChannelEvent(typeArg: String, init: js.UndefOr[RTCDataChannelEventInit]) extends Event(typeArg, init) { - def this(init: RTCDataChannelEventInit) = this("datachannel", init) + def this(init: js.UndefOr[RTCDataChannelEventInit]) = + this(typeArg = "datachannel", init = init) /** * Contains the RTCDataChannel containing the data channel associated with diff --git a/src/main/scala/org/scalajs/dom/ext/package.scala b/src/main/scala/org/scalajs/dom/ext/package.scala index 90e848b21..1e9f15bc6 100644 --- a/src/main/scala/org/scalajs/dom/ext/package.scala +++ b/src/main/scala/org/scalajs/dom/ext/package.scala @@ -1,8 +1,8 @@ package org.scalajs.dom import scala.language.implicitConversions - import scala.collection.mutable +import scala.runtime.RichDouble package object ext { @@ -22,17 +22,18 @@ package object ext { def cast[T] = x.asInstanceOf[T] } - implicit def pimpAnimatedNumber(x: svg.AnimatedNumber) = x.baseVal + implicit def pimpAnimatedNumber(x: svg.AnimatedNumber): Double = x.baseVal - implicit def pimpRichAnimatedNumber(x: svg.AnimatedNumber) = + implicit def pimpRichAnimatedNumber(x: svg.AnimatedNumber): RichDouble = x.baseVal: runtime.RichDouble - implicit def pimpAnimatedLength(x: svg.AnimatedLength) = x.baseVal.value + implicit def pimpAnimatedLength(x: svg.AnimatedLength): Double = + x.baseVal.value - implicit def pimpRichAnimatedLength(x: svg.AnimatedLength) = + implicit def pimpRichAnimatedLength(x: svg.AnimatedLength): RichDouble = x.baseVal.value: runtime.RichDouble - implicit def color2String(c: Color) = c.toString + implicit def color2String(c: Color): String = c.toString implicit class pimpedContext(val ctx: CanvasRenderingContext2D) { def prepCircle(x: Double, y: Double, r: Double) = { ctx.beginPath() diff --git a/src/main/scala/org/scalajs/dom/raw/lib.scala b/src/main/scala/org/scalajs/dom/raw/lib.scala index 77a6c1785..bb4e760ac 100644 --- a/src/main/scala/org/scalajs/dom/raw/lib.scala +++ b/src/main/scala/org/scalajs/dom/raw/lib.scala @@ -1561,11 +1561,9 @@ class MouseEvent(typeArg: String, init: js.UndefOr[MouseEventInit]) @js.native @JSGlobal class PointerEvent(typeArg: String, - pointerEventInit: js.UndefOr[PointerEventInit] = js.undefined) + pointerEventInit: js.UndefOr[PointerEventInit] = js.native) extends MouseEvent(typeArg, pointerEventInit) { - def this(typeArg: String) = this(typeArg, js.native) - /** * An identifier assigned to a pointer event that is unique from the identifiers * of all active pointer events at the time. Authors cannot assume values convey @@ -3115,10 +3113,11 @@ class Touch extends js.Object { */ @js.native @JSGlobal -class KeyboardEvent(typeArg: String, init: js.UndefOr[KeyboardEventInit]) +class KeyboardEvent(typeArg: String, + init: js.UndefOr[KeyboardEventInit] = js.native) extends UIEvent(typeArg, init) with ModifierKeyEvent { - def this(typeArg: String) = this(typeArg, js.native) +// def this(typeArg: String) = this(typeArg, js.native) /** * Returns the Unicode value of a character key pressed during a keypress event.