Socket
Book a DemoInstallSign in
Socket

@storybook/addon-docs

Package Overview
Dependencies
Maintainers
12
Versions
2324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-docs - npm Package Compare versions

Comparing version

to
0.0.0-pr-31551-sha-32f7796f

dist/chunk-2UFMRE4V.mjs

124

dist/blocks.d.ts
import * as React from 'react';
import React__default, { FC, ComponentProps, FunctionComponent, PropsWithChildren, ReactElement, Context, ReactNode } from 'react';
import React__default, { ComponentProps, FunctionComponent, PropsWithChildren, FC, Context, ReactElement, ReactNode } from 'react';
import { Conditional, DocsContextProps, PreparedStory, ModuleExports, Renderer as Renderer$1, Args as Args$1, StoryId, ModuleExport, ResolvedModuleExportType, ResolvedModuleExportFromType, Parameters as Parameters$1, ProjectAnnotations, BaseAnnotations, ComponentTitle } from 'storybook/internal/types';
export { DocsContextProps } from 'storybook/internal/types';
import { Channel } from 'storybook/internal/channels';
export { b as DocsContainer, D as DocsContainerProps, a as TableOfContents } from './DocsContainer-fccc2203.js';
import { Renderer } from 'storybook/internal/csf';

@@ -10,4 +10,40 @@ import { PropDescriptor } from 'storybook/preview-api';

