Description
Is your feature request related to a problem? Please describe
I love how I can add the 'controls' addon and edit controls for each story 💯
I also love how this seamlessly integrates with the 'docs' addon and when visiting the Docs page I see my changes reflected in the preview there as well 💯
The frustration happens when I want to see the generated code. Adding the 'storysource' addon does not have the same behavior as the 'controls' addon. With 'storysource' all I see is something like this:
(args) => <MyComponent {...args} />
Which isn't at all helpful. So as a consumer if I want to dynamically fiddle with controls and then see the generated code - I have to first edit controls for the story from the Controls tab in the addons panel in the Canvas page. Then know to go to the Docs page, possibly scroll to find the same story, and then expand the code preview. 😞
Describe the solution you'd like
I'd like it if the 'storysource' addon had more intuitive behavior by functioning like the controls addon. Where when added a Source or Code tab would appear in the addons panel. And that tab would essentially have the same generated output you see in the Docs page when clicking "Show Code".
It should also pull from the same story params so that when needed I can override the code output via
storyname.parameters = {
docs: {
source: {
code: `some custom code output here`
}
}
}
Describe alternatives you've considered
I'm aware that with custom page templates I could manually set each story block with an 'ArgsTable' block. This would allow both editing toggles and seeing the generated code for each story from the 'Docs' page. However this would needlessly bloat the Docs page - especially for components with a lot of controls. Not to mention the amount of automation I'd be losing by giving up the 'Stories' block which is really convenient.
Are you able to assist to bring the feature to reality?
Possibly in the future but not at this time...
Additional context
The Source/Code block circled in red should be what the storysource addon displays