Skip to content

Commit

Permalink
Release 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ochrons committed Nov 25, 2017
1 parent 987cc32 commit a2700ff
Show file tree
Hide file tree
Showing 33 changed files with 100 additions and 109 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changes

## 1.1.3
- Upgrade to Scala 2.12.4 and Scala.js 0.6.19
- Update diode-react to scalajs-react 1.1.0
- Use the existing `startTime` in `Pending` and `PendingStale` `PotState`
- Add a hook to log exceptions encountered while processing effects
- Documentation fixes

## 1.1.2
- Upgrade to Scala 2.11.11, 2.12.2 and Scala.js 0.6.15
- Update diode-react to scalajs-react 1.0.0
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/suzaku-io/diode)
[![Build Status](https://travis-ci.org/suzaku-io/diode.svg?branch=master)](https://travis-ci.org/suzaku-io/diode)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.15.svg)](https://www.scala-js.org)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.17.svg)](https://www.scala-js.org)

Diode is a Scala/Scala.js library for managing immutable application state with unidirectional data flow. It is heavily
influenced and inspired by [Flux](https://facebook.github.io/flux/) and
Expand All @@ -24,13 +24,13 @@ Full documentation [available here](https://diode.suzaku.io).
Add following dependency declaration to your Scala project.

```scala
"io.suzaku" %% "diode" % "1.1.2"
"io.suzaku" %% "diode" % "1.1.3"
```

In a Scala.js project the dependency looks like this.

```scala
"io.suzaku" %%% "diode" % "1.1.2"
"io.suzaku" %%% "diode" % "1.1.3"
```

<img align="right" src="doc/images/architecture.png">
Expand Down
14 changes: 10 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import com.typesafe.sbt.pgp.PgpKeys._

crossScalaVersions := Seq("2.11.11", "2.12.4")

scalafmtOnCompile in ThisBuild := true
scalafmtVersion in ThisBuild := "1.3.0"

val commonSettings = Seq(
organization := "io.suzaku",
version := Version.library,
Expand All @@ -23,12 +26,15 @@ val commonSettings = Seq(
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
),
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => Seq("-Xlint:-unused")
case _ => Nil
}),
scalacOptions in Compile -= "-Ywarn-value-discard",
scalacOptions in (Compile, doc) -= "-Xfatal-warnings",
testFrameworks += new TestFramework("utest.runner.Framework"),
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "utest" % "0.4.4" % "test"
"com.lihaoyi" %%% "utest" % "0.5.3" % "test"
)
)

Expand Down Expand Up @@ -143,7 +149,7 @@ lazy val diodeDevtools = crossProject
)
.jsSettings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1"
"org.scala-js" %%% "scalajs-dom" % "0.9.3"
),
scalacOptions ++= sourceMapSetting.value
)
Expand All @@ -161,7 +167,7 @@ lazy val diodeReact = project
.settings(
name := "diode-react",
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.1.1"
"com.github.japgolly.scalajs-react" %%% "core" % "1.1.0"
),
scalacOptions ++= sourceMapSetting.value
)
Expand Down
3 changes: 1 addition & 2 deletions diode-react/src/main/scala/diode/react/ReactConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ trait ReactConnector[M <: AnyRef] { circuit: Circuit[M] =>
.renderBackend[Backend]
.componentWillMount(_.backend.willMount)
.componentWillUnmount(_.backend.willUnmount)
.shouldComponentUpdatePure(scope =>
(scope.currentState ne scope.nextState) || (scope.currentProps ne scope.nextProps))
.shouldComponentUpdatePure(scope => (scope.currentState ne scope.nextState) || (scope.currentProps ne scope.nextProps))
.build
.withRawProp("key", key)
}
Expand Down
2 changes: 1 addition & 1 deletion doc/book.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
}
},
"variables": {
"version": "1.1.2"
"version": "1.1.3"
}
}
8 changes: 4 additions & 4 deletions doc/usage/Handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ val treeHandler = new ActionHandler(zoomTo(_.tree.root)) {
}
}

