@storybook/vue3 7.1.0-alpha.3 → 7.1.0-alpha.30
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/chunk-HSFPF76R.mjs +6 -0
- package/dist/config.d.ts +6 -17
- package/dist/config.js +25 -44
- package/dist/config.mjs +32 -43
- package/dist/index.d.ts +10 -11
- package/dist/index.js +1 -1
- package/dist/index.mjs +8 -1
- package/dist/render-32b7dd3f.d.ts +148 -0
- package/package.json +15 -14
- package/src/typings.d.ts +1 -0
- package/template/cli/js/Header.vue +1 -1
- package/template/cli/js/Page.vue +1 -1
- package/template/cli/ts-3-8/Header.vue +1 -1
- package/template/cli/ts-3-8/Page.vue +8 -5
- package/template/cli/ts-4-9/Header.vue +1 -1
- package/template/cli/ts-4-9/Page.vue +8 -5
- package/template/stories/preview.js +29 -4
- package/template/stories_vue3-vite-default-ts/BaseLayout.vue +18 -0
- package/template/stories_vue3-vite-default-ts/CustomRenderFunctionalComponent.stories.ts +32 -0
- package/template/stories_vue3-vite-default-ts/CustomRenderOptionsArgsFromData.stories.ts +45 -0
- package/template/stories_vue3-vite-default-ts/GlobalSetup.stories.ts +52 -0
- package/template/stories_vue3-vite-default-ts/GlobalSetup.vue +6 -0
- package/template/{stories/GlobalUsage.stories.js → stories_vue3-vite-default-ts/GlobalUsage.stories.ts} +1 -1
- package/template/stories_vue3-vite-default-ts/GlobalUsage.vue +3 -0
- package/template/stories_vue3-vite-default-ts/MySlotComponent.vue +12 -0
- package/template/{stories → stories_vue3-vite-default-ts}/OverrideArgs.stories.js +3 -1
- package/template/{stories → stories_vue3-vite-default-ts}/OverrideArgs.vue +3 -3
- package/template/stories_vue3-vite-default-ts/ReactiveArgs.stories.ts +137 -0
- package/template/stories_vue3-vite-default-ts/ReactiveDecorators.stories.ts +88 -0
- package/template/stories_vue3-vite-default-ts/ReactiveSlots.stories.ts +127 -0
- package/template/stories_vue3-vite-default-ts/Reactivity.vue +44 -0
- package/template/stories_vue3-vite-default-ts/ScopedSlots.stories.ts +81 -0
- package/template/stories_vue3-vite-default-ts/SourceDecorator.stories.ts +46 -0
- package/template/stories_vue3-vite-default-ts/decorators.stories.ts +84 -0
- package/template/stories_vue3-vite-default-ts/preview.ts +12 -0
- package/dist/chunk-2GDW2BFM.mjs +0 -1
- package/dist/render-c842c5d5.d.ts +0 -14
- package/template/stories/GlobalUsage.vue +0 -3
- package/template/stories/ReactiveArgs.stories.js +0 -44
- package/template/stories/decorators.stories.js +0 -66
- /package/template/{stories → stories_vue3-vite-default-ts}/ReactiveArgs.vue +0 -0
@@ -1,14 +0,0 @@
|
|
1
|
-
import { WebRenderer, ArgsStoryFn, RenderContext } from '@storybook/types';
|
2
|
-
import { ConcreteComponent } from 'vue';
|
3
|
-
|
4
|
-
type StoryFnVueReturnType = ConcreteComponent<any>;
|
5
|
-
interface VueRenderer extends WebRenderer {
|
6
|
-
component: Omit<ConcreteComponent<this['T']>, 'props'>;
|
7
|
-
storyResult: StoryFnVueReturnType;
|
8
|
-
}
|
9
|
-
|
10
|
-
declare const render: ArgsStoryFn<VueRenderer>;
|
11
|
-
declare const setup: (fn: (app: any) => void) => void;
|
12
|
-
declare function renderToCanvas({ storyFn, forceRemount, showMain, showException, storyContext }: RenderContext<VueRenderer>, canvasElement: VueRenderer['canvasElement']): () => void;
|
13
|
-
|
14
|
-
export { VueRenderer as V, renderToCanvas as a, render as r, setup as s };
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { expect } from '@storybook/jest';
|
2
|
-
import { global as globalThis } from '@storybook/global';
|
3
|
-
import { within, userEvent } from '@storybook/testing-library';
|
4
|
-
import { UPDATE_STORY_ARGS, STORY_ARGS_UPDATED, RESET_STORY_ARGS } from '@storybook/core-events';
|
5
|
-
import ReactiveArgs from './ReactiveArgs.vue';
|
6
|
-
|
7
|
-
export default {
|
8
|
-
component: ReactiveArgs,
|
9
|
-
argTypes: {
|
10
|
-
// To show that other props are passed through
|
11
|
-
backgroundColor: { control: 'color' },
|
12
|
-
},
|
13
|
-
};
|
14
|
-
|
15
|
-
export const ReactiveTest = {
|
16
|
-
args: {
|
17
|
-
label: 'Button',
|
18
|
-
},
|
19
|
-
// test that args are updated correctly in rective mode
|
20
|
-
play: async ({ canvasElement, id }) => {
|
21
|
-
const channel = globalThis.__STORYBOOK_ADDONS_CHANNEL__;
|
22
|
-
const canvas = within(canvasElement);
|
23
|
-
|
24
|
-
await channel.emit(RESET_STORY_ARGS, { storyId: id });
|
25
|
-
await new Promise((resolve) => {
|
26
|
-
channel.once(STORY_ARGS_UPDATED, resolve);
|
27
|
-
});
|
28
|
-
const reactiveButton = await canvas.getByRole('button');
|
29
|
-
await expect(reactiveButton).toHaveTextContent('Button 0');
|
30
|
-
|
31
|
-
await userEvent.click(reactiveButton); // click to update the label to increment the count + 1
|
32
|
-
await channel.emit(UPDATE_STORY_ARGS, {
|
33
|
-
storyId: id,
|
34
|
-
updatedArgs: { label: 'updated' },
|
35
|
-
});
|
36
|
-
await new Promise((resolve) => {
|
37
|
-
channel.once(STORY_ARGS_UPDATED, resolve);
|
38
|
-
});
|
39
|
-
await expect(canvas.getByRole('button')).toHaveTextContent('updated 1');
|
40
|
-
|
41
|
-
await userEvent.click(reactiveButton); // click to update the label to increment the count + 1
|
42
|
-
await expect(reactiveButton).toHaveTextContent('updated 2');
|
43
|
-
},
|
44
|
-
};
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { global as globalThis } from '@storybook/global';
|
2
|
-
import { h } from 'vue';
|
3
|
-
|
4
|
-
const { Button, Pre } = globalThis.Components;
|
5
|
-
|
6
|
-
export default {
|
7
|
-
component: Button,
|
8
|
-
};
|
9
|
-
|
10
|
-
export const ComponentTemplate = {
|
11
|
-
args: { label: 'With component' },
|
12
|
-
decorators: [
|
13
|
-
() => ({
|
14
|
-
components: {
|
15
|
-
Pre,
|
16
|
-
},
|
17
|
-
template: `
|
18
|
-
<Pre text="decorator" />
|
19
|
-
<story/>
|
20
|
-
`,
|
21
|
-
}),
|
22
|
-
],
|
23
|
-
};
|
24
|
-
|
25
|
-
export const SimpleTemplate = {
|
26
|
-
args: { label: 'With border' },
|
27
|
-
decorators: [
|
28
|
-
() => ({
|
29
|
-
template: `
|
30
|
-
<div style="border: 5px solid red;">
|
31
|
-
<story/>
|
32
|
-
</div>
|
33
|
-
`,
|
34
|
-
}),
|
35
|
-
],
|
36
|
-
};
|
37
|
-
|
38
|
-
export const VueWrapper = {
|
39
|
-
args: { label: 'With Vue wrapper' },
|
40
|
-
decorators: [
|
41
|
-
(storyFn) => {
|
42
|
-
// Call the `storyFn` to receive a component that Vue can render
|
43
|
-
const story = storyFn();
|
44
|
-
// Vue 3 "Functional" component as decorator
|
45
|
-
return () => {
|
46
|
-
return h('div', { style: 'border: 2px solid blue' }, h(story));
|
47
|
-
};
|
48
|
-
},
|
49
|
-
],
|
50
|
-
};
|
51
|
-
|
52
|
-
export const DynamicWrapper = {
|
53
|
-
args: { label: 'With dynamic wrapper', primary: true },
|
54
|
-
argTypes: {
|
55
|
-
// Number type is detected, but we still want to constrain the range from 1-6
|
56
|
-
level: { control: { type: 'range', min: 1, max: 6 } },
|
57
|
-
},
|
58
|
-
decorators: [
|
59
|
-
(storyFn, { args }) => ({
|
60
|
-
template: `<div :style="{ borderWidth: level, borderColor: 'red', borderStyle: 'solid' }"><story /></div>`,
|
61
|
-
data() {
|
62
|
-
return { level: `${args.level}px` };
|
63
|
-
},
|
64
|
-
}),
|
65
|
-
],
|
66
|
-
};
|
File without changes
|