Releases: shadaj/slinky
v0.6.3
Highlights 🎉
- Improve experience using
ReactElement
s within first-order types such as Map and List PR #285 - Support React Native's Keyboard API PR #293
Bug Fixes
- Fix crashes when calling
setState
on a component withProps
set to some subtype ofFunction1
PR #295 - Support
useCallback
with a function that takes arguments PR #290 - Fix false warnings on
@react
classes if-Ywarn-value-discard
scalac option was used PR #296 - Update the IntelliJ support plugin to be compatible with IntelliJ 2019.2 PR #297
v0.6.2
v0.6.1
v0.6.0
Highlights 🎉
- Casting the
target
property of event objects is no longer needed! Now all event handlers are statically typed based on the tag they are being placed on PR #243 - Support React Hooks for functional components, see the docs for more details PR #227
- Add support for writing functional components, see the docs for more details PR #217
- Slinky docs have moved to a new domain, slinky.dev!
Breaking Changes ⚠️
- The tags API has seen some major changes, please take a look at the separate section below for more details PR #243
- Half-built components and tags, which have some props provided but have not yet been converted to a
ReactElement
, cannot be reused. Doing this will result in a runtime exception pointing out where the reuse occured PR #253 - Components using the static lifecycle functions
getDerivedStateFromProps
andgetDerivedStateFromError
must now override the functions with aval
PR #248 - The
React.forwardRef
function now takes aFunctionalComponentTakingRef
, which can be creating by creating a functional component that takes an additional ref parameter:FunctionalComponent((props, ref) => ...)
PR #227 - The
ReactRef
type is no longer variant in its type parameters to increase type safety PR #227 - Components will no longer have their
displayName
when built infullOptJS
mode, this results in a ~2.5% decrease in bundle size and matches behavior with JS where names are obfuscated in production builds PR #217 - The
Option
writer now emitsnull
instead ofjs.undefined
for a value ofNone
PR #247
Bug Fixes
- Make the static lifecycle functions
getDerivedStateFromProps
andgetDerivedStateFromError
work correctly infullOptJS
mode PR #248 - Fix issues around state not updating when setting an
Option
toNone
in hot reloading mode PR #247 - Handle
null
return values in derived state functions to not update the state PR #249 - Fix the
js.|
reader/writer implementations to work correctly infullOptJS
mode PR #248 - Support autoComplete attr for input and form elements PR #225
- Fix capitalization of
rowSpan
/colSpan
attribute (used to berowspan
/colspan
) PR #224
Tags API Changes
This release includes a major rewrite of the tags API that eliminates the need to cast the target
value of event handlers and improves typesafety by more closely matching the official React API. As a result of these changes, event handlers defined in separate methods or code abstracting over tags may not initially compile with this new version.
Event Handlers
Event handlers in previous versions of Slinky were functions from a DOM event type to Unit
. In React, events are normalized into SyntheticEvent
s that provide a common subset of the events generated in different browsers. In this version of Slinky, event handlers have been changed to all be functions from a synthetic event type (one of SyntheticEvent[TargetDOMType, UnderlyingDOMEventType]
, SyntheticMouseEvent[TargetDOMType]
, SyntheticTouchEvent[TargetDOMType]
, etc based on the event being listened to) to Unit
.
This means that explicit references to the DOM event type will no longer compile and will need to be replaced by an appropriate synthetic event type with a TargetDOMType
that matches the DOM type of the tag the listener is being placed on. This change ensures that the properties available on event objects at compile time match those generated by React.
Abstracting over Tags
In previous versions of Slinky, passing in attributes required the first attribute to be passed separately from the varargs parameter containing the rest of the attributes. In this version, the API for constructing tags has changed from apply
taking either (firstTag: AttrPair[...], otherTags: AttrPair[...]*)
or ReactElement*
to just a single method taking (mods: TagMod[...]*)
with conversions from AttrPair
and ReactElement
to this type.
So code that passed in generated attributes like:
div(firstAttr, restAttrs: _*)
will now need to be replaced by
div(allAttrs: _*)
Similarly, in components that previously took in AttrPair
and ReactElement
separately, this can now be simplified to just take TagMod
s.
v0.5.2
Highlights 🎉
- Slinky support for Scala 2.13 is now built with 2.13.0-M5 PR #202
- Add support for
getDerivedStateFromError
from React 16.6 PR #206 - Add support for the
Suspense
component from React 16.6 PR #216 - Use default parameters to fill in missing props on exported components PR #221
Bug Fixes
- Fix compile errors when overriding the
Props
orState
type PR #220 - Update library injector setup to support IntelliJ 2018.3 and newer PR #219
- Fix runtime crash when
initialState()
is defined with the extra parentheses PR #218 - Fix compilation errors in generating
Reader
/Writer
when private objects are involved PR #205
v0.5.1
Features
- Support reading and writing
scala.Array
PR #187 - Support the
defaultValue
attribute for specifying a default form value without overriding user inputs PR #186
Bug Fixes
- Prevent crashes with components that store an
Option
of an opaque type in theirState
PR #198 - Fix
ComponentWrapper
s not picking up manually defined Reader/Writers for theState
type PR #190 - Fix how the IntelliJ extensions handles components that have a
children
prop but no other props PR #189 - Fix errors when using the
@react
macro annotation withComponent
/StatelessComponent
imported locally PR #188 - Fix the
value
attribute not being available on theselect
andtextarea
tags PR #177 - Bump Scala version to 2.12.7 and SBT/plugin versions as well PR #176
v0.5.0
Highlights 🎉
- Slinky now supports Scala 2.13.0-M4 PR #153!
- Magnolia has been replaced with a custom implementation tuned for Slinky, resulting in smaller bundles and faster compilation PR #159, PR #159
- Readers and writers for props are no longer needed for hot-reloading components, resulting in up to 2x drops in bundle size in
fastOptJS
mode PR #162 - React element construction is now more aggressively inlined, resulting in smaller bundle sizes (5% drop in the docs project) PR #156
- Switch from React VR package to React 360 PR #141
Breaking Changes
- Scalameta is no longer used for the
@react
macro, and Macro Paradise is used instead. See the docs for updated installation instructions for adding the Macro Paradise compiler plugin PR #132 @react
components taking achildren
prop now generate anapply
method with the children moved to a curried parameter to better match JSX PR #161- React VR components are no longer supported, the
slinky-vr
module now points to React 360 PR #141 ReactComponentClass
now takes a type parameter of theProps
type to improve type safety with higher-order components. Existing uses can be safely replaced withReactComponentClass[_]
PR #157- Interop with Scala.js React now requires using the explicit conversions
.toSlinky
and.toScalaJSReact
PR #151
v0.4.3
- Support pointer events that were added in React 16.4 PR #149
- Bump Scala.js React version for interop to 1.2.0 PR #148
- Fix errors in Reader/Writer provider macros with Scala versions > 2.12.4 PR #147
- Support storing any type as a default context value PR #136
- Set sourcemaps to use GitHub URLs so that they load in other apps PR #143