{"version":3,"file":"Embark_BlogTableofContents.DaX2D8Bo.mjs","names":["React.useState","richText"],"sources":["https:/framerusercontent.com/modules/94L99RYjCzjsvtRsoDWC/rdElzGzGi97B3VfxcJQb/Embark_BlogTableofContents.js"],"sourcesContent":["// TableOfContents.tsx\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import*as React from\"react\";/**\n * @framerDisableUnlink\n */export default function TableOfContents({title=\"Table of contents\",showNumbers=true,richTextId=\"rich-text-content\",typography={headerFont:\"Inter\",headerFontSize:24,headerLineHeight:1.5,headerFontWeight:600,itemFont:\"Inter\",itemFontSize:16,itemLineHeight:1.5,itemFontWeight:400},colors={headerColor:\"#FFFFFF\",itemColor:\"rgba(255,255,255,0.8)\",backgroundColor:\"#000000\",itemBackground:\"#000000\",itemHoverColor:\"Supernova\",itemHoverTextColor:\"#FFFFFF\"},layout={containerPadding:\"24px\",itemPadding:\"12px\",itemSpacing:8,containerRadius:12,itemRadius:8},animation={transition:{type:\"spring\",stiffness:600,damping:45,mass:1,delay:0}}}){const[sections,setSections]=React.useState([]);React.useEffect(()=>{const updateSections=()=>{const richText=document.getElementById(richTextId);if(!richText)return;const headings=richText.querySelectorAll(\"h1, h2, h3, h4, h5, h6\");const newSections=Array.from(headings).map((heading,index)=>{if(!heading.id){heading.id=`section-${index}`;}return{title:heading.textContent,id:heading.id,level:parseInt(heading.tagName[1])};});setSections(newSections);};updateSections();const observer=new MutationObserver(updateSections);const richText=document.getElementById(richTextId);if(richText){observer.observe(richText,{childList:true,subtree:true,characterData:true});}return()=>observer.disconnect();},[richTextId]);const handleClick=id=>{const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\",block:\"start\"});}};const styles={container:{padding:layout.containerPadding,background:colors.backgroundColor,borderRadius:layout.containerRadius,width:\"100%\",position:\"sticky\",top:\"20px\"},title:{color:colors.headerColor,fontFamily:typography.headerFont,fontSize:typography.headerFontSize,lineHeight:typography.headerLineHeight,fontWeight:typography.headerFontWeight,marginBottom:\"20px\",margin:0},link:level=>({display:\"block\",padding:layout.itemPadding,marginBottom:layout.itemSpacing,marginLeft:`${(level-1)*20}px`,color:colors.itemColor,fontFamily:typography.itemFont,background:colors.itemBackground,borderRadius:layout.itemRadius,textDecoration:\"none\",cursor:\"pointer\",fontSize:typography.itemFontSize,lineHeight:typography.itemLineHeight,fontWeight:typography.itemFontWeight}),number:{marginRight:\"8px\",opacity:.5}};return /*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsx(\"h2\",{style:styles.title,children:title}),sections.map((section,index)=>/*#__PURE__*/_jsxs(motion.div,{style:styles.link(section.level),whileHover:{backgroundColor:colors.itemHoverColor,color:colors.itemHoverTextColor},transition:animation.transition,onClick:()=>handleClick(section.id),children:[showNumbers&&/*#__PURE__*/_jsxs(\"span\",{style:styles.number,children:[index+1,\".\"]}),section.title]},`${section.id}-${index}`))]});}addPropertyControls(TableOfContents,{// Basic Settings\ntitle:{type:ControlType.String,title:\"Title\",defaultValue:\"Table of contents\"},showNumbers:{type:ControlType.Boolean,title:\"Show Numbers\",defaultValue:true},richTextId:{type:ControlType.String,title:\"Rich Text ID\",defaultValue:\"rich-text-content\"},// Typography Settings\ntypography:{type:ControlType.Object,title:\"Typography\",controls:{// Header Typography\nheaderFont:{type:ControlType.Font,title:\"Header Font\",defaultValue:\"Inter\"},headerFontSize:{type:ControlType.Number,title:\"Size\",defaultValue:24,min:0,step:1},headerLineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.5,min:0,step:.1},headerFontWeight:{type:ControlType.Number,title:\"Weight\",defaultValue:600,min:100,max:900,step:100},// Item Typography\nitemFont:{type:ControlType.Font,title:\"Item Font\",defaultValue:\"Inter\"},itemFontSize:{type:ControlType.Number,title:\"Size\",defaultValue:16,min:0,step:1},itemLineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.5,min:0,step:.1},itemFontWeight:{type:ControlType.Number,title:\"Weight\",defaultValue:400,min:100,max:900,step:100}}},// Colors\ncolors:{type:ControlType.Object,title:\"Colors\",controls:{headerColor:{type:ControlType.Color,title:\"Header\",defaultValue:\"#FFFFFF\"},itemColor:{type:ControlType.Color,title:\"Item\",defaultValue:\"rgba(255,255,255,0.8)\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},itemBackground:{type:ControlType.Color,title:\"Item Background\",defaultValue:\"#000000\"},itemHoverColor:{type:ControlType.Color,title:\"Item Hover\",defaultValue:\"Supernova\"},itemHoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#FFFFFF\"}}},// Layout\nlayout:{type:ControlType.Object,title:\"Layout\",controls:{containerPadding:{type:ControlType.Padding,title:\"Container Padding\",defaultValue:\"24px\"},itemPadding:{type:ControlType.Padding,title:\"Item Padding\",defaultValue:\"12px\"},itemSpacing:{type:ControlType.Number,title:\"Item Spacing\",defaultValue:8,min:0,max:100,step:1},containerRadius:{type:ControlType.Number,title:\"Container Radius\",defaultValue:12,min:0,max:100,step:1},itemRadius:{type:ControlType.Number,title:\"Item Radius\",defaultValue:8,min:0,max:100,step:1}}},transition:{type:ControlType.Transition,title:\"Hover Animation\",description:\"More components at [Embark Studio Inc.](https://embarkstudio.io/resources)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Embark_BlogTableofContents.map"],"mappings":"iWAGG,SAAwB,EAAgB,CAAC,QAAM,oBAAoB,cAAY,GAAK,aAAW,oBAAoB,aAAW,CAAC,WAAW,QAAQ,eAAe,GAAG,iBAAiB,IAAI,iBAAiB,IAAI,SAAS,QAAQ,aAAa,GAAG,eAAe,IAAI,eAAe,IAAI,CAAC,SAAO,CAAC,YAAY,U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