0.11.0 (commit log)
- Upgrade React to v15. (Currently 15.0.1.)
- New HTML attributes:
cite
profile
onAnimationStart
onAnimationEnd
onAnimationIteration
onTransitionEnd
onInvalid
- Remove top-level
React
APIs deprecated in React 14. - Remove
ReactCloneWithProps
which was deprecated in React 14. Addons.Perf.Measurements
is now opaque. This is temporary. See facebook/react#6286.Addons.Perf.printDOM()
has been deprecated and renamed to.printOperations()
.
- New HTML attributes:
- Upgrade Scala.JS to 0.6.8.
- Upgrade scalajs-dom to 0.9.0.
- Upgrade Scalaz module to use 7.2.1 - the first official Scala.JS release of Scalaz.
- Switch Monocle from 1.2.0 to 1.2.0-2 which uses the official Scalaz 7.2.1.
- Drop support for Scalaz 7.1.
Also if you use ScalaCSS, you'll need to update to 0.4.1.
- When building a component,
.buildU
has been deprecated..build
now handles both cases. - Add a new package
….react.experimental
containing:StaticPropComponent
- A means of creating a component with static and dynamic props such that the component's backend can safely create local constants based on the static props.
- Component state changing can now return a
Future[Unit]
and aCallbackTo[Future[Unit]]
. - Add
.displayName: String
to React components (specifically constructors and mounted instances). PropsChildren
is now ajs.Array[ReactNode]
.ReactEvent
s gained.extract(getNow: Event => A)(useAsync: A => B): B
as a convenience method to extract an event value for asynchronous use. (See #255.)- Add
.pressedModifierKeys()
toReactKeyboardEvent
which checks the state of all pressed modifier keys. (This replacesReactKeyboardEvent.checkKeyMods
.) - Added
zoom{,L}
methods toCompState.WriteAccess[S]
.
- Add to
Callback{,To}.attemptTry
which catches non-fatal errors using a ScalaTry
. - The following
Callback
methods have been changed to preventscalac
silent throwing away your results in certain scenarios (eg. accidentally use.map
to anotherCallback
instead of using.flatMap
). This is a problem with Scala andUnit
- you can experience the same withscala.concurrent.Future
too, but at least it's fixed (worked-around) here..map
and its alias|>
inCallback(To)
..map
and its alias|>
inCallbackOption
..thenRun
inCallback(To)
.
- Deprecated
Callback.ifTrue
andCallback#conditionally
. Added.when
and.unless
, both onCallback
instances and theCallback
object. - Added to
CallbackOption
:.when(=> Boolean)
.unless(=> Boolean)
.filterNot(A => Boolean)
Callback{,To,Option}
are now covariant by (zero-cost) implicit conversion.CallbackOption.keyCodeSwitch
to use events'.keyCode
instead of.nativeEvent.keyCode
.
- Add a
TriStateCheckbox
component. (demo) - Add to
Reusability
:.map
for creatingReusability[Map[K, V]]
instances. (not implicit).whenTrue
..whenFalse
.
- Add
Reusability.caseClassExcept(fields*)
to exclude case class fields from the reusability check.
- Add auto-correction to routes. See Loose routes with auto-correction.
- Replace
BaseUrl.fromWindowOrigin
with a more IE-friendly implementation that does not uselocation.origin
. - Add new Router DSL:
remainingPath
- Captures the (non-empty) remaining portion of the URL path.remainingPathOrBlank
- Captures the (potentially-empty) remaining portion of the URL path.
- Increase and improve
Router
logging. (Still off by default. Remember to use.logToConsole
to enable.) - Add to
extra.router
'sRoute[A]
:.pmap[B](A => Option[B])(B => A): Route[B]
.pmapL[B](Prism[A, B]): Route[B]
- Router
Rule#action
changed fromPage => Option[Action[Page]]
to(Path, Page) => Option[Action[Page]]
. - Changed order and constraints of type params of
japgolly.scalajs.react.extra.router.StaticDsl.RouteCommon
.
It's now possible to create markup that is omitted by the compiler during fullOptJS
.
An example use-case is adding data-xxxx
attributes to tags for unit tests to find.
In such a case you'd want the attributes (and their values) completely removed from the production JS.
- Add
TagMod.devOnly
which makes a givenTagMod
appear in dev (fastOptJS
) and not prod (fullOptJS
). (Unfortunately it only accepts one arg at a time because Scala doesn't allow by-name varargs.) - Add
ReactAttr.devOnly
to create DOM attributes that appear in dev (fastOptJS
) and not prod (fullOptJS
). - Add
ReactStyle.devOnly
to create DOM styles that appear in dev (fastOptJS
) and not prod (fullOptJS
).
- VDOM
val
s changed tolazy val
s. Improves JS' startup performance and allows more DCE (dead-code elimination). In the case of this project'sgh-pages
JS, it shaved 19k off the JS output size. - In production mode (
fullOptJS
) we now inline elements like Babel does which improves runtime performance. - Refactor embedded Scalatags. Now has less classes + traits, and is much cleaner. Unless you extend it yourself (which you're free to do but isn't officially supported) you won't be affected.
- Add
ReactTestVar
totest
module that can be used to mock the following types in tests:ExternalVar[A]
ReusableVar[A]
Example.
- Add
ComponentTester
totest
module. (Doco) - Add
WithExternalCompStateAccess
totest
module. (Doco) - Add
ReactTestUtils.withRenderedIntoDocument
which callsrenderIntoDocument
, and automatically unmounts the component when done. - Add
ReactTestUtils.removeReactDataAttr(html: String): String
which removes React's internal-use data attributes from HTML. - Mounted components gain
.outerHtmlWithoutReactDataAttr()
after importing...react.test._
. - Fixed
test
module was accidently exporting a μtest dependency.
##### Migration commands
Only one this time.
Callback.ifTrue
may be common but it's better that you choose when
/unless
in each replacement in order to maximise readability.
# .buildU → .build
find . -name '*.scala' -type f -exec perl -pi -e 's/(?<=\.build)U(?![a-zA-Z0-9_])//' {} +