@storybook/addon-docs 9.2.0-alpha.3 → 10.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.
- package/README.md +5 -3
- package/dist/_browser-chunks/Color-LWAWP22K.js +1566 -0
- package/dist/_browser-chunks/DocsRenderer-HT7GNKAR.js +9 -0
- package/dist/_browser-chunks/chunk-67KILNXL.js +6831 -0
- package/dist/_browser-chunks/chunk-74ZUTOZN.js +65 -0
- package/dist/_browser-chunks/chunk-MM7DTO55.js +44 -0
- package/dist/_browser-chunks/chunk-RX6225WF.js +46 -0
- package/dist/_browser-chunks/chunk-TQ5Q4DDG.js +846 -0
- package/dist/_browser-chunks/chunk-UZFOWTVP.js +974 -0
- package/dist/_node-chunks/chunk-6DADMWJS.js +248 -0
- package/dist/_node-chunks/chunk-LNIOBV3K.js +231 -0
- package/dist/_node-chunks/chunk-QLR5HOHE.js +48 -0
- package/dist/_node-chunks/chunk-YXBYQIGE.js +35424 -0
- package/dist/_node-chunks/mdx-plugin-NOHB7LLV.js +1653 -0
- package/dist/_node-chunks/rehype-external-links-D74PKVP3.js +168 -0
- package/dist/_node-chunks/rehype-slug-KQZG2QNC.js +127 -0
- package/dist/angular/index.d.ts +3 -0
- package/dist/angular/index.js +11 -0
- package/dist/blocks.d.ts +86 -42
- package/dist/blocks.js +8123 -201
- package/dist/ember/index.d.ts +3 -0
- package/dist/ember/index.js +11 -0
- package/dist/index.d.ts +42 -5
- package/dist/index.js +17 -15
- package/dist/manager.js +85 -154
- package/dist/mdx-loader.js +38 -71
- package/dist/mdx-react-shim.js +2 -0
- package/dist/preset.js +310 -72
- package/dist/preview.js +8 -13
- package/dist/web-components/index.d.ts +2 -0
- package/dist/web-components/index.js +0 -0
- package/manager.js +1 -1
- package/package.json +45 -89
- package/preset.js +1 -1
- package/preview.js +1 -1
- package/angular/README.md +0 -256
- package/angular/index.d.ts +0 -1
- package/angular/index.js +0 -4
- package/common/README.md +0 -98
- package/dist/Color-AVL7NMMY.mjs +0 -10
- package/dist/DocsContainer-fccc2203.d.ts +0 -51
- package/dist/DocsRenderer-3PZUHFFL.mjs +0 -2
- package/dist/DocsRenderer-ULRJ3H2C.mjs +0 -8
- package/dist/blocks.mjs +0 -213
- package/dist/chunk-2UFMRE4V.mjs +0 -5
- package/dist/chunk-CEH6MNVV.mjs +0 -3
- package/dist/chunk-GWJYCGSQ.mjs +0 -7
- package/dist/chunk-QUZPS4B6.mjs +0 -3
- package/dist/chunk-SPFYY5GD.mjs +0 -3
- package/dist/index.mjs +0 -8
- package/dist/preview.mjs +0 -5
- package/dist/shims/mdx-react-shim.js +0 -12
- package/dist/shims/mdx-react-shim.mjs +0 -1
- package/ember/README.md +0 -153
- package/ember/index.d.ts +0 -1
- package/ember/index.js +0 -3
- package/react/README.md +0 -149
- package/svelte/HOC.svelte +0 -7
- package/vue/README.md +0 -152
- package/vue3/README.md +0 -152
- package/web-components/README.md +0 -131
- package/web-components/index.js +0 -1
- /package/dist/{shims/mdx-react-shim.d.ts → mdx-react-shim.d.ts} +0 -0
package/dist/preview.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
10
|
-
|
|
11
|
-
var __defProp=Object.defineProperty;var __getOwnPropNames=Object.getOwnPropertyNames;var __esm=(fn,res)=>function(){return fn&&(res=(0, fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});};var DocsRenderer_exports={};__export(DocsRenderer_exports,{DocsRenderer:()=>DocsRenderer,defaultComponents:()=>defaultComponents});var defaultComponents,ErrorBoundary,DocsRenderer,init_DocsRenderer=__esm({"src/DocsRenderer.tsx"(){defaultComponents={code:blocks.CodeOrSourceMdx,a:blocks.AnchorMdx,...blocks.HeadersMdx},ErrorBoundary=class extends React.Component{constructor(){super(...arguments);this.state={hasError:!1};}static getDerivedStateFromError(){return {hasError:!0}}componentDidCatch(err){let{showException}=this.props;showException(err);}render(){let{hasError}=this.state,{children}=this.props;return hasError?null:React__default.default.createElement(React__default.default.Fragment,null,children)}},DocsRenderer=class{constructor(){this.render=async(context,docsParameter,element)=>{let components={...defaultComponents,...docsParameter?.components},TDocs=blocks.Docs;return new Promise((resolve,reject)=>{import('@mdx-js/react').then(({MDXProvider})=>reactDomShim.renderElement(React__default.default.createElement(ErrorBoundary,{showException:reject,key:Math.random()},React__default.default.createElement(MDXProvider,{components},React__default.default.createElement(TDocs,{context,docsParameter}))),element)).then(()=>resolve());})},this.unmount=element=>{reactDomShim.unmountElement(element);};}};}});var tocbot_exports={};__export(tocbot_exports,{default:()=>tocbot_default,destroy:()=>destroy,init:()=>init,refresh:()=>refresh});function build_html_default(options){let forEach=[].forEach,some=[].some,body=typeof window<"u"&&document.body,SPACE_CHAR=" ",tocElement,currentlyHighlighting=!0,eventCount=0;function createEl(d,container){let link=container.appendChild(createLink(d));if(d.children.length){let list=createList(d.isCollapsed);d.children.forEach(child=>{createEl(child,list);}),link.appendChild(list);}}function render(parent,data){let container=createList(!1);if(data.forEach(d=>{createEl(d,container);}),tocElement=parent||tocElement,tocElement!==null)return tocElement.firstChild&&tocElement.removeChild(tocElement.firstChild),data.length===0?tocElement:tocElement.appendChild(container)}function createLink(data){let item=document.createElement("li"),a=document.createElement("a");return options.listItemClass&&item.setAttribute("class",options.listItemClass),options.onClick&&(a.onclick=options.onClick),options.includeTitleTags&&a.setAttribute("title",data.textContent),options.includeHtml&&data.childNodes.length?forEach.call(data.childNodes,node=>{a.appendChild(node.cloneNode(!0));}):a.textContent=data.textContent,a.setAttribute("href",`${options.basePath}#${data.id}`),a.setAttribute("class",`${options.linkClass+SPACE_CHAR}node-name--${data.nodeName}${SPACE_CHAR}${options.extraLinkClasses}`),item.appendChild(a),item}function createList(isCollapsed){let listElement=options.orderedList?"ol":"ul",list=document.createElement(listElement),classes=options.listClass+SPACE_CHAR+options.extraListClasses;return isCollapsed&&(classes=classes+SPACE_CHAR+options.collapsibleClass,classes=classes+SPACE_CHAR+options.isCollapsedClass),list.setAttribute("class",classes),list}function updateFixedSidebarClass(){let scrollTop=getScrollTop(),posFixedEl=document.querySelector(options.positionFixedSelector);options.fixedSidebarOffset==="auto"&&(options.fixedSidebarOffset=tocElement.offsetTop),scrollTop>options.fixedSidebarOffset?posFixedEl.className.indexOf(options.positionFixedClass)===-1&&(posFixedEl.className+=SPACE_CHAR+options.positionFixedClass):posFixedEl.className=posFixedEl.className.replace(SPACE_CHAR+options.positionFixedClass,"");}function getHeadingTopPos(obj){let position=0;return obj!==null&&(position=obj.offsetTop,options.hasInnerContainers&&(position+=getHeadingTopPos(obj.offsetParent))),position}function updateClassname(obj,className){return obj&&obj.className!==className&&(obj.className=className),obj}function updateToc(headingsArray,event){options.positionFixedSelector&&updateFixedSidebarClass();let headings=headingsArray,clickedHref=event?.target?.getAttribute?event?.target?.getAttribute("href"):null,isBottomMode=clickedHref&&clickedHref.charAt(0)==="#"?getIsHeaderBottomMode(clickedHref.replace("#","")):!1,shouldUpdate=currentlyHighlighting||isBottomMode;if(event&&eventCount<5&&eventCount++,shouldUpdate&&tocElement&&headings.length>0){let topHeader=getTopHeader(headings),oldActiveTocLink=tocElement.querySelector(`.${options.activeLinkClass}`),topHeaderId=topHeader.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g,"\\$1"),hashId=window.location.hash.replace("#",""),activeId=topHeaderId,isPageBottomMode=getIsPageBottomMode();clickedHref&&isBottomMode?activeId=clickedHref.replace("#",""):hashId&&hashId!==topHeaderId&&isPageBottomMode&&(getIsHeaderBottomMode(topHeaderId)||eventCount<=2)&&(activeId=hashId);let activeTocLink=tocElement.querySelector(`.${options.linkClass}[href="${options.basePath}#${activeId}"]`);if(oldActiveTocLink===activeTocLink)return;let tocLinks=tocElement.querySelectorAll(`.${options.linkClass}`);forEach.call(tocLinks,tocLink=>{updateClassname(tocLink,tocLink.className.replace(SPACE_CHAR+options.activeLinkClass,""));});let tocLis=tocElement.querySelectorAll(`.${options.listItemClass}`);forEach.call(tocLis,tocLi=>{updateClassname(tocLi,tocLi.className.replace(SPACE_CHAR+options.activeListItemClass,""));}),activeTocLink&&activeTocLink.className.indexOf(options.activeLinkClass)===-1&&(activeTocLink.className+=SPACE_CHAR+options.activeLinkClass);let li=activeTocLink?.parentNode;li&&li.className.indexOf(options.activeListItemClass)===-1&&(li.className+=SPACE_CHAR+options.activeListItemClass);let tocLists=tocElement.querySelectorAll(`.${options.listClass}.${options.collapsibleClass}`);forEach.call(tocLists,list=>{list.className.indexOf(options.isCollapsedClass)===-1&&(list.className+=SPACE_CHAR+options.isCollapsedClass);}),activeTocLink?.nextSibling&&activeTocLink.nextSibling.className.indexOf(options.isCollapsedClass)!==-1&&updateClassname(activeTocLink.nextSibling,activeTocLink.nextSibling.className.replace(SPACE_CHAR+options.isCollapsedClass,"")),removeCollapsedFromParents(activeTocLink?.parentNode.parentNode);}}function removeCollapsedFromParents(element){return element&&element.className.indexOf(options.collapsibleClass)!==-1&&element.className.indexOf(options.isCollapsedClass)!==-1?(updateClassname(element,element.className.replace(SPACE_CHAR+options.isCollapsedClass,"")),removeCollapsedFromParents(element.parentNode.parentNode)):element}function disableTocAnimation(event){let target=event.target||event.srcElement;typeof target.className!="string"||target.className.indexOf(options.linkClass)===-1||(currentlyHighlighting=!1);}function enableTocAnimation(){currentlyHighlighting=!0;}function getCurrentlyHighlighting(){return currentlyHighlighting}function getIsHeaderBottomMode(headerId){let scrollEl=getScrollEl();return (document?.getElementById(headerId)).offsetTop>scrollEl.offsetHeight-scrollEl.clientHeight*1.4-options.bottomModeThreshold}function getIsPageBottomMode(){let scrollEl=getScrollEl(),isScrollable=scrollEl.scrollHeight>scrollEl.clientHeight,isBottomMode=getScrollTop()+scrollEl.clientHeight>scrollEl.offsetHeight-options.bottomModeThreshold;return isScrollable&&isBottomMode}function getScrollEl(){let el;return options.scrollContainer&&document.querySelector(options.scrollContainer)?el=document.querySelector(options.scrollContainer):el=document.documentElement||body,el}function getScrollTop(){return getScrollEl()?.scrollTop||0}function getTopHeader(headings,scrollTop=getScrollTop()){let topHeader;return some.call(headings,(heading,i)=>{if(getHeadingTopPos(heading)>scrollTop+options.headingsOffset+10){let index=i===0?i:i-1;return topHeader=headings[index],!0}if(i===headings.length-1)return topHeader=headings[headings.length-1],!0}),topHeader}function updateUrlHashForHeader(headingsArray){let scrollTop=getScrollTop(),topHeader=getTopHeader(headingsArray,scrollTop),isPageBottomMode=getIsPageBottomMode();if((!topHeader||scrollTop<5)&&!isPageBottomMode)window.location.hash==="#"||window.location.hash===""||window.history.pushState(null,null,"#");else if(topHeader&&!isPageBottomMode){let newHash=`#${topHeader.id}`;window.location.hash!==newHash&&window.history.pushState(null,null,newHash);}}return {enableTocAnimation,disableTocAnimation,render,updateToc,getCurrentlyHighlighting,getTopHeader,getScrollTop,updateUrlHashForHeader}}var default_options_default={tocSelector:".js-toc",tocElement:null,contentSelector:".js-toc-content",contentElement:null,headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",hasInnerContainers:!1,linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",activeListItemClass:"is-active-li",collapseDepth:0,scrollSmooth:!0,scrollSmoothDuration:420,scrollSmoothOffset:0,scrollEndCallback:function(e){},headingsOffset:1,enableUrlHashUpdateOnScroll:!1,scrollHandlerType:"auto",scrollHandlerTimeout:50,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1,includeTitleTags:!1,onClick:function(e){},orderedList:!0,scrollContainer:null,skipRendering:!1,headingLabelCallback:!1,ignoreHiddenElements:!1,headingObjectCallback:null,basePath:"",disableTocScrollSync:!1,tocScrollingWrapper:null,tocScrollOffset:30,bottomModeThreshold:30};function parseContent(options){let reduce=[].reduce;function getLastItem(array){return array[array.length-1]}function getHeadingLevel(heading){return +heading.nodeName.toUpperCase().replace("H","")}function isHTMLElement(maybeElement){try{return maybeElement instanceof window.HTMLElement||maybeElement instanceof window.parent.HTMLElement}catch{return maybeElement instanceof window.HTMLElement}}function getHeadingObject(heading){if(!isHTMLElement(heading))return heading;if(options.ignoreHiddenElements&&(!heading.offsetHeight||!heading.offsetParent))return null;let headingLabel=heading.getAttribute("data-heading-label")||(options.headingLabelCallback?String(options.headingLabelCallback(heading.innerText)):(heading.innerText||heading.textContent).trim()),obj={id:heading.id,children:[],nodeName:heading.nodeName,headingLevel:getHeadingLevel(heading),textContent:headingLabel};return options.includeHtml&&(obj.childNodes=heading.childNodes),options.headingObjectCallback?options.headingObjectCallback(obj,heading):obj}function addNode(node,nest){let obj=getHeadingObject(node),level=obj.headingLevel,array=nest,lastItem=getLastItem(array),lastItemLevel=lastItem?lastItem.headingLevel:0,counter=level-lastItemLevel;for(;counter>0&&(lastItem=getLastItem(array),!(lastItem&&level===lastItem.headingLevel));)lastItem&&lastItem.children!==void 0&&(array=lastItem.children),counter--;return level>=options.collapseDepth&&(obj.isCollapsed=!0),array.push(obj),array}function selectHeadings(contentElement,headingSelector){let selectors=headingSelector;options.ignoreSelector&&(selectors=headingSelector.split(",").map(function(selector){return `${selector.trim()}:not(${options.ignoreSelector})`}));try{return contentElement.querySelectorAll(selectors)}catch{return console.warn(`Headers not found with selector: ${selectors}`),null}}function nestHeadingsArray(headingsArray){return reduce.call(headingsArray,function(prev,curr){let currentHeading=getHeadingObject(curr);return currentHeading&&addNode(currentHeading,prev.nest),prev},{nest:[]})}return {nestHeadingsArray,selectHeadings}}function initSmoothScrolling(options){var duration=options.duration,offset=options.offset;if(typeof window>"u"||typeof location>"u")return;var pageUrl=location.hash?stripHash(location.href):location.href;delegatedLinkHijacking();function delegatedLinkHijacking(){document.body.addEventListener("click",onClick,!1);function onClick(e){!isInPageLink(e.target)||e.target.className.indexOf("no-smooth-scroll")>-1||e.target.href.charAt(e.target.href.length-2)==="#"&&e.target.href.charAt(e.target.href.length-1)==="!"||e.target.className.indexOf(options.linkClass)===-1||jump(e.target.hash,{duration,offset,callback:function(){setFocus(e.target.hash);}});}}function isInPageLink(n){return n.tagName.toLowerCase()==="a"&&(n.hash.length>0||n.href.charAt(n.href.length-1)==="#")&&(stripHash(n.href)===pageUrl||stripHash(n.href)+"#"===pageUrl)}function stripHash(url){return url.slice(0,url.lastIndexOf("#"))}function setFocus(hash){var element=document.getElementById(hash.substring(1));element&&(/^(?:a|select|input|button|textarea)$/i.test(element.tagName)||(element.tabIndex=-1),element.focus());}}function jump(target,options){var start=window.pageYOffset,opt={duration:options.duration,offset:options.offset||0,callback:options.callback,easing:options.easing||easeInOutQuad},tgt=document.querySelector('[id="'+decodeURI(target).split("#").join("")+'"]')||document.querySelector('[id="'+target.split("#").join("")+'"]'),distance=typeof target=="string"?opt.offset+(target?tgt&&tgt.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):target,duration=typeof opt.duration=="function"?opt.duration(distance):opt.duration,timeStart,timeElapsed;requestAnimationFrame(function(time){timeStart=time,loop(time);});function loop(time){timeElapsed=time-timeStart,window.scrollTo(0,opt.easing(timeElapsed,start,distance,duration)),timeElapsed<duration?requestAnimationFrame(loop):end();}function end(){window.scrollTo(0,start+distance),typeof opt.callback=="function"&&opt.callback();}function easeInOutQuad(t,b,c,d){return t/=d/2,t<1?c/2*t*t+b:(t--,-c/2*(t*(t-2)-1)+b)}}function updateTocScroll(options){let toc=options.tocScrollingWrapper||options.tocElement||document.querySelector(options.tocSelector);if(toc&&toc.scrollHeight>toc.clientHeight){let activeItem=toc.querySelector(`.${options.activeListItemClass}`);if(activeItem){let scrollAmount=activeItem.offsetTop-options.tocScrollOffset;toc.scrollTop=scrollAmount>0?scrollAmount:0;}}}var _options={},_buildHtml,_parseContent,_headingsArray,_scrollListener,clickListener;function init(customOptions){let hasInitialized=!1;_options=extend(default_options_default,customOptions||{}),_options.scrollSmooth&&(_options.duration=_options.scrollSmoothDuration,_options.offset=_options.scrollSmoothOffset,initSmoothScrolling(_options)),_buildHtml=build_html_default(_options),_parseContent=parseContent(_options),destroy();let contentElement=getContentElement(_options);if(contentElement===null)return;let tocElement=getTocElement(_options);if(tocElement===null||(_headingsArray=_parseContent.selectHeadings(contentElement,_options.headingSelector),_headingsArray===null))return;let nestedHeadings=_parseContent.nestHeadingsArray(_headingsArray).nest;if(!_options.skipRendering)_buildHtml.render(tocElement,nestedHeadings);else return this;let isClick=!1,scrollHandlerTimeout=_options.scrollHandlerTimeout||_options.throttleTimeout;_scrollListener=((fn,delay)=>getScrollHandler(fn,delay,_options.scrollHandlerType))(e=>{_buildHtml.updateToc(_headingsArray,e),!_options.disableTocScrollSync&&!isClick&&updateTocScroll(_options),_options.enableUrlHashUpdateOnScroll&&hasInitialized&&_buildHtml.getCurrentlyHighlighting()&&_buildHtml.updateUrlHashForHeader(_headingsArray);let isTop=e?.target?.scrollingElement?.scrollTop===0;(e&&(e.eventPhase===0||e.currentTarget===null)||isTop)&&(_buildHtml.updateToc(_headingsArray),_options.scrollEndCallback?.(e));},scrollHandlerTimeout),hasInitialized||(_scrollListener(),hasInitialized=!0),window.onhashchange=window.onscrollend=e=>{_scrollListener(e);},_options.scrollContainer&&document.querySelector(_options.scrollContainer)?(document.querySelector(_options.scrollContainer).addEventListener("scroll",_scrollListener,!1),document.querySelector(_options.scrollContainer).addEventListener("resize",_scrollListener,!1)):(document.addEventListener("scroll",_scrollListener,!1),document.addEventListener("resize",_scrollListener,!1));let timeout=null;clickListener=throttle(event=>{isClick=!0,_options.scrollSmooth&&_buildHtml.disableTocAnimation(event),_buildHtml.updateToc(_headingsArray,event),timeout&&clearTimeout(timeout),timeout=setTimeout(()=>{_buildHtml.enableTocAnimation();},_options.scrollSmoothDuration),setTimeout(()=>{isClick=!1;},_options.scrollSmoothDuration+100);},_options.throttleTimeout),_options.scrollContainer&&document.querySelector(_options.scrollContainer)?document.querySelector(_options.scrollContainer).addEventListener("click",clickListener,!1):document.addEventListener("click",clickListener,!1);}function destroy(){let tocElement=getTocElement(_options);tocElement!==null&&(_options.skipRendering||tocElement&&(tocElement.innerHTML=""),_options.scrollContainer&&document.querySelector(_options.scrollContainer)?(document.querySelector(_options.scrollContainer).removeEventListener("scroll",_scrollListener,!1),document.querySelector(_options.scrollContainer).removeEventListener("resize",_scrollListener,!1),_buildHtml&&document.querySelector(_options.scrollContainer).removeEventListener("click",clickListener,!1)):(document.removeEventListener("scroll",_scrollListener,!1),document.removeEventListener("resize",_scrollListener,!1),_buildHtml&&document.removeEventListener("click",clickListener,!1)));}function refresh(customOptions){destroy(),init(customOptions||_options);}var hasOwnProp=Object.prototype.hasOwnProperty;function extend(...args){let target={};for(let i=0;i<args.length;i++){let source=args[i];for(let key in source)hasOwnProp.call(source,key)&&(target[key]=source[key]);}return target}function throttle(fn,threshold,scope){threshold||(threshold=250);let last,deferTimer;return function(...args){let context=scope||this,now=+new Date;last&&now<last+threshold?(clearTimeout(deferTimer),deferTimer=setTimeout(()=>{last=now,fn.apply(context,args);},threshold)):(last=now,fn.apply(context,args));}}function debounce(func,wait){let timeout;return (...args)=>{clearTimeout(timeout),timeout=setTimeout(()=>func.apply(this,args),wait);}}function getScrollHandler(func,timeout,type="auto"){switch(type){case"debounce":return debounce(func,timeout);case"throttle":return throttle(func,timeout);default:return timeout<334?debounce(func,timeout):throttle(func,timeout)}}function getContentElement(options){try{return options.contentElement||document.querySelector(options.contentSelector)}catch{return console.warn(`Contents element not found: ${options.contentSelector}`),null}}function getTocElement(options){try{return options.tocElement||document.querySelector(options.tocSelector)}catch{return console.warn(`TOC element not found: ${options.tocSelector}`),null}}var tocbot={destroy,init,refresh};var tocbot_default=tocbot;globalThis.__STORYBOOK_UNSAFE_TOCBOT__||(globalThis.__STORYBOOK_UNSAFE_TOCBOT__=tocbot_default??tocbot_exports);var excludeTags=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((acc,entry)=>{let[tag,option]=entry;return option.excludeFromDocsStories&&(acc[tag]=!0),acc},{}),parameters={docs:{renderer:async()=>{let{DocsRenderer:DocsRenderer2}=await Promise.resolve().then(()=>(init_DocsRenderer(),DocsRenderer_exports));return new DocsRenderer2},stories:{filter:story=>(story.tags||[]).filter(tag=>excludeTags[tag]).length===0&&!story.parameters.docs?.disable}}};
|
|
12
|
-
|
|
13
|
-
exports.parameters = parameters;
|
|
1
|
+
import {
|
|
2
|
+
parameters
|
|
3
|
+
} from "./_browser-chunks/chunk-RX6225WF.js";
|
|
4
|
+
import "./_browser-chunks/chunk-TQ5Q4DDG.js";
|
|
5
|
+
import "./_browser-chunks/chunk-MM7DTO55.js";
|
|
6
|
+
export {
|
|
7
|
+
parameters
|
|
8
|
+
};
|
|
File without changes
|
package/manager.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/manager';
|
|
1
|
+
export * from './dist/manager.js';
|
package/package.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Document
|
|
3
|
+
"version": "10.0.0-beta.1",
|
|
4
|
+
"description": "Storybook Docs: Document UI components automatically with stories and MDX",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"notes",
|
|
6
|
+
"docs",
|
|
8
7
|
"documentation",
|
|
9
8
|
"storybook",
|
|
9
|
+
"storybook-addon",
|
|
10
10
|
"essentials",
|
|
11
|
-
"organize"
|
|
11
|
+
"organize",
|
|
12
|
+
"MDX",
|
|
13
|
+
"markdown",
|
|
14
|
+
"autodocs",
|
|
15
|
+
"styleguide",
|
|
16
|
+
"style guide",
|
|
17
|
+
"component",
|
|
18
|
+
"components",
|
|
19
|
+
"react",
|
|
20
|
+
"vue",
|
|
21
|
+
"angular",
|
|
22
|
+
"svelte",
|
|
23
|
+
"web-components"
|
|
12
24
|
],
|
|
13
25
|
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/addons/docs",
|
|
14
26
|
"bugs": {
|
|
@@ -24,96 +36,57 @@
|
|
|
24
36
|
"url": "https://opencollective.com/storybook"
|
|
25
37
|
},
|
|
26
38
|
"license": "MIT",
|
|
39
|
+
"type": "module",
|
|
27
40
|
"exports": {
|
|
28
41
|
".": {
|
|
29
42
|
"types": "./dist/index.d.ts",
|
|
30
|
-
"
|
|
31
|
-
"require": "./dist/index.js"
|
|
43
|
+
"default": "./dist/index.js"
|
|
32
44
|
},
|
|
33
|
-
"./
|
|
34
|
-
"types": "./dist/
|
|
35
|
-
"
|
|
36
|
-
"require": "./dist/preview.js"
|
|
45
|
+
"./angular": {
|
|
46
|
+
"types": "./dist/angular/index.d.ts",
|
|
47
|
+
"default": "./dist/angular/index.js"
|
|
37
48
|
},
|
|
38
|
-
"./preset": "./dist/preset.js",
|
|
39
49
|
"./blocks": {
|
|
40
50
|
"types": "./dist/blocks.d.ts",
|
|
41
|
-
"
|
|
42
|
-
"require": "./dist/blocks.js"
|
|
51
|
+
"default": "./dist/blocks.js"
|
|
43
52
|
},
|
|
44
|
-
"./
|
|
45
|
-
"types": "./dist/
|
|
46
|
-
"
|
|
47
|
-
"require": "./dist/preview.js"
|
|
48
|
-
},
|
|
49
|
-
"./dist/preset": "./dist/preset.js",
|
|
50
|
-
"./dist/shims/mdx-react-shim": {
|
|
51
|
-
"types": "./dist/shims/mdx-react-shim.d.ts",
|
|
52
|
-
"import": "./dist/shims/mdx-react-shim.mjs",
|
|
53
|
-
"require": "./dist/shims/mdx-react-shim.js"
|
|
53
|
+
"./ember": {
|
|
54
|
+
"types": "./dist/ember/index.d.ts",
|
|
55
|
+
"default": "./dist/ember/index.js"
|
|
54
56
|
},
|
|
57
|
+
"./manager": "./dist/manager.js",
|
|
58
|
+
"./mdx-loader": "./dist/mdx-loader.js",
|
|
55
59
|
"./mdx-react-shim": {
|
|
56
|
-
"types": "./dist/
|
|
57
|
-
"
|
|
58
|
-
"require": "./dist/shims/mdx-react-shim.js"
|
|
60
|
+
"types": "./dist/mdx-react-shim.d.ts",
|
|
61
|
+
"default": "./dist/mdx-react-shim.js"
|
|
59
62
|
},
|
|
60
|
-
"./mdx-loader": "./dist/mdx-loader.js",
|
|
61
|
-
"./svelte/HOC.svelte": "./svelte/HOC.svelte",
|
|
62
|
-
"./ember": "./ember/index.js",
|
|
63
|
-
"./ember/index.js": "./ember/index.js",
|
|
64
|
-
"./angular": "./angular/index.js",
|
|
65
|
-
"./angular/index.js": "./angular/index.js",
|
|
66
|
-
"./web-components/index.js": "./web-components/index.js",
|
|
67
63
|
"./package.json": "./package.json",
|
|
68
|
-
"./
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"dist/index.d.ts"
|
|
77
|
-
],
|
|
78
|
-
"angular": [
|
|
79
|
-
"angular/index.d.ts"
|
|
80
|
-
],
|
|
81
|
-
"blocks": [
|
|
82
|
-
"dist/blocks.d.ts"
|
|
83
|
-
],
|
|
84
|
-
"ember": [
|
|
85
|
-
"ember/index.d.ts"
|
|
86
|
-
],
|
|
87
|
-
"preview": [
|
|
88
|
-
"dist/preview.d.ts"
|
|
89
|
-
]
|
|
64
|
+
"./preset": "./dist/preset.js",
|
|
65
|
+
"./preview": {
|
|
66
|
+
"types": "./dist/preview.d.ts",
|
|
67
|
+
"default": "./dist/preview.js"
|
|
68
|
+
},
|
|
69
|
+
"./web-components": {
|
|
70
|
+
"types": "./dist/web-components/index.d.ts",
|
|
71
|
+
"default": "./dist/web-components/index.js"
|
|
90
72
|
}
|
|
91
73
|
},
|
|
92
74
|
"files": [
|
|
93
75
|
"dist/**/*",
|
|
94
|
-
"angular/**/*",
|
|
95
|
-
"common/**/*",
|
|
96
|
-
"ember/**/*",
|
|
97
|
-
"html/**/*",
|
|
98
|
-
"svelte/**/*",
|
|
99
|
-
"react/**/*",
|
|
100
|
-
"vue/**/*",
|
|
101
|
-
"web-components/**/*",
|
|
102
|
-
"lit/**/*",
|
|
103
76
|
"README.md",
|
|
104
77
|
"*.js",
|
|
105
78
|
"*.d.ts",
|
|
106
79
|
"!src/**/*"
|
|
107
80
|
],
|
|
108
81
|
"scripts": {
|
|
109
|
-
"check": "jiti ../../../scripts/
|
|
110
|
-
"prep": "jiti ../../../scripts/
|
|
82
|
+
"check": "jiti ../../../scripts/check/check-package.ts",
|
|
83
|
+
"prep": "jiti ../../../scripts/build/build-package.ts"
|
|
111
84
|
},
|
|
112
85
|
"dependencies": {
|
|
113
86
|
"@mdx-js/react": "^3.0.0",
|
|
114
|
-
"@storybook/csf-plugin": "
|
|
87
|
+
"@storybook/csf-plugin": "10.0.0-beta.1",
|
|
115
88
|
"@storybook/icons": "^1.4.0",
|
|
116
|
-
"@storybook/react-dom-shim": "
|
|
89
|
+
"@storybook/react-dom-shim": "10.0.0-beta.1",
|
|
117
90
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
118
91
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
119
92
|
"ts-dedent": "^2.0.0"
|
|
@@ -137,32 +110,15 @@
|
|
|
137
110
|
"telejson": "8.0.0",
|
|
138
111
|
"tocbot": "^4.20.1",
|
|
139
112
|
"typescript": "^5.8.3",
|
|
140
|
-
"vite": "^
|
|
113
|
+
"vite": "^7.0.4"
|
|
141
114
|
},
|
|
142
115
|
"peerDependencies": {
|
|
143
|
-
"storybook": "^
|
|
116
|
+
"storybook": "^10.0.0-beta.1"
|
|
144
117
|
},
|
|
145
118
|
"publishConfig": {
|
|
146
119
|
"access": "public"
|
|
147
120
|
},
|
|
148
|
-
"
|
|
149
|
-
"previewEntries": [
|
|
150
|
-
"./src/preview.ts"
|
|
151
|
-
],
|
|
152
|
-
"exportEntries": [
|
|
153
|
-
"./src/index.ts",
|
|
154
|
-
"./src/blocks.ts",
|
|
155
|
-
"./src/shims/mdx-react-shim.ts"
|
|
156
|
-
],
|
|
157
|
-
"nodeEntries": [
|
|
158
|
-
"./src/mdx-loader.ts",
|
|
159
|
-
"./src/preset.ts"
|
|
160
|
-
],
|
|
161
|
-
"managerEntries": [
|
|
162
|
-
"./src/manager.tsx"
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
"gitHead": "ce6a1e4a8d5ad69c699021a0b183df89cfc7b684",
|
|
121
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16",
|
|
166
122
|
"storybook": {
|
|
167
123
|
"displayName": "Docs",
|
|
168
124
|
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './dist/preset.js';
|
package/preview.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/preview';
|
|
1
|
+
export * from './dist/preview.js';
|
package/angular/README.md
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
<center>
|
|
2
|
-
<img src="../docs/media/angular-hero.png" width="100%" />
|
|
3
|
-
</center>
|
|
4
|
-
|
|
5
|
-
<h1>Storybook Docs for Angular</h1>
|
|
6
|
-
|
|
7
|
-
> migration guide: This page documents the method to configure storybook introduced recently in 5.3.0, consult the [migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md) if you want to migrate to this format of configuring storybook.
|
|
8
|
-
|
|
9
|
-
Storybook Docs transforms your Storybook stories into world-class component documentation. Storybook Docs for Angular supports [DocsPage](../docs/docspage.md) for auto-generated docs, and [MDX](../docs/mdx.md) for rich long-form docs.
|
|
10
|
-
|
|
11
|
-
To learn more about Storybook Docs, read the [general documentation](../README.md). To learn the Angular specifics, read on!
|
|
12
|
-
|
|
13
|
-
- [Installation](#installation)
|
|
14
|
-
- [DocsPage](#docspage)
|
|
15
|
-
- [Props tables](#props-tables)
|
|
16
|
-
- [Automatic Compodoc setup](#automatic-compodoc-setup)
|
|
17
|
-
- [Manual Compodoc setup](#manual-compodoc-setup)
|
|
18
|
-
- [MDX](#mdx)
|
|
19
|
-
- [IFrame height](#iframe-height)
|
|
20
|
-
- [Inline Stories](#inline-stories)
|
|
21
|
-
- [More resources](#more-resources)
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
First add the package. Make sure that the versions for your `@storybook/*` packages match:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
yarn add -D @storybook/addon-docs
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Then add the following to your `.storybook/main.js` exports:
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
export default {
|
|
35
|
-
addons: ['@storybook/addon-docs'],
|
|
36
|
-
};
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## DocsPage
|
|
40
|
-
|
|
41
|
-
When you [install docs](#installation) you should get basic [DocsPage](../docs/docspage.md) documentation automagically for all your stories, available in the `Docs` tab of the Storybook UI.
|
|
42
|
-
|
|
43
|
-
## Props tables
|
|
44
|
-
|
|
45
|
-
Getting [Props tables](../docs/props-tables.md) for your components requires a few more steps. Docs for Angular relies on [Compodoc](https://compodoc.app/), the excellent API documentation tool. It supports `inputs`, `outputs`, `properties`, `methods`, `view/content child/children` as first class prop types.
|
|
46
|
-
|
|
47
|
-
### Automatic Compodoc setup
|
|
48
|
-
|
|
49
|
-
During `sb init`, you will be asked, whether you want to setup Compodoc for your project. Just answer the question with Yes. Compodoc is then ready to use!
|
|
50
|
-
|
|
51
|
-
## Manual Compodoc setup
|
|
52
|
-
|
|
53
|
-
You'll need to register Compodoc's `documentation.json` file in `.storybook/preview.ts`:
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
import { setCompodocJson } from '@storybook/addon-docs/angular';
|
|
57
|
-
import docJson from '../documentation.json';
|
|
58
|
-
|
|
59
|
-
setCompodocJson(docJson);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Finally, to set up compodoc, you'll first need to install Compodoc:
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
yarn add -D @compodoc/compodoc
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Then you'll need to configure Compodoc to generate a `documentation.json` file. Adding the following snippet to your `projects.<project>.architect.<storybook|build-storybook>` in the `angular.json` creates a metadata file `./documentation.json` each time you run storybook:
|
|
69
|
-
|
|
70
|
-
```jsonc
|
|
71
|
-
// angular.json
|
|
72
|
-
{
|
|
73
|
-
"projects": {
|
|
74
|
-
"your-project": {
|
|
75
|
-
"architect": {
|
|
76
|
-
"storybook": {
|
|
77
|
-
...,
|
|
78
|
-
"compodoc": true,
|
|
79
|
-
"compodocArgs": [
|
|
80
|
-
"-e",
|
|
81
|
-
"json",
|
|
82
|
-
"-d",
|
|
83
|
-
"." // the root folder of your project
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
"build-storybook": {
|
|
87
|
-
...,
|
|
88
|
-
"compodoc": true,
|
|
89
|
-
"compodocArgs": [
|
|
90
|
-
"-e",
|
|
91
|
-
"json",
|
|
92
|
-
"-d",
|
|
93
|
-
"." // the root folder of your project
|
|
94
|
-
],
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Unfortunately, it's not currently possible to update this dynamically as you edit your components, but [there's an open issue](https://github.com/storybookjs/storybook/issues/8672) to support this with improvements to Compodoc.
|
|
103
|
-
|
|
104
|
-
Finally, be sure to fill in the `component` field in your story metadata:
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
import { AppComponent } from './app.component';
|
|
108
|
-
|
|
109
|
-
export default {
|
|
110
|
-
title: 'App Component',
|
|
111
|
-
component: AppComponent,
|
|
112
|
-
};
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
If you haven't upgraded from `storiesOf`, you can use a parameter to do the same thing:
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { storiesOf } from '@storybook/angular';
|
|
119
|
-
import { AppComponent } from './app.component';
|
|
120
|
-
|
|
121
|
-
storiesOf('App Component', module)
|
|
122
|
-
.addParameters({ component: AppComponent })
|
|
123
|
-
.add( ... );
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## MDX
|
|
127
|
-
|
|
128
|
-
[MDX](../docs/mdx.md) is a convenient way to document your components in Markdown and embed documentation components, such as stories and props tables, inline.
|
|
129
|
-
|
|
130
|
-
Docs has peer dependencies on `react`. If you want to write stories in MDX, you may need to add this dependency as well:
|
|
131
|
-
|
|
132
|
-
```sh
|
|
133
|
-
yarn add -D react
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
137
|
-
|
|
138
|
-
```js
|
|
139
|
-
export default {
|
|
140
|
-
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
141
|
-
};
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Finally, you can create MDX files like this:
|
|
145
|
-
|
|
146
|
-
```md
|
|
147
|
-
import { Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
148
|
-
import { AppComponent } from './app.component';
|
|
149
|
-
|
|
150
|
-
<Meta title='App Component' component={AppComponent} />
|
|
151
|
-
|
|
152
|
-
# App Component
|
|
153
|
-
|
|
154
|
-
Some **markdown** description, or whatever you want.
|
|
155
|
-
|
|
156
|
-
<Story name='basic' height='400px'>{{
|
|
157
|
-
component: AppComponent,
|
|
158
|
-
props: {},
|
|
159
|
-
}}</Story>
|
|
160
|
-
|
|
161
|
-
## ArgsTable
|
|
162
|
-
|
|
163
|
-
<ArgsTable of={AppComponent} />
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Yes, it's redundant to declare `component` twice. [Coming soon](https://github.com/storybookjs/storybook/issues/8673).
|
|
167
|
-
|
|
168
|
-
Also, to use the `Props` doc block, you need to set up Compodoc, [as described above](#docspage).
|
|
169
|
-
|
|
170
|
-
When you are using `template`, `moduleMetadata` and/or `addDecorators` with `storiesOf` then you can easily translate your story to MDX, too:
|
|
171
|
-
|
|
172
|
-
```md
|
|
173
|
-
import { Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
174
|
-
import { CheckboxComponent, RadioButtonComponent } from './my-components';
|
|
175
|
-
import { moduleMetadata } from '@storybook/angular';
|
|
176
|
-
|
|
177
|
-
<Meta title='Checkbox' decorators={[
|
|
178
|
-
moduleMetadata({
|
|
179
|
-
declarations: [CheckboxComponent]
|
|
180
|
-
})
|
|
181
|
-
]} />
|
|
182
|
-
|
|
183
|
-
# Basic Checkbox
|
|
184
|
-
|
|
185
|
-
<Story name='basic check' height='400px'>{{
|
|
186
|
-
template: `
|
|
187
|
-
<div class="some-wrapper-with-padding">
|
|
188
|
-
<my-checkbox [checked]="checked">Some Checkbox</my-checkbox>
|
|
189
|
-
</div>
|
|
190
|
-
`,
|
|
191
|
-
props: {
|
|
192
|
-
checked: true
|
|
193
|
-
}
|
|
194
|
-
}}</Story>
|
|
195
|
-
|
|
196
|
-
# Basic Radiobutton
|
|
197
|
-
|
|
198
|
-
<Story name='basic radio' height='400px'>{{
|
|
199
|
-
moduleMetadata: {
|
|
200
|
-
declarations: [RadioButtonComponent]
|
|
201
|
-
}
|
|
202
|
-
template: `
|
|
203
|
-
<div class="some-wrapper-with-padding">
|
|
204
|
-
<my-radio-btn [checked]="checked">Some Checkbox</my-radio-btn>
|
|
205
|
-
</div>
|
|
206
|
-
`,
|
|
207
|
-
props: {
|
|
208
|
-
checked: true
|
|
209
|
-
}
|
|
210
|
-
}}</Story>
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## IFrame height
|
|
214
|
-
|
|
215
|
-
Storybook Docs renders all Angular stories inside IFrames, with a default height of `60px`. You can update this default globally, or modify the IFrame height locally per story in `DocsPage` and `MDX`.
|
|
216
|
-
|
|
217
|
-
To update the global default, modify `.storybook/preview.ts`:
|
|
218
|
-
|
|
219
|
-
```ts
|
|
220
|
-
export const parameters = { docs: { story: { iframeHeight: '400px' } } };
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
For `DocsPage`, you need to update the parameter locally in a story:
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
export const basic = () => ...
|
|
227
|
-
basic.parameters = {
|
|
228
|
-
docs: { story: { iframeHeight: '400px' } },
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
And for `MDX` you can modify it as an attribute on the `Story` element:
|
|
233
|
-
|
|
234
|
-
```md
|
|
235
|
-
<Story name='basic' height='400px'>{...}</Story>
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Inline Stories
|
|
239
|
-
|
|
240
|
-
Storybook Docs renders all Angular stories inline by default.
|
|
241
|
-
|
|
242
|
-
However, you can render stories in an iframe, with a default height of `100px` (configurable using the `docs.story.iframeHeight` story parameter), by using the `docs.story.inline` parameter.
|
|
243
|
-
|
|
244
|
-
To do so for all stories, update `.storybook/preview.js`:
|
|
245
|
-
|
|
246
|
-
```js
|
|
247
|
-
export const parameters = { docs: { story: { inline: false } } };
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## More resources
|
|
251
|
-
|
|
252
|
-
Want to learn more? Here are some more articles on Storybook Docs:
|
|
253
|
-
|
|
254
|
-
- References: [DocsPage](../docs/docspage.md) / [MDX](../docs/mdx.md) / [FAQ](../docs/faq.md) / [Recipes](../docs/recipes.md) / [Theming](../docs/theming.md) / [Props](../docs/props-tables.md)
|
|
255
|
-
- Announcements: [Vision](https://medium.com/storybookjs/storybook-docs-sneak-peak-5be78445094a) / [DocsPage](https://medium.com/storybookjs/storybook-docspage-e185bc3622bf) / [MDX](https://medium.com/storybookjs/rich-docs-with-storybook-mdx-61bc145ae7bc) / [Framework support](https://medium.com/storybookjs/storybook-docs-for-new-frameworks-b1f6090ee0ea)
|
|
256
|
-
- Example: [Storybook Design System](https://github.com/storybookjs/design-system)
|
package/angular/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const setCompodocJson: (compodocJson: any) => void;
|
package/angular/index.js
DELETED
package/common/README.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<h1>Storybook Docs Common Setup</h1>
|
|
2
|
-
|
|
3
|
-
Storybook Docs transforms your Storybook stories into world-class component documentation. Docs supports [all web frameworks that Storybook supports](../README.md#framework-support).
|
|
4
|
-
|
|
5
|
-
Popular frameworks like [React](../react/README.md)/[Vue 3](../vue3/README.md)/[Angular](../angular/README.md)/[Ember](../ember/README.md)/[Web components](../web-components/README.md) have their own framework-specific optimizations and setup guides. This README documents the "common" setup for other frameworks that don't have any docs-specific optimizations.
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [DocsPage](#docspage)
|
|
9
|
-
- [MDX](#mdx)
|
|
10
|
-
- [IFrame height](#iframe-height)
|
|
11
|
-
- [More resources](#more-resources)
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
First add the package. Make sure that the versions for your `@storybook/*` packages match:
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
yarn add -D @storybook/addon-docs
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Then add the following to your `.storybook/main.js` addons:
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
export default {
|
|
25
|
-
addons: ['@storybook/addon-docs'],
|
|
26
|
-
};
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## DocsPage
|
|
30
|
-
|
|
31
|
-
When you [install docs](#installation) you should get basic [DocsPage](../docs/docspage.md) documentation automagically for all your stories, available in the `Docs` tab of the Storybook UI.
|
|
32
|
-
|
|
33
|
-
## MDX
|
|
34
|
-
|
|
35
|
-
[MDX](../docs/mdx.md) is a convenient way to document your components in Markdown and embed documentation components, such as stories and props tables, inline.
|
|
36
|
-
|
|
37
|
-
Docs has peer dependencies on `react`. If you want to write stories in MDX, you may need to add this dependency as well:
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
yarn add -D react
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Then update your `.storybook/main.js` to make sure you load MDX files:
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
export default {
|
|
47
|
-
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
48
|
-
};
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Finally, you can create MDX files like this:
|
|
52
|
-
|
|
53
|
-
```md
|
|
54
|
-
import { Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
55
|
-
|
|
56
|
-
<Meta title='App Component' />
|
|
57
|
-
|
|
58
|
-
# App Component
|
|
59
|
-
|
|
60
|
-
Some **markdown** description, or whatever you want.
|
|
61
|
-
|
|
62
|
-
<Story name='basic' height='400px'>{() => {
|
|
63
|
-
return { ... }; // should match the typical story format for your framework
|
|
64
|
-
}}</Story>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## IFrame height
|
|
68
|
-
|
|
69
|
-
In the "common" setup, Storybook Docs renders stories inside `iframe`s, with a default height of `60px`. You can update this default globally, or modify the `iframe` height locally per story in `DocsPage` and `MDX`.
|
|
70
|
-
|
|
71
|
-
To update the global default, modify `.storybook/preview.js`:
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
export const parameters = { docs: { story: { iframeHeight: '400px' } } };
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
For `DocsPage`, you need to update the parameter locally in a story:
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
export const basic = () => ...
|
|
81
|
-
basic.parameters = {
|
|
82
|
-
docs: { story: { iframeHeight: '400px' } }
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
And for `MDX` you can modify it, especially if you work with some components using fixed or sticky positions, as an attribute on the `Story` element:
|
|
87
|
-
|
|
88
|
-
```md
|
|
89
|
-
<Story name='basic' height='400px'>{...}</Story>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## More resources
|
|
93
|
-
|
|
94
|
-
Want to learn more? Here are some more articles on Storybook Docs:
|
|
95
|
-
|
|
96
|
-
- References: [DocsPage](../docs/docspage.md) / [MDX](../docs/mdx.md) / [FAQ](../docs/faq.md) / [Recipes](../docs/recipes.md) / [Theming](../docs/theming.md) / [Props](../docs/props-tables.md)
|
|
97
|
-
- Announcements: [Vision](https://medium.com/storybookjs/storybook-docs-sneak-peak-5be78445094a) / [DocsPage](https://medium.com/storybookjs/storybook-docspage-e185bc3622bf) / [MDX](https://medium.com/storybookjs/rich-docs-with-storybook-mdx-61bc145ae7bc) / [Framework support](https://medium.com/storybookjs/storybook-docs-for-new-frameworks-b1f6090ee0ea)
|
|
98
|
-
- Example: [Storybook Design System](https://github.com/storybookjs/design-system)
|