@storybook/vue3 7.6.0-beta.2 → 8.0.0-alpha.0

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.
@@ -0,0 +1,5 @@
1
+ import { h, createApp, reactive, isVNode, isReactive } from 'vue';
2
+
3
+ var render=(props,context)=>{let{id,component:Component}=context;if(!Component)throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);return ()=>h(Component,props,getSlots(props,context))},setup=fn=>{globalThis.PLUGINS_SETUP_FUNCTIONS??=new Set,globalThis.PLUGINS_SETUP_FUNCTIONS.add(fn);},runSetupFunctions=async(app,storyContext)=>{globalThis&&globalThis.PLUGINS_SETUP_FUNCTIONS&&await Promise.all([...globalThis.PLUGINS_SETUP_FUNCTIONS].map(fn=>fn(app,storyContext)));},map=new Map;async function renderToCanvas({storyFn,forceRemount,showMain,showException,storyContext,id},canvasElement){let existingApp=map.get(canvasElement);if(existingApp&&!forceRemount){let element=storyFn(),args=getArgs(element,storyContext);return updateArgs(existingApp.reactiveArgs,args),()=>{teardown(existingApp.vueApp,canvasElement);}}existingApp&&forceRemount&&teardown(existingApp.vueApp,canvasElement);let vueApp=createApp({setup(){storyContext.args=reactive(storyContext.args);let rootElement=storyFn(),args=getArgs(rootElement,storyContext),appState={vueApp,reactiveArgs:reactive(args)};return map.set(canvasElement,appState),()=>h(rootElement)}});return vueApp.config.errorHandler=e=>showException(e),await runSetupFunctions(vueApp,storyContext),vueApp.mount(canvasElement),showMain(),()=>{teardown(vueApp,canvasElement);}}function getSlots(props,context){let{argTypes}=context,slots=Object.entries(props).filter(([key])=>argTypes[key]?.table?.category==="slots").map(([key,value])=>[key,typeof value=="function"?value:()=>value]);return Object.fromEntries(slots)}function getArgs(element,storyContext){return element.props&&isVNode(element)?element.props:storyContext.args}function updateArgs(reactiveArgs,nextArgs){if(Object.keys(nextArgs).length===0)return;let currentArgs=isReactive(reactiveArgs)?reactiveArgs:reactive(reactiveArgs);Object.keys(currentArgs).forEach(key=>{key in nextArgs||delete currentArgs[key];}),Object.assign(currentArgs,nextArgs);}function teardown(storybookApp,canvasElement){storybookApp?.unmount(),map.has(canvasElement)&&map.delete(canvasElement);}
4
+
5
+ export { render, renderToCanvas, setup };
@@ -1,5 +1,7 @@
1
- export { decorateStory as applyDecorators, render, renderToCanvas } from './chunk-UXHY756F.mjs';
1
+ export { render, renderToCanvas } from './chunk-OTMFLEOE.mjs';
2
+ import { h } from 'vue';
3
+ import { sanitizeStoryContextUpdate } from '@storybook/preview-api';
2
4
 
3
- var parameters={renderer:"vue3"};
5
+ function normalizeFunctionalComponent(options){return typeof options=="function"?{render:options,name:options.name}:options}function prepare(rawStory,innerStory){let story=rawStory;return story===null?null:typeof story=="function"?story:innerStory?{...normalizeFunctionalComponent(story),components:{...story.components||{},story:innerStory}}:{render(){return h(story)}}}function decorateStory(storyFn,decorators){return decorators.reduce((decorated,decorator)=>context=>{let story,decoratedStory=decorator(update=>{let sanitizedUpdate=sanitizeStoryContextUpdate(update);return update&&(sanitizedUpdate.args=Object.assign(context.args,sanitizedUpdate.args)),story=decorated({...context,...sanitizedUpdate}),story},context);return story||(story=decorated(context)),decoratedStory===story?story:prepare(decoratedStory,()=>h(story))},context=>prepare(storyFn(context)))}var parameters={renderer:"vue3"};
4
6
 
