|
1 | | -## 0.11.0 ([commit log](https://github.com/japgolly/scalajs-react/compare/v0.10.4...v0.11.0)) (UNRELEASED) |
| 1 | +# 0.11.0 ([commit log](https://github.com/japgolly/scalajs-react/compare/v0.10.4...v0.11.0)) |
| 2 | + |
| 3 | +### Libraries |
| 4 | + |
| 5 | +* Upgrade React to [v15](https://facebook.github.io/react/blog/2016/04/07/react-v15.html). (Currently [15.0.1](https://facebook.github.io/react/blog/2016/04/08/react-v15.0.1.html).) |
| 6 | + * New HTML attributes: |
| 7 | + * `cite` |
| 8 | + * `profile` |
| 9 | + * `onAnimationStart` |
| 10 | + * `onAnimationEnd` |
| 11 | + * `onAnimationIteration` |
| 12 | + * `onTransitionEnd` |
| 13 | + * `onInvalid` |
| 14 | + * Remove top-level `React` APIs deprecated in React 14. |
| 15 | + * Remove `ReactCloneWithProps` which was deprecated in React 14. |
| 16 | + * `Addons.Perf.Measurements` is now opaque. This is temporary. See https://github.com/facebook/react/pull/6286. |
| 17 | + * `Addons.Perf.printDOM()` has been deprecated and renamed to `.printOperations()`. |
| 18 | +* Upgrade Scala.JS to 0.6.8. |
| 19 | +* Upgrade scalajs-dom to 0.9.0. |
| 20 | +* Upgrade Scalaz module to use 7.2.1 - the first official Scala.JS release of Scalaz. |
| 21 | +* Switch Monocle from 1.2.0 to 1.2.0-2 which uses the official Scalaz 7.2.1. |
| 22 | +* Drop support for Scalaz 7.1. |
| 23 | + |
| 24 | +### Core |
2 | 25 |
|
3 | 26 | * When building a component, `.buildU` has been deprecated. `.build` now handles both cases. |
4 | | -* Changed order and constraints of type params of `japgolly.scalajs.react.extra.router.StaticDsl.RouteCommon`. |
5 | | -* Add to `extra.router`'s `Route[A]`: |
6 | | - * `.pmap[B](A => Option[B])(B => A): Route[B]` |
7 | | - * `.pmapL[B](Prism[A, B]): Route[B]` |
8 | | -* Increase and improve `Router` logging. (Still off by default. Remember to use `.logToConsole` to enable.) |
9 | | -* Add auto-correction to routes. See [Loose routes with auto-correction](../ROUTER.md#loose-routes-with-auto-correction). |
10 | | -* Router `Rule#action` changed from `Page => Option[Action[Page]]` to `(Path, Page) => Option[Action[Page]]`. |
11 | | -* Add new Router DSL: |
12 | | - * `remainingPath` - Captures the (non-empty) remaining portion of the URL path. |
13 | | - * `remainingPathOrBlank` - Captures the (potentially-empty) remaining portion of the URL path. |
14 | | -* Add `ReactTestVar` to `test` module that can be used to mock the following types in tests: |
15 | | - * `ExternalVar[A]` |
16 | | - * `ReusableVar[A]` |
17 | | - [Example.](../TESTING.md#reacttestvar) |
18 | | -* Replace `BaseUrl.fromWindowOrigin` with a more IE-friendly implementation that does not use `location.origin`. |
19 | | -* Add `ReactTestUtils.withRenderedIntoDocument` which calls `renderIntoDocument`, and automatically unmounts the component when done. |
20 | | -* Component state changing can now return a `Future[Unit]` and a `CallbackTo[Future[Unit]]`. |
21 | | -* Add `ComponentTester` to `test` module. ([Doco](../TESTING.md#componenttester)) |
22 | | -* Add `WithExternalCompStateAccess` to `test` module. ([Doco](../TESTING.md#withexternalcompstateaccess)) |
23 | | -* VDOM `val`s changed to `lazy val`s. Improves JS' startup performance and allows more DCE (dead-code elimination). |
24 | | - In the case of this project's `gh-pages` JS, it shaved 19k off the JS output size. |
25 | | -* In [production mode](https://github.com/scala-js/scala-js/issues/1998) (`fullOptJS`) |
26 | | - we now [inline elements like Babel does](http://babeljs.io/blog/2015/03/31/5.0.0/#inline-elements) |
27 | | - which improves runtime performance. |
28 | | -* Add `ReactTestUtils.removeReactDataAttr(html: String): String` which removes React's internal-use data attributes from HTML. |
29 | 27 | * Add a new package `….react.experimental` containing: |
30 | 28 | * `StaticPropComponent` - A means of creating a component with static and dynamic props such that |
31 | 29 | the component's backend can safely create local constants based on the static props. |
| 30 | +* Component state changing can now return a `Future[Unit]` and a `CallbackTo[Future[Unit]]`. |
| 31 | +* Add `.displayName: String` to React components (specifically constructors and mounted instances). |
| 32 | +* `PropsChildren` is now a `js.Array[ReactNode]`. |
| 33 | +* `ReactEvent`s gained `.extract(getNow: => A)(useAsync: A => B): B` as a convenience method to extract an event value for asynchronous use. |
| 34 | + (See [#255](https://github.com/japgolly/scalajs-react/issues/255).) |
| 35 | +* Add `.pressedModifierKeys()` to `ReactKeyboardEvent` which checks the state of all pressed modifier keys. |
| 36 | + (This replaces `ReactKeyboardEvent.checkKeyMods`.) |
32 | 37 | * Added `zoom{,L}` methods to `CompState.WriteAccess[S]`. |
33 | | -* Add to `Reusability`: |
34 | | - * `.map` for creating `Reusability[Map[K, V]]` instances. *(not implicit)* |
35 | | - * `.whenTrue`. |
36 | | - * `.whenFalse`. |
37 | | -* Upgrade Scala.JS to 0.6.8. |
| 38 | + |
| 39 | +### Callbacks |
| 40 | + |
38 | 41 | * Add to `Callback{,To}`: `.attemptTry` which catches non-fatal errors using a Scala `Try`. |
39 | | -* Mounted components gain `.outerHtmlWithoutReactDataAttr()` after importing `...react.test._`. |
40 | | -* `Callback{,To,Option}` are now covariant by (zero-cost) implicit conversion. |
41 | 42 | * The following `Callback` methods have been changed to prevent `scalac` silent throwing away your results in certain |
42 | 43 | scenarios (eg. accidentally use `.map` to another `Callback` instead of using `.flatMap`). |
43 | 44 | This is a problem with Scala and `Unit` - you can experience the same with `scala.concurrent.Future` too, but at least |
44 | 45 | it's fixed (worked-around) here. |
45 | 46 | * `.map` and its alias `|>` in `Callback(To)`. |
46 | 47 | * `.map` and its alias `|>` in `CallbackOption`. |
47 | 48 | * `.thenRun` in `Callback(To)`. |
48 | | -* Add `.pressedModifierKeys()` to `ReactKeyboardEvent` which checks the state of all pressed modifier keys. |
49 | | - (This replaces `ReactKeyboardEvent.checkKeyMods`.) |
| 49 | +* Deprecated `Callback.ifTrue` and `Callback#conditionally`. |
| 50 | + Added `.when` and `.unless`, both on `Callback` instances and the `Callback` object. |
| 51 | +* Added to `CallbackOption`: |
| 52 | + * `.when(=> Boolean)` |
| 53 | + * `.unless(=> Boolean)` |
| 54 | + * `.filterNot(A => Boolean)` |
| 55 | +* `Callback{,To,Option}` are now covariant by (zero-cost) implicit conversion. |
| 56 | +* `CallbackOption.keyCodeSwitch` to use events' `.keyCode` instead of `.nativeEvent.keyCode`. |
| 57 | + |
| 58 | +### Extra |
| 59 | + |
50 | 60 | * Add a `TriStateCheckbox` component. ([demo](https://japgolly.github.io/scalajs-react/#examples/tristate-checkbox)) |
51 | | -* `ReactEvent`s gained `.extract(getNow: => A)(useAsync: A => B): B` as a convenience method to extract an event value for asynchronous use. |
52 | | - (See [#255](https://github.com/japgolly/scalajs-react/issues/255).) |
| 61 | +* Add to `Reusability`: |
| 62 | + * `.map` for creating `Reusability[Map[K, V]]` instances. *(not implicit)* |
| 63 | + * `.whenTrue`. |
| 64 | + * `.whenFalse`. |
53 | 65 | * Add `Reusability.caseClassExcept(fields*)` to exclude case class fields from the reusability check. |
54 | | -* Refactor embedded Scalatags. Now has less classes + traits, and is much cleaner. |
55 | | - Unless you extend it yourself (which you're free to do but isn't officially supported) you won't be affected. |
| 66 | + |
| 67 | +### Router |
| 68 | + |
| 69 | +* Add auto-correction to routes. See [Loose routes with auto-correction](../ROUTER.md#loose-routes-with-auto-correction). |
| 70 | +* Replace `BaseUrl.fromWindowOrigin` with a more IE-friendly implementation that does not use `location.origin`. |
| 71 | +* Add new Router DSL: |
| 72 | + * `remainingPath` - Captures the (non-empty) remaining portion of the URL path. |
| 73 | + * `remainingPathOrBlank` - Captures the (potentially-empty) remaining portion of the URL path. |
| 74 | +* Increase and improve `Router` logging. (Still off by default. Remember to use `.logToConsole` to enable.) |
| 75 | +* Add to `extra.router`'s `Route[A]`: |
| 76 | + * `.pmap[B](A => Option[B])(B => A): Route[B]` |
| 77 | + * `.pmapL[B](Prism[A, B]): Route[B]` |
| 78 | +* Router `Rule#action` changed from `Page => Option[Action[Page]]` to `(Path, Page) => Option[Action[Page]]`. |
| 79 | +* Changed order and constraints of type params of `japgolly.scalajs.react.extra.router.StaticDsl.RouteCommon`. |
| 80 | + |
| 81 | +### Dev-only Tags |
| 82 | + |
| 83 | +It's now possible to create markup that is omitted by the compiler during `fullOptJS`. |
| 84 | + |
| 85 | +An example use-case is adding `data-xxxx` attributes to tags for unit tests to find. |
| 86 | +In such a case you'd want the attributes (and their values) completely removed from the production JS. |
| 87 | + |
56 | 88 | * Add `TagMod.devOnly` which makes a given `TagMod` appear in dev (`fastOptJS`) and not prod (`fullOptJS`). |
57 | 89 | (Unfortunately it only accepts one arg at a time because Scala doesn't allow by-name varargs.) |
58 | 90 | * Add `ReactAttr.devOnly` to create DOM attributes that appear in dev (`fastOptJS`) and not prod (`fullOptJS`). |
59 | 91 | * Add `ReactStyle.devOnly` to create DOM styles that appear in dev (`fastOptJS`) and not prod (`fullOptJS`). |
60 | | -* Upgrade Scalaz module to use 7.2.1 - the first official Scala.JS release of Scalaz. |
61 | | -* `CallbackOption.keyCodeSwitch` to use events' `.keyCode` instead of `.nativeEvent.keyCode`. |
62 | | -* Drop support for Scalaz 7.1. |
63 | | -* Upgrade scalajs-dom to 0.9.0. |
| 92 | + |
| 93 | +### Optimisation |
| 94 | + |
| 95 | +* VDOM `val`s changed to `lazy val`s. Improves JS' startup performance and allows more DCE (dead-code elimination). |
| 96 | + In the case of this project's `gh-pages` JS, it shaved 19k off the JS output size. |
| 97 | +* In [production mode](https://github.com/scala-js/scala-js/issues/1998) (`fullOptJS`) |
| 98 | + we now [inline elements like Babel does](http://babeljs.io/blog/2015/03/31/5.0.0/#inline-elements) |
| 99 | + which improves runtime performance. |
| 100 | +* Refactor embedded Scalatags. Now has less classes + traits, and is much cleaner. |
| 101 | + Unless you extend it yourself (which you're free to do but isn't officially supported) you won't be affected. |
| 102 | + |
| 103 | +### Testing |
| 104 | + |
| 105 | +* Add `ReactTestVar` to `test` module that can be used to mock the following types in tests: |
| 106 | + * `ExternalVar[A]` |
| 107 | + * `ReusableVar[A]` |
| 108 | + [Example.](../TESTING.md#reacttestvar) |
| 109 | +* Add `ComponentTester` to `test` module. ([Doco](../TESTING.md#componenttester)) |
| 110 | +* Add `WithExternalCompStateAccess` to `test` module. ([Doco](../TESTING.md#withexternalcompstateaccess)) |
| 111 | +* Add `ReactTestUtils.withRenderedIntoDocument` which calls `renderIntoDocument`, and automatically unmounts the component when done. |
| 112 | +* Add `ReactTestUtils.removeReactDataAttr(html: String): String` which removes React's internal-use data attributes from HTML. |
| 113 | +* Mounted components gain `.outerHtmlWithoutReactDataAttr()` after importing `...react.test._`. |
64 | 114 | * Fixed `test` module was accidently exporting a μtest dependency. |
65 | | -* Upgrade React to [v15](https://facebook.github.io/react/blog/2016/04/07/react-v15.html). (Currently [15.0.1](https://facebook.github.io/react/blog/2016/04/08/react-v15.0.1.html).) |
66 | | - * Remove top-level `React` APIs deprecated in React 14. |
67 | | - * Remove `ReactCloneWithProps` which was deprecated in React 14. |
68 | | - * `Addons.Perf.Measurements` is now opaque. This is temporary. See https://github.com/facebook/react/pull/6286. |
69 | | - * `Addons.Perf.printDOM()` has been deprecated and renamed to `.printOperations()`. |
70 | | - * New HTML attributes: |
71 | | - * `cite` |
72 | | - * `profile` |
73 | | - * `onAnimationStart` |
74 | | - * `onAnimationEnd` |
75 | | - * `onAnimationIteration` |
76 | | - * `onTransitionEnd` |
77 | | - * `onInvalid` |
78 | | -* Deprecated `Callback.ifTrue` and `Callback#conditionally`. |
79 | | - Added `.when` and `.unless`, both on `Callback` instances and the `Callback` object. |
80 | | -* Added to `CallbackOption`: |
81 | | - * `.when(=> Boolean)` |
82 | | - * `.unless(=> Boolean)` |
83 | | - * `.filterNot(A => Boolean)` |
84 | | -* Add `.displayName: String` to React components (specifically constructors and mounted instances). |
85 | | -* `PropsChildren` is now a `js.Array[ReactNode]`. |
86 | 115 |
|
| 116 | +<br> |
| 117 | +##### Migration commands |
87 | 118 |
|
88 | | -### Migration commands |
| 119 | +Only one this time. |
| 120 | +`Callback.ifTrue` may be common but it's better that you choose `when`/`unless` in each replacement in order to maximise readability. |
89 | 121 |
|
90 | 122 | ```sh |
91 | 123 | # .buildU → .build |
92 | 124 | find . -name '*.scala' -type f -exec perl -pi -e 's/(?<=\.build)U(?![a-zA-Z0-9_])//' {} + |
93 | 125 | ``` |
94 | | - |
|
0 commit comments