feat: animated spinner
closes #284
This PR enables an animated spinner with consola.start() which is stopped by consola.{sucess,fail,fatalerror}
The implementation also handles multi-line interrupts when the spinner is spinning and another log happens. both for build-in consola methods and when consola.wrapAll() is active.
[wip] it still can be problematic in ambiguous contexts, therefore we need a stable spy on stdout/stderr to count new lines and track them.
This PR is also likely landing for consola v4 as behavior change could be a regression.
I'm currently working with spinnies, but I really like to use Consola. Only thing for me that is missing is exactly this. Would be so great to have this!
Is this also handling that the consola.{sucess,fail,fatalerror} is overwriting the current spinner like spinnies does? I'd like to have a simple list like listr and spinnies that can be stopped on the same line.
In the current, simplest implementation, (top-level) consola.sucess,fail,fatalerror finalizes (previous) loading state (started by consola.start)
I am thinking of two possible ways to expose controllable spinner instances for listr like behavior:
createSpinner(): Spinner(fromconsola/utils)consola.start(): Spinner
I am leaning more towards the first as it is an explicit API and we can enhance it more easily without needing to hook into global events. And we keep consola.* behavior for minimal usage like other utils.
Another note to mention, I am thinking to use "stick to buttom" style similar to apt. Stick to top is possible and we can make sure it remains (semi) stable like webpackbar but it is so much costly at very least since we need to spy and rerender everything goes out in consola during spinning. (it all works well when consola/spinner is in control. as soon as another source wants writing to stdout/stderr things go complicated)