Skip to content

Commit

Permalink
Merge v0.10 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
japgolly committed Oct 18, 2015
2 parents 89f405a + ba2834c commit 0136334
Show file tree
Hide file tree
Showing 124 changed files with 6,220 additions and 4,061 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ Includes a router, testing utils, performance utils, more.
- [Type Summary](doc/TYPES.md).
- [Functional Programming](doc/FP.md).
- Scala-only Utilities.
- [Router](extra/ROUTER2.md).
- [Router](extra/ROUTER.md).
- [Performance Management](extra/PERF.md).
- [Smaller stuff](extra/README.md).
- [Testing](test/README.md).
- [Changelogs](doc/)[Latest](doc/CHANGELOG-0.9.md).
- [Changelogs](doc/)[Latest](doc/CHANGELOG-0.10.md).


##### External Resources

* Templates & Tutorials
* [chandu0101 / scalajs-react-template](https://github.com/chandu0101/scalajs-react-template)
* [ochrons / scalajs-spa-tutorial](https://github.com/ochrons/scalajs-spa-tutorial)
* [elacin / scalajs-todos](https://github.com/elacin/scalajs-todos)
* [TodoMVC example](http://todomvc.com/examples/scalajs-react)
* [Scala.js and React: Building an Application for the Web](https://scala-bility.blogspot.com/2015/05/scalajs-and-react-building-application.html)

* [Interop With Third-Party Components - chandu0101](https://github.com/chandu0101/scalajs-react-components/blob/master/doc/InteropWithThirdParty.md)
Expand All @@ -41,6 +41,6 @@ Includes a router, testing utils, performance utils, more.


##### Requirements:
* React 0.12 *(0.13 probably works too, 0.14 will be fully supported when released)*
* React 0.14
* Scala 2.11
* Scala.JS 0.6.3+
* Scala.JS 0.6.4+
41 changes: 28 additions & 13 deletions core/src/main/scala/japgolly/scalajs/react/Addons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,36 @@ object Addons {
object ReactCssTransitionGroup {
/** Items in the CSSTransitionGroup need this attribute for animation to work properly. */
@inline final def key = vdom.Attrs.key

private val factory =
React.createFactory(
React.addons.CSSTransitionGroup.asInstanceOf[JsComponentType[js.Any, js.Any, TopNode]])
}

case class ReactCssTransitionGroup(name : String,
enter : js.UndefOr[Boolean] = js.undefined,
leave : js.UndefOr[Boolean] = js.undefined,
component: js.UndefOr[String] = js.undefined,
ref : js.UndefOr[String] = js.undefined) {
case class ReactCssTransitionGroup(name : String,
appear : js.UndefOr[Boolean] = js.undefined,
appearTimeout: js.UndefOr[Int] = js.undefined,
enter : js.UndefOr[Boolean] = js.undefined,
enterTimeout : js.UndefOr[Int] = js.undefined,
leave : js.UndefOr[Boolean] = js.undefined,
leaveTimeout : js.UndefOr[Int] = js.undefined,
component : js.UndefOr[String] = js.undefined,
ref : js.UndefOr[String] = js.undefined) {
def toJs: js.Object = {
val p = js.Dynamic.literal("transitionName" -> name)
enter .foreach(p.updateDynamic("transitionEnter")(_))
leave .foreach(p.updateDynamic("transitionLeave")(_))
component.foreach(p.updateDynamic("component" )(_))
ref .foreach(p.updateDynamic("ref" )(_))
appear .foreach(p.updateDynamic("transitionAppear")(_))
appearTimeout.foreach(p.updateDynamic("transitionAppearTimeout")(_))
enter .foreach(p.updateDynamic("transitionEnter")(_))
enterTimeout .foreach(p.updateDynamic("transitionEnterTimeout")(_))
leave .foreach(p.updateDynamic("transitionLeave")(_))
leaveTimeout .foreach(p.updateDynamic("transitionLeaveTimeout")(_))
component .foreach(p.updateDynamic("component" )(_))
ref .foreach(p.updateDynamic("ref" )(_))
p
}

def apply(children: ReactNode*): ReactComponentU_ = {
val f = React.addons.CSSTransitionGroup
f(toJs, children.toJsArray).asInstanceOf[ReactComponentU_]
}
def apply(children: ReactNode*): ReactComponentU_ =
ReactCssTransitionGroup.factory(toJs, children.toJsArray).asInstanceOf[ReactComponentU_]
}

object ReactCloneWithProps {
Expand All @@ -40,6 +50,11 @@ object Addons {
obj
}

/**
* `cloneWithProps` is now deprecated. Use `React.cloneElement` instead (unlike `cloneWithProps`, `cloneElement`
* does not merge `className` or `style` automatically; you can merge them manually if needed).
*/
@deprecated("As of React 0.14, you must use React.cloneElement instead.", "0.10.0")
def apply(child: ReactNode, newProps: Map[String, js.Any]) = {
val f = React.addons.cloneWithProps
f(child, mapToJS(newProps)).asInstanceOf[ReactComponentU_]
Expand Down
Loading

0 comments on commit 0136334

Please sign in to comment.