xstate.dart icon indicating copy to clipboard operation
xstate.dart copied to clipboard

[WIP] Implementation Plan

Open sahandevs opened this issue 5 years ago • 2 comments

Machine Definition

Defining https://www.w3.org/2011/04/SCXML/scxml.xsd with dart models.

Translation

image Convert a machine that user provides to the machine definition format.

  • machine.fromJson : xstatejs format
  • machine.fromSCXML: scxml format

Interpreter

image

An interpreter takes one Machine Definition (required), one Initial State and zero or more hooks and returns a Machine Instance.

Hooks

hook to an internal event of the interpreter. (onRaiseError, onStateChanged, ... )

Machine Instance

provides these properties:

  • Stream<State> state: current state of the machine
    • State :
      • value: current state value
      • matches(State pattern): check if the state matches a pattern
      • context
  • void send(Event event): sends event to the machine

Flutter

  • Basic binding for flutter
  • Provide a simple example

Basic Tooling

  • Machine definition validation & auto completion
    • provide schema validation for Machine.fromJson with https://github.com/davidkpiano/xstate/pull/960/files#diff-573778b9503823ca0d77478e05c11054
    • provide validation for Machine.fromSCXML with https://www.w3.org/2011/04/SCXML/scxml.xsd
    • provide auto completion for target transition states
    • provide error for invalid or impossible transitions
  • state.matches() validation & auto completion
    • provides all possible patterns for the machine.
    • provide errors for invalid pattern
  • state.context suggestion and type validation

sahandevs avatar Feb 10 '20 08:02 sahandevs

Hey @sahandevs! I'd love to help out with this project, is there a particular area you could point me to as a good starting place?

ekweible avatar May 01 '20 18:05 ekweible

Hi @ekweible! It would be awesome.

I've delayed this project but I will be back on it very soon. last thing I was working on was implementing the interpreter based on https://www.w3.org/TR/scxml (implemented part is here: https://github.com/sahandevs/xstate.dart/blob/master/packages/xstate/lib/src/interpreter/helpers.dart)

There are few todos there but the next thing i was going to work on was writing some test for the functions there. writing test for them should not be hard because they are bunch of independent function.

Thanks!

sahandevs avatar May 03 '20 11:05 sahandevs