5
- export { parameters };
7
+ export { decorateStory as applyDecorators, parameters };
package/dist/index.d.ts CHANGED
@@ -1,23 +1,10 @@
1
- import * as _storybook_types from '@storybook/types';
2
- import { Addon_ClientStoryApi, Addon_Loadable, Args, ComponentAnnotations, AnnotatedStoryFn, ArgsStoryFn, ArgsFromMeta, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations } from '@storybook/types';
1
+ export { s as setup } from './render-18d12fa7.js';
2
+ import { Args, ComponentAnnotations, AnnotatedStoryFn, ArgsStoryFn, ArgsFromMeta, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations } from '@storybook/types';
3
3
  export { ArgTypes, Args, Parameters, StrictArgs } from '@storybook/types';
4
- import { App, FunctionalComponent, VNodeChild } from 'vue';
5
- import { V as VueRenderer } from './types-ad933ac1.js';
6
4
  import { Simplify, SetOptional, Constructor, RemoveIndexSignature } from 'type-fest';
5
+ import { FunctionalComponent, VNodeChild } from 'vue';
7
6
  import { ComponentProps, ComponentSlots } from 'vue-component-type-helpers';
8
- export { s as setup } from './render-18d12fa7.js';
9
-
10
- interface ClientApi extends Addon_ClientStoryApi<VueRenderer['storyResult']> {
11
- configure(loader: Addon_Loadable, module: NodeModule): void;
12
- forceReRender(): void;
13
- raw: () => any;
14
- load: (...args: any[]) => void;
15
- app: App;
16
- }
17
- declare const storiesOf: ClientApi['storiesOf'];
18
- declare const configure: ClientApi['configure'];
19
- declare const forceReRender: () => void;
20
- declare const raw: ((...args: any[]) => never) | (() => _storybook_types.BoundStory<VueRenderer>[] | undefined);
7
+ import { V as VueRenderer } from './types-ad933ac1.js';
21
8
 
