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
CLI: Use Svelte-native CSF during initialization #14363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Tested locally -- looks great
@j3rem1e can you review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unrelated to this change, but the 'Button.svelte' generated by the CLI is bugged.
It works only if the story is fully rerendered, not if new properties are injected to a running component (mode
and style
internal properties are not reactive)
/> | ||
|
||
<Template let:args> | ||
<Button {...args} on:click={args.onClick} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen this in a lot of examples in Storybook, but what is the purpose of declaring events as properties ? It's look like a React convention.
In Svelte, event and properties are not the same thing. It's not a big deal, but passing an undeclared property to a component in svelte will display a warning in development mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Args can be properties, events, slots, etc.
The two main patterns for how we use them, tho we may develop more:
- auto-generated controls to manipulate the value in UI
- dependency injection, e.g. auto-generated actions, which makes the stories more portable (no direct dependency on
@storybook/addon-actions
)
It's the latter case that's highlighted here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification.
Something should probably be added to the plugin in order to remove this warning. maybe filtering actions, and subscribing automatically to the linked event.
Issue:
What I did
Use CSF in svelte CLI
How to test
CLI