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.
- Oh dear: require() should be import
- Bad require() path
- README tweaks
mermaid
helper function to allow Mermaid state-diagrams to be used with Statebot:
import { Statebot, mermaid } from 'statebot'
const fsm = Statebot('traffic-lights', {
chart: mermaid`
stateDiagram
direction LR
go --> prepareToStop
prepareToStop --> stop
%% ...gotta keep that traffic flowing
stop --> prepareToGo
prepareToGo --> go
`
})
Front-matter is ignored:
import { Statebot, mermaid } from 'statebot'
const fsm = Statebot('traffic-lights', {
chart: mermaid`
---
title: Traffic lights
---
stateDiagram
direction LR
go --> prepareToStop
prepareToStop --> stop
%% ...gotta keep that traffic flowing
stop --> prepareToGo
prepareToGo --> go
`
})
:::
blocks are also ignored, which is useful because the Mermaid Preview extension for VS Code will display a chart when the cursor is placed between the blocks:
import { Statebot, mermaid as mmd } from 'statebot'
const fsm = Statebot('traffic-lights', {
chart: mmd`
::: mermaid
stateDiagram
direction LR
go --> prepareToStop
prepareToStop --> stop
%% ...gotta keep that traffic flowing
stop --> prepareToGo
prepareToGo --> go
:::
`
})
Note: Mermaid start
[*] -->
and stop--> [*]
states will become__START__
and__STOP__
Statebot states respectively.
- package.json .mjs exports for Hooks
- Most .js extensions are now .mjs. Hopefully this fixes compatibility with newer Jest versions
- README tweak
- Typedefs for TStatebotFsm should be methods rather than props
- Exclude mitt from cjs/esm build: It's specified as a regular dependency now
- Remove .dev from build filenames
- Tweak README as JSDoc lives in index.d.ts now
- Out of date types locations in package.json
- Links to hooks
Imports updated:
routeIsPossible
/assertRoute
now come from 'statebot/assert'- React/Mithril Hooks can be imported from 'statebot/hooks/react' and 'statebot/hooks/mithril'. There are no longer separate packages for these.
- Documentation now built with Typedoc
- Typedefs are now manually updated instead of generated from jsdoc
- Fix esbuild error by re-ordering package.json exports
- Fix WebPack error: "Default condition should be last one"
- Replace nullish coalescing
??
with ternary to fix Bundlephobia error.
- peek(eventName, stateObject?), tests, documentation
- canTransitionTo('state', { afterEvent: 'event' }), tests, documentation
- Updated dependencies
- Updated dependencies, tweaked README
- If a
performTransition
then
method oronTransitions
callback return a function, it will be invoked when the state is exited in the same manner as if an.onExiting()
handler was created using it.
- Guard against wrapped-on() args not being an array
- Dependencies, package.json tweaks
- Wrong package.json setting for Node
- Updated README example required commas
- inState/InState now supports an object for config as well as a string:
inState('idle')
// true | false
inState('idle', 'waiting')
// "waiting" | null
inState({
idle: 'hold up',
success: () => 'fn-result',
done: <JSX />
})
// "hold up" | "fn-result" | <JSX /> | null
- package.json exports
- Revert previous argument-defaults tweak, as it bugged Enter(). Fixed, regression test added
- Further tests for arity of emit/Emit
- Replace padLeft/padRight with padEnd/padStart respectively
- Add code-comments to make CodeFactor happy with documentation page
- Remove argument-defaults to reduce compiled/minified code-size slightly
- Now using Mitt for events
- Changed license from ISC to MIT
- Custom event-emitter support broken in previous commit (emit not working)
- Dependencies
- Throws if invalid event-emitter passed-in
- Compatibility with mitt event-emitter library
- inState + statesAvailableFromHere tests
- More links for pause/resume/paused in docs
- Build-comments for CodeFactor
- Dependencies
- pause/paused/resume methods, tests, docs
- Put an example at the top of the README to get to the point more quickly :P
- routeIsPossible() did not support "backtracking" in some cases
- Basic tests for backtracking
- Charts with empty-strings for states were not always parsing properly
- Added tests for charts with empty-strings
- Added tests for callback-counts + ordering
- Tweak Hook-examples in the README
- .DS_Store snuck into dist/
- Build index.d.ts automatically, fixing broken autocompletion
- ESM build renamed from .mjs to .js, since tsc won't read it to build index.d.ts otherwise
- Use ES6 import/export syntax in source-files (slightly small dist/ files resulted)
- Put dev source-maps in their own files
### Added
- Build ES6 module in dist/esm
- Got started with some basic tests
- React Hooks :) and Mithril ones, too
- Fix require().default regression in Rollup config
- Build documentation.js JSON in
docs/
for tinkering
- Compatibility with projects using Rollup
- Emphasise in docs that Statebot isn't bound to a particular framework
- Updated babel, documentation, eslint, rollup
- Include a React example in docs + README
- Typo in code
- A few more README tweaks
- Fix docs for updated Enter/Emit
- Enter/Emit can accept arguments that will curry into the functions they return.
- inState now fully documented.
- InState supports currying arguments into outputWhenTrue() argument.
- A few JSDoc links weren't working
- VS Code autocomplete wasn't working fully
- Migrated from Webpack to Rollup; smaller min builds, UMD build
- Add "files" to package.json to reduce npm module size
- Reduce code-size a little
- README tweaks
- Upgrade dev-dependencies
- Browser build now uses 'var' webpack option rather than 'umd'
- Lua inspired 'coroutine' chart in the JSDocs
-
Updated disallowed characters for cross-env compatibility of charts.
This was a tiny change to Statebot, but will break any charts using the characters now excluded (probably none at this point!) Still, it's good to show semver willing, eh? ;)
- Include links to the shell-port, Statebot-sh
- Various post-publishing documentation fixes
- Statebot :)