@san-siva/blogkit 1.1.0 → 1.1.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/dist/cjs/dynamicComponents/BlogDynamic.js +29 -18
- package/dist/cjs/dynamicComponents/BlogDynamic.js.map +1 -1
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.css.map +1 -1
- package/dist/esm/dynamicComponents/BlogDynamic.js +29 -18
- package/dist/esm/dynamicComponents/BlogDynamic.js.map +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.css.map +1 -1
- package/dist/types/dynamicComponents/BlogDynamic.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dynamicComponents/BlogDynamic.tsx +65 -58
- package/src/styles/Blog.module.scss +4 -2
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useCallback, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
4
|
+
import { useSpring, animated } from '@react-spring/web';
|
|
4
5
|
import styles from '../styles/Blog.module.scss.js';
|
|
5
6
|
|
|
6
7
|
const Blog = ({ children, title = 'In this article' }) => {
|
|
7
|
-
const addPaddingTopTimerReference = useRef(null);
|
|
8
|
-
const highlightCategoryTimerReference = useRef(null);
|
|
9
|
-
const clearTimers = (addPaddingTopTimerReference_, highlightCategoryTimerReference_) => {
|
|
10
|
-
if (addPaddingTopTimerReference_) {
|
|
11
|
-
clearTimeout(addPaddingTopTimerReference_);
|
|
12
|
-
}
|
|
13
|
-
if (highlightCategoryTimerReference_) {
|
|
14
|
-
clearTimeout(highlightCategoryTimerReference_);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
8
|
const sectionReferences = useRef(new Map());
|
|
18
9
|
const [categoryTitles, setCategoryTitles] = useState(new Map());
|
|
19
10
|
const [visibleTitle, setVisibleTitle] = useState(null);
|
|
11
|
+
const [showTOC, setShowTOC] = useState(false);
|
|
20
12
|
const updateTimerRef = useRef(null);
|
|
13
|
+
const showTOCTimerRef = useRef(null);
|
|
21
14
|
const sortByDomPosition = useCallback(([, a], [, b]) => {
|
|
22
15
|
const position = a.el.compareDocumentPosition(b.el);
|
|
23
16
|
if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
@@ -28,6 +21,16 @@ const Blog = ({ children, title = 'In this article' }) => {
|
|
|
28
21
|
}
|
|
29
22
|
return 0;
|
|
30
23
|
}, []);
|
|
24
|
+
const debounceShowTOC = useCallback(() => {
|
|
25
|
+
if (showTOC)
|
|
26
|
+
return;
|
|
27
|
+
if (showTOCTimerRef.current) {
|
|
28
|
+
clearTimeout(showTOCTimerRef.current);
|
|
29
|
+
}
|
|
30
|
+
showTOCTimerRef.current = setTimeout(() => {
|
|
31
|
+
setShowTOC(true);
|
|
32
|
+
}, 200);
|
|
33
|
+
}, [showTOC]);
|
|
31
34
|
const updateCategoryTitles = useCallback(() => {
|
|
32
35
|
const now = Date.now();
|
|
33
36
|
const newCategoryTitles = new Map();
|
|
@@ -46,12 +49,13 @@ const Blog = ({ children, title = 'In this article' }) => {
|
|
|
46
49
|
isSubSection,
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
|
-
if (newCategoryTitles.size
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if (newCategoryTitles.size === 0)
|
|
53
|
+
return;
|
|
54
|
+
setCategoryTitles(newCategoryTitles);
|
|
55
|
+
debounceShowTOC();
|
|
56
|
+
if (visibleTitle)
|
|
57
|
+
return;
|
|
58
|
+
setVisibleTitle(firstSectionId);
|
|
55
59
|
}, [visibleTitle, sortByDomPosition]);
|
|
56
60
|
const debounceUpdateCategoryTitles = useCallback(() => {
|
|
57
61
|
// Clear existing timer and set a new one to batch updates
|
|
@@ -87,10 +91,12 @@ const Blog = ({ children, title = 'In this article' }) => {
|
|
|
87
91
|
}, [categoryTitles.size]);
|
|
88
92
|
useEffect(() => {
|
|
89
93
|
return () => {
|
|
90
|
-
clearTimers(addPaddingTopTimerReference.current, highlightCategoryTimerReference.current);
|
|
91
94
|
if (updateTimerRef.current) {
|
|
92
95
|
clearTimeout(updateTimerRef.current);
|
|
93
96
|
}
|
|
97
|
+
if (showTOCTimerRef.current) {
|
|
98
|
+
clearTimeout(showTOCTimerRef.current);
|
|
99
|
+
}
|
|
94
100
|
};
|
|
95
101
|
}, []);
|
|
96
102
|
const handleSectionReference = useCallback((element) => {
|
|
@@ -145,13 +151,18 @@ const Blog = ({ children, title = 'In this article' }) => {
|
|
|
145
151
|
clearTimeout(timer);
|
|
146
152
|
}, 1000);
|
|
147
153
|
};
|
|
154
|
+
const sidebarStyle = useSpring({
|
|
155
|
+
opacity: showTOC ? 1 : 0,
|
|
156
|
+
transform: showTOC ? 'translateX(0)' : 'translateX(80px)',
|
|
157
|
+
config: { tension: 280, friction: 60 },
|
|
158
|
+
});
|
|
148
159
|
return (jsxs("div", { className: styles.blog, children: [jsx("div", { className: styles['blog__content'], children: Children.map(children, child => {
|
|
149
160
|
if (!isValidElement(child))
|
|
150
161
|
return child;
|
|
151
162
|
return cloneElement(child, {
|
|
152
163
|
ref: handleSectionReference,
|
|
153
164
|
});
|
|
154
|
-
}) }), jsxs(
|
|
165
|
+
}) }), jsxs(animated.div, { className: styles['blog__sidebar'], style: sidebarStyle, children: [jsx("p", { className: `${styles['margin-bottom--3']} ${styles['category__header']}`, children: title }), [...categoryTitles].map(([id, { title, isSubSection }], index, array) => {
|
|
155
166
|
const isNextSectionSubSection = array[index + 1]?.[1]?.isSubSection;
|
|
156
167
|
return (jsx("p", { "data-idx": index, "data-id": id, className: `${styles['category__title']} ${id === visibleTitle ? styles['category__title--active'] : ''} ${isSubSection ? styles['category__title--sub'] : ''} ${isSubSection && !isNextSectionSubSection
|
|
157
168
|
? styles['margin-bottom-imp--2']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlogDynamic.js","sources":["../../../src/dynamicComponents/BlogDynamic.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tChildren,\n\tcloneElement,\n\tisValidElement,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\n\nimport type { MouseEvent, ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/Blog.module.scss';\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n}\n\nexport interface ForwardedReference {\n\tparentRef: HTMLDivElement;\n\tchildRefs: HTMLDivElement[];\n}\n\ninterface SectionReferenceValue {\n\tel: HTMLElement;\n\ttitle: string;\n\tisSubSection: boolean;\n}\n\ntype SectionReference = Map<string, SectionReferenceValue>;\n\ninterface CategoryTitleValue extends SectionReferenceValue {\n\tlastUpdatedAt: number;\n}\n\ntype CategoryTitle = Map<string, CategoryTitleValue>;\n\ntype AddPaddingTopTimerReference = ReturnType<typeof setTimeout> | null;\n\nconst Blog = ({ children, title = 'In this article' }: BlogProperties) => {\n\tconst addPaddingTopTimerReference = useRef<AddPaddingTopTimerReference>(null);\n\tconst highlightCategoryTimerReference =\n\t\tuseRef<AddPaddingTopTimerReference>(null);\n\n\tconst clearTimers = (\n\t\taddPaddingTopTimerReference_: AddPaddingTopTimerReference,\n\t\thighlightCategoryTimerReference_: AddPaddingTopTimerReference\n\t) => {\n\t\tif (addPaddingTopTimerReference_) {\n\t\t\tclearTimeout(addPaddingTopTimerReference_);\n\t\t}\n\t\tif (highlightCategoryTimerReference_) {\n\t\t\tclearTimeout(highlightCategoryTimerReference_);\n\t\t}\n\t};\n\n\tconst sectionReferences = useRef<SectionReference>(new Map());\n\tconst [categoryTitles, setCategoryTitles] = useState<CategoryTitle>(\n\t\tnew Map()\n\t);\n\tconst [visibleTitle, setVisibleTitle] = useState<string | null>(null);\n\tconst updateTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tconst sortByDomPosition = useCallback(\n\t\t([, a]: [string, SectionReferenceValue], [, b]: [string, SectionReferenceValue]) => {\n\t\t\tconst position = a.el.compareDocumentPosition(b.el);\n\t\t\tif (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n\t\t\t\treturn -1; // a comes before b\n\t\t\t} else if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n\t\t\t\treturn 1; // b comes before a\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t\t[]\n\t);\n\n\tconst updateCategoryTitles = useCallback(() => {\n\t\tconst now = Date.now();\n\t\tconst newCategoryTitles = new Map<string, CategoryTitleValue>();\n\n\t\t// Sort sections by their DOM position to maintain correct order\n\t\tconst sectionsArray = Array.from(sectionReferences.current.entries());\n\t\tsectionsArray.sort(sortByDomPosition);\n\n\t\tlet firstSectionId: string | null = null;\n\t\tfor (const [id, { title, el, isSubSection }] of sectionsArray) {\n\t\t\tif (!firstSectionId) {\n\t\t\t\tfirstSectionId = id;\n\t\t\t}\n\t\t\tnewCategoryTitles.set(id, {\n\t\t\t\tel,\n\t\t\t\ttitle,\n\t\t\t\tlastUpdatedAt: now,\n\t\t\t\tisSubSection,\n\t\t\t});\n\t\t}\n\n\t\tif (newCategoryTitles.size > 0) {\n\t\t\tsetCategoryTitles(newCategoryTitles);\n\t\t\tif (!visibleTitle) {\n\t\t\t\tsetVisibleTitle(firstSectionId);\n\t\t\t}\n\t\t}\n\t}, [visibleTitle, sortByDomPosition]);\n\n\tconst debounceUpdateCategoryTitles = useCallback(() => {\n\t\t// Clear existing timer and set a new one to batch updates\n\t\tif (updateTimerRef.current) {\n\t\t\tclearTimeout(updateTimerRef.current);\n\t\t}\n\t\tupdateTimerRef.current = setTimeout(() => {\n\t\t\tupdateCategoryTitles();\n\t\t}, 50);\n\t}, [updateCategoryTitles]);\n\n\tuseEffect(() => {\n\t\tconst observers = new Map<string, IntersectionObserver>();\n\t\tfor (const [id, { el }] of categoryTitles) {\n\t\t\tconst observer = new IntersectionObserver(\n\t\t\t\t([entry]) => {\n\t\t\t\t\tif (!entry.isIntersecting) return;\n\t\t\t\t\tsetVisibleTitle(visibleId => {\n\t\t\t\t\t\tif (visibleId === id && !entry.isIntersecting) return null;\n\t\t\t\t\t\tif (entry.isIntersecting) return id;\n\t\t\t\t\t\treturn visibleId;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t{ threshold: 0.1 }\n\t\t\t);\n\t\t\tobservers.set(id, observer);\n\t\t\tobserver.observe(el);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const observer of observers.values()) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [categoryTitles.size]);\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tclearTimers(\n\t\t\t\taddPaddingTopTimerReference.current,\n\t\t\t\thighlightCategoryTimerReference.current\n\t\t\t);\n\t\t\tif (updateTimerRef.current) {\n\t\t\t\tclearTimeout(updateTimerRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleSectionReference = useCallback((element: ForwardedReference) => {\n\t\tif (!element) return;\n\t\tconst { parentRef, childRefs } = element;\n\n\t\t// Add parent section reference\n\t\tif (parentRef) {\n\t\t\tconst id = parentRef.dataset.id;\n\t\t\tconst title = parentRef.dataset.title;\n\t\t\tif (id && title) {\n\t\t\t\tsectionReferences.current.set(id, {\n\t\t\t\t\tel: parentRef,\n\t\t\t\t\ttitle,\n\t\t\t\t\tisSubSection: false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Add child section references\n\t\tif (Array.isArray(childRefs)) {\n\t\t\tfor (const childRef of childRefs) {\n\t\t\t\tif (!childRef) continue;\n\t\t\t\tconst id = childRef.dataset.id;\n\t\t\t\tconst title = childRef.dataset.title;\n\t\t\t\tif (id && title) {\n\t\t\t\t\tsectionReferences.current.set(id, {\n\t\t\t\t\t\tel: childRef,\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tisSubSection: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdebounceUpdateCategoryTitles();\n\t}, [debounceUpdateCategoryTitles]);\n\n\tconst handleClickCategoryTitle = (\n\t\terror: MouseEvent<HTMLParagraphElement>\n\t) => {\n\t\tconst id = error.currentTarget.dataset.id;\n\t\tconst index = error.currentTarget.dataset.idx;\n\t\tif (!id || !index) return;\n\n\t\tconst { el } = categoryTitles.get(id) || {};\n\t\tif (!el) return;\n\n\t\tconst top = el.getBoundingClientRect().top + document.body.scrollTop - 100;\n\t\tdocument.body.scrollTo({\n\t\t\ttop,\n\t\t\tbehavior: 'smooth',\n\t\t});\n\n\t\tconst timer = setTimeout(() => {\n\t\t\tsetVisibleTitle(id);\n\t\t\tclearTimeout(timer);\n\t\t}, 1000);\n\t};\n\n\n\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t<div className={styles['blog__content']}>\n\t\t\t\t{Children.map(children, child => {\n\t\t\t\t\tif (!isValidElement(child)) return child;\n\t\t\t\t\treturn cloneElement(child, {\n\t\t\t\t\t\tref: handleSectionReference,\n\t\t\t\t\t} as RefAttributes<ForwardedReference>);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t\t<div className={styles['blog__sidebar']}>\n\t\t\t\t<p\n\t\t\t\t\tclassName={`${styles['margin-bottom--3']} ${styles['category__header']}`}\n\t\t\t\t>\n\t\t\t\t\t{title}\n\t\t\t\t</p>\n\t\t\t\t{[...categoryTitles].map(\n\t\t\t\t\t([id, { title, isSubSection }], index, array) => {\n\t\t\t\t\t\tconst isNextSectionSubSection = array[index + 1]?.[1]?.isSubSection;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\t\tdata-idx={index}\n\t\t\t\t\t\t\t\tdata-id={id}\n\t\t\t\t\t\t\t\tclassName={`${styles['category__title']} ${\n\t\t\t\t\t\t\t\t\tid === visibleTitle ? styles['category__title--active'] : ''\n\t\t\t\t\t\t\t\t} ${isSubSection ? styles['category__title--sub'] : ''} ${\n\t\t\t\t\t\t\t\t\tisSubSection && !isNextS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C,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA,CAAA,EAAI,MAAM,CAAC,kBAAkB,CAAC,CAAA,CAAE,YAEvE,KAAK,EAAA,CACH,EACH,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,CACvB,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAI;AAC/C,wBAAA,MAAM,uBAAuB,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY;wBACnE,QACCA,uBAEW,KAAK,EAAA,SAAA,EACN,EAAE,EACX,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,iBAAiB,CAAC,IACtC,EAAE,KAAK,YAAY,GAAG,MAAM,CAAC,yBAAyB,CAAC,GAAG,EAC3D,IAAI,YAAY,GAAG,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAA,CAAA,EACrD,YAAY,IAAI,CAAC;AAChB,kCAAE,MAAM,CAAC,sBAAsB;AAC/B,kCAAE,EACJ,CAAA,CAAE,EACF,OAAO,EAAE,wBAAwB,EAAA,QAAA,EAEhC,KAAK,EAAA,EAZD,EAAE,CAaJ;AAEN,oBAAA,CAAC,CACD,CAAA,EAAA,CACI,CAAA,EAAA,CACD;AAER;;;;"}
|
|
1
|
+
{"version":3,"file":"BlogDynamic.js","sources":["../../../src/dynamicComponents/BlogDynamic.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tChildren,\n\tcloneElement,\n\tisValidElement,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { useSpring, animated } from '@react-spring/web';\n\nimport type { MouseEvent, ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/Blog.module.scss';\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n}\n\nexport interface ForwardedReference {\n\tparentRef: HTMLDivElement;\n\tchildRefs: HTMLDivElement[];\n}\n\ninterface SectionReferenceValue {\n\tel: HTMLElement;\n\ttitle: string;\n\tisSubSection: boolean;\n}\n\ntype SectionReference = Map<string, SectionReferenceValue>;\n\ninterface CategoryTitleValue extends SectionReferenceValue {\n\tlastUpdatedAt: number;\n}\n\ntype CategoryTitle = Map<string, CategoryTitleValue>;\n\nconst Blog = ({ children, title = 'In this article' }: BlogProperties) => {\n\tconst sectionReferences = useRef<SectionReference>(new Map());\n\tconst [categoryTitles, setCategoryTitles] = useState<CategoryTitle>(\n\t\tnew Map()\n\t);\n\tconst [visibleTitle, setVisibleTitle] = useState<string | null>(null);\n\tconst [showTOC, setShowTOC] = useState(false);\n\n\tconst updateTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\tconst showTOCTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tconst sortByDomPosition = useCallback(\n\t\t(\n\t\t\t[, a]: [string, SectionReferenceValue],\n\t\t\t[, b]: [string, SectionReferenceValue]\n\t\t) => {\n\t\t\tconst position = a.el.compareDocumentPosition(b.el);\n\t\t\tif (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n\t\t\t\treturn -1; // a comes before b\n\t\t\t} else if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n\t\t\t\treturn 1; // b comes before a\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t\t[]\n\t);\n\n\tconst debounceShowTOC = useCallback(() => {\n\t\tif (showTOC) return;\n\t\tif (showTOCTimerRef.current) {\n\t\t\tclearTimeout(showTOCTimerRef.current);\n\t\t}\n\t\tshowTOCTimerRef.current = setTimeout(() => {\n\t\t\tsetShowTOC(true);\n\t\t}, 200);\n\t}, [showTOC]);\n\n\tconst updateCategoryTitles = useCallback(() => {\n\t\tconst now = Date.now();\n\t\tconst newCategoryTitles = new Map<string, CategoryTitleValue>();\n\n\t\t// Sort sections by their DOM position to maintain correct order\n\t\tconst sectionsArray = Array.from(sectionReferences.current.entries());\n\t\tsectionsArray.sort(sortByDomPosition);\n\n\t\tlet firstSectionId: string | null = null;\n\t\tfor (const [id, { title, el, isSubSection }] of sectionsArray) {\n\t\t\tif (!firstSectionId) {\n\t\t\t\tfirstSectionId = id;\n\t\t\t}\n\t\t\tnewCategoryTitles.set(id, {\n\t\t\t\tel,\n\t\t\t\ttitle,\n\t\t\t\tlastUpdatedAt: now,\n\t\t\t\tisSubSection,\n\t\t\t});\n\t\t}\n\n\t\tif (newCategoryTitles.size === 0) return;\n\n\t\tsetCategoryTitles(newCategoryTitles);\n\t\tdebounceShowTOC();\n\n\t\tif (visibleTitle) return;\n\t\tsetVisibleTitle(firstSectionId);\n\t}, [visibleTitle, sortByDomPosition]);\n\n\tconst debounceUpdateCategoryTitles = useCallback(() => {\n\t\t// Clear existing timer and set a new one to batch updates\n\t\tif (updateTimerRef.current) {\n\t\t\tclearTimeout(updateTimerRef.current);\n\t\t}\n\t\tupdateTimerRef.current = setTimeout(() => {\n\t\t\tupdateCategoryTitles();\n\t\t}, 50);\n\t}, [updateCategoryTitles]);\n\n\tuseEffect(() => {\n\t\tconst observers = new Map<string, IntersectionObserver>();\n\t\tfor (const [id, { el }] of categoryTitles) {\n\t\t\tconst observer = new IntersectionObserver(\n\t\t\t\t([entry]) => {\n\t\t\t\t\tif (!entry.isIntersecting) return;\n\t\t\t\t\tsetVisibleTitle(visibleId => {\n\t\t\t\t\t\tif (visibleId === id && !entry.isIntersecting) return null;\n\t\t\t\t\t\tif (entry.isIntersecting) return id;\n\t\t\t\t\t\treturn visibleId;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t{ threshold: 0.1 }\n\t\t\t);\n\t\t\tobservers.set(id, observer);\n\t\t\tobserver.observe(el);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const observer of observers.values()) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [categoryTitles.size]);\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (updateTimerRef.current) {\n\t\t\t\tclearTimeout(updateTimerRef.current);\n\t\t\t}\n\t\t\tif (showTOCTimerRef.current) {\n\t\t\t\tclearTimeout(showTOCTimerRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleSectionReference = useCallback(\n\t\t(element: ForwardedReference) => {\n\t\t\tif (!element) return;\n\t\t\tconst { parentRef, childRefs } = element;\n\n\t\t\t// Add parent section reference\n\t\t\tif (parentRef) {\n\t\t\t\tconst id = parentRef.dataset.id;\n\t\t\t\tconst title = parentRef.dataset.title;\n\t\t\t\tif (id && title) {\n\t\t\t\t\tsectionReferences.current.set(id, {\n\t\t\t\t\t\tel: parentRef,\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tisSubSection: false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add child section references\n\t\t\tif (Array.isArray(childRefs)) {\n\t\t\t\tfor (const childRef of childRefs) {\n\t\t\t\t\tif (!childRef) continue;\n\t\t\t\t\tconst id = childRef.dataset.id;\n\t\t\t\t\tconst title = childRef.dataset.title;\n\t\t\t\t\tif (id && title) {\n\t\t\t\t\t\tsectionReferences.current.set(id, {\n\t\t\t\t\t\t\tel: childRef,\n\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\tisSubSection: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdebounceUpdateCategoryTitles();\n\t\t},\n\t\t[debounceUpdateCategoryTitles]\n\t);\n\n\tconst handleClickCategoryTitle = (\n\t\terror: MouseEvent<HTMLParagraphElement>\n\t) => {\n\t\tconst id = error.currentTarget.dataset.id;\n\t\tconst index = error.currentTarget.dataset.idx;\n\t\tif (!id || !index) return;\n\n\t\tconst { el } = categoryTitles.get(id) || {};\n\t\tif (!el) return;\n\n\t\tconst top = el.getBoundingClientRect().top + document.body.scrollTop - 100;\n\t\tdocument.body.scrollTo({\n\t\t\ttop,\n\t\t\tbehavior: 'smooth',\n\t\t});\n\n\t\tconst timer = setTimeout(() => {\n\t\t\tsetVisibleTitle(id);\n\t\t\tclearTimeout(timer);\n\t\t}, 1000);\n\t};\n\n\tconst sidebarStyle = useSpring({\n\t\topacity: showTOC ? 1 : 0,\n\t\ttransform: showTOC ? 'translateX(0)' : 'translateX(80px)',\n\t\tconfig: { tension: 280, friction: 60 },\n\t});\n\n\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t<div className={styles['blog__content']}>\n\t\t\t\t{Children.map(children, child => {\n\t\t\t\t\tif (!isValidElement(child)) return child;\n\t\t\t\t\treturn cloneElement(child, {\n\t\t\t\t\t\tref: handleSectionReference,\n\t\t\t\t\t} as RefAttributes<ForwardedReference>);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t\t<animated.div className={styles['blog__sidebar']} style={sidebarStyle}>\n\t\t\t\t<p\n\t\t\t\t\tclassName={`${styles['margin-bottom--3']} ${styles['category__header']}`}\n\t\t\t\t>\n\t\t\t\t\t{title}\n\t\t\t\t</p>\n\t\t\t\t{[...categoryTitles].map(\n\t\t\t\t\t([id, { title, isSubSection }], index, array) => {\n\t\t\t\t\t\tconst isNextSectionSubSection = array[index + 1]?.[1]?.isSubSection;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\t\tdata-idx={index}\n\t\t\t\t\t\t\t\tdata-id={id}\n\t\t\t\t\t\t\t\tclassName={`${styles['category__title']} ${\n\t\t\t\t\t\t\t\t\tid === visibleTitle ? styles['category__title--active'] : ''\n\t\t\t\t\t\t\t\t} ${isSubSection ? styles['category__title--sub'] : ''} ${\n\t\t\t\t\t\t\t\t\tisSubSection && !isNextSectionSubSection\n\t\t\t\t\t\t\t\t\t\t? styles['margin-bottom-imp--2']\n\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\tonClick={handleClickCategoryTitle}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t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