Skip to content

Instantly share code, notes, and snippets.

@jacobparis
Created April 5, 2020 03:18
Show Gist options
  • Save jacobparis/1a27cf4ddb397f593a7008769e3e69ed to your computer and use it in GitHub Desktop.
Save jacobparis/1a27cf4ddb397f593a7008769e3e69ed to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const formatMachine = Machine({
id: 'format',
type: 'parallel',
states: {
bold: {
initial: 'off',
states: {
on: {
on: {
BOLD: 'off'
}
},
off: {
on: {
BOLD: 'on'
}
}
}
},
italic: {
initial: 'off',
states: {
on: {
on: {
ITALICIZE: 'off'
}
},
off: {
on: {
ITALICIZE: 'on'
}
}
}
},
underlined: {
initial: 'off',
states: {
on: {
on: {
UNDERLINE: 'off'
}
},
off: {
on: {
UNDERLINE: 'on'
}
}
}
},
align: {
on: {
LEFT: 'align.left',
CENTER: 'align.center',
RIGHT: 'align.right',
JUSTIFY: 'align.justify'
},
initial: 'left',
states: {
left: {},
center: {},
right: {},
justify: {}
}
},
line_break: {
initial: 'paragraph',
states: {
paragraph: {
on: {
NUMBER: 'numbers',
BULLET: 'bullets'
}
},
numbers: {
on: {
NUMBER: 'paragraph',
BULLET: 'bullets'
}
},
bullets: {
on: {
NUMBER: 'numbers',
BULLET: 'paragraph'
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment