@storybook/svelte 8.3.0-alpha.6 → 8.3.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Turns an object into reactive props in Svelte 5.
3
- * Needs to be in a separate .svelte.js file to ensure Svelte
4
- * compiles it.
5
- * As proposed in https://github.com/sveltejs/svelte/issues/9827#issuecomment-1845589616
2
+ * Turns an object into reactive props in Svelte 5. Needs to be in a separate .svelte.js file to
3
+ * ensure Svelte compiles it. As proposed in
4
+ * https://github.com/sveltejs/svelte/issues/9827#issuecomment-1845589616
5
+ *
6
6
  * @template TProps
7
7
  * @param {TProps} data - The data to create Svelte 5 props from.
8
8
  * @returns {TProps} - The created Svelte 5 props.
package/dist/index.d.ts CHANGED
@@ -40,33 +40,37 @@ type ComposedStory<TArgs extends Args = any> = ComposedStoryFn<SvelteRenderer, T
40
40
  type MapToComposed<TModule> = {
41
41
  [K in keyof TModule]: TModule[K] extends StoryAnnotationsOrFn<SvelteRenderer, infer TArgs extends Args> ? ComposedStory<TArgs> : never;
42
42
  };
43
- /** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder.
43
+ /**
44
+ * Function that sets the globalConfig of your storybook. The global config is the preview module of
45
+ * your .storybook folder.
44
46
  *
45
- * It should be run a single time, so that your global config (e.g. decorators) is applied to your stories when using `composeStories` or `composeStory`.
47
+ * It should be run a single time, so that your global config (e.g. decorators) is applied to your
48
+ * stories when using `composeStories` or `composeStory`.
46
49
  *
47
50
  * Example:
48
- *```jsx
51
+ *
52
+ * ```jsx
49
53
  * // setup.js (for jest)
50
54
  * import { setProjectAnnotations } from '@storybook/svelte';
51
55
  * import projectAnnotations from './.storybook/preview';
52
56
  *
53
57
  * setProjectAnnotations(projectAnnotations);
54
- *```
58
+ * ```
55
59
  *
56
- * @param projectAnnotations - e.g. (import projectAnnotations from '../.storybook/preview')
60
+ * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
57
61
  */
58
62
  declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<SvelteRenderer>;
59
63
  declare const INTERNAL_DEFAULT_PROJECT_ANNOTATIONS: ProjectAnnotations<SvelteRenderer>;
60
64
  /**
61
65
  * Function that will receive a story along with meta (e.g. a default export from a .stories file)
62
- * and optionally projectAnnotations e.g. (import * from '../.storybook/preview)
63
- * and will return a composed component that has all args/parameters/decorators/etc combined and applied to it.
64
- *
66
+ * and optionally projectAnnotations e.g. (import * from '../.storybook/preview) and will return a
67
+ * composed component that has all args/parameters/decorators/etc combined and applied to it.
65
68
  *
66
69
  * It's very useful for reusing a story in scenarios outside of Storybook like unit testing.
67
70
  *
68
71
  * Example:
69
- *```jsx
72
+ *
73
+ * ```jsx
70
74
  * import { render } from '@testing-library/svelte';
71
75
  * import { composeStory } from '@storybook/svelte';
72
76
  * import Meta, { Primary as PrimaryStory } from './Button.stories';
@@ -77,24 +81,26 @@ declare const INTERNAL_DEFAULT_PROJECT_ANNOTATIONS: ProjectAnnotations<SvelteRen
77
81
  * const { getByText } = render(Primary, { label: 'Hello world' });
78
82
  * expect(getByText(/Hello world/i)).not.toBeNull();
79
83
  * });
80
- *```
84
+ * ```
81
85
  *
82
86
  * @param story
83
- * @param componentAnnotations - e.g. (import Meta from './Button.stories')
84
- * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
85
- * @param [exportsName] - in case your story does not contain a name and you want it to have a name.
87
+ * @param componentAnnotations - E.g. (import Meta from './Button.stories')
88
+ * @param [projectAnnotations] - E.g. (import * as projectAnnotations from '../.storybook/preview')
89
+ * this can be applied automatically if you use `setProjectAnnotations` in your setup files.
90
+ * @param [exportsName] - In case your story does not contain a name and you want it to have a name.
86
91
  */
