Skip to content

Latest commit

 

History

History
127 lines (105 loc) · 6.79 KB

0.11.0.md

File metadata and controls

127 lines (105 loc) · 6.79 KB

0.11.0 (commit log)

Libraries

  • 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().
  • 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.

Core

  • 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 a CallbackTo[Future[Unit]].
  • Add .displayName: String to React components (specifically constructors and mounted instances).
  • PropsChildren is now a js.Array[ReactNode].
  • ReactEvents 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() to ReactKeyboardEvent which checks the state of all pressed modifier keys. (This replaces ReactKeyboardEvent.checkKeyMods.)
  • Added zoom{,L} methods to CompState.WriteAccess[S].

Callbacks

  • Add to Callback{,To}.attemptTry which catches non-fatal errors using a Scala Try.
  • The following Callback methods have been changed to prevent scalac silent throwing away your results in certain scenarios (eg. accidentally use .map to another Callback instead of using .flatMap). This is a problem with Scala and Unit - you can experience the same with scala.concurrent.Future too, but at least it's fixed (worked-around) here.
    • .map and its alias |> in Callback(To).
    • .map and its alias |> in CallbackOption.
    • .thenRun in Callback(To).
  • Deprecated Callback.ifTrue and Callback#conditionally. Added .when and .unless, both on Callback instances and the Callback 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.

Extra

  • Add a TriStateCheckbox component. (demo)
  • Add to Reusability:
    • .map for creating Reusability[Map[K, V]] instances. (not implicit)
    • .whenTrue.
    • .whenFalse.
  • Add Reusability.caseClassExcept(fields*) to exclude case class fields from the reusability check.

Router

  • Add auto-correction to routes. See Loose routes with auto-correction.
  • Replace BaseUrl.fromWindowOrigin with a more IE-friendly implementation that does not use location.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's Route[A]:
    • .pmap[B](A => Option[B])(B => A): Route[B]
    • .pmapL[B](Prism[A, B]): Route[B]
  • Router Rule#action changed from Page => Option[Action[Page]] to (Path, Page) => Option[Action[Page]].
  • Changed order and constraints of type params of japgolly.scalajs.react.extra.router.StaticDsl.RouteCommon.

Dev-only Tags

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 given TagMod 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).

Optimisation

  • VDOM vals changed to lazy vals. Improves JS' startup performance and allows more DCE (dead-code elimination). In the case of this project's gh-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.

Testing

  • Add ReactTestVar to test module that can be used to mock the following types in tests:
    • ExternalVar[A]
    • ReusableVar[A] Example.
  • Add ComponentTester to test module. (Doco)
  • Add WithExternalCompStateAccess to test module. (Doco)
  • Add ReactTestUtils.withRenderedIntoDocument which calls renderIntoDocument, 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_])//' {} +