All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
ReactElement
is now a fullMonoid
withempty
as identity and append creating React.Fragment elements.- Breaking: module
Elmish.React.DOM
has been removed and its contents moved toElmish.React
. - Breaking: module
Elmish.Trace
has been removed. Its sole export has been part of the standarddebug
library for a while now. - Fixed a bug with
readForeign
and nestedNullable
s: reading[1,"foo",2]
asNullable (Array Int)
would complain that the second element is bogus (which is true) and incorrectly state that the expected type wasNullable Int
.
-
Fixed a bug that allowed
ComponentDef
to be captured in closures for a long time, which could lead to using stale values in complex scenarios whereComponentDef
is not constant, but depends on arguments. See #83. -
Breaking: Changed the order of arguments of
bindComponent
quasiBind
,hush
, andsubscribe'
functions for subscriptions to enable creating more complicated subscriptions from primitive ones.
- it is no longer possible to dispatch messages after unmounting.
- support for subscriptions - see the
Elmish.Subscription
module.
- Breaking:
forks
's parameter now takes a record of{ dispatch, onStop }
instead of just a nakeddispatch
function. This change is in support of subscriptions.
- Upgraded to PureScript 0.15.13
- Breaking:
CanReceiveFromJavaScript.validateForeignType
method no longer takes aProxy
as first parameter, relying instead on visible type applications.
- type parameters of
readForeign
andreadForeign'
can now be specified via visible type application, a new feature in PureScript 0.15.10
handleMaybe
now forcesMaybe
, allowing use of ambiguous functors, e.g.onClick: dispatch <?| pure Foo
- Operators
<|
and<?|
now have zero precedence, allowing mixing them with the$
operator, e.g.dispatch <| foo $ bar $ baz
handleEffect
overloaded function for more ergonomic construction of event handlers.
- Operators
<|
and<?|
(functionshandle
andhandleMaybe
) can now take either a "message" or a function "event -> message" as their right argument for more ergonomic construction of event handlers.
Data.Undefined.NoProblem.Req
is now considered safe for passing to/from JS
- Upgraded to PureScript 0.15
Elmish.React.Ref
type with acallbackRef
constructor
- Breaking: Renamed
Elmish.Ref
toElmish.Opaque
- Breaking: changed the FFI mechanism to use
Opt
to denote optional props instead of two separate rows.
- Breaking: Removed the whole
Elmish.JsCallback
module. All use sites should convert toEffectFnN
.
- React props for FFI-imported components are now allowed to have a
ref
prop. This was a silly restriction. - Generated React component classes now have more descriptive names. This is to help with debugging and testing. See #52.
- Fixed a bug related to maintaining state in
wrapWithLocalState
. See #50.
- Integration tests powered by enzyme
- Breaking:
ComponentDef
renamed toComponentDef'
. - Added
ComponentDef
as type alias forComponentDef' Aff
. - Breaking:
Transition
renamed toTransition'
. - Added
Transition
as type alias forTransition' Aff
.
- Fixed a bug with
CanReceiveFromJavaScript (Array Foreign)
instance: it had a superfluous constraint.
CanReceiveFromJavaScript (Object a)
instance for anya
. Previously only worked forForeign
.CanReceiveFromJavaScript (Array Foreign)
instance as an optimization. Unlke the generalArray a
instance, theArray Foreign
instance doesn't have to check every element of the array.
readForeign'
- a new function that's likereadForeign
, but returns error information on failure.- Added tests. So far - only for
readForeign
.
- Breaking:
CanReceiveFromJavaScript
class modified to afford that.
- Bug fix:
readForeign
for records no longer requires nullable fields to be present in the record.
- Package maintenance
- Breaking:
DispatchMsgFn
(replaced withDispatch
) and friends -issueMsg
,issueError
,cmapMaybe
,dispatchMsgFn
,ignoreMsg
. - Breaking: Dispatch can no longer report errors due to failed decoding of parameters passed from JavaScript. This feature turned out to be nearly useless, yet it was creating quite a bit of extra complexity.
- Breaking:
handle
andhandleMaybe
are no longer variadic. They only work with single-argument event handler, which is the most common case. SinceDispatch
is now just a function, other cases can be easily covered viamkEffectFnX
(for which bothhandle
andhandleMaybe
are no facades).
- Breaking:
Dispatch
(replacesDispatchMsgFn
) - just an alias formsg -> Effect Unit
now <|
alias forhandle
<?|
alias forhandleMaybe
CanPassToJavaScript
instances forEffect Unit
,EffectFn1 a Unit
, andEffectFn2 a b Unit
, so they can be used as event handlers.
- migrated to PureScript 0.14
Transition
is now aMonad
- migrated to GitHub Actions
- migrated to Spago
- we now make sure that commands (aka effects) yielded by an
update
call actually run asynchronously
defaultMain
- a convenience entry point for the simplest use case - a single bundle embedded in a single HTML file.
- Breaking: The signature of
Transition
now allows effects to produce zero, one, or multiple messages, instead of exactly one as before. This is achieved by making each effect take a message-dispatching callback rather than monadically returning a message as before. - Breaking:
fork
now requiresMonadEffect
.
- Convenience smart constructor
transition
, which has the same signature as theTransition
data constructor used to have before this change. forks
- likefork
(see v0.1.4), but allows the effect to produce zero, one, or multiple messages by way of taking a callback rather than returning a message.forkVoid
- likefork
, but the effect does not produce any messages.forkMaybe
- likefork
, but the effect may or may not produce a message.
- Breaking: removed the
Elmish.Test
module. Now that the type ofTransition
no longer pretends to be pure (i.e. contains mention ofEffect
), the testing support can no longer work in the pureStateT
, and will have to be rewritten on top ofEffect
, with a mutable cell to accumulate messages. However, since we're not actually using testing support (yet?), I have decided to deprioritize this.
- Support for SSR (server-side rendering) via
Elmish.Boot.boot
. This breaks pre-existingElmish.Boot
users (see "Removed").
- Breaking: The contents of
Elmish.Boot
-BootResult
,boot
, andboot'
. Replaced and subsumed by server-side rendering support (see "Added").
- Breaking:
Elmish.React.reactMount
renamed torender
to match React's naming. wrapWithLocalState
will now report errors to the console instead of swallowing them. This could be used by catch-all error reporters such as Rollbar or Airbrake.- Breaking:
mkJsCallback
remaned tojsCallback
and lost itsonError
parameter. It will now report errors to the console, same aswrapWithLocalState
. The previous version with an explicitonError
parameter is now available asjsCallback'
- React API is now FFIed via
EffectFnX
instead ofFnX
.
- Breaking:
wrapWithLocalState
no longer takes an extraDispatchMsgFn Unit
parameter (used only for error reporting) - Breaking: All places that previously took a
DispatchMsgFn Unit
sink for the purpose of reporting errors only, now take aDispatchMsgFn Void
instead to better reflect the fact that they're not going to issue messages through that sink - Upgraded to PureScript 0.13.8
wrapWithLocalState'
- a more elaborate version ofwrapWithLocalState
that takes the extraDispatchMsgFn Void
parameter
Bind
instance forTransition
, enablingdo
-notationfork
- a convenience wrapper function for constructing effectful state updates in imperative-ish style- Reexports
lmap
andrmap
fromBiFunctor
- Convenience reexports of
bimap
,(>$<)
, and(>#<)
- Support HTML data attributes via
_data :: Object
API.
- Upgraded to PureScript 0.13.0 (see release notes)
id
fromCommonProps
Bifunctor
,Functor
,Applicative
instances forTransition
ComponentReturnCallback
- a CPS-style way of returning polymorphically typed components.boot
- a common-case app entry point: mounts a UI component to a DOM element with given ID.
construct
andwrapWithLocalState
now accept aDispatchMsgFn Unit
instead of(DispatchError -> Effect Unit)
for reporting view errors.construct
now takes the error-reporting function after execution of the effect, to improve composability.
pureUpdate
in favor ofpure
Initial release