From 8c5701e9e52d5e60c84420ac6c8d9378b7658f3d Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Fri, 10 May 2024 14:43:35 -0400 Subject: [PATCH] update deps --- build.sbt | 8 ++++---- example/src/main/scala/example/AnimatedTitle.scala | 11 +++++------ .../core/js/src/main/scala/animus/Transitions.scala | 10 +++++----- .../com/raquo/airstream/core/AnimationManager.scala | 2 +- .../com/raquo/airstream/core/SpringSignal.scala | 2 +- .../raquo/airstream/core/TransitioningSignal.scala | 12 ++++++------ package.json | 2 +- project/build.properties | 2 +- project/plugins.sbt | 2 +- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/build.sbt b/build.sbt index 882d6ef..878b080 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ inThisBuild( name := "animus", normalizedName := "animus", organization := "com.kitlangton", - scalaVersion := "3.3.3", + scalaVersion := "3.4.1", crossScalaVersions := Seq("3.3.3"), organization := "io.github.kitlangton", homepage := Some(url("https://github.com/kitlangton/animus")), @@ -57,8 +57,8 @@ lazy val scalacSettings = "-feature" :: Nil -val zioVersion = "2.0.21" -val laminarVersion = "16.0.0" +val zioVersion = "2.1.0" +val laminarVersion = "17.0.0" lazy val commonSettings = Seq( scalacOptions ++= scalacSettings @@ -83,7 +83,7 @@ lazy val animus = crossProject(JSPlatform) commonSettings, libraryDependencies ++= Seq( "dev.zio" %%% "zio-test" % zioVersion % Test, - "io.github.kitlangton" %%% "quotidian" % "0.0.14" + "io.github.kitlangton" %%% "quotidian" % "0.0.15" ) ) .jsSettings( diff --git a/example/src/main/scala/example/AnimatedTitle.scala b/example/src/main/scala/example/AnimatedTitle.scala index fb0a7dd..835ae25 100644 --- a/example/src/main/scala/example/AnimatedTitle.scala +++ b/example/src/main/scala/example/AnimatedTitle.scala @@ -1,9 +1,9 @@ package example -import com.raquo.laminar.api.L._ -import animus._ +import com.raquo.laminar.api.L.* +import animus.* -object AnimatedTitle extends Component { +object AnimatedTitle extends Component: val activeVar = Var(true) val $time: Signal[Double] = @@ -19,8 +19,8 @@ object AnimatedTitle extends Component { val $opacity = $time.map(i => (Math.sin((i + idx * 15) / 30.0) / -2) + 1) def activate(signal: Signal[Double], default: Double): Signal[Double] = - activeVar.signal.flatMap { active => - if (active) signal + activeVar.signal.flatMapSwitch { active => + if active then signal else Val(default) }.spring @@ -34,4 +34,3 @@ object AnimatedTitle extends Component { ) } ) -} diff --git a/modules/core/js/src/main/scala/animus/Transitions.scala b/modules/core/js/src/main/scala/animus/Transitions.scala index ba185fc..88c28aa 100644 --- a/modules/core/js/src/main/scala/animus/Transitions.scala +++ b/modules/core/js/src/main/scala/animus/Transitions.scala @@ -54,7 +54,7 @@ object Transitions: val scrollHeightVar = Var(0.0) val $scrollHeight = $open.distinct - .flatMap { + .flatMapSwitch { if _ then scrollHeightVar.signal else Val(0.0) } @@ -83,14 +83,14 @@ object Transitions: } }, $scrollHeight --> { _ => () }, - maxHeight <-- signalVar.signal.flatten + maxHeight <-- signalVar.signal.flattenSwitch ) def width($open: Signal[Boolean], speed: Double = 1): Mod[HtmlElement] = val scrollWidthVar = Var(0.0) val $scrollWidth = $open.distinct - .flatMap { + .flatMapSwitch { if _ then scrollWidthVar.signal else Val(0.0) } @@ -119,7 +119,7 @@ object Transitions: } }, $scrollWidth --> { _ => () }, - maxWidth <-- signalVar.signal.flatten + maxWidth <-- signalVar.signal.flattenSwitch ) def scale($open: Signal[Boolean], closedScale: Double = 0.0, speed: Double = 1): Mod[HtmlElement] = @@ -212,7 +212,7 @@ object Transitions: xs } - $adding.flatMap(_ => + $adding.flatMapSwitch(_ => $values.map { values => ordering.toList.flatMap(key => values.get(key)) } diff --git a/modules/core/js/src/main/scala/com/raquo/airstream/core/AnimationManager.scala b/modules/core/js/src/main/scala/com/raquo/airstream/core/AnimationManager.scala index 8eeb61d..f5066e7 100644 --- a/modules/core/js/src/main/scala/com/raquo/airstream/core/AnimationManager.scala +++ b/modules/core/js/src/main/scala/com/raquo/airstream/core/AnimationManager.scala @@ -4,7 +4,7 @@ import animus.Animator import org.scalajs.dom.window.requestAnimationFrame object AnimationManager: - private val animations = scalajs.js.Map.empty[Int, Animator[_]] + private val animations = scalajs.js.Map.empty[Int, Animator[?]] private var animating = false private var animationId: Int = 0 diff --git a/modules/core/js/src/main/scala/com/raquo/airstream/core/SpringSignal.scala b/modules/core/js/src/main/scala/com/raquo/airstream/core/SpringSignal.scala index 4806933..49bac64 100644 --- a/modules/core/js/src/main/scala/com/raquo/airstream/core/SpringSignal.scala +++ b/modules/core/js/src/main/scala/com/raquo/airstream/core/SpringSignal.scala @@ -18,7 +18,7 @@ class SpringSignal[A]( with WritableSignal[A] with SingleParentSignal[A, A]: - private var spring: Animator[A] = _ + private var spring: Animator[A] = scala.compiletime.uninitialized var animationId: Int = -1 override def onStart(): Unit = diff --git a/modules/core/js/src/main/scala/com/raquo/airstream/core/TransitioningSignal.scala b/modules/core/js/src/main/scala/com/raquo/airstream/core/TransitioningSignal.scala index d14776a..10af2e9 100644 --- a/modules/core/js/src/main/scala/com/raquo/airstream/core/TransitioningSignal.scala +++ b/modules/core/js/src/main/scala/com/raquo/airstream/core/TransitioningSignal.scala @@ -9,7 +9,7 @@ import scala.scalajs.js.timers.{SetTimeoutHandle, clearTimeout, setTimeout} import scala.util.Try class TransitioningSignal[Input, Output, Key]( - override protected[this] val parent: Signal[Seq[Input]], + override protected val parent: Signal[Seq[Input]], getKey: Input => Key, project: (Key, Input, Signal[Input], Transition) => Output ) extends Signal[Seq[Output]] @@ -28,12 +28,12 @@ class TransitioningSignal[Input, Output, Key]( override protected[airstream] val topoRank: Int = Protected.topoRank(parent) + 1 - private[this] val timeoutHandles: mutable.Map[Key, SetTimeoutHandle] = mutable.Map.empty - private[this] val memoized: mutable.Map[Key, (Output, Var[Input], Var[TransitionStatus])] = mutable.Map.empty - private[this] val activeKeys: mutable.Set[Key] = mutable.Set.empty + private val timeoutHandles: mutable.Map[Key, SetTimeoutHandle] = mutable.Map.empty + private val memoized: mutable.Map[Key, (Output, Var[Input], Var[TransitionStatus])] = mutable.Map.empty + private val activeKeys: mutable.Set[Key] = mutable.Set.empty // Used to track the order of the values. - private[this] val ordered = new OrderedSet[Key](Vector.empty) + private val ordered = new OrderedSet[Key](Vector.empty) protected override def onStop(): Unit = memoized.clear() @@ -41,7 +41,7 @@ class TransitioningSignal[Input, Output, Key]( def refireMemoized(): Unit = fireValue(ordered.toList.map(memoized(_)._1), null) - private[this] def memoizedProject(nextInputs: Seq[Input], first: Boolean = false): Seq[Output] = + private def memoizedProject(nextInputs: Seq[Input], first: Boolean = false): Seq[Output] = val nextKeys = mutable.HashSet.empty[Key] // HashSet has desirable performance tradeoffs val nextOutputs = nextInputs.map { input => diff --git a/package.json b/package.json index 803903d..cd25d3b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "postcss": "^8.4.38", "postcss-import": "16.1.0", "postcss-preset-env": "9.5.11", - "sass": "^1.76.0", + "sass": "^1.77.0", "stylelint": "16.5.0", "stylelint-config-recommended": "14.0.0", "stylelint-config-standard": "36.0.0", diff --git a/project/build.properties b/project/build.properties index f2f1347..ee06c39 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.9.9 \ No newline at end of file +sbt.version = 1.10.0 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 3604b3d..06e7c4f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.23.0")