@storybook/svelte-vite 9.0.0-alpha.2 → 9.0.0-alpha.21

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.
Files changed (33) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/preset.d.ts +1 -0
  6. package/dist/preset.js +3 -11
  7. package/package.json +10 -9
  8. package/template/cli/js/Button.stories.svelte +31 -0
  9. package/template/cli/js/Button.svelte +27 -0
  10. package/template/cli/js/Header.stories.svelte +26 -0
  11. package/template/cli/js/Header.svelte +47 -0
  12. package/template/cli/js/Page.stories.svelte +30 -0
  13. package/template/cli/js/Page.svelte +70 -0
  14. package/template/cli/ts/Button.stories.svelte +31 -0
  15. package/template/cli/ts/Button.svelte +30 -0
  16. package/template/cli/ts/Header.stories.svelte +26 -0
  17. package/template/cli/ts/Header.svelte +45 -0
  18. package/template/cli/ts/Page.stories.svelte +30 -0
  19. package/template/cli/ts/Page.svelte +70 -0
  20. package/template/stories_svelte-vite-default-js/docgen/jsdoc.stories.js +17 -0
  21. package/template/stories_svelte-vite-default-js/docgen/jsdoc.svelte +92 -0
  22. package/template/stories_svelte-vite-default-ts/docgen/jsdoc.stories.js +17 -0
  23. package/template/stories_svelte-vite-default-ts/docgen/jsdoc.svelte +91 -0
  24. package/template/stories_svelte-vite-default-ts/docgen/ts-inline-prop-types.stories.ts +16 -0
  25. package/template/stories_svelte-vite-default-ts/docgen/ts-inline-prop-types.svelte +103 -0
  26. package/template/stories_svelte-vite-default-ts/docgen/ts-legacy.stories.ts +16 -0
  27. package/template/stories_svelte-vite-default-ts/docgen/ts-legacy.svelte +98 -0
  28. package/template/stories_svelte-vite-default-ts/docgen/ts-referenced-prop-types.stories.ts +16 -0
  29. package/template/stories_svelte-vite-default-ts/docgen/ts-referenced-prop-types.svelte +107 -0
  30. package/template/stories_svelte-vite-default-ts/docgen/ts.stories.ts +16 -0
  31. package/template/stories_svelte-vite-default-ts/docgen/ts.svelte +125 -0
  32. package/template/stories_svelte-vite-default-ts/docgen/types.ts +7 -0
  33. package/template/stories_svelte-vite-default-ts/docs-ts.stories.js +0 -10
@@ -0,0 +1,125 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { LiteralNumbers, LiteralStrings } from './types';
4
+ import { MyEnum } from './types';
5
+
6
+ type MyObject = {
7
+ foo: string;
8
+ bar: number;
9
+ };
10
+
11
+ type Props = {
12
+ /** Boolean */
13
+ boolean?: boolean;
14
+ /** String */
15
+ string?: string;
16
+ /** String (required) */
17
+ stringRequired: string;
18
+ /** Number */
19
+ number?: number;
20
+ /** True literal */
21
+ trueLiteral?: true | undefined;
22
+ /** Symbol */
23
+ symbol?: symbol | undefined;
24
+ /** Null */
25
+ nullValue?: null;
26
+ /** Undefined */
27
+ undefinedValue?: undefined;
28
+ /** Any */
29
+ any?: any;
30
+ /** Date */
31
+ date?: Date;
32
+ /** Array of numbers */
33
+ arrayOfNumbers?: number[];
34
+ /** Enum */
35
+ enumValue?: MyEnum;
36
+ /** Union of literal strings */
37
+ unionLiteralStrings?: LiteralStrings;
38
+ /** Union of literal numbers */
39
+ unionLiteralNumbers?: LiteralNumbers;
40
+ /** Object */
41
+ object?: MyObject | undefined;
42
+ /** Inline object */
43
+ inlineObject?:
44
+ | {
45
+ foo: string;
46
+ bar: number;
47
+ }
48
+ | undefined;
49
+ /** Record */
50
+ record?: Record<string, number>;
51
+ /** Union of types */
52
+ unionTypes?: number | string;
53
+ /** Intersection of types */
54
+ intersection?: ({ a: number } & { b: string }) | undefined;
55
+ /** Event callback function */
56
+ func?: (event: MouseEvent) => number;
57
+ /** Children */
58
+ children: Snippet;
59
+ /** Actual arg types inferred from the component */
60
+ argTypes: Record<string, any>;
61
+ };
62
+
63
+ const {
64
+ boolean = true,
65
+ string = 'default',
66
+ stringRequired,
67
+ number = 123,
68
+ trueLiteral = undefined,
69
+ symbol = undefined,
70
+ nullValue = null,
71
+ undefinedValue = undefined,
72
+ any = null,
73
+ date = new Date('20 Jan 1983'),
74
+ arrayOfNumbers = [1, 20, 300],
75
+ enumValue = MyEnum.FOO,
76
+ unionLiteralStrings = 'apple',
77
+ unionLiteralNumbers = 100,
78
+ object = undefined,
79
+ inlineObject = undefined,
80
+ record = { a: 1, b: 2 },
81
+ unionTypes = 123,
82
+ intersection = undefined,
83
+ func = () => 10,
84
+ children,
85
+ argTypes,
86
+ }: Props = $props();
87
+ </script>
88
+
89
+ <h1>Docgen: TS</h1>
90
+
91
+ <h2>Args</h2>
92
+ <pre>{JSON.stringify(
93
+ {
94
+ boolean,
95
+ string,
96
+ stringRequired,
97
+ number,
98
+ trueLiteral,
99
+ symbol,
100
+ nullValue,
101
+ undefinedValue,
102
+ any,
103
+ date,
104
+ arrayOfNumbers,
105
+ enumValue,
106
+ unionLiteralStrings,
107
+ unionLiteralNumbers,
108
+ object,
109
+ inlineObject,
110
+ record,
111
+ unionTypes,
112
+ intersection,
113
+ func,
114
+ },
115
+ null,
116
+ 2
117
+ )}</pre>
118
+
119
+ <h2>Children</h2>
120
+ {#if children}
121
+ {@render children()}
122
+ {/if}
123
+
124
+ <h2>Arg Types</h2>
125
+ <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -0,0 +1,7 @@
1
+ export type LiteralNumbers = 100 | 1000 | 10000;
2
+ export type LiteralStrings = 'apple' | 'grape' | 'orange';
3
+
4
+ export enum MyEnum {
5
+ FOO = 'foo',
6
+ BAR = 'bar',
7
+ }
@@ -1,10 +0,0 @@
1
- import DocsTS from './DocsTS.svelte';
2
-
3
- export default {
4
- title: 'stories/renderers/svelte/docs-ts',
5
- component: DocsTS,
6
- args: {},
7
- tags: ['autodocs'],
8
- };
9
-
10
- export const Primary = {};