Skip to content

Releases: LevelbossMike/ember-statecharts

Release 0.12.0

25 Aug 14:41
Compare
Choose a tag to compare

0.12.0 (2020-08-25)

This release adds two new features:

  1. The onTransition-hook can be used to react to statechart state changes from the outside. This is useful when you want to persist statechanges or for instrumentation, logging etc. - onTransition behaves the same way as xstate's own interpreter#onTransition.

  2. To align ember-statecharts with xstate/react, xstate/vue and xstate's own interpreter functionality ember-statecharts now allows starting the interpreter that useMachine creates in a specific state - overriding the usual initialState.

const machine = Machine({
  initial: 'inactive',
  states: {
    inactive: {
      on: {
        START: 'active',
      },
    },
    active: {
      on: {
        STOP: 'inactive',
      },
    },
  },
});

class Test extends Component {
  @use statechart = useMachine(machine, { state: this.args.state })
}
{{!-- assuming this.state === 'active' --}}
<Test @state={{this.state}} />

The above code will start the statechart in the active state.

The restart function in the update-hook will take this state into account as well:

{{!-- assuming this.state === 'active' on initial load --}}
<Test @state={{this.state}} />

{{!-- sets `state` to `inactive`--}}
<button type="button" {{on "click" this.setInactive}}>
  Deactivate
</button>
class Test extends Component {
  @use statechart = useMachine(machine, { state: this.args.state })
     .update(({ restart }) => {
        // will restart interpreter in this.args.state
        restart();
      })
}

In addition to starting/restarting automatically in the state passed in interpreterOptions ember-statecharts now also allows passing the state that the interpreter should be restarted in:

class Test extends Component {
  @use statechart = useMachine(wizardMachine)
     .withContext({
       step: this.args.step
     })
     .update(({ restart, context: { step } }) => {
        // will restart interpreter in the state passed as `args.step`
        restart(step);
      })
}

Features

  • add onTransition-hook for useMachine (462c518)
  • start/restart in specific state is now possible(1d3e2a2)
  • add types for new update method (acf2b5d)

Release 0.11.0

04 Jul 18:22
Compare
Choose a tag to compare

0.11.0 (2020-07-04)

Bug Fixes

  • or not working with new matchesState (2168822)
  • allow interpreter options to be passed to override devTool / other things if desired (except the clock) (997bc9e)
  • check for passed in machine (ce31e89)
  • handle machine creation in useMachine function (22e35b8)
  • Update CHANGELOG.md v0.10.0-beta.0 (2060e40)

Features

  • add .update-hook for handling usable updates (fd31747)
  • Add type definitions (4329796)
  • expose interpreted machine service (8065939)
  • implement useMachine (d7ce532)
  • support machine configs (59ff076)
  • warn about usable-updates on args/state changes (d278f97)

Release 0.10.0

10 Jun 10:27
Compare
Choose a tag to compare

0.10.0 (2020-06-10)

Bug Fixes

  • or not working with new matchesState (118e163)

Release 0.10.0-beta.1

04 Jun 16:04
Compare
Choose a tag to compare
Release 0.10.0-beta.1 Pre-release
Pre-release

0.10.0-beta.1 (2020-06-04)

Bug Fixes

  • allow interpreter options to be passed to override devTool / other things if desired (except the clock) (0fa019a)
  • check for passed in machine (2cf1c0f)
  • handle machine creation in useMachine function (96769be)
  • Update CHANGELOG.md v0.10.0-beta.0 (84cb5b0)

Features

  • Add type definitions (15569b7)
  • expose interpreted machine service (6c63289)
  • implement useMachine (b4b2155)
  • support machine configs (c9c471c)
  • warn about usable-updates on args/state changes (85cd021)

useMachine-beta.0

04 May 20:00
Compare
Choose a tag to compare
useMachine-beta.0 Pre-release
Pre-release

This beta release of ember-statecharts comes with an improved api to work with xstate-machines directly - useMachine. Please refer to #235 for details about the idea behind useMachine and make sure to report any issues you find.

🚀 Enhancement / Feature

  • #235 Initial
    implementation useMachine-api

Committers: 1

@useMachine(TestMachine)
  .withConfig(/*...*/)
  .withContext(/*...*/)
  

Related issue: #235

v0.9.0

09 Apr 13:34
Compare
Choose a tag to compare

v0.9.0 (2020-04-09)

Full Changelog

🏠 Internal

  • #217 Update docs to Octane
  • #217 Update xstate to 4.8.0

See xstate#4.8.0 - release notes for new xstate release notes.

Committers: 2

v0.8.2

05 Jul 19:00
Compare
Choose a tag to compare

v0.8.2 (2019-07-05)

Full Changelog

🏠 Internal

See xstate#4.6.4 - release notes for new xstate release notes.

Committers: 1

v0.8.1

05 Jul 18:59
Compare
Choose a tag to compare

v0.8.1 (2019-07-05)

Full Changelog

🚀 Enhancement / Feature

Finally we have an addon-docs page 🚀 - https://www.ember-statecharts.com

Committers: 1

v0.8.0

16 Jun 15:08
Compare
Choose a tag to compare

v0.8.0 (2019-06-16)

Full Changelog

🚀 Enhancement / Feature

matchesState and debugState now also support statecharts that are named differently than statechart.

export default Component.extend({
  // ...

  isOn: matchesState('on', 'customStatechartName'),

  _debug: debugState('customStatechartName'),

  customStatechartName: statechart({
    initial: 'off',
    states: {
      off: {
        on: {
          POWER: 'on',
        },
      },
      on: {
        on: {
          POWER: 'off',
        },
      },
    },
  }),
});

🏠 Internal

See xstate#4.6.0 - release notes for new xstate features.

Committers: 1

v0.7.1

25 Apr 14:36
Compare
Choose a tag to compare

Full Changelog

🐛 Bug Fix

Committers: 1