import { SourceType } from 'storybook/internal/docs-tools';
import { ThemeVars } from 'storybook/theming';
import 'storybook/internal/channels';
import 'storybook/theming';
declare enum SourceError {
NO_STORY = "There\u2019s no story here.",
SOURCE_UNAVAILABLE = "Oh no! The source is not available."
}
interface SourceCodeProps {
/** The language the syntax highlighter uses for your story’s code */
language?: SupportedLanguage;
/** Use this to override the content of the source block. */
code?: string;
/** The formatter the syntax highlighter uses for your story’s code. */
format?: ComponentProps<typeof SyntaxHighlighter>['format'];
/** Display the source snippet in a dark mode. */
dark?: boolean;
}
interface SourceProps$1 extends SourceCodeProps {
isLoading?: boolean;
error?: SourceError;
}
/** Syntax-highlighted source code for a component (or anything!) */
declare const Source$1: FunctionComponent<SourceProps$1>;
type PreviewProps = PropsWithChildren<{
isLoading?: true;
layout?: Layout;
inline?: boolean;
isColumn?: boolean;
columns?: number;
withSource?: SourceProps$1;
isExpanded?: boolean;
withToolbar?: boolean;
className?: string;
additionalActions?: ActionItem[];
}>;
type Layout = 'padded' | 'fullscreen' | 'centered';
interface ArgType {

@@ -78,37 +114,2 @@ name?: string;

declare enum SourceError {
NO_STORY = "There\u2019s no story here.",
SOURCE_UNAVAILABLE = "Oh no! The source is not available."
}
interface SourceCodeProps {
/** The language the syntax highlighter uses for your story’s code */
language?: SupportedLanguage;
/** Use this to override the content of the source block. */
code?: string;
/** The formatter the syntax highlighter uses for your story’s code. */
format?: ComponentProps<typeof SyntaxHighlighter>['format'];
/** Display the source snippet in a dark mode. */
dark?: boolean;
}
interface SourceProps$1 extends SourceCodeProps {
isLoading?: boolean;
error?: SourceError;
}
/** Syntax-highlighted source code for a component (or anything!) */
declare const Source$1: FunctionComponent<SourceProps$1>;
type PreviewProps = PropsWithChildren<{
isLoading?: true;
layout?: Layout;
inline?: boolean;
isColumn?: boolean;
columns?: number;
withSource?: SourceProps$1;
isExpanded?: boolean;
withToolbar?: boolean;
className?: string;
additionalActions?: ActionItem[];
}>;
type Layout = 'padded' | 'fullscreen' | 'centered';
interface CommonProps {

@@ -179,41 +180,2 @@ story: PreparedStory;

interface TocbotOptions {
tocSelector: string;
contentSelector: string;
headingSelector: string;
ignoreSelector?: string;
headingsOffset?: number;
scrollSmoothOffset?: number;
orderedList?: boolean;
onClick?: (e: MouseEvent) => void;
scrollEndCallback?: () => void;
[key: string]: unknown;
}
interface TocParameters {
/** CSS selector for the container to search for headings. */
contentsSelector?: string;
/**
* When true, hide the TOC. We still show the empty container (as opposed to showing nothing at
* all) because it affects the page layout and we want to preserve the layout across pages.
*/
disable?: boolean;
/** CSS selector to match headings to list in the TOC. */
headingSelector?: string;
/** Headings that match the ignoreSelector will be skipped. */
ignoreSelector?: string;
/** Custom title ReactElement or string to display above the TOC. */
title?: ReactElement | string | null;
/**
* TocBot options, not guaranteed to be available in future versions.
*
* @see tocbot docs {@link https://tscanlin.github.io/tocbot/#usage}
*/
unsafeTocbotOptions?: Omit<TocbotOptions, 'onClick' | 'scrollEndCallback'>;
}
type TableOfContentsProps = React__default.PropsWithChildren<TocParameters & {
className?: string;
channel: Channel;
}>;
declare const TableOfContents: ({ title, disable, headingSelector, contentsSelector, ignoreSelector, unsafeTocbotOptions, channel, className, }: TableOfContentsProps) => React__default.JSX.Element;
declare const anchorBlockIdFromId: (storyId: string) => string;

@@ -417,8 +379,2 @@ interface AnchorProps {

interface DocsContainerProps<TFramework extends Renderer$1 = Renderer$1> {
context: DocsContextProps<TFramework>;
theme?: ThemeVars;
}
declare const DocsContainer: FC<PropsWithChildren<DocsContainerProps>>;
declare const PRIMARY_STORY = "^";

@@ -1076,2 +1032,2 @@ type Component = any;

export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, Control, ControlProps, ControlType, Controls, DateConfig, DateControl, DateProps, DateValue, DescriptionContainer as Description, DescriptionType, Docs, DocsContainer, DocsContainerProps, DocsContext, DocsPage, DocsProps, DocsStory, DocsStoryProps, ExternalDocs, ExternalDocsContainer, ExternalDocsProps, FilesControl, FilesControlProps, HeaderMdx, HeadersMdx, Heading, HeadingProps, IconGallery, IconItem, Markdown, Meta, NormalizedOptionsConfig, NumberConfig, NumberControl, NumberValue, ObjectConfig, ObjectControl, ObjectProps, ObjectValue, Of, Options, OptionsArray, OptionsConfig, OptionsControl, OptionsControlType, OptionsMultiSelection, OptionsObject, OptionsProps, OptionsSelection, OptionsSingleSelection, PRIMARY_STORY, PresetColor, Primary, ArgsTable as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceParameters, SourceProps, Stories, Story, StoryProps, StorySources, Subheading, Subtitle, TableOfContents, TextConfig, TextControl, TextProps, TextValue, Title, Typeset, UNKNOWN_ARGS_HASH, Unstyled, Wrapper, anchorBlockIdFromId, argsHash, assertIsFn, extractTitle, format, formatDate, formatTime, getStoryId, getStoryProps, parse, parseDate, parseTime, slugs, useOf, useSourceProps };
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, Control, ControlProps, ControlType, Controls, DateConfig, DateControl, DateProps, DateValue, DescriptionContainer as Description, DescriptionType, Docs, DocsContext, DocsPage, DocsProps, DocsStory, DocsStoryProps, ExternalDocs, ExternalDocsContainer, ExternalDocsProps, FilesControl, FilesControlProps, HeaderMdx, HeadersMdx, Heading, HeadingProps, IconGallery, IconItem, Markdown, Meta, NormalizedOptionsConfig, NumberConfig, NumberControl, NumberValue, ObjectConfig, ObjectControl, ObjectProps, ObjectValue, Of, Options, OptionsArray, OptionsConfig, OptionsControl, OptionsControlType, OptionsMultiSelection, OptionsObject, OptionsProps, OptionsSelection, OptionsSingleSelection, PRIMARY_STORY, PresetColor, Primary, ArgsTable as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceParameters, SourceProps, Stories, Story, StoryProps, StorySources, Subheading, Subtitle, TextConfig, TextControl, TextProps, TextValue, Title, Typeset, UNKNOWN_ARGS_HASH, Unstyled, Wrapper, anchorBlockIdFromId, argsHash, assertIsFn, extractTitle, format, formatDate, formatTime, getStoryId, getStoryProps, parse, parseDate, parseTime, slugs, useOf, useSourceProps };

@@ -1,11 +0,8 @@

import * as core_dist_types from 'storybook/internal/types';
export * from '@storybook/addon-docs/blocks';
import { Renderer, DocsRenderFunction, ModuleExports, ModuleExport } from 'storybook/internal/types';
import * as storybook_internal_csf from 'storybook/internal/csf';
import { ComponentType } from 'react';
import { ModuleExports, ModuleExport, Renderer, DocsRenderFunction } from 'storybook/internal/types';
import { ThemeVars } from 'storybook/theming';
import { D as DocsContainerProps, T as TocParameters } from './DocsContainer-fccc2203.js';
import 'storybook/internal/channels';
declare class DocsRenderer<TRenderer extends Renderer> {
render: DocsRenderFunction<TRenderer>;
unmount: (element: HTMLElement) => void;
constructor();
}
type StoryBlockParameters = {

@@ -68,3 +65,3 @@ /** Whether a story's play function runs when shown in docs page */

onClick: () => void;
title: string | JSX.Element;
title: string | React.JSX.Element;
}[];

@@ -122,3 +119,3 @@ /** Provide HTML class(es) to the preview element, for custom styling. */

/** Source code transformations */
transform?: (code: string, storyContext: any) => string;
transform?: (code: string, storyContext: any) => string | Promise<string>;
/**

@@ -150,4 +147,10 @@ * Specifies how the source code is rendered.

*/
canvas?: CanvasBlockParameters;
canvas?: Partial<CanvasBlockParameters>;
/**
* Enable the Code panel.
*
* @see https://storybook.js.org/docs/writing-docs/code-panel
*/
codePanel?: boolean;
/**
* Controls block configuration

@@ -159,2 +162,8 @@ *

/**
* Customize the Docs Container
*
* @see https://storybook.js.org/docs/writing-docs/autodocs#customize-the-docs-container
*/
container?: ComponentType<DocsContainerProps>;
/**
* Component/story description when shown in docs page

@@ -172,3 +181,3 @@ *

*/
page?: unknown;
page?: ComponentType;
/**

@@ -179,3 +188,3 @@ * Source code configuration when shown in docs page

*/
source?: SourceBlockParameters;
source?: Partial<SourceBlockParameters>;
/**

@@ -186,3 +195,3 @@ * Story configuration

*/
story?: StoryBlockParameters;
story?: Partial<StoryBlockParameters>;
/**

@@ -195,2 +204,8 @@ * The subtitle displayed when shown in docs page

/**
* Override the default theme
*
* @see https://storybook.js.org/docs/writing-docs/autodocs#override-the-default-theme
*/
theme?: ThemeVars;
/**
* The title displayed when shown in docs page

@@ -201,7 +216,22 @@ *

title?: string;
/**
* Configure the table of contents
*
* @see https://storybook.js.org/docs/writing-docs/autodocs#configure-the-table-of-contents
*/
toc?: true | TocParameters;
};
}
interface DocsTypes {
parameters: DocsParameters;
}
declare const _default: () => core_dist_types.ProjectAnnotations<core_dist_types.Renderer>;
declare class DocsRenderer<TRenderer extends Renderer> {
render: DocsRenderFunction<TRenderer>;
unmount: (element: HTMLElement) => void;
constructor();
}
export { DocsParameters, DocsRenderer, _default as default };
declare const _default: () => storybook_internal_csf.PreviewAddon<DocsTypes>;
export { DocsRenderer, DocsTypes, _default as default };

