Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kitlangton committed May 10, 2024
1 parent 3975259 commit 8c5701e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down
11 changes: 5 additions & 6 deletions example/src/main/scala/example/AnimatedTitle.scala
Original file line number Diff line number Diff line change
@@ -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] =
Expand All @@ -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

Expand All @@ -34,4 +34,3 @@ object AnimatedTitle extends Component {
)
}
)
}
10 changes: 5 additions & 5 deletions modules/core/js/src/main/scala/animus/Transitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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] =
Expand Down Expand Up @@ -212,7 +212,7 @@ object Transitions:
xs
}

$adding.flatMap(_ =>
$adding.flatMapSwitch(_ =>
$values.map { values =>
ordering.toList.flatMap(key => values.get(key))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -28,20 +28,20 @@ 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()
super.onStop()

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 =>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.9.9
sbt.version = 1.10.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 8c5701e

Please sign in to comment.