Skip to content
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

Merged
merged 1 commit into from Mar 29, 2021
Merged

Conversation

tooppaaa
Copy link
Contributor

Issue:

What I did

Use CSF in svelte CLI

How to test

CLI

@tooppaaa tooppaaa requested a review from j3rem1e March 27, 2021 19:52
@shilman shilman changed the title CLI: use CSF for svelete during initialization CLI: Use Svelte-native CSF during initialization Mar 27, 2021
Copy link
Member

@shilman shilman left a 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?

Copy link
Contributor

@j3rem1e j3rem1e left a 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} />
Copy link
Contributor

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.

Copy link
Member

@shilman shilman Mar 28, 2021

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:

  1. auto-generated controls to manipulate the value in UI
  2. 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

Copy link
Contributor

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.

@shilman shilman merged commit feda281 into next Mar 29, 2021
@shilman shilman deleted the feature/csfSvelteCLI branch March 29, 2021 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants