Skip to content

Commit

Permalink
Merge branch 'main' of github.com:storybookjs/addon-svelte-csf into u…
Browse files Browse the repository at this point in the history
…se-preview-api
  • Loading branch information
JReinhold committed Jan 23, 2024
2 parents a642183 + afad5de commit d3109cc
Show file tree
Hide file tree
Showing 22 changed files with 2,353 additions and 430 deletions.
8 changes: 5 additions & 3 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import type { StorybookConfig } from '@storybook/svelte-vite';

const config: StorybookConfig = {
framework: '@storybook/svelte-vite',
stories: [
'../stories/**/*.stories.svelte',
],
stories: [{
directory: '../stories',
files:'**/*.stories.svelte',
titlePrefix:'Demo'
}],
addons: [
'../dist/preset/index.js',
'@storybook/addon-essentials',
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"deepscan.enable": true
}
"deepscan.enable": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
203 changes: 203 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,206 @@
# v4.1.0 (Fri Dec 29 2023)

#### 🚀 Enhancement

- Update versions of peer dependencies to allow latest Vite and Vite Svelte plugin [#159](https://github.com/storybookjs/addon-svelte-csf/pull/159) ([@joekrump](https://github.com/joekrump))

#### Authors: 1

- Joe Krump ([@joekrump](https://github.com/joekrump))

---

# v4.0.13 (Tue Nov 21 2023)

#### 🐛 Bug Fix

- Add component description from jsdoc on meta export [#158](https://github.com/storybookjs/addon-svelte-csf/pull/158) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.12 (Fri Nov 17 2023)

#### 🐛 Bug Fix

- Exports package.json [#157](https://github.com/storybookjs/addon-svelte-csf/pull/157) ([@tylergaw](https://github.com/tylergaw))

#### Authors: 1

- Tyler Gaw ([@tylergaw](https://github.com/tylergaw))

---

# v4.0.11 (Fri Nov 10 2023)

#### 🐛 Bug Fix

- Parse comments as Story description [#154](https://github.com/storybookjs/addon-svelte-csf/pull/154) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.10 (Thu Nov 09 2023)

#### 🐛 Bug Fix

- Update src/preset/indexer.ts [#153](https://github.com/storybookjs/addon-svelte-csf/pull/153) ([@benmccann](https://github.com/benmccann))
- Add support for experimental_indexers [#153](https://github.com/storybookjs/addon-svelte-csf/pull/153) ([@j3rem1e](https://github.com/j3rem1e))
- Upgrade dev dependencies to Storybook v7.5.2 and Svelte 4.2.2 [#153](https://github.com/storybookjs/addon-svelte-csf/pull/153) ([@j3rem1e](https://github.com/j3rem1e))

#### 📝 Documentation

- Updated Readme to include component [#150](https://github.com/storybookjs/addon-svelte-csf/pull/150) ([@brittneypostma](https://github.com/brittneypostma))

#### Authors: 3

- Ben McCann ([@benmccann](https://github.com/benmccann))
- Brittney Postma ([@brittneypostma](https://github.com/brittneypostma))
- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.9 (Sat Sep 23 2023)

#### 🐛 Bug Fix

- Fix reactivity of args when HMR remount the RenderContext [#144](https://github.com/storybookjs/addon-svelte-csf/pull/144) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.8 (Thu Sep 21 2023)

#### 🐛 Bug Fix

- Fix forwarding of actions handlers [#142](https://github.com/storybookjs/addon-svelte-csf/pull/142) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.7 (Sat Sep 16 2023)

#### 🐛 Bug Fix

- Update src/parser/extract-stories.ts [#134](https://github.com/storybookjs/addon-svelte-csf/pull/134) ([@benmccann](https://github.com/benmccann))
- Allow 'meta' to be exported as const from module script [#134](https://github.com/storybookjs/addon-svelte-csf/pull/134) ([@j3rem1e](https://github.com/j3rem1e))
- Supports for tags in <Meta/> [#134](https://github.com/storybookjs/addon-svelte-csf/pull/134) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 2

- Ben McCann ([@benmccann](https://github.com/benmccann))
- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.6 (Fri Sep 15 2023)

#### 🐛 Bug Fix

- Allow configuration of filename patterns besides *.stories.svelte [#140](https://github.com/storybookjs/addon-svelte-csf/pull/140) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.5 (Wed Sep 13 2023)

#### 🐛 Bug Fix

- fix: MetaProps typing [#139](https://github.com/storybookjs/addon-svelte-csf/pull/139) ([@paoloricciuti](https://github.com/paoloricciuti))

#### Authors: 1

- Paolo Ricciuti ([@paoloricciuti](https://github.com/paoloricciuti))

---

# v4.0.4 (Wed Sep 13 2023)

#### 🐛 Bug Fix

- fix: move MetaProps to its own declaration to allow for overrides [#138](https://github.com/storybookjs/addon-svelte-csf/pull/138) ([@paoloricciuti](https://github.com/paoloricciuti))

#### Authors: 1

- Paolo Ricciuti ([@paoloricciuti](https://github.com/paoloricciuti))

---

# v4.0.3 (Sat Sep 02 2023)

#### 🐛 Bug Fix

- Fix test snapshots [#137](https://github.com/storybookjs/addon-svelte-csf/pull/137) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.2 (Sat Sep 02 2023)

#### 🐛 Bug Fix

- [Bug] titlePrefix in advanced story specifiers causes the story to crash with "Didn't find 'xyz' in CSF file" [#136](https://github.com/storybookjs/addon-svelte-csf/pull/136) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.1 (Thu Aug 31 2023)

#### 🐛 Bug Fix

- Fix svelte-stories-loader in Windows [#133](https://github.com/storybookjs/addon-svelte-csf/pull/133) ([@j3rem1e](https://github.com/j3rem1e))

#### Authors: 1

- Jérémie ([@j3rem1e](https://github.com/j3rem1e))

---

# v4.0.0 (Tue Aug 29 2023)

#### 💥 Breaking Change

- Require Svelte v4, vite-plugin-svelte v2, Vite v4 [#128](https://github.com/storybookjs/addon-svelte-csf/pull/128) ([@JReinhold](https://github.com/JReinhold))

#### Authors: 1

- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold))

---

# v3.0.10 (Tue Aug 29 2023)

#### 🐛 Bug Fix

- Fix: `typeof Meta` in Svelte v3 (Pin Svelte peer dependency to v3) [#127](https://github.com/storybookjs/addon-svelte-csf/pull/127) ([@JReinhold](https://github.com/JReinhold))

#### Authors: 1

- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold))

---

# v3.0.9 (Wed Aug 23 2023)

#### 🐛 Bug Fix
Expand Down
68 changes: 61 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,57 @@ It supports:

## Example

Have a basic button component:

```svelte
<script>
import { Meta, Story, Template } from '@storybook/addon-svelte-csf';
export let rounded = true;
</script>
<style>
.rounded {
border-radius: 35px;
}
button {
border: 3px solid;
padding: 10px 20px;
background-color: white;
outline: none;
}
</style>
<button class="button" class:rounded on:click={onClick}>
<slot />
</button>
```

And a `button.stories.svelte` file:

```svelte
<script context="module">
import Button from './Button.svelte';
export const meta = {
title: "Button",
component: Button
}
</script>
<script>
import { Story, Template } from '@storybook/addon-svelte-csf';
let count = 0;
function handleClick() {
count += 1;
}
</script>
<Meta title="Button" component={Button}/>
<Template let:args>
<Button {...args} on:click={handleClick}>
<!--👇 'on:click' allows to forward event to addon-actions -->
<Button {...args}
on:click
on:click={handleClick}>
You clicked: {count}
</Button>
</Template>
Expand All @@ -43,7 +78,10 @@ It supports:
</Story>
```

# Getting Started
Actions are automatically registered by Storybook. To be used by this addon, you just have to forward the event (`on:click` in the previous example).


## Getting Started

1. `npm install --save-dev @storybook/addon-svelte-csf` or `yarn add --dev @storybook/addon-svelte-csf`
2. In `.storybook/main.js`, add `@storybook/addon-svelte-csf` to the addons array
Expand All @@ -64,5 +102,21 @@ module.exports = {
};
```

> **Warning**
> v3 and above of this addon requires at least Storybook v7. If you're using Storybook between v6.4.20 and v7.0.0, you should instead use v2 of this addon with `npm install --save-dev @storybook/addon-svelte-csf@^2.0.10` or `yarn add --dev @storybook/addon-svelte-csf@^2.0.10`
## Version Dependencies

### 4.0.0

Version 4 of this addon requires _at least_:

- Storybook v7
- Svelte v4
- Vite v4 (if using Vite)
- `@sveltejs/vite-plugin-svelte` v2 (if using Vite)

If you're using Svelte v3 you can use version `^3.0.0` of this addon instead.

### 3.0.0

Version 3 of this addon requires at least Storybook v7.

If you're using Storybook between v6.4.20 and v7.0.0, you should instead use version `^2.0.0` of this addon.
Loading

0 comments on commit d3109cc

Please sign in to comment.