override val actionHandler = composeHandlers(treeHandler)
override protected val actionHandler = composeHandlers(treeHandler)
```

Now our application is ready to handle dispatched `ReplaceTree` actions successfully!
Expand Down Expand Up @@ -207,7 +207,7 @@ val selectionHandler = new ActionHandler(zoomTo(_.tree.selected)) {
}
}

override val actionHandler = composeHandlers(treeHandler, selectionHandler)
override protected val actionHandler = composeHandlers(treeHandler, selectionHandler)
```

Again we zoom into the `tree` but this time we continue to `selected`. The handler implementation is as trivial as with
Expand Down Expand Up @@ -237,13 +237,13 @@ val selectionHandler = new ActionHandler(zoomTo(_.tree.selected)) {
}
}

override val actionHandler = foldHandlers(treeHandler, selectionHandler)
override protected val actionHandler = foldHandlers(treeHandler, selectionHandler)
```

You can combine `composeHandlers` and `foldHandlers` to build more complex action handler hierarchies.

```scala
override val actionHandler = foldHandlers(composeHandlers(h1, h2, h3), composeHandlers(h4, h5))
override protected val actionHandler = foldHandlers(composeHandlers(h1, h2, h3), composeHandlers(h4, h5))
```

The above handler would pass the action to both of the composed handlers.
Expand Down
2 changes: 1 addition & 1 deletion examples/raf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ See [live demonstration](http://diode.suzaku.io/examples/raf/)
1. Clone the repository from GitHub
1. Run `sbt "~fastOptJS"` in the `examples/raf` directory
1. Wait for update/compilation to complete (you'll see `1. Waiting for source changes... (press enter to interrupt)`)
1. Navigate to [http://localhost:12345/target/scala-2.12/classes/index.html](http://localhost:12345/target/scala-2.12/classes/index.html)
1. Navigate to [http://localhost:12345](http://localhost:12345)
1. Press `Enter` in console to quit
13 changes: 5 additions & 8 deletions examples/raf/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ enablePlugins(ScalaJSPlugin, WorkbenchPlugin)

name := "Diode RAF Example"

crossScalaVersions := Seq("2.11.11", "2.12.2")
scalaVersion := "2.12.4"

scalaVersion := "2.12.2"

// create javascript launcher. Searches for an object extends JSApp
persistLauncher := true
scalaJSUseMainModuleInitializer := true

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1",
"com.lihaoyi" %%% "scalatags" % "0.6.2",
"io.suzaku" %%% "diode-core" % "1.1.2"
"org.scala-js" %%% "scalajs-dom" % "0.9.3",
"com.lihaoyi" %%% "scalatags" % "0.6.7",
"io.suzaku" %%% "diode-core" % "1.1.3"
)

workbenchDefaultRootObject := Some(("target/scala-2.12/classes/index.html", "target/scala-2.12/"))
2 changes: 1 addition & 1 deletion examples/raf/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.11
sbt.version=0.13.16
6 changes: 3 additions & 3 deletions examples/raf/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21")

addSbtPlugin("com.lihaoyi" % "workbench" % "0.3.1-SNAPSHOT")
addSbtPlugin("com.lihaoyi" % "workbench" % "0.3.1")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.13")
4 changes: 0 additions & 4 deletions examples/raf/src/main/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
</head>
<body style="margin: 10px">
<div id="root"></div>
<!-- include JS dependencies -->
<script type="text/javascript" src="../diode-raf-example-jsdeps.js"></script>
<!-- include application -->
<script type="text/javascript" src="../diode-raf-example-fastopt.js"></script>
<!-- run application -->
<script type="text/javascript" src="../diode-raf-example-launcher.js"></script>
</body>
</html>
16 changes: 8 additions & 8 deletions examples/raf/src/main/scala/example/AppCircuit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ case object Reset extends Action

case class AddAnimation(animation: Animation) extends Action

case class UpdateAnimation(id: Int) extends RAFAction with Action
case class UpdateAnimation(id: Int) extends RAFAction

case class StartAnimation(id: Int, animation: Animation) extends RAFAction with Action
case class StartAnimation(id: Int, animation: Animation) extends Action

case class PauseAnimation(id: Int) extends RAFAction with Action
case class PauseAnimation(id: Int) extends Action

case class ContinueAnimation(id: Int) extends RAFAction with Action
case class ContinueAnimation(id: Int) extends Action

case class DeleteAnimation(id: Int) extends RAFAction with Action
case class DeleteAnimation(id: Int) extends Action

/**
* AppCircuit provides the actual instance of the `RootModel` and all the action
Expand All @@ -70,16 +70,16 @@ object AppCircuit extends Circuit[RootModel] {
def initialModel = RootModel(Map(), System.currentTimeMillis())

// zoom into the model, providing access only to the animations
val animationHandler = new AnimationHandler(zoomTo(_.animations), zoom(_.now))
private val animationHandler = new AnimationHandler(zoomTo(_.animations), zoom(_.now))

val timestampHandler = new ActionHandler(zoomTo(_.now)) {
private val timestampHandler = new ActionHandler(zoomTo(_.now)) {
override def handle = {
case RAFTimeStamp(time) =>
updated(time)
}
}

val actionHandler = composeHandlers(animationHandler, timestampHandler)
override protected val actionHandler = composeHandlers(animationHandler, timestampHandler)
}

class AnimationHandler[M](modelRW: ModelRW[M, Map[Int, Animated]], now: ModelRO[Double]) extends ActionHandler(modelRW) {
Expand Down
9 changes: 5 additions & 4 deletions examples/raf/src/main/scala/example/SimpleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import scalatags.JsDom.all._
import org.scalajs.dom
import org.scalajs.dom.raw.Node

@JSExportTopLevel("SimpleApp")
object SimpleApp extends JSApp {
Expand Down Expand Up @@ -33,7 +34,7 @@ object SimpleApp extends JSApp {
elem
}

def renderAnimation(animId: Int, animated: Animated, prevAnim: Option[Animated]) = {
def renderAnimation(animId: Int, animated: Animated, prevAnim: Option[Animated]): Unit = {
import scalatags.JsDom.{svgTags => svg, svgAttrs => svga}
// only render if animation has changed
if (!prevAnim.exists(_.isRunning == animated.isRunning)) {
Expand Down Expand Up @@ -73,7 +74,7 @@ object SimpleApp extends JSApp {
}
}

def renderAnimations(animations: Map[Int, Animated]) = {
def renderAnimations(animations: Map[Int, Animated]): Unit = {
if (animations.size != prevAnimations.size) {
// number of animations has changed, render everything
prevAnimations = Map()
Expand All @@ -89,10 +90,10 @@ object SimpleApp extends JSApp {
prevAnimations = animations
}

def render(root: dom.Element) = {
def render(root: dom.Element): Unit = {
val e = div(
cls := "container",
div(img(src := "diode-logo-small.png")),
div(img(src := "classes/diode-logo-small.png")),
h1("RAF example"),
p(a(href := "https://github.com/suzaku-io/diode/tree/master/examples/raf", "Source code")),
div(
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ See [live demonstration](http://diode.suzaku.io/examples/simple/)
1. Clone the repository from GitHub
1. Run `sbt "~fastOptJS"` in the `examples/simple` directory
1. Wait for update/compilation to complete (you'll see `1. Waiting for source changes... (press enter to interrupt)`)
1. Navigate to [http://localhost:12345/target/scala-2.12/classes/index.html](http://localhost:12345/target/scala-2.12/classes/index.html)
1. Navigate to [http://localhost:12345](http://localhost:12345)
1. Press `Enter` in console to quit
18 changes: 8 additions & 10 deletions examples/simple/build.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
enablePlugins(ScalaJSPlugin)
enablePlugins(ScalaJSPlugin, WorkbenchPlugin)

name := "Diode Example"

crossScalaVersions := Seq("2.11.11", "2.12.2")
scalaVersion := "2.12.4"

scalaVersion := "2.12.2"

workbenchSettings

bootSnippet := "SimpleApp().main();"
scalaJSUseMainModuleInitializer := true

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1",
"com.lihaoyi" %%% "scalatags" % "0.6.2",
"io.suzaku" %%% "diode-core" % "1.1.2"
"org.scala-js" %%% "scalajs-dom" % "0.9.3",
"com.lihaoyi" %%% "scalatags" % "0.6.7",
"io.suzaku" %%% "diode-core" % "1.1.3"
)

workbenchDefaultRootObject := Some(("target/scala-2.12/classes/index.html", "target/scala-2.12"))
2 changes: 1 addition & 1 deletion examples/simple/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=0.13.16
6 changes: 3 additions & 3 deletions examples/simple/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21")

addSbtPlugin("com.lihaoyi" % "workbench" % "0.2.3")
addSbtPlugin("com.lihaoyi" % "workbench" % "0.3.1")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.13")
3 changes: 0 additions & 3 deletions examples/simple/src/main/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
<body style="margin: 10px">
<div id="root"></div>
<script type="text/javascript" src="../diode-example-fastopt.js"></script>
<script>
SimpleApp.main();
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/simple/src/main/scala/example/SimpleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object SimpleApp extends JSApp {
def render(root: Element) = {
val e = div(
cls := "container",
div(img(src := "diode-logo-small.png")),
div(img(src := "classes/diode-logo-small.png")),
h1("Simple counter example"),
p(a(href := "https://github.com/suzaku-io/diode/tree/master/examples/simple", "Source code")),
counter.render // renders the counter view
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ See [live demonstration](http://diode.suzaku.io/examples/todomvc/)
1. Clone the repository from GitHub
1. Run `sbt "~fastOptJS"` in the `examples/todomvc` directory
1. Wait for update/compilation to complete (you'll see `1. Waiting for source changes... (press enter to interrupt)`)
1. Navigate to [http://localhost:12345/target/scala-2.12/classes/index.html](http://localhost:12345/target/scala-2.12/classes/index.html)
1. Navigate to [http://localhost:12345](http://localhost:12345)
1. Press `Enter` in console to quit
26 changes: 11 additions & 15 deletions examples/todomvc/build.sbt
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
enablePlugins(ScalaJSPlugin)
enablePlugins(ScalaJSPlugin, WorkbenchPlugin)

name := "Diode React TodoMVC"

crossScalaVersions := Seq("2.11.8", "2.12.1")

scalaVersion := "2.12.1"

workbenchSettings

bootSnippet := "TodoMVCApp().main();"
scalaVersion := "2.12.4"

testFrameworks += new TestFramework("utest.runner.Framework")

emitSourceMaps := true

/* create javascript launcher. Searches for an object extends JSApp */
persistLauncher := true
scalaJSUseMainModuleInitializer := true

val diodeVersion = "1.1.2"
val diodeVersion = "1.1.3"

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1",
"com.github.japgolly.scalajs-react" %%% "core" % "1.0.0",
"com.github.japgolly.scalajs-react" %%% "extra" % "1.0.0",
"org.scala-js" %%% "scalajs-dom" % "0.9.3",
"com.github.japgolly.scalajs-react" %%% "core" % "1.1.0",
"com.github.japgolly.scalajs-react" %%% "extra" % "1.1.0",
"io.suzaku" %%% "diode" % diodeVersion,
"io.suzaku" %%% "diode-devtools" % diodeVersion,
"io.suzaku" %%% "diode-react" % diodeVersion,
"io.suzaku" %%% "boopickle" % "1.2.6"
)

jsDependencies ++= Seq(
"org.webjars.bower" % "react" % "15.5.4" / "react-with-addons.js" commonJSName "React" minified "react-with-addons.min.js",
"org.webjars.bower" % "react" % "15.5.4" / "react-dom.js" commonJSName "ReactDOM" minified "react-dom.min.js" dependsOn "react-with-addons.js"
"org.webjars.bower" % "react" % "15.6.1" / "react-with-addons.js" commonJSName "React" minified "react-with-addons.min.js",
"org.webjars.bower" % "react" % "15.6.1" / "react-dom.js" commonJSName "ReactDOM" minified "react-dom.min.js" dependsOn "react-with-addons.js"
)

workbenchDefaultRootObject := Some(("target/scala-2.12/classes/index.html", "target/scala-2.12/"))
2 changes: 1 addition & 1 deletion examples/todomvc/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=0.13.16
6 changes: 3 additions & 3 deletions examples/todomvc/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21")

addSbtPlugin("com.lihaoyi" % "workbench" % "0.2.3")
addSbtPlugin("com.lihaoyi" % "workbench" % "0.3.1")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.13")
Loading

0 comments on commit a2700ff

Please sign in to comment.