@@ -8,3 +8,3 @@ 'use strict';

var blocks = require('@storybook/addon-docs/blocks');
var previewApi = require('storybook/preview-api');
var csf = require('storybook/internal/csf');

@@ -15,10 +15,4 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

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:()=>exports.DocsRenderer,defaultComponents:()=>defaultComponents});var defaultComponents,ErrorBoundary;exports.DocsRenderer = void 0;var 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)}},exports.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 preview_exports={};__export(preview_exports,{parameters:()=>parameters});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}}};init_DocsRenderer();var index_default=()=>previewApi.definePreview(preview_exports);
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:()=>exports.DocsRenderer,defaultComponents:()=>defaultComponents});var defaultComponents,ErrorBoundary;exports.DocsRenderer = void 0;var 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)}},exports.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 preview_exports={};__export(preview_exports,{parameters:()=>parameters});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}}};init_DocsRenderer();var index_default=()=>csf.definePreviewAddon(preview_exports);
exports.default = index_default;
Object.keys(blocks).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return blocks[k]; }
});
});

@@ -11,4 +11,4 @@ 'use strict';

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 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}}};
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}}};
exports.parameters = parameters;
{
"name": "@storybook/addon-docs",
"version": "0.0.0-pr-31521-sha-e03553cd",
"version": "0.0.0-pr-31551-sha-32f7796f",
"description": "Document component usage and properties in Markdown",

@@ -114,5 +114,5 @@ "keywords": [

"@mdx-js/react": "^3.0.0",
"@storybook/csf-plugin": "0.0.0-pr-31521-sha-e03553cd",
"@storybook/icons": "^1.2.12",
"@storybook/react-dom-shim": "0.0.0-pr-31521-sha-e03553cd",
"@storybook/csf-plugin": "0.0.0-pr-31551-sha-32f7796f",
"@storybook/icons": "^1.4.0",
"@storybook/react-dom-shim": "0.0.0-pr-31551-sha-32f7796f",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",

@@ -144,3 +144,3 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",

"peerDependencies": {
"storybook": "^0.0.0-pr-31521-sha-e03553cd"
"storybook": "^0.0.0-pr-31551-sha-32f7796f"
},

@@ -147,0 +147,0 @@ "publishConfig": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.