22
9
  /**
23
10
  * Metadata to configure the stories for a component.
@@ -62,4 +49,4 @@ type Loader<TArgs = StrictArgs> = LoaderFunction<VueRenderer, TArgs>;
62
49
  type StoryContext<TArgs = StrictArgs> = StoryContext$1<VueRenderer, TArgs>;
63
50
  type Preview = ProjectAnnotations<VueRenderer>;
64
51
 
65
- export { ComponentPropsAndSlots, Decorator, Loader, Meta, Preview, Story, StoryContext, StoryFn, StoryObj, VueRenderer, configure, forceReRender, raw, storiesOf };
52
+ export { ComponentPropsAndSlots, Decorator, Loader, Meta, Preview, Story, StoryContext, StoryFn, StoryObj, VueRenderer };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{configure:()=>configure,forceReRender:()=>forceReRender,raw:()=>raw,setup:()=>setup,storiesOf:()=>storiesOf});module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow.STORYBOOK_ENV="vue3";globalWindow.PLUGINS_SETUP_FUNCTIONS||=new Set;var import_preview_api2=require("@storybook/preview-api");var import_vue=require("vue"),import_preview_api=require("@storybook/preview-api");function normalizeFunctionalComponent(options){return typeof options=="function"?{render:options,name:options.name}:options}function prepare(rawStory,innerStory){let story=rawStory;return story===null?null:typeof story=="function"?story:innerStory?{...normalizeFunctionalComponent(story),components:{...story.components||{},story:innerStory}}:{render(){return(0,import_vue.h)(story)}}}function decorateStory(storyFn,decorators){return decorators.reduce((decorated,decorator)=>context=>{let story,decoratedStory=decorator(update=>{let sanitizedUpdate=(0,import_preview_api.sanitizeStoryContextUpdate)(update);return update&&(sanitizedUpdate.args=Object.assign(context.args,sanitizedUpdate.args)),story=decorated({...context,...sanitizedUpdate}),story},context);return story||(story=decorated(context)),decoratedStory===story?story:prepare(decoratedStory,()=>(0,import_vue.h)(story))},context=>prepare(storyFn(context)))}var import_vue2=require("vue"),render=(props,context)=>{let{id,component:Component}=context;if(!Component)throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);return()=>(0,import_vue2.h)(Component,props,getSlots(props,context))},setup=fn=>{globalThis.PLUGINS_SETUP_FUNCTIONS??=new Set,globalThis.PLUGINS_SETUP_FUNCTIONS.add(fn)},runSetupFunctions=async(app,storyContext)=>{globalThis&&globalThis.PLUGINS_SETUP_FUNCTIONS&&await Promise.all([...globalThis.PLUGINS_SETUP_FUNCTIONS].map(fn=>fn(app,storyContext)))},map=new Map;async function renderToCanvas({storyFn,forceRemount,showMain,showException,storyContext,id},canvasElement){let existingApp=map.get(canvasElement);if(existingApp&&!forceRemount){let element=storyFn(),args=getArgs(element,storyContext);return updateArgs(existingApp.reactiveArgs,args),()=>{teardown(existingApp.vueApp,canvasElement)}}existingApp&&forceRemount&&teardown(existingApp.vueApp,canvasElement);let vueApp=(0,import_vue2.createApp)({setup(){storyContext.args=(0,import_vue2.reactive)(storyContext.args);let rootElement=storyFn(),args=getArgs(rootElement,storyContext),appState={vueApp,reactiveArgs:(0,import_vue2.reactive)(args)};return map.set(canvasElement,appState),()=>(0,import_vue2.h)(rootElement)}});return vueApp.config.errorHandler=e=>showException(e),await runSetupFunctions(vueApp,storyContext),vueApp.mount(canvasElement),showMain(),()=>{teardown(vueApp,canvasElement)}}function getSlots(props,context){let{argTypes}=context,slots=Object.entries(props).filter(([key])=>{var _a2,_b;return((_b=(_a2=argTypes[key])==null?void 0:_a2.table)==null?void 0:_b.category)==="slots"}).map(([key,value])=>[key,typeof value=="function"?value:()=>value]);return Object.fromEntries(slots)}function getArgs(element,storyContext){return element.props&&(0,import_vue2.isVNode)(element)?element.props:storyContext.args}function updateArgs(reactiveArgs,nextArgs){if(Object.keys(nextArgs).length===0)return;let currentArgs=(0,import_vue2.isReactive)(reactiveArgs)?reactiveArgs:(0,import_vue2.reactive)(reactiveArgs);Object.keys(currentArgs).forEach(key=>{key in nextArgs||delete currentArgs[key]}),Object.assign(currentArgs,nextArgs)}function teardown(storybookApp,canvasElement){storybookApp==null||storybookApp.unmount(),map.has(canvasElement)&&map.delete(canvasElement)}var RENDERER="vue3",api=(0,import_preview_api2.start)(renderToCanvas,{decorateStory,render}),storiesOf=(kind,m)=>api.clientApi.storiesOf(kind,m).addParameters({renderer:RENDERER}),configure=(...args)=>api.configure(RENDERER,...args),{forceReRender}=api,{raw}=api.clientApi;var _a;try{(_a=module==null?void 0:module.hot)!=null&&_a.decline&&module.hot.decline()}catch{}0&&(module.exports={configure,forceReRender,raw,setup,storiesOf});
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{setup:()=>setup});module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow.STORYBOOK_ENV="vue3";globalWindow.PLUGINS_SETUP_FUNCTIONS||=new Set;var import_vue=require("vue");var setup=fn=>{globalThis.PLUGINS_SETUP_FUNCTIONS??=new Set,globalThis.PLUGINS_SETUP_FUNCTIONS.add(fn)};var _a;try{(_a=module==null?void 0:module.hot)!=null&&_a.decline&&module.hot.decline()}catch{}0&&(module.exports={setup});
package/dist/index.mjs CHANGED
@@ -1,8 +1,4 @@
1
- import { renderToCanvas, decorateStory, render } from './chunk-UXHY756F.mjs';
2
- export { setup } from './chunk-UXHY756F.mjs';
1
+ export { setup } from './chunk-OTMFLEOE.mjs';
3
2
  import { global } from '@storybook/global';
4
- import { start } from '@storybook/preview-api';
5
3
 
6
- var{window:globalWindow}=global;globalWindow.STORYBOOK_ENV="vue3";globalWindow.PLUGINS_SETUP_FUNCTIONS||=new Set;var RENDERER="vue3",api=start(renderToCanvas,{decorateStory,render}),storiesOf=(kind,m)=>api.clientApi.storiesOf(kind,m).addParameters({renderer:RENDERER}),configure=(...args)=>api.configure(RENDERER,...args),{forceReRender}=api,{raw}=api.clientApi;try{module?.hot?.decline&&module.hot.decline();}catch{}
7
-
8
- export { configure, forceReRender, raw, storiesOf };
4
+ var{window:globalWindow}=global;globalWindow.STORYBOOK_ENV="vue3";globalWindow.PLUGINS_SETUP_FUNCTIONS||=new Set;try{module?.hot?.decline&&module.hot.decline();}catch{}
package/dist/preset.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { StorybookConfig } from '@storybook/types';
1
+ import { PresetProperty } from '@storybook/types';
2
2
 
3
- declare const previewAnnotations: StorybookConfig['previewAnnotations'];
3
+ declare const previewAnnotations: PresetProperty<'previewAnnotations'>;
4
4
 
5
5
  export { previewAnnotations };
package/dist/preset.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{previewAnnotations:()=>previewAnnotations});module.exports=__toCommonJS(preset_exports);var import_path=require("path"),previewAnnotations=async(input,options)=>{let docsEnabled=Object.keys(await options.presets.apply("docs",{},options)).length>0;return[].concat(input).concat([(0,import_path.join)(__dirname,"entry-preview.mjs")]).concat(docsEnabled?[(0,import_path.join)(__dirname,"entry-preview-docs.mjs")]:[])};0&&(module.exports={previewAnnotations});
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{previewAnnotations:()=>previewAnnotations});module.exports=__toCommonJS(preset_exports);var import_path=require("path"),previewAnnotations=async(input=[],options)=>{let docsEnabled=Object.keys(await options.presets.apply("docs",{},options)).length>0;return[].concat(input).concat([(0,import_path.join)(__dirname,"entry-preview.mjs")]).concat(docsEnabled?[(0,import_path.join)(__dirname,"entry-preview-docs.mjs")]:[])};0&&(module.exports={previewAnnotations});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/vue3",
3
- "version": "7.6.0-beta.2",
3
+ "version": "8.0.0-alpha.0",
4
4
  "description": "Storybook Vue 3 renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -47,11 +47,10 @@
47
47
  "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
48
48
  },
49
49
  "dependencies": {
50
- "@storybook/core-client": "7.6.0-beta.2",
51
- "@storybook/docs-tools": "7.6.0-beta.2",
50
+ "@storybook/docs-tools": "8.0.0-alpha.0",
52
51
  "@storybook/global": "^5.0.0",
53
- "@storybook/preview-api": "7.6.0-beta.2",
54
- "@storybook/types": "7.6.0-beta.2",
52
+ "@storybook/preview-api": "8.0.0-alpha.0",
53
+ "@storybook/types": "8.0.0-alpha.0",
55
54
  "lodash": "^4.17.21",
56
55
  "ts-dedent": "^2.0.0",
57
56
  "type-fest": "~2.19",
@@ -63,7 +62,7 @@
63
62
  "@vue/compiler-core": "^3.3.4",
64
63
  "@vue/vue3-jest": "29",
65
64
  "babel-jest": "^29.7.0",
66
- "typescript": "~4.9.3",
65
+ "typescript": "^5.3.2",
67
66
  "vue": "^3.2.47",
68
67
  "vue-tsc": "latest"
69
68
  },
@@ -1,6 +1,6 @@
1
1
  import MyButton from './Button.vue';
2
2
 
3
- // More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction
3
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
4
  export default {
5
5
  title: 'Example/Button',
6
6
  component: MyButton,
@@ -19,7 +19,7 @@ export default {
19
19
  },
20
20
  };
21
21
 
22
- // More on writing stories with args: https://storybook.js.org/docs/vue/writing-stories/args
22
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
23
23
  export const Primary = {
24
24
  args: {
25
25
  primary: true,
@@ -3,7 +3,7 @@ import MyHeader from './Header.vue';
3
3
  export default {
4
4
  title: 'Example/Header',
5
5
  component: MyHeader,
6
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
6
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
7
7
  tags: ['autodocs'],
8
8
  render: (args) => ({
9
9
  // Components used in your story `template` are defined in the `components` object
@@ -21,7 +21,7 @@ export default {
21
21
  template: '<my-header :user="user" />',
22
22
  }),
23
23
  parameters: {
24
- // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout
24
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
25
25
  layout: 'fullscreen',
26
26
  },
27
27
  };
@@ -5,14 +5,14 @@ export default {
5
5
  title: 'Example/Page',
6
6
  component: MyPage,
7
7
  parameters: {
8
- // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout
8
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
9
9
  layout: 'fullscreen',
10
10
  },
11
11
  };
12
12
 
13
13
  export const LoggedOut = {};
14
14
 
15
- // More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing
15
+ // More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
16
16
  export const LoggedIn = {
17
17
  render: () => ({
18
18
  components: {
@@ -2,11 +2,11 @@ import type { Meta, StoryObj } from '@storybook/vue3';
2
2
 
3
3
  import Button from './Button.vue';
4
4
 
5
- // More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction
5
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
6
6
  const meta: Meta<typeof Button> = {
7
7
  title: 'Example/Button',
8
8
  component: Button,
9
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
9
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
10
10
  tags: ['autodocs'],
11
11
  argTypes: {
12
12
  size: { control: 'select', options: ['small', 'medium', 'large'] },
@@ -20,7 +20,7 @@ export default meta;
20
20
  type Story = StoryObj<typeof Button>;
21
21
  /*
22
22
  *👇 Render functions are a framework specific feature to allow you control on how the component renders.
23
- * See https://storybook.js.org/docs/vue/api/csf
23
+ * See https://storybook.js.org/docs/api/csf
24
24
  * to learn how to use render functions.
25
25
  */
