@storybook/web-components 11.0.0-beta.0 → 11.0.0-beta.2
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.
- package/dist/_browser-chunks/chunk-MWWF5KJS.js +326 -0
- package/dist/_browser-chunks/{chunk-4CVRUPXU.js → chunk-TBDFGSWB.js} +1 -1
- package/dist/_node-chunks/{chunk-5M5RLD63.js → chunk-5SMBZEFE.js} +10 -22
- package/dist/_node-chunks/{chunk-Z6DDEEJW.js → chunk-M3JM7VKZ.js} +31 -7
- package/dist/docgen/docgen-worker.js +8 -8
- package/dist/docgen/index.js +8 -8
- package/dist/entry-preview-argtypes.js +2 -2
- package/dist/entry-preview-docs.js +1 -1
- package/dist/index.js +2 -2
- package/dist/preset.js +455 -739
- package/package.json +2 -2
- package/template/cli/js/Button.stories.js +11 -10
- package/template/cli/js/Header.stories.js +8 -5
- package/template/cli/js/Page.stories.js +9 -8
- package/template/cli/ts/Button.stories.ts +11 -14
- package/template/cli/ts/Header.stories.ts +8 -9
- package/template/cli/ts/Page.stories.ts +9 -12
- package/dist/_browser-chunks/chunk-EGBR6PF2.js +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/web-components",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.2",
|
|
4
4
|
"description": "Storybook Web Components renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"lit": "^2.0.0 || ^3.0.0",
|
|
77
|
-
"storybook": "^11.0.0-beta.
|
|
77
|
+
"storybook": "^11.0.0-beta.2",
|
|
78
78
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
79
79
|
},
|
|
80
80
|
"publishConfig": {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import { fn } from 'storybook/test';
|
|
2
3
|
|
|
3
4
|
import { Button } from './Button';
|
|
4
5
|
|
|
5
6
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
-
|
|
7
|
+
const meta = preview.meta({
|
|
7
8
|
title: 'Example/Button',
|
|
8
9
|
tags: ['autodocs'],
|
|
9
10
|
render: (args) => Button(args),
|
|
@@ -15,32 +16,32 @@ export default {
|
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
args: { onClick: fn() },
|
|
18
|
-
};
|
|
19
|
+
});
|
|
19
20
|
|
|
20
21
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
21
|
-
export const Primary = {
|
|
22
|
+
export const Primary = meta.story({
|
|
22
23
|
args: {
|
|
23
24
|
primary: true,
|
|
24
25
|
label: 'Button',
|
|
25
26
|
},
|
|
26
|
-
};
|
|
27
|
+
});
|
|
27
28
|
|
|
28
|
-
export const Secondary = {
|
|
29
|
+
export const Secondary = meta.story({
|
|
29
30
|
args: {
|
|
30
31
|
label: 'Button',
|
|
31
32
|
},
|
|
32
|
-
};
|
|
33
|
+
});
|
|
33
34
|
|
|
34
|
-
export const Large = {
|
|
35
|
+
export const Large = meta.story({
|
|
35
36
|
args: {
|
|
36
37
|
size: 'large',
|
|
37
38
|
label: 'Button',
|
|
38
39
|
},
|
|
39
|
-
};
|
|
40
|
+
});
|
|
40
41
|
|
|
41
|
-
export const Small = {
|
|
42
|
+
export const Small = meta.story({
|
|
42
43
|
args: {
|
|
43
44
|
size: 'small',
|
|
44
45
|
label: 'Button',
|
|
45
46
|
},
|
|
46
|
-
};
|
|
47
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import { fn } from 'storybook/test';
|
|
2
3
|
|
|
3
4
|
import { Header } from './Header';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = preview.meta({
|
|
6
7
|
title: 'Example/Header',
|
|
7
8
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/web-components/vue/writing-docs/autodocs
|
|
8
9
|
tags: ['autodocs'],
|
|
@@ -12,13 +13,15 @@ export default {
|
|
|
12
13
|
onLogout: fn(),
|
|
13
14
|
onCreateAccount: fn(),
|
|
14
15
|
},
|
|
15
|
-
};
|
|
16
|
-
export const LoggedIn = {
|
|
16
|
+
});
|
|
17
|
+
export const LoggedIn = meta.story({
|
|
17
18
|
args: {
|
|
18
19
|
user: {
|
|
19
20
|
name: 'Jane Doe',
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
|
-
};
|
|
23
|
+
});
|
|
23
24
|
|
|
24
|
-
export const LoggedOut = {
|
|
25
|
+
export const LoggedOut = meta.story({
|
|
26
|
+
args: {},
|
|
27
|
+
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
1
2
|
import * as HeaderStories from './Header.stories';
|
|
2
3
|
import { Page } from './Page';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const meta = preview.meta({
|
|
5
6
|
title: 'Example/Page',
|
|
6
7
|
render: (args) => Page(args),
|
|
7
|
-
};
|
|
8
|
+
});
|
|
8
9
|
|
|
9
|
-
export const LoggedIn = {
|
|
10
|
+
export const LoggedIn = meta.story({
|
|
10
11
|
args: {
|
|
11
12
|
// More on composing args: https://storybook.js.org/docs/writing-stories/args#args-composition
|
|
12
|
-
...HeaderStories.LoggedIn.args,
|
|
13
|
+
...HeaderStories.LoggedIn.input.args,
|
|
13
14
|
},
|
|
14
|
-
};
|
|
15
|
+
});
|
|
15
16
|
|
|
16
|
-
export const LoggedOut = {
|
|
17
|
+
export const LoggedOut = meta.story({
|
|
17
18
|
args: {
|
|
18
|
-
...HeaderStories.LoggedOut.args,
|
|
19
|
+
...HeaderStories.LoggedOut.input.args,
|
|
19
20
|
},
|
|
20
|
-
};
|
|
21
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import type { ButtonProps } from './Button';
|
|
|
6
6
|
import { Button } from './Button';
|
|
7
7
|
|
|
8
8
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
9
|
-
const meta = {
|
|
9
|
+
const meta = preview.type<{ args: ButtonProps }>().meta({
|
|
10
10
|
title: 'Example/Button',
|
|
11
11
|
tags: ['autodocs'],
|
|
12
12
|
render: (args) => Button(args),
|
|
@@ -18,35 +18,32 @@ const meta = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
args: { onClick: fn() },
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<ButtonProps>;
|
|
21
|
+
});
|
|
25
22
|
|
|
26
23
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
27
|
-
export const Primary
|
|
24
|
+
export const Primary = meta.story({
|
|
28
25
|
args: {
|
|
29
26
|
primary: true,
|
|
30
27
|
label: 'Button',
|
|
31
28
|
},
|
|
32
|
-
};
|
|
29
|
+
});
|
|
33
30
|
|
|
34
|
-
export const Secondary
|
|
31
|
+
export const Secondary = meta.story({
|
|
35
32
|
args: {
|
|
36
33
|
label: 'Button',
|
|
37
34
|
},
|
|
38
|
-
};
|
|
35
|
+
});
|
|
39
36
|
|
|
40
|
-
export const Large
|
|
37
|
+
export const Large = meta.story({
|
|
41
38
|
args: {
|
|
42
39
|
size: 'large',
|
|
43
40
|
label: 'Button',
|
|
44
41
|
},
|
|
45
|
-
};
|
|
42
|
+
});
|
|
46
43
|
|
|
47
|
-
export const Small
|
|
44
|
+
export const Small = meta.story({
|
|
48
45
|
args: {
|
|
49
46
|
size: 'small',
|
|
50
47
|
label: 'Button',
|
|
51
48
|
},
|
|
52
|
-
};
|
|
49
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
|
|
5
5
|
import type { HeaderProps } from './Header';
|
|
6
6
|
import { Header } from './Header';
|
|
7
7
|
|
|
8
|
-
const meta = {
|
|
8
|
+
const meta = preview.type<{ args: HeaderProps }>().meta({
|
|
9
9
|
title: 'Example/Header',
|
|
10
10
|
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
11
|
tags: ['autodocs'],
|
|
@@ -15,17 +15,16 @@ const meta = {
|
|
|
15
15
|
onLogout: fn(),
|
|
16
16
|
onCreateAccount: fn(),
|
|
17
17
|
},
|
|
18
|
-
}
|
|
18
|
+
});
|
|
19
19
|
|
|
20
|
-
export
|
|
21
|
-
type Story = StoryObj<HeaderProps>;
|
|
22
|
-
|
|
23
|
-
export const LoggedIn: Story = {
|
|
20
|
+
export const LoggedIn = meta.story({
|
|
24
21
|
args: {
|
|
25
22
|
user: {
|
|
26
23
|
name: 'Jane Doe',
|
|
27
24
|
},
|
|
28
25
|
},
|
|
29
|
-
};
|
|
26
|
+
});
|
|
30
27
|
|
|
31
|
-
export const LoggedOut
|
|
28
|
+
export const LoggedOut = meta.story({
|
|
29
|
+
args: {},
|
|
30
|
+
});
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import preview from '../../.storybook/preview';
|
|
2
2
|
|
|
3
3
|
import * as HeaderStories from './Header.stories';
|
|
4
4
|
import type { PageProps } from './Page';
|
|
5
5
|
import { Page } from './Page';
|
|
6
6
|
|
|
7
|
-
const meta = {
|
|
7
|
+
const meta = preview.type<{ args: PageProps }>().meta({
|
|
8
8
|
title: 'Example/Page',
|
|
9
9
|
render: (args: PageProps) => Page(args),
|
|
10
|
-
}
|
|
10
|
+
});
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
type Story = StoryObj<PageProps>;
|
|
14
|
-
|
|
15
|
-
export const LoggedIn: Story = {
|
|
12
|
+
export const LoggedIn = meta.story({
|
|
16
13
|
args: {
|
|
17
14
|
// More on composing args: https://storybook.js.org/docs/writing-stories/args#args-composition
|
|
18
|
-
...HeaderStories.LoggedIn.args,
|
|
15
|
+
...HeaderStories.LoggedIn.input.args,
|
|
19
16
|
},
|
|
20
|
-
};
|
|
17
|
+
});
|
|
21
18
|
|
|
22
|
-
export const LoggedOut
|
|
19
|
+
export const LoggedOut = meta.story({
|
|
23
20
|
args: {
|
|
24
|
-
...HeaderStories.LoggedOut.args,
|
|
21
|
+
...HeaderStories.LoggedOut.input.args,
|
|
25
22
|
},
|
|
26
|
-
};
|
|
23
|
+
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-4BE7D4DS.js";
|
|
4
|
-
|
|
5
|
-
// src/entry-preview-docs.ts
|
|
6
|
-
var entry_preview_docs_exports = {};
|
|
7
|
-
__export(entry_preview_docs_exports, {
|
|
8
|
-
decorators: () => decorators,
|
|
9
|
-
parameters: () => parameters
|
|
10
|
-
});
|
|
11
|
-
import { SourceType as SourceType2 } from "storybook/internal/docs-tools";
|
|
12
|
-
|
|
13
|
-
// src/docs/sourceDecorator.ts
|
|
14
|
-
import { SourceType } from "storybook/internal/docs-tools";
|
|
15
|
-
import { render } from "lit";
|
|
16
|
-
import { emitTransformCode, useEffect } from "storybook/preview-api";
|
|
17
|
-
var LIT_EXPRESSION_COMMENTS = /<!--\?lit\$[0-9]+\$-->|<!--\??-->/g;
|
|
18
|
-
function skipSourceRender(context) {
|
|
19
|
-
let sourceParams = context?.parameters.docs?.source, isArgsStory = context?.parameters.__isArgsStory;
|
|
20
|
-
return sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
|
|
21
|
-
}
|
|
22
|
-
function renderStorySource(storyResult) {
|
|
23
|
-
let container = window.document.createElement("div");
|
|
24
|
-
return storyResult instanceof DocumentFragment ? render(storyResult.cloneNode(!0), container) : render(storyResult, container), container.innerHTML.replace(LIT_EXPRESSION_COMMENTS, "");
|
|
25
|
-
}
|
|
26
|
-
function sourceDecorator(storyFn, context) {
|
|
27
|
-
let story = storyFn(), renderedForSource = context?.parameters.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context) : story, source;
|
|
28
|
-
return useEffect(() => {
|
|
29
|
-
source && emitTransformCode(source, context);
|
|
30
|
-
}), skipSourceRender(context) || (source = renderStorySource(renderedForSource)), story;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/entry-preview-docs.ts
|
|
34
|
-
var useStaticServiceSnippets = "FEATURES" in globalThis && globalThis.FEATURES?.docgenServer, decorators = useStaticServiceSnippets ? [] : [sourceDecorator], parameters = {
|
|
35
|
-
docs: {
|
|
36
|
-
source: {
|
|
37
|
-
type: SourceType2.DYNAMIC,
|
|
38
|
-
language: "html"
|
|
39
|
-
},
|
|
40
|
-
story: { inline: !0 }
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
decorators,
|
|
46
|
-
parameters,
|
|
47
|
-
entry_preview_docs_exports
|
|
48
|
-
};
|