@storybook/svelte-vite 9.0.0-alpha.9 → 9.0.0-beta.1

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 (47) hide show
  1. package/dist/preset.js +2 -10
  2. package/package.json +8 -8
  3. package/template/cli/{svelte-5-ts-3-8 → js}/Button.stories.svelte +1 -1
  4. package/template/cli/js/Button.svelte +11 -20
  5. package/template/cli/js/Header.svelte +12 -17
  6. package/template/cli/{svelte-5-js → js}/Page.stories.svelte +1 -1
  7. package/template/cli/js/Page.svelte +4 -4
  8. package/template/cli/{svelte-5-ts-4-9 → ts}/Button.stories.svelte +1 -1
  9. package/template/cli/{svelte-5-ts-3-8 → ts}/Button.svelte +8 -7
  10. package/template/cli/{svelte-5-ts-4-9 → ts}/Header.svelte +3 -3
  11. package/template/cli/{svelte-5-ts-4-9 → ts}/Page.stories.svelte +1 -1
  12. package/template/stories_svelte-vite-default-js/docgen/jsdoc.stories.js +17 -0
  13. package/template/stories_svelte-vite-default-js/docgen/jsdoc.svelte +92 -0
  14. package/template/stories_svelte-vite-default-ts/docgen/jsdoc.stories.js +17 -0
  15. package/template/stories_svelte-vite-default-ts/docgen/jsdoc.svelte +91 -0
  16. package/template/stories_svelte-vite-default-ts/docgen/ts-inline-prop-types.stories.ts +16 -0
  17. package/template/stories_svelte-vite-default-ts/docgen/ts-inline-prop-types.svelte +103 -0
  18. package/template/stories_svelte-vite-default-ts/docgen/ts-legacy.stories.ts +16 -0
  19. package/template/stories_svelte-vite-default-ts/docgen/ts-legacy.svelte +98 -0
  20. package/template/stories_svelte-vite-default-ts/docgen/ts-referenced-prop-types.stories.ts +16 -0
  21. package/template/stories_svelte-vite-default-ts/docgen/ts-referenced-prop-types.svelte +107 -0
  22. package/template/stories_svelte-vite-default-ts/docgen/ts.stories.ts +16 -0
  23. package/template/stories_svelte-vite-default-ts/docgen/ts.svelte +125 -0
  24. package/template/cli/js/Button.stories.js +0 -43
  25. package/template/cli/js/Header.stories.js +0 -22
  26. package/template/cli/js/Page.stories.js +0 -28
  27. package/template/cli/svelte-5-js/Button.stories.svelte +0 -31
  28. package/template/cli/svelte-5-js/Button.svelte +0 -26
  29. package/template/cli/svelte-5-js/Header.svelte +0 -47
  30. package/template/cli/svelte-5-js/Page.svelte +0 -70
  31. package/template/cli/svelte-5-ts-3-8/Header.svelte +0 -45
  32. package/template/cli/svelte-5-ts-3-8/Page.stories.svelte +0 -30
  33. package/template/cli/svelte-5-ts-4-9/Button.svelte +0 -29
  34. package/template/cli/svelte-5-ts-4-9/Header.stories.svelte +0 -26
  35. package/template/cli/svelte-5-ts-4-9/Page.svelte +0 -70
  36. package/template/cli/ts-4-9/Button.stories.ts +0 -48
  37. package/template/cli/ts-4-9/Button.svelte +0 -34
  38. package/template/cli/ts-4-9/Header.stories.ts +0 -27
  39. package/template/cli/ts-4-9/Header.svelte +0 -52
  40. package/template/cli/ts-4-9/Page.stories.ts +0 -33
  41. package/template/cli/ts-4-9/Page.svelte +0 -70
  42. package/template/stories_svelte-vite-default-ts/DocsTS.svelte +0 -97
  43. package/template/stories_svelte-vite-default-ts/docs-ts.stories.js +0 -10
  44. /package/template/cli/{svelte-5-js → js}/Header.stories.svelte +0 -0
  45. /package/template/cli/{svelte-5-ts-3-8 → ts}/Header.stories.svelte +0 -0
  46. /package/template/cli/{svelte-5-ts-3-8 → ts}/Page.svelte +0 -0
  47. /package/template/stories_svelte-vite-default-ts/{types.ts → docgen/types.ts} +0 -0