26
26
  export const Primary: Story = {
@@ -4,7 +4,7 @@ import MyHeader from './Header.vue';
4
4
 
5
5
  const meta: Meta<typeof MyHeader> = {
6
6
  /* 👇 The title prop is optional.
7
- * See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
7
+ * See https://storybook.js.org/docs/configure/#configure-story-loading
8
8
  * to learn how to generate automatic titles
9
9
  */
10
10
  title: 'Example/Header',
@@ -17,10 +17,10 @@ const meta: Meta<typeof MyHeader> = {
17
17
  template: '<my-header :user="args.user" />',
18
18
  }),
19
19
  parameters: {
20
- // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
20
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
21
21
  layout: 'fullscreen',
22
22
  },
23
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
23
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
24
24
  tags: ['autodocs'],
25
25
  };
26
26
 
@@ -10,17 +10,17 @@ const meta: Meta<typeof MyPage> = {
10
10
  template: '<my-page />',
11
11
  }),
12
12
  parameters: {
13
- // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout
13
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
14
14
  layout: 'fullscreen',
15
15
  },
16
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
16
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
17
17
  tags: ['autodocs'],
18
18
  };
19
19
 
20
20
  export default meta;
21
21
  type Story = StoryObj<typeof MyPage>;
22
22
 
23
- // More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing
23
+ // More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
24
24
  export const LoggedIn: Story = {
25
25
  play: async ({ canvasElement }: any) => {
26
26
  const canvas = within(canvasElement);
@@ -2,11 +2,11 @@ import type { Meta, StoryObj } from '@storybook/vue3';
2
2
 
3
3
  import Button from './Button.vue';
4
4
 
5
- // More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction
5
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
6
6
  const meta = {
7
7
  title: 'Example/Button',
8
8
  component: Button,
9
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
9
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
10
10
  tags: ['autodocs'],
11
11
  argTypes: {
12
12
  size: { control: 'select', options: ['small', 'medium', 'large'] },
@@ -20,7 +20,7 @@ export default meta;
20
20
  type Story = StoryObj<typeof meta>;
21
21
  /*
22
22
  *👇 Render functions are a framework specific feature to allow you control on how the component renders.
23
- * See https://storybook.js.org/docs/vue/api/csf
23
+ * See https://storybook.js.org/docs/api/csf
24
24
  * to learn how to use render functions.
25
25
  */
26
26
  export const Primary: Story = {
@@ -4,7 +4,7 @@ import MyHeader from './Header.vue';
4
4
 
5
5
  const meta = {
6
6
  /* 👇 The title prop is optional.
7
- * See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
7
+ * See https://storybook.js.org/docs/configure/#configure-story-loading
8
8
  * to learn how to generate automatic titles
9
9
  */
10
10
  title: 'Example/Header',
@@ -17,10 +17,10 @@ const meta = {
17
17
  template: '<my-header :user="args.user" />',
18
18
  }),
19
19
  parameters: {
20
- // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
20
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
21
21
  layout: 'fullscreen',
22
22
  },
23
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
23
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
24
24
  tags: ['autodocs'],
25
25
  } satisfies Meta<typeof MyHeader>;
26
26
 
@@ -10,17 +10,17 @@ const meta = {
10
10
  template: '<my-page />',
11
11
  }),
12
12
  parameters: {
13
- // More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout
13
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
14
14
  layout: 'fullscreen',
15
15
  },
16
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
16
+ // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
17
17
  tags: ['autodocs'],
18
18
  } satisfies Meta<typeof MyPage>;
19
19
 
20
20
  export default meta;
21
21
  type Story = StoryObj<typeof meta>;
22
22
 
23
- // More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing
23
+ // More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
24
24
  export const LoggedIn: Story = {
25
25
  play: async ({ canvasElement }: any) => {
26
26
  const canvas = within(canvasElement);
@@ -1,6 +0,0 @@
1
- import { h, createApp, reactive, isVNode, isReactive } from 'vue';
2
- import { sanitizeStoryContextUpdate } from '@storybook/preview-api';
3
-
4
- function normalizeFunctionalComponent(options){return typeof options=="function"?{render:options,name:options.name}:options}function prepare(rawStory,innerStory){let story=rawStory;return story===null?null:typeof story=="function"?story:innerStory?{...normalizeFunctionalComponent(story),components:{...story.components||{},story:innerStory}}:{render(){return h(story)}}}function decorateStory(storyFn,decorators){return decorators.reduce((decorated,decorator)=>context=>{let story,decoratedStory=decorator(update=>{let sanitizedUpdate=sanitizeStoryContextUpdate(update);return update&&(sanitizedUpdate.args=Object.assign(context.args,sanitizedUpdate.args)),story=decorated({...context,...sanitizedUpdate}),story},context);return story||(story=decorated(context)),decoratedStory===story?story:prepare(decoratedStory,()=>h(story))},context=>prepare(storyFn(context)))}var render=(props,context)=>{let{id,component:Component}=context;if(!Component)throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);return ()=>h(Component,props,getSlots(props,context))},setup=fn=>{globalThis.PLUGINS_SETUP_FUNCTIONS??=new Set,globalThis.PLUGINS_SETUP_FUNCTIONS.add(fn);},runSetupFunctions=async(app,storyContext)=>{globalThis&&globalThis.PLUGINS_SETUP_FUNCTIONS&&await Promise.all([...globalThis.PLUGINS_SETUP_FUNCTIONS].map(fn=>fn(app,storyContext)));},map=new Map;async function renderToCanvas({storyFn,forceRemount,showMain,showException,storyContext,id},canvasElement){let existingApp=map.get(canvasElement);if(existingApp&&!forceRemount){let element=storyFn(),args=getArgs(element,storyContext);return updateArgs(existingApp.reactiveArgs,args),()=>{teardown(existingApp.vueApp,canvasElement);}}existingApp&&forceRemount&&teardown(existingApp.vueApp,canvasElement);let vueApp=createApp({setup(){storyContext.args=reactive(storyContext.args);let rootElement=storyFn(),args=getArgs(rootElement,storyContext),appState={vueApp,reactiveArgs:reactive(args)};return map.set(canvasElement,appState),()=>h(rootElement)}});return vueApp.config.errorHandler=e=>showException(e),await runSetupFunctions(vueApp,storyContext),vueApp.mount(canvasElement),showMain(),()=>{teardown(vueApp,canvasElement);}}function getSlots(props,context){let{argTypes}=context,slots=Object.entries(props).filter(([key])=>argTypes[key]?.table?.category==="slots").map(([key,value])=>[key,typeof value=="function"?value:()=>value]);return Object.fromEntries(slots)}function getArgs(element,storyContext){return element.props&&isVNode(element)?element.props:storyContext.args}function updateArgs(reactiveArgs,nextArgs){if(Object.keys(nextArgs).length===0)return;let currentArgs=isReactive(reactiveArgs)?reactiveArgs:reactive(reactiveArgs);Object.keys(currentArgs).forEach(key=>{key in nextArgs||delete currentArgs[key];}),Object.assign(currentArgs,nextArgs);}function teardown(storybookApp,canvasElement){storybookApp?.unmount(),map.has(canvasElement)&&map.delete(canvasElement);}
5
-
6
- export { decorateStory, render, renderToCanvas, setup };