-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic source rendering for Vue #11400
Comments
First of all, thank you for your efforts. You are doing great work. It would be very good to see this feature in production. Just wanted to say. Also I need to say showing source is not properly work in Vue when using standard
|
@zackkrida that's the source code of the story, which is the intended behavior |
@shilman Apologies if I came off as rude in any way—I understand that's the 'source', as written. It's probably also an impossible or difficult problem, but I'm just referring to the idea that the source of a Vue component would reflect what folks would write in user land as consumers of a component library. |
@zackkrida No offense taken. As we've evolved storybook the story source is getting more abstracted/efficient (e.g. auto-generated controls), but further away from what you'd write in an app. This issue exists both to show the dynamically updated arg values and also render the component usage in a more natural way. Let's see what we can do! |
Just adding a +1 here. WOuld love to see those Vue code snippes resemble the Vue source if possible. |
@richardhuf84 please add a 👍 to the original issue description. that's the most direct way to help us prioritize. |
#11400 This commit adds dynamic source code rendering feature to Docs addon for Vue.js. The goals are 1) reflecting Controls' value to code block and 2) showing a code similar to what component consumers would write. To archive these goals, this feature compiles a component with Vue, then walks through vdom and stringifys the result. It could be possible to parse components' template or render function then stringify results, but it would be costly and hard to maintain (especially for parsing). We can use vue-template-compiler for the purpose, but it can't handle render functions so it's not the way to go IMO. Speaking of the goal 2, someone wants events to be in the output code. But it's so hard to retrieve component definitions (e.g. `methods`, `computed`). I think it's okay to skip events until we figure there is a high demand for that.
Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.27 containing PR #12812 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Thanks @shilman I've updated to 6.1.0 alpha, and can confirm that the code snippets look correct for Vue. Thanks alot for your work, and being so responsive. |
All credit goes to @pocka who saved the day on this one. 🎉 |
Follow-up to #11332 but for Vue
The text was updated successfully, but these errors were encountered: