diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54dba553d..63418c0c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - scala: [ 2.13.12 ] + scala: [ 2.13.13 ] command: [ udash-jvm/test, udash-js/test, guide-selenium/test ] steps: - uses: actions/checkout@v3 diff --git a/bootstrap4/.js/src/main/scala/io/udash/bootstrap/UdashBootstrap.scala b/bootstrap4/.js/src/main/scala/io/udash/bootstrap/UdashBootstrap.scala index 3f8ee6e21..fe5c958ec 100644 --- a/bootstrap4/.js/src/main/scala/io/udash/bootstrap/UdashBootstrap.scala +++ b/bootstrap4/.js/src/main/scala/io/udash/bootstrap/UdashBootstrap.scala @@ -9,7 +9,7 @@ object UdashBootstrap { final val True: ReadableProperty[Boolean] = true.toProperty final val ColorSecondary: ReadableProperty[BootstrapStyles.Color] = BootstrapStyles.Color.Secondary.toProperty private final val NoneProperty = scala.None.toProperty - def None[A]: ReadableProperty[Option[A]] = NoneProperty.asInstanceOf[ReadableProperty[Option[A]]] + def None[A]: ReadableProperty[Option[A]] = NoneProperty /** Loads FontAwesome styles. */ def loadFontAwesome(): Element = diff --git a/bootstrap4/.js/src/test/scala/io/udash/bootstrap/carousel/UdashCarouselTest.scala b/bootstrap4/.js/src/test/scala/io/udash/bootstrap/carousel/UdashCarouselTest.scala index 856865e9d..8de67118c 100644 --- a/bootstrap4/.js/src/test/scala/io/udash/bootstrap/carousel/UdashCarouselTest.scala +++ b/bootstrap4/.js/src/test/scala/io/udash/bootstrap/carousel/UdashCarouselTest.scala @@ -134,13 +134,13 @@ class UdashCarouselTest extends AsyncUdashCoreFrontendTest { var changedEvent: CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]] = null carousel.listen { case ev@CarouselEvent(_, _, _, false) => - changeEvent = ev.asInstanceOf[CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]]] + changeEvent = ev case ev@CarouselEvent(_, _, _, true) => - changedEvent = ev.asInstanceOf[CarouselEvent[UdashCarouselSlide, ReadableProperty[UdashCarouselSlide]]] + changedEvent = ev } carousel.goTo(5) - retrying(changeEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, false)) - retrying(changedEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, true)) + retrying(changeEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, changed = false)) + retrying(changedEvent shouldBe CarouselEvent(carousel, 5, CarouselEvent.Direction.Left, changed = true)) retrying(carousel.activeSlide.get shouldBe 5) } diff --git a/core/.js/src/test/scala/io/udash/bindings/TagsBindingTest.scala b/core/.js/src/test/scala/io/udash/bindings/TagsBindingTest.scala index 2e46b1852..61b9b2cd1 100644 --- a/core/.js/src/test/scala/io/udash/bindings/TagsBindingTest.scala +++ b/core/.js/src/test/scala/io/udash/bindings/TagsBindingTest.scala @@ -1686,11 +1686,11 @@ class TagsBindingTest extends UdashFrontendTest with Bindings { bindings: Bindin done.listenStructure(p => patches += p) todos.set(Seq( - Todo("A", false), - Todo("B", false), - Todo("C", false), - Todo("D", false), - Todo("E", false) + Todo("A", completed = false), + Todo("B", completed = false), + Todo("C", completed = false), + Todo("D", completed = false), + Todo("E", completed = false), )) patches.size should be(0) diff --git a/core/src/test/scala/io/udash/properties/SeqPropertyTest.scala b/core/src/test/scala/io/udash/properties/SeqPropertyTest.scala index 06de4083a..de7596c96 100644 --- a/core/src/test/scala/io/udash/properties/SeqPropertyTest.scala +++ b/core/src/test/scala/io/udash/properties/SeqPropertyTest.scala @@ -706,11 +706,11 @@ class SeqPropertyTest extends UdashCoreTest { filtered.listen(_ => ()) val s = Seq( - D("A", false), - D("B", false), - D("C", false), - D("D", false), - D("E", false) + D("A", b = false), + D("B", b = false), + D("C", b = false), + D("D", b = false), + D("E", b = false), ) ts.set(s) diff --git a/guide/guide/.js/src/main/scala/io/udash/web/guide/views/frontend/FrontendRoutingView.scala b/guide/guide/.js/src/main/scala/io/udash/web/guide/views/frontend/FrontendRoutingView.scala index d73fa2423..3dc098383 100644 --- a/guide/guide/.js/src/main/scala/io/udash/web/guide/views/frontend/FrontendRoutingView.scala +++ b/guide/guide/.js/src/main/scala/io/udash/web/guide/views/frontend/FrontendRoutingView.scala @@ -4,17 +4,16 @@ import io.udash._ import io.udash.auth.{UnauthenticatedException, UnauthorizedException} import io.udash.bootstrap.utils.BootstrapStyles import io.udash.css.CssView -import io.udash.web.commons.components.{CodeBlock, ForceBootstrap} +import io.udash.utils.URLEncoder +import io.udash.web.commons.components.ForceBootstrap import io.udash.web.commons.styles.GlobalStyles +import io.udash.web.guide._ import io.udash.web.guide.demos.AutoDemo import io.udash.web.guide.styles.partials.GuideStyles import io.udash.web.guide.views.References -import io.udash.web.guide.{Context, _} import org.scalajs.dom import scalatags.JsDom -import scala.scalajs.js - case object FrontendRoutingViewFactory extends ViewFactory[FrontendRoutingState] { override def create(): (View, Presenter[FrontendRoutingState]) = { val url = Property.blank[String] @@ -23,13 +22,16 @@ case object FrontendRoutingViewFactory extends ViewFactory[FrontendRoutingState] } class FrontendRoutingPresenter(url: Property[String]) extends Presenter[FrontendRoutingState] { + import Context.applicationInstance + override def handleState(state: FrontendRoutingState) = { url.set(applicationInstance.currentUrl.value) } } class FrontendRoutingView(url: Property[String]) extends View with CssView { + import Context._ import JsDom.all._ import com.avsystem.commons.SharedExtensions.universalOps @@ -219,14 +221,12 @@ class FrontendRoutingView(url: Property[String]) extends View with CssView { size = BootstrapStyles.SpacingSize.Normal ))(input( BootstrapStyles.Form.control, id := "url-demo-link-input", value := "", - placeholder := "Type something in this field and look at the URL...", onkeyup :+= ((event: dom.Event) => { + placeholder := "Type something in this field and look at the URL...", onkeyup :+= { (event: dom.Event) => applicationInstance.goTo(FrontendRoutingState( - Some(js.Dynamic.global - .encodeURIComponent(event.target.asInstanceOf[dom.html.Input].value) - .asInstanceOf[String]) + Some(URLEncoder.encode(event.target.asInstanceOf[dom.html.Input].value, spaceAsPlus = false)) )) true - }) + } )), p("This view was created with: ", span(id := "url-demo-link-init")(applicationInstance.currentUrl.value)) ) diff --git a/guide/homepage/.js/src/main/scala/io/udash/web/homepage/components/demo/DemoComponent.scala b/guide/homepage/.js/src/main/scala/io/udash/web/homepage/components/demo/DemoComponent.scala index 6dd6801fb..228897a56 100644 --- a/guide/homepage/.js/src/main/scala/io/udash/web/homepage/components/demo/DemoComponent.scala +++ b/guide/homepage/.js/src/main/scala/io/udash/web/homepage/components/demo/DemoComponent.scala @@ -36,9 +36,10 @@ final class DemoComponent(implicit application: Application[RoutingState]) exten ) }.toSeq ), - produce(application.currentStateProperty) { state => - state.opt.collect { case state: IndexState => code(state.codeDemo).setup(Prism.highlightAllUnder) }.getOrElse[Element](div().render) + produce(application.currentStateProperty) { + case state: IndexState => code(state.codeDemo).setup(Prism.highlightAllUnder) + case _ => div().render } ) ).render -} \ No newline at end of file +} diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 765b868cb..80a60db5c 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,7 +5,7 @@ import sbt.* import sbt.Keys.scalaVersion object Dependencies { - val versionOfScala = "2.13.12" //update .github/workflows/ci.yml as well + val versionOfScala = "2.13.13" //update .github/workflows/ci.yml as well val jqueryWrapperVersion = "3.3.0" @@ -14,7 +14,7 @@ object Dependencies { val scalaCssVersion = "1.0.0" val servletVersion = "4.0.1" - val avsCommonsVersion = "2.13.3" + val avsCommonsVersion = "2.14.0" val atmosphereJSVersion = "3.1.3" val atmosphereVersion = "2.7.10" diff --git a/rest/src/main/scala/io/udash/rest/openapi/OpenApi.scala b/rest/src/main/scala/io/udash/rest/openapi/OpenApi.scala index a02cea02d..e839e5e42 100644 --- a/rest/src/main/scala/io/udash/rest/openapi/OpenApi.scala +++ b/rest/src/main/scala/io/udash/rest/openapi/OpenApi.scala @@ -247,7 +247,7 @@ final case class Schema( @td uniqueItems: Boolean = false, @td properties: Map[String, RefOr[Schema]] = Map.empty, - @td additionalProperties: AdditionalProperties = AdditionalProperties.Flag(true), + @td additionalProperties: AdditionalProperties = AdditionalProperties.Flag(value = true), @td maxProperties: OptArg[Int] = OptArg.Empty, @td minProperties: OptArg[Int] = OptArg.Empty, @td required: List[String] = Nil, @@ -295,7 +295,7 @@ object Schema extends HasGenObjectCodec[Schema] { def enumMapOf(keys: List[String], value: RefOr[Schema]): Schema = Schema(`type` = DataType.Object, properties = keys.iterator.map(k => (k, value)).toMap, - additionalProperties = AdditionalProperties.Flag(false) + additionalProperties = AdditionalProperties.Flag(value = false) ) def nullable(schema: RefOr[Schema]): Schema = schema match { diff --git a/rest/src/main/scala/io/udash/rest/openapi/OpenApiMetadata.scala b/rest/src/main/scala/io/udash/rest/openapi/OpenApiMetadata.scala index a656dedbc..fc97821bc 100644 --- a/rest/src/main/scala/io/udash/rest/openapi/OpenApiMetadata.scala +++ b/rest/src/main/scala/io/udash/rest/openapi/OpenApiMetadata.scala @@ -275,7 +275,7 @@ final case class OpenApiParamInfo[T]( @bincompat private[rest] def this( name: String, whenAbsentInfo: Opt[WhenAbsentInfo[T]], flags: ParamFlags, restSchema: RestSchema[T] - ) = this(name, whenAbsentInfo, false, flags, restSchema) + ) = this(name, whenAbsentInfo, optional = false, flags, restSchema) } final case class OpenApiParameter[T]( diff --git a/rpc/src/test/scala/io/udash/rpc/RpcMessagesTest.scala b/rpc/src/test/scala/io/udash/rpc/RpcMessagesTest.scala index 1d527c00c..616c006b5 100644 --- a/rpc/src/test/scala/io/udash/rpc/RpcMessagesTest.scala +++ b/rpc/src/test/scala/io/udash/rpc/RpcMessagesTest.scala @@ -74,20 +74,6 @@ trait RpcMessagesTestScenarios extends UdashSharedTest with Utils { deserialized3 should be(sealedException) } - // "serialize and deserialize exception stacktrace" in { - // val serialized = write[RpcResponse](exception) - // val deserialized = read[RpcResponse](serialized) - // deserialized.asInstanceOf[RpcResponseException].exception.getStackTrace should be(exception.exception.getStackTrace) - // - // val serialized2 = write[RpcResponse](runtimeException) - // val deserialized2 = read[RpcResponse](serialized2) - // deserialized2.asInstanceOf[RpcResponseException].exception.getStackTrace should be(runtimeException.exception.getStackTrace) - // - // val serialized3 = write[RpcResponse](sealedException) - // val deserialized3 = read[RpcResponse](serialized3) - // deserialized3.asInstanceOf[RpcResponseException].exception.getStackTrace should be(sealedException.exception.getStackTrace) - // } - "serialize and deserialize rpc failure msg" in { val serialized = write[RpcFailure](rpcFail) val deserialized = read[RpcFailure](serialized) @@ -120,7 +106,7 @@ trait RpcMessagesTestScenarios extends UdashSharedTest with Utils { } "serialize and deserialize simple case classes" in { - val test: TestCC = TestCC(5, 123L, 432, true, "bla", 'a' :: 'b' :: Nil) + val test: TestCC = TestCC(5, 123L, 432, b = true, "bla", 'a' :: 'b' :: Nil) val serialized = write[TestCC](test) val deserialized = read[TestCC](serialized) @@ -128,8 +114,8 @@ trait RpcMessagesTestScenarios extends UdashSharedTest with Utils { } "serialize and deserialize nested case classes" in { - val test: TestCC = TestCC(5, 123L, 432, true, "bla", 'a' :: 'b' :: Nil) - val test2: TestCC = TestCC(-35, 1L, 432, true, "blsddf sdg \"{,}[,]\"a", 'a' :: 'b' :: Nil) + val test: TestCC = TestCC(5, 123L, 432, b = true, "bla", 'a' :: 'b' :: Nil) + val test2: TestCC = TestCC(-35, 1L, 432, b = true, "blsddf sdg \"{,}[,]\"a", 'a' :: 'b' :: Nil) val nested: NestedTestCC = NestedTestCC(-123, test, test2) val serialized = write(nested) val deserialized = read[NestedTestCC](serialized) diff --git a/utils/.js/src/main/scala/io/udash/logging/UdashLogger.scala b/utils/.js/src/main/scala/io/udash/logging/UdashLogger.scala index 6d9565b12..a4c098fce 100644 --- a/utils/.js/src/main/scala/io/udash/logging/UdashLogger.scala +++ b/utils/.js/src/main/scala/io/udash/logging/UdashLogger.scala @@ -1,12 +1,12 @@ package io.udash.logging +import org.scalajs.dom import org.scalajs.dom.Console import scala.scalajs.js -import scala.scalajs.js.Dynamic.global class UdashLogger(clazz: Class[_]) extends CrossLogger { - private val console: Console = global.console.asInstanceOf[Console] + private val console: Console = dom.console private def printWithParams(method: (js.Any, Seq[js.Any]) => Unit)(message: String, params: Any*): Unit = method(message, params.map(_.asInstanceOf[js.Any]))