Closed phaistonian closed 1 year ago
Ladle doesn't support this for the same reason Storybook is trying to deprecate it now. Ladle was built around static analysis, automatic code-splitting, automatic story naming and meta.json.
I think the fact Storybook is moving in the same direction now is a proof that it was the correct architectural decision.
I also just went over Indexer API proposal. That's something that could fit into Ladle's architecture as well. However, that's still a build time feature, it doesn't replace/solve programmatically added stories. Also, it might not be as value to us since we only support React/MDX.
I think the only path here would be to introduce some sort of declarative macros. However, it's a foreign concept to JS developers so not sure if it would be successful.
I still believe being able to provide such functionality will be of value — especially since Storybook does not.
Imagine having a vast number of templates, and you want to generate stories without repeating the tedious process of generating simple stories for them.
I thought about creating story files for each glob match, either on the filesystem or on memory, on startup — and perhaps when a watcher triggers a needed change — but that feels like a hack.
In any case, I wish such a feature will "Land on Ladle" one day ;)
Imagine having a vast number of templates, and you want to generate stories without repeating the tedious process of generating simple stories for them.
That sounds like a use-case for controls (args/argTypes) or similar API. If you insist on having separate stories (extra items in the sidebar), macros would be way to go.
Is your feature request related to a problem? Please describe. Yes.
Being able to create stories on demand based on a huge number of scenarios.
Describe the solution you'd like An API - same as
storiesOf
of Storybook, perhaps, that will enable to declare stories programmatically.Describe alternatives you've considered Storybook can do that with
storiesOf
and this, but it's not ideal.Additional context