@@ -0,0 +1,98 @@
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
+ /** Boolean */
12
+ export let boolean: boolean = true;
13
+ /** String */
14
+ export let string: string = 'default';
15
+ /** String (required) */
16
+ export let stringRequired: string;
17
+ /** Number */
18
+ export let number: number = 123;
19
+ /** True literal */
20
+ export let trueLiteral: true | undefined = undefined;
21
+ /** Symbol */
22
+ export let symbol: symbol | undefined = undefined;
23
+ /** Null */
24
+ export let nullValue: null = null;
25
+ /** Undefined */
26
+ export let undefinedValue: undefined = undefined;
27
+ /** Any */
28
+ export let any: any = null;
29
+ /** Date */
30
+ export let date: Date = new Date('20 Jan 1983');
31
+ /** Array of numbers */
32
+ export let arrayOfNumbers: number[] = [1, 20, 300];
33
+ /** Enum */
34
+ export let enumValue: MyEnum = MyEnum.FOO;
35
+ /** Union of literal strings */
36
+ export let unionLiteralStrings: LiteralStrings = 'apple';
37
+ /** Union of literal numbers */
38
+ export let unionLiteralNumbers: LiteralNumbers = 1000;
39
+ /** Object */
40
+ export let object: MyObject | undefined = undefined;
41
+ /** Inline object */
42
+ export let inlineObject:
43
+ | {
44
+ foo: string;
45
+ bar: number;
46
+ }
47
+ | undefined = undefined;
48
+ /** Record */
49
+ export let record: Record<string, number> = { a: 1, b: 2 };
50
+ /** Union of types */
51
+ export let unionTypes: number | string = 123;
52
+ /** Intersection of types */
53
+ export let intersection: ({ a: number } & { b: string }) | undefined = undefined;
54
+ /** Event callback function */
55
+ export let func: (event: MouseEvent) => number = () => 10;
56
+ /** Snippet contents */
57
+ export let children: Snippet;
58
+ /** Actual arg types inferred from the component */
59
+ export let argTypes: Record<string, any> = {};
60
+ </script>
61
+
62
+ <h1>Docgen: TS - legacy</h1>
63
+
64
+ <h2>Args</h2>
65
+ <pre>{JSON.stringify(
66
+ {
67
+ boolean,
68
+ string,
69
+ stringRequired,
70
+ number,
71
+ trueLiteral,
72
+ symbol,
73
+ nullValue,
74
+ undefinedValue,
75
+ any,
76
+ date,
77
+ arrayOfNumbers,
78
+ enumValue,
79
+ unionLiteralStrings,
80
+ unionLiteralNumbers,
81
+ object,
82
+ inlineObject,
83
+ record,
84
+ unionTypes,
85
+ intersection,
86
+ func,
87
+ },
88
+ null,
89
+ 2
90
+ )}</pre>
91
+
92
+ <h2>Children</h2>
93
+ {#if children}
94
+ {@render children()}
95
+ {/if}
96
+
97
+ <h2>Arg Types</h2>
98
+ <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -0,0 +1,16 @@
1
+ import type { Meta } from '@storybook/svelte-vite';
2
+
3
+ import TSReferencedPropTypes from './ts-referenced-prop-types.svelte';
4
+
5
+ const meta = {
6
+ component: TSReferencedPropTypes,
7
+ tags: ['autodocs'],
8
+ render: (args, { argTypes }) => ({
9
+ Component: TSReferencedPropTypes,
10
+ props: { ...args, argTypes },
11
+ }),
12
+ } satisfies Meta<typeof TSReferencedPropTypes>;
13
+
14
+ export default meta;
15
+
16
+ export const Default = {};
@@ -0,0 +1,107 @@
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 PropsA = {
12
+ /** Boolean */
13
+ boolean?: boolean;
14
+ /** String */
15
+ string?: string;
16
+ /** String (required) */
17
+ stringRequired: string;
18
+ /** Number */
19
+ number?: number;
20
+ };
21
+ type PropsB = {
22
+ /** True literal */
23
+ trueLiteral?: true;
24
+ /** Symbol */
25
+ symbol?: symbol;
26
+ /** Null */
27
+ nullValue?: null;
28
+ /** Undefined */
29
+ undefinedValue?: undefined;
30
+ /** Any */
31
+ any?: any;
32
+ /** Date */
33
+ date?: Date;
34
+ /** Array of numbers */
35
+ arrayOfNumbers?: number[];
36
+ /** Enum */
37
+ enumValue?: MyEnum;
38
+ /** Union of literal strings */
39
+ unionLiteralStrings?: LiteralStrings;
40
+ /** Union of literal numbers */
41
+ unionLiteralNumbers?: LiteralNumbers;
42
+ /** Object */
43
+ object?: MyObject;
44
+ /** Inline object */
45
+ inlineObject?: {
46
+ foo: string;
47
+ bar: number;
48
+ };
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 };
55
+ /** Event callback function */
56
+ func?: (event: MouseEvent) => number;
57
+ /** Snippet contents */
58
+ children: Snippet;
59
+ /** Actual arg types inferred from the component */
60
+ argTypes: Record<string, any>;
61
+ };
62
+
63
+ let {
64
+ boolean = true,
65
+ string = 'default',
66
+ stringRequired,
67
+ number = 123,
68
+ nullValue = null,
69
+ arrayOfNumbers = [1, 20, 300],
70
+ enumValue = MyEnum.FOO,
71
+ record = { a: 1, b: 2 },
72
+ date = new Date('20 Jan 1983'),
73
+ unionTypes = 123,
74
+ children,
75
+ func = () => 10,
76
+ argTypes,
77
+ }: PropsA & PropsB = $props();
78
+ </script>
79
+
80
+ <h1>Docgen: TS - referenced prop types</h1>
81
+
82
+ <h2>Args</h2>
83
+ <pre>{JSON.stringify(
84
+ {
85
+ boolean,
86
+ string,
87
+ stringRequired,
88
+ number,
89
+ nullValue,
90
+ arrayOfNumbers,
91
+ enumValue,
92
+ record,
93
+ date,
94
+ unionTypes,
95
+ func,
96
+ },
97
+ null,
98
+ 2
99
+ )}</pre>
100
+
101
+ <h2>Children</h2>
102
+ {#if children}
103
+ {@render children()}
104
+ {/if}
105
+
106
+ <h2>Arg Types</h2>
107
+ <pre>{JSON.stringify(argTypes, null, 2)}</pre>
@@ -0,0 +1,16 @@
1
+ import type { Meta } from '@storybook/svelte-vite';
2
+
3
+ import TS from './ts.svelte';
4
+
5
+ const meta = {
6
+ component: TS,
7
+ tags: ['autodocs'],
8
+ render: (args, { argTypes }) => ({
9
+ Component: TS,
10
+ props: { ...args, argTypes },
11
+ }),
12
+ } satisfies Meta<typeof TS>;
13
+
14
+ export default meta;
15
+
16
+ export const Default = {};
@@ -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>
@@ -1,43 +0,0 @@
1
- import Button from './Button.svelte';
2
-
3
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
- export default {
5
- title: 'Example/Button',
6
- component: Button,
7
- tags: ['autodocs'],
8
- argTypes: {
9
- backgroundColor: { control: 'color' },
10
- size: {
11
- control: { type: 'select' },
12
- options: ['small', 'medium', 'large'],
13
- },
14
- },
15
- };
16
-
17
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
18
- export const Primary = {
19
- args: {
20
- primary: true,
21
- label: 'Button',
22
- },
23
- };
24
-
25
- export const Secondary = {
26
- args: {
27
- label: 'Button',
28
- },
29
- };
30
-
31
- export const Large = {
32
- args: {
33
- size: 'large',
34
- label: 'Button',
35
- },
36
- };
37
-
38
- export const Small = {
39
- args: {
40
- size: 'small',
41
- label: 'Button',
42
- },
43
- };
@@ -1,22 +0,0 @@
1
- import Header from './Header.svelte';
2
-
3
- export default {
4
- title: 'Example/Header',
5
- component: Header,
6
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
7
- tags: ['autodocs'],
8
- parameters: {
9
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
10
- layout: 'fullscreen',
11
- },
12
- };
13
-
14
- export const LoggedIn = {
15
- args: {
16
- user: {
17
- name: 'Jane Doe',
18
- },
19
- },
20
- };
21
-
22
- export const LoggedOut = {};
@@ -1,28 +0,0 @@
1
- import { expect, userEvent, waitFor, within } from '@storybook/test';
2
-
3
- import Page from './Page.svelte';
4
-
5
- export default {
6
- title: 'Example/Page',
7
- component: Page,
8
- parameters: {
9
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
10
- layout: 'fullscreen',
11
- },
12
- };
13
-
14
- export const LoggedOut = {};
15
-
16
- // More on component testing: https://storybook.js.org/docs/writing-tests/component-testing
17
- export const LoggedIn = {
18
- play: async ({ canvasElement }) => {
19
- const canvas = within(canvasElement);
20
- const loginButton = canvas.getByRole('button', { name: /Log in/i });
21
- await expect(loginButton).toBeInTheDocument();
22
- await userEvent.click(loginButton);
23
- await waitFor(() => expect(loginButton).not.toBeInTheDocument());
24
-
25
- const logoutButton = canvas.getByRole('button', { name: /Log out/i });
26
- await expect(logoutButton).toBeInTheDocument();
27
- },
28
- };
@@ -1,31 +0,0 @@
1
- <script module>
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Button from './Button.svelte';
4
- import { fn } from 'storybook/test';
5
-
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
- const { Story } = defineMeta({
8
- title: 'Example/Button',
9
- component: Button,
10
- tags: ['autodocs'],
11
- argTypes: {
12
- backgroundColor: { control: 'color' },
13
- size: {
14
- control: { type: 'select' },
15
- options: ['small', 'medium', 'large'],
16
- },
17
- },
18
- args: {
19
- onClick: fn(),
20
- }
21
- });
22
- </script>
23
-
24
- <!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args -->
25
- <Story name="Primary" args={{ primary: true, label: 'Button' }} />
26
-
27
- <Story name="Secondary" args={{ label: 'Button' }} />
28
-
29
- <Story name="Large" args={{ size: 'large', label: 'Button' }} />
30
-
31
- <Story name="Small" args={{ size: 'small', label: 'Button' }} />
@@ -1,26 +0,0 @@
1
- <script>
2
- import './button.css';
3
-
4
- /**
5
- * @typedef {Object} Props
6
- * @property {boolean} [primary] Is this the principal call to action on the page?
7
- * @property {string} [backgroundColor] What background color to use
8
- * @property {'small' | 'medium' | 'large'} [size] How large should the button be?
9
- * @property {string} label Button contents
10
- * @property {() => void} [onClick] The onclick event handler
11
- */
12
-
13
- /** @type {Props} */
14
- const { primary = false, backgroundColor, size = 'medium', label, onClick } = $props();
15
- </script>
16
-
17
- <button
18
- type="button"
19
- class={['storybook-button', `storybook-button--${size}`].join(' ')}
20
- class:storybook-button--primary={primary}
21
- class:storybook-button--secondary={!primary}
22
- style:background-color={backgroundColor}
23
- onclick={onClick}
24
- >
25
- {label}
26
- </button>
@@ -1,47 +0,0 @@
1
- <script>
2
- import './header.css';
3
- import Button from './Button.svelte';
4
-
5
- /**
6
- * @typedef {Object} Props
7
- * @property {{name: string}} [user] The user object
8
- * @property {() => void} [onLogin] The login event handler
9
- * @property {() => void} [onLogout] The logout event handler
10
- * @property {() => void} [onCreateAccount] The account creation event handler
11
- */
12
-
13
- /** @type {Props} */
14
- const { user, onLogin, onLogout, onCreateAccount } = $props();
15
- </script>
16
-
17
- <header>
18
- <div class="storybook-header">
19
- <div>
20
- <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
21
- <g fill="none" fill-rule="evenodd">
22
- <path
23
- d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
24
- fill="#FFF"
25
- />
26
- <path
27
- d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
28
- fill="#555AB9"
29
- />
30
- <path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
31
- </g>
32
- </svg>
33
- <h1>Acme</h1>
34
- </div>
35
- <div>
36
- {#if user}
37
- <span class="welcome">
38
- Welcome, <b>{user.name}</b>!
39
- </span>
40
- <Button size="small" onClick={onLogout} label="Log out" />
41
- {:else}
42
- <Button size="small" onClick={onLogin} label="Log in" />
43
- <Button primary size="small" onClick={onCreateAccount} label="Sign up" />
44
- {/if}
45
- </div>
46
- </div>
47
- </header>
@@ -1,70 +0,0 @@
1
- <script>
2
- import './page.css';
3
- import Header from './Header.svelte';
4
-
5
- let user = $state(null);
6
- </script>
7
-
8
- <article>
9
- <Header
10
- {user}
11
- onLogin={() => (user = { name: 'Jane Doe' })}
12
- onLogout={() => (user = null)}
13
- onCreateAccount={() => (user = { name: 'Jane Doe' })}
14
- />
15
-
16
- <section class="storybook-page">
17
- <h2>Pages in Storybook</h2>
18
- <p>
19
- We recommend building UIs with a
20
- <a
21
- href="https://blog.hichroma.com/component-driven-development-ce1109d56c8e"
22
- target="_blank"
23
- rel="noopener noreferrer"
24
- >
25
- <strong>component-driven</strong>
26
- </a>
27
- process starting with atomic components and ending with pages.
28
- </p>
29
- <p>
30
- Render pages with mock data. This makes it easy to build and review page states without
31
- needing to navigate to them in your app. Here are some handy patterns for managing page data
32
- in Storybook:
33
- </p>
34
- <ul>
35
- <li>
36
- Use a higher-level connected component. Storybook helps you compose such data from the
37
- "args" of child component stories
38
- </li>
39
- <li>
40
- Assemble data in the page component from your services. You can mock these services out
41
- using Storybook.
42
- </li>
43
- </ul>
44
- <p>
45
- Get a guided tutorial on component-driven development at
46
- <a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
47
- Storybook tutorials
48
- </a>
49
- . Read more in the
50
- <a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">docs</a>
51
- .
52
- </p>
53
- <div class="tip-wrapper">
54
- <span class="tip">Tip</span>
55
- Adjust the width of the canvas with the
56
- <svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
57
- <g fill="none" fill-rule="evenodd">
58
- <path
59
- d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0
60
- 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0
61
- 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
62
- id="a"
63
- fill="#999"
64
- />
65
- </g>
66
- </svg>
67
- Viewports addon in the toolbar
68
- </div>
69
- </section>
70
- </article>
@@ -1,45 +0,0 @@
1
- <script lang="ts">
2
- import './header.css';
3
- import Button from './Button.svelte';
4
-
5
- interface Props {
6
- user?: { name: string };
7
- onLogin?: () => void;
8
- onLogout?: () => void;
9
- onCreateAccount?: () => void;
10
- }
11
-
12
- const { user, onLogin, onLogout, onCreateAccount }: Props = $props();
13
- </script>
14
-
15
- <header>
16
- <div class="storybook-header">
17
- <div>
18
- <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
19
- <g fill="none" fill-rule="evenodd">
20
- <path
21
- d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
22
- fill="#FFF"
23
- />
24
- <path
25
- d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
26
- fill="#555AB9"
27
- />
28
- <path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
29
- </g>
30
- </svg>
31
- <h1>Acme</h1>
32
- </div>
33
- <div>
34
- {#if user}
35
- <span class="welcome">
36
- Welcome, <b>{user.name}</b>!
37
- </span>
38
- <Button size="small" onClick={onLogout} label="Log out" />
39
- {:else}
40
- <Button size="small" onClick={onLogin} label="Log in" />
41
- <Button primary size="small" onClick={onCreateAccount} label="Sign up" />
42
- {/if}
43
- </div>
44
- </div>
45
- </header>