Browse Source
Updated dependencies
Updated dependencies
Updated version to 0.0.10 Updated ScalaTest to 3.2.2 Updated scala version to 2.13.4 Updated scala.js version to 1.1.0 Updated to outwatch version to commit 676f94a Added dependency to outwatch-utils Updated scala.js bundler to 0.20.0 Updated sbt-microsites to 1.1.2 Removed obsolete scalac arguments Updated Router class itself - Now generic over effect type instead of being hardcoded to cats.effect.IO - Uses colibri.Observable instead of monix.Observable - Added history events listener to update dom on back/forward button pressmaster
11 changed files with 105 additions and 84 deletions
-
3.gitignore
-
1.scalafmt.conf
-
48build.sbt
-
85outwatch-router/src/main/scala/outwatch/router/Router.scala
-
14outwatch-router/src/main/scala/outwatch/router/dsl/C.scala
-
5outwatch-router/src/main/scala/outwatch/router/package.scala
-
7outwatch-router/src/test/scala/outwatch/router/AppRouterTestSpec.scala
-
10project/Options.scala
-
6project/Version.scala
-
2project/build.properties
-
8project/plugins.sbt
@ -1,13 +1,13 @@ |
|||
package outwatch.router |
|||
package dsl |
|||
|
|||
import outwatch.dom.VDomModifier |
|||
import outwatch.dom.{dsl => O, _} |
|||
import outwatch._ |
|||
import outwatch.dsl._ |
|||
|
|||
object C { |
|||
def a[P](linkHref: String)(attrs: VDomModifier*)(implicit store: RouterStore[P]): BasicVNode = |
|||
O.a( |
|||
O.href := linkHref, |
|||
O.onClick.preventDefault.mapTo(Replace(Path(linkHref))) --> store |
|||
)(attrs) |
|||
def link[P](linkHref: String)(attrs: VDomModifier*)(implicit store: RouterStore[P]): BasicVNode = |
|||
a(href := linkHref)( |
|||
onClick.preventDefault.useLazy(Replace(Path(linkHref))) --> store.sink, |
|||
attrs, |
|||
) |
|||
} |
@ -1,9 +1,10 @@ |
|||
package outwatch |
|||
|
|||
import outwatch.dom.VDomModifier |
|||
import outwatch._ |
|||
import colibri.ProSubject |
|||
|
|||
package object router { |
|||
type RouterStore[P] = ProHandler[Action, (Action, RouterState[P])] |
|||
type RouterStore[P] = ProSubject[Action, (Action, RouterState[P])] |
|||
|
|||
type RouterResolve[P] = PartialFunction[P, VDomModifier] |
|||
} |
@ -1,15 +1,14 @@ |
|||
package outwatch |
|||
package router |
|||
|
|||
import org.scalatest._ |
|||
import org.scalatest.flatspec.AnyFlatSpec |
|||
import org.scalatest.matchers.should.Matchers |
|||
|
|||
class PathTestSpec extends AnyFlatSpec with Matchers { |
|||
class PathTest(url: String, path: Path){ |
|||
path.toUrlString should equal (url) |
|||
class PathTest(url: String, path: Path) { |
|||
path.toUrlString should equal(url) |
|||
} |
|||
|
|||
"Root url" should "be /" in new PathTest("/", Root) |
|||
"A 1 part path" should "be correct" in new PathTest("/search", Root / "search") |
|||
} |
|||
|
@ -1,4 +1,4 @@ |
|||
object Version{ |
|||
val version = "0.0.9" |
|||
val scalaVersion = "2.12.8" |
|||
object Version { |
|||
val version = "0.0.10" |
|||
val scalaVersion = "2.13.4" |
|||
} |
@ -1 +1 @@ |
|||
sbt.version=1.3.0-RC2 |
|||
sbt.version=1.4.3 |
@ -1,6 +1,6 @@ |
|||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28") |
|||
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6") |
|||
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.2.8" ) |
|||
addSbtPlugin("com.47deg" % "sbt-microsites" % "0.8.0") |
|||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0") |
|||
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") |
|||
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.2.8") |
|||
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.1.2") |
|||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") |
|||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2") |
Write
Preview
Loading…
Cancel
Save
Reference in new issue