87
92
  declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotationsOrFn<SvelteRenderer, TArgs>, componentAnnotations: Meta<TArgs | any>, projectAnnotations?: ProjectAnnotations<SvelteRenderer>, exportsName?: string): ComposedStory<TArgs>;
88
93
  /**
89
94
  * Function that will receive a stories import (e.g. `import * as stories from './Button.stories'`)
90
- * and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`)
91
- * and will return an object containing all the stories passed, but now as a composed component that has all args/parameters/decorators/etc combined and applied to it.
92
- *
95
+ * and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`) and will return
96
+ * an object containing all the stories passed, but now as a composed component that has all
97
+ * args/parameters/decorators/etc combined and applied to it.
93
98
  *
94
99
  * It's very useful for reusing stories in scenarios outside of Storybook like unit testing.
95
100
  *
96
101
  * Example:
97
- *```jsx
102
+ *
103
+ * ```jsx
98
104
  * import { render } from '@testing-library/svelte';
99
105
  * import { composeStories } from '@storybook/svelte';
100
106
  * import * as stories from './Button.stories';
@@ -105,10 +111,11 @@ declare function composeStory<TArgs extends Args = Args>(story: StoryAnnotations
105
111
  * const { getByText } = render(Primary, { label: 'Hello world' });
106
112
  * expect(getByText(/Hello world/i)).not.toBeNull();
107
113
  * });
108
- *```
114
+ * ```
109
115
  *
110
- * @param csfExports - e.g. (import * as stories from './Button.stories')
111
- * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files.
116
+ * @param csfExports - E.g. (import * as stories from './Button.stories')
117
+ * @param [projectAnnotations] - E.g. (import * as projectAnnotations from '../.storybook/preview')
118
+ * this can be applied automatically if you use `setProjectAnnotations` in your setup files.
112
119
  */
113
120
  declare function composeStories<TModule extends Store_CSFExports<SvelteRenderer, any>>(csfExports: TModule, projectAnnotations?: ProjectAnnotations<SvelteRenderer>): Omit<MapToComposed<StoriesWithPartialProps<SvelteRenderer<PreviewRender<any, any, any>>, TModule>>, keyof Store_CSFExports>;
114
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/svelte",
3
- "version": "8.3.0-alpha.6",
3
+ "version": "8.3.0-alpha.7",
4
4
  "description": "Storybook Svelte renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -57,11 +57,11 @@
57
57
  "prep": "jiti ../../../scripts/prepare/bundle.ts"
58
58
  },
59
59
  "dependencies": {
60
- "@storybook/components": "^8.3.0-alpha.6",
60
+ "@storybook/components": "^8.3.0-alpha.7",
61
61
  "@storybook/global": "^5.0.0",
62
- "@storybook/manager-api": "^8.3.0-alpha.6",
63
- "@storybook/preview-api": "^8.3.0-alpha.6",
64
- "@storybook/theming": "^8.3.0-alpha.6",
62
+ "@storybook/manager-api": "^8.3.0-alpha.7",
63
+ "@storybook/preview-api": "^8.3.0-alpha.7",
64
+ "@storybook/theming": "^8.3.0-alpha.7",
65
65
  "sveltedoc-parser": "^4.2.1",
66
66
  "ts-dedent": "^2.0.0",
67
67
  "type-fest": "~2.19"
@@ -77,7 +77,7 @@
77
77
  "typescript": "^5.3.2"
78
78
  },
79
79
  "peerDependencies": {
80
- "storybook": "^8.3.0-alpha.6",
80
+ "storybook": "^8.3.0-alpha.7",
81
81
  "svelte": "^4.0.0 || ^5.0.0-next.65"
82
82
  },
83
83
  "engines": {