switz / driver

🏁 A typescript package for declarative finite states and commonly derived values - zero dependencies, fully typed, & framework agnostic
https://npmjs.com/package/@switz/driver
MIT License
115 stars 1 forks source link

Add debug mode #3

Closed switz closed 1 year ago

switz commented 1 year ago

Calling driver.debug({ ... should spit out an array of every possible computed state. This takes every state key and marks it as true once.

so you can basically craft "storybooks"/matrices of every state by doing:

const vals = driver.debug({ ... });

return vals.map((val) => <div key={val.activeState}>
  <h3>{val.activeState}</h3>
  <DownloadButton text={val.text} isDisabled={val.isDisabled} />
</div>);