1 |
- "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__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 __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{composeStories:()=>composeStories,composeStory:()=>composeStory,configure:()=>configure,forceReRender:()=>forceReRender,raw:()=>raw,setGlobalConfig:()=>setGlobalConfig,setProjectAnnotations:()=>setProjectAnnotations,storiesOf:()=>storiesOf});module.exports=__toCommonJS(src_exports);var import_global=require("@storybook/global"),{window:globalWindow}=import_global.global;globalWindow&&(globalWindow.STORYBOOK_ENV="react");var import_preview_api=require("@storybook/preview-api");var import_global2=require("@storybook/global"),import_react=__toESM(require("react")),import_react_dom_shim=require("@storybook/react-dom-shim"),{FRAMEWORK_OPTIONS}=import_global2.global,render=(args,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 import_react.default.createElement(Component,{...args})},ErrorBoundary=class extends import_react.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError}=this.state,{showMain}=this.props;hasError||showMain()}componentDidCatch(err){let{showException}=this.props;showException(err)}render(){let{hasError}=this.state,{children}=this.props;return hasError?null:children}},Wrapper=FRAMEWORK_OPTIONS!=null&&FRAMEWORK_OPTIONS.strictMode?import_react.StrictMode:import_react.Fragment;async function renderToCanvas({storyContext,unboundStoryFn,showMain,showException,forceRemount},canvasElement){let content=import_react.default.createElement(ErrorBoundary,{showMain,showException},import_react.default.createElement(unboundStoryFn,{...storyContext})),element=Wrapper?import_react.default.createElement(Wrapper,null,content):content;return forceRemount&&(0,import_react_dom_shim.unmountElement)(canvasElement),await(0,import_react_dom_shim.renderElement)(element,canvasElement),()=>(0,import_react_dom_shim.unmountElement)(canvasElement)}var RENDERER="react",api=(0,import_preview_api.start)(renderToCanvas,{render}),storiesOf=(kind,m)=>api.clientApi.storiesOf(kind,m).addParameters({renderer:RENDERER}),configure=(...args)=>api.configure(RENDERER,...args),forceReRender=api.forceReRender,raw=api.clientApi.raw;var import_preview_api2=require("@storybook/preview-api"),import_client_logger=require("@storybook/client-logger");function setProjectAnnotations(projectAnnotations){(0,import_preview_api2.setProjectAnnotations)(projectAnnotations)}function setGlobalConfig(projectAnnotations){(0,import_client_logger.deprecate)("setGlobalConfig is deprecated. Use setProjectAnnotations instead."),setProjectAnnotations(projectAnnotations)}var defaultProjectAnnotations={render};function composeStory(story,componentAnnotations,projectAnnotations,exportsName){return(0,import_preview_api2.composeStory)(story,componentAnnotations,projectAnnotations,defaultProjectAnnotations,exportsName)}function composeStories(csfExports,projectAnnotations){return(0,import_preview_api2.composeStories)(csfExports,projectAnnotations,composeStory)}var _a;typeof module<"u"&&((_a=module==null?void 0:module.hot)==null||_a.decline());0&&(module.exports={composeStories,composeStory,configure,forceReRender,raw,setGlobalConfig,setProjectAnnotations,storiesOf});
|