mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-12 07:42:34 +02:00
1 line
No EOL
9.1 KiB
JavaScript
1 line
No EOL
9.1 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["63623"],{54343:function(e,l,t){t.d(l,{Z:()=>n});let n={tocCollapsibleButton:"tocCollapsibleButton_IbtT",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_Nor3"}},89102:function(e,l,t){t.d(l,{Z:()=>n});let n={tocCollapsible:"tocCollapsible_BEWm",tocCollapsibleContent:"tocCollapsibleContent_FG8F",tocCollapsibleExpanded:"tocCollapsibleExpanded_FzA_"}},22438:function(e,l,t){t.d(l,{Z:()=>n});let n={tableOfContentsInline:"tableOfContentsInline_2sru"}},67079:function(e,l,t){t.d(l,{Z:()=>n});let n={browserWindow:"browserWindow_my1Q",browserWindowHeader:"browserWindowHeader_jXSR",row:"row_KZDM",buttons:"buttons_uHc7",right:"right_oyze",browserWindowAddressBar:"browserWindowAddressBar_Pd8y",dot:"dot_giz1",browserWindowMenuIcon:"browserWindowMenuIcon_Vhuh",bar:"bar_rrRL",browserWindowBody:"browserWindowBody_Idgs"}},95216:function(e,l,t){t.r(l),t.d(l,{assets:()=>u,contentTitle:()=>c,default:()=>f,frontMatter:()=>d,metadata:()=>n,toc:()=>v});var n=t(93558),o=t(85893),s=t(80980),r=t(44456),i=t(42518),a=t(39858);let d={toc_min_heading_level:2,toc_max_heading_level:6},c=void 0,u={},v=[{value:"lvl 2",id:"lvl-2",level:2},{value:"lvl 3",id:"lvl-3",level:3},{value:"lvl 4",id:"lvl-4",level:4},{value:"lvl 5",id:"lvl-5",level:5},{value:"lvl 6",id:"lvl-6",level:6},{value:"lvl 2",id:"lvl-2-1",level:2},{value:"lvl 3",id:"lvl-3-1",level:3},{value:"lvl 4",id:"lvl-4-1",level:4},{value:"lvl 5",id:"lvl-5-1",level:5},{value:"lvl 6",id:"lvl-6-1",level:6}];function h(e){let l={h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",hr:"hr",p:"p",...(0,s.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.p,{children:"Test the TOC behavior of a real-world MD doc with valid headings"}),"\n",(0,o.jsx)(l.hr,{}),"\n",(0,o.jsx)(l.h2,{id:"lvl-2",children:"lvl 2"}),"\n",(0,o.jsx)(l.h3,{id:"lvl-3",children:"lvl 3"}),"\n",(0,o.jsx)(l.h4,{id:"lvl-4",children:"lvl 4"}),"\n",(0,o.jsx)(l.h5,{id:"lvl-5",children:"lvl 5"}),"\n",(0,o.jsx)(l.h6,{id:"lvl-6",children:"lvl 6"}),"\n",(0,o.jsx)(l.h2,{id:"lvl-2-1",children:"lvl 2"}),"\n",(0,o.jsx)(l.h3,{id:"lvl-3-1",children:"lvl 3"}),"\n",(0,o.jsx)(l.h4,{id:"lvl-4-1",children:"lvl 4"}),"\n",(0,o.jsx)(l.h5,{id:"lvl-5-1",children:"lvl 5"}),"\n",(0,o.jsx)(l.h6,{id:"lvl-6-1",children:"lvl 6"}),"\n",(0,o.jsx)(l.hr,{}),"\n",(0,o.jsx)(l.p,{children:"INLINE:"}),"\n","\n","\n",(0,o.jsx)(r.Z,{children:(0,o.jsx)(i.Z,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})}),"\n",(0,o.jsx)(l.hr,{}),"\n",(0,o.jsx)(l.p,{children:"COLLAPSIBLE:"}),"\n","\n",(0,o.jsx)(r.Z,{children:(0,o.jsx)(a.Z,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})})]})}function f(e={}){let{wrapper:l}={...(0,s.a)(),...e.components};return l?(0,o.jsx)(l,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}f.displayName="MDXContent(_dogfooding/_docs tests/toc/toc-test-good.mdx)"},31770:function(e,l,t){t.d(l,{Z:()=>i});var n=t(85893);t(67294);var o=t(90496),s=t(77827),r=t(54343);function i(e){let{collapsed:l,...t}=e;return(0,n.jsx)("button",{type:"button",...t,className:(0,o.Z)("clean-btn",r.Z.tocCollapsibleButton,!l&&r.Z.tocCollapsibleButtonExpanded,t.className),children:(0,n.jsx)(s.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})})}},39858:function(e,l,t){t.d(l,{Z:()=>d});var n=t(85893);t(67294);var o=t(90496),s=t(97812),r=t(31373),i=t(31770),a=t(89102);function d(e){let{toc:l,className:t,minHeadingLevel:d,maxHeadingLevel:c}=e,{collapsed:u,toggleCollapsed:v}=(0,s.u)({initialState:!0});return(0,n.jsxs)("div",{className:(0,o.Z)(a.Z.tocCollapsible,!u&&a.Z.tocCollapsibleExpanded,t),children:[(0,n.jsx)(i.Z,{collapsed:u,onClick:v}),(0,n.jsx)(s.z,{lazy:!0,className:a.Z.tocCollapsibleContent,collapsed:u,children:(0,n.jsx)(r.Z,{toc:l,minHeadingLevel:d,maxHeadingLevel:c})})]})}},42518:function(e,l,t){t.d(l,{Z:()=>r});var n=t(85893);t(67294);var o=t(31373),s=t(22438);function r(e){let{toc:l,minHeadingLevel:t,maxHeadingLevel:r}=e;return(0,n.jsx)("div",{className:s.Z.tableOfContentsInline,children:(0,n.jsx)(o.Z,{toc:l,minHeadingLevel:t,maxHeadingLevel:r,className:"table-of-contents",linkClassName:null})})}},77655:function(e,l,t){t.d(l,{Z:()=>r});var n=t(85893),o=t(67294),s=t(35363);let r=o.memo(function e(l){let{toc:t,className:o,linkClassName:r,isChild:i}=l;return t.length?(0,n.jsx)("ul",{className:i?void 0:o,children:t.map(l=>(0,n.jsxs)("li",{children:[(0,n.jsx)(s.Z,{to:`#${l.id}`,className:r??void 0,dangerouslySetInnerHTML:{__html:l.value}}),(0,n.jsx)(e,{isChild:!0,toc:l.children,className:o,linkClassName:r})]},l.id))}):null})},31373:function(e,l,t){t.d(l,{Z:()=>d});var n=t(85893),o=t(67294),s=t(26378),r=t(79910),i=t(16394),a=t(77655);function d(e){let{toc:l,className:t="table-of-contents table-of-contents__left-border",linkClassName:d="table-of-contents__link",linkActiveClassName:c,minHeadingLevel:u,maxHeadingLevel:v,...h}=e,f=(0,s.L)(),m=u??f.tableOfContents.minHeadingLevel,b=v??f.tableOfContents.maxHeadingLevel,p=(0,r.b)({toc:l,minHeadingLevel:m,maxHeadingLevel:b}),x=(0,o.useMemo)(()=>{if(d&&c)return{linkClassName:d,linkActiveClassName:c,minHeadingLevel:m,maxHeadingLevel:b}},[d,c,m,b]);return(0,i.S)(x),(0,n.jsx)(a.Z,{toc:p,className:t,linkClassName:d,...h})}},16394:function(e,l,t){t.d(l,{S:()=>r});var n=t(67294),o=t(26378);function s(e){let l=e.getBoundingClientRect();return l.top===l.bottom?s(e.parentNode):l}function r(e){let l=(0,n.useRef)(void 0),t=function(){let e=(0,n.useRef)(0),{navbar:{hideOnScroll:l}}=(0,o.L)();return(0,n.useEffect)(()=>{e.current=l?0:document.querySelector(".navbar").clientHeight},[l]),e}();(0,n.useEffect)(()=>{if(!e)return()=>{};let{linkClassName:n,linkActiveClassName:o,minHeadingLevel:r,maxHeadingLevel:i}=e;function a(){let e=Array.from(document.getElementsByClassName(n)),a=function(e,l){let{anchorTopOffset:t}=l,n=e.find(e=>s(e).top>=t);if(n){var o;return(o=s(n)).top>0&&o.bottom<window.innerHeight/2?n:e[e.indexOf(n)-1]??null}return e[e.length-1]??null}(function(e){let{minHeadingLevel:l,maxHeadingLevel:t}=e,n=[];for(let e=l;e<=t;e+=1)n.push(`h${e}.anchor`);return Array.from(document.querySelectorAll(n.join()))}({minHeadingLevel:r,maxHeadingLevel:i}),{anchorTopOffset:t.current}),d=e.find(e=>a&&a.id===decodeURIComponent(e.href.substring(e.href.indexOf("#")+1)));e.forEach(e=>{e===d?(l.current&&l.current!==e&&l.current.classList.remove(o),e.classList.add(o),l.current=e):e.classList.remove(o)})}return document.addEventListener("scroll",a),document.addEventListener("resize",a),a(),()=>{document.removeEventListener("scroll",a),document.removeEventListener("resize",a)}},[e,t])}},79910:function(e,l,t){t.d(l,{b:()=>o});var n=t(67294);function o(e){let{toc:l,minHeadingLevel:t,maxHeadingLevel:o}=e;return(0,n.useMemo)(()=>(function e(l){let{toc:t,minHeadingLevel:n,maxHeadingLevel:o}=l;return t.flatMap(l=>{let t=e({toc:l.children,minHeadingLevel:n,maxHeadingLevel:o});return l.level>=n&&l.level<=o?[{...l,children:t}]:t})})({toc:function(e){let l=e.map(e=>({...e,parentIndex:-1,children:[]})),t=Array(7).fill(-1);l.forEach((e,l)=>{let n=t.slice(2,e.level);e.parentIndex=Math.max(...n),t[e.level]=l});let n=[];return l.forEach(e=>{let{parentIndex:t,...o}=e;t>=0?l[t].children.push(o):n.push(o)}),n}(l),minHeadingLevel:t,maxHeadingLevel:o}),[l,t,o])}},44456:function(e,l,t){t.d(l,{Z:()=>r});var n=t(85893);t(67294);var o=t(90496),s=t(67079);function r(e){let{children:l,minHeight:t,url:r="http://localhost:3000",style:i,bodyStyle:a}=e;return(0,n.jsxs)("div",{className:s.Z.browserWindow,style:{...i,minHeight:t},children:[(0,n.jsxs)("div",{className:s.Z.browserWindowHeader,children:[(0,n.jsxs)("div",{className:s.Z.buttons,children:[(0,n.jsx)("span",{className:s.Z.dot,style:{background:"#f25f58"}}),(0,n.jsx)("span",{className:s.Z.dot,style:{background:"#fbbe3c"}}),(0,n.jsx)("span",{className:s.Z.dot,style:{background:"#58cb42"}})]}),(0,n.jsx)("div",{className:(0,o.Z)(s.Z.browserWindowAddressBar,"text--truncate"),children:r}),(0,n.jsx)("div",{className:s.Z.browserWindowMenuIcon,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:s.Z.bar}),(0,n.jsx)("span",{className:s.Z.bar}),(0,n.jsx)("span",{className:s.Z.bar})]})})]}),(0,n.jsx)("div",{className:s.Z.browserWindowBody,style:a,children:l})]})}},80980:function(e,l,t){t.d(l,{Z:()=>i,a:()=>r});var n=t(67294);let o={},s=n.createContext(o);function r(e){let l=n.useContext(s);return n.useMemo(function(){return"function"==typeof e?e(l):{...l,...e}},[l,e])}function i(e){let l;return l=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),n.createElement(s.Provider,{value:l},e.children)}},93558:function(e){e.exports=JSON.parse('{"id":"toc/toc-test-good","title":"toc-test-good","description":"Test the TOC behavior of a real-world MD doc with valid headings","source":"@site/_dogfooding/_docs tests/toc/toc-test-good.mdx","sourceDirName":"toc","slug":"/toc/toc-test-good","permalink":"/tests/docs/toc/toc-test-good","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedBy":"S\xe9bastien Lorber","lastUpdatedAt":1748625776000,"frontMatter":{"toc_min_heading_level":2,"toc_max_heading_level":6},"sidebar":"sidebar","previous":{"title":"toc-test-bad","permalink":"/tests/docs/toc/toc-test-bad"}}')}}]); |