@san-siva/blogkit 1.1.21 → 1.1.22

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.
Files changed (31) hide show
  1. package/dist/cjs/components/BlogSection.js +2 -2
  2. package/dist/cjs/components/BlogSection.js.map +1 -1
  3. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +6 -7
  4. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  5. package/dist/cjs/index.css +1 -1
  6. package/dist/cjs/index.css.map +1 -1
  7. package/dist/cjs/staticComponents/BlogSectionStatic.js +2 -5
  8. package/dist/cjs/staticComponents/BlogSectionStatic.js.map +1 -1
  9. package/dist/cjs/styles/BlogSection.module.scss.js +1 -1
  10. package/dist/esm/components/BlogSection.js +2 -2
  11. package/dist/esm/components/BlogSection.js.map +1 -1
  12. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +6 -7
  13. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  14. package/dist/esm/index.css +1 -1
  15. package/dist/esm/index.css.map +1 -1
  16. package/dist/esm/staticComponents/BlogSectionStatic.js +2 -5
  17. package/dist/esm/staticComponents/BlogSectionStatic.js.map +1 -1
  18. package/dist/esm/styles/BlogSection.module.scss.js +1 -1
  19. package/dist/types/components/BlogSection.d.ts +0 -1
  20. package/dist/types/components/BlogSection.d.ts.map +1 -1
  21. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts +0 -1
  22. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts.map +1 -1
  23. package/dist/types/staticComponents/BlogSectionStatic.d.ts +1 -2
  24. package/dist/types/staticComponents/BlogSectionStatic.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/components/BlogSection.tsx +0 -4
  27. package/src/dynamicComponents/BlogSectionDynamic.tsx +24 -21
  28. package/src/staticComponents/BlogSectionStatic.tsx +2 -13
  29. package/src/styles/BlogHeader.module.scss +6 -5
  30. package/src/styles/BlogSection.module.scss +19 -37
  31. package/src/styles/BlogSection.module.scss.d.ts +1 -2
@@ -6,13 +6,10 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var BlogSection_module = require('../styles/BlogSection.module.scss.js');
7
7
  var index = require('../utils/index.js');
8
8
 
9
- const BlogSectionStatic = ({ title = '', category = '', children = null, increaseMarginBottom = false, }) => {
9
+ const BlogSectionStatic = ({ title = '', category = '', children = null, }) => {
10
10
  const titleWithCategory = category ? `${category} - ${title}` : title;
11
11
  const id = index.generateIdForBlogTitle(titleWithCategory);
12
- return (jsxRuntime.jsxs("div", { className: `${BlogSection_module.default['blog-section']}
13
- ${increaseMarginBottom
14
- ? BlogSection_module.default['margin-bottom--9']
15
- : BlogSection_module.default['margin-bottom--6']}`, "data-title": title, "data-id": id, children: [title ? (jsxRuntime.jsx("h4", { className: BlogSection_module.default['blog-section__title'], children: title })) : null, children] }));
12
+ return (jsxRuntime.jsxs("div", { className: BlogSection_module.default['blog-section'], "data-title": title, "data-id": id, children: [title ? (jsxRuntime.jsx("h3", { className: BlogSection_module.default['blog-section__title'], children: title })) : null, children] }));
16
13
  };
17
14
 
18
15
  exports.default = BlogSectionStatic;
@@ -1 +1 @@
1
- {"version":3,"file":"BlogSectionStatic.js","sources":["../../../src/staticComponents/BlogSectionStatic.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport styles from '../styles/BlogSection.module.scss';\nimport { generateIdForBlogTitle } from '../utils';\n\ninterface BlogSectionStaticProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n\tincreaseMarginBottom?: boolean;\n}\n\nconst BlogSectionStatic = ({\n\ttitle = '',\n\tcategory = '',\n\tchildren = null,\n\tincreaseMarginBottom = false,\n}: BlogSectionStaticProperties) => {\n\tconst titleWithCategory = category ? `${category} - ${title}` : title;\n\tconst id = generateIdForBlogTitle(titleWithCategory);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles['blog-section']}\n\t\t\t\t${\n\t\t\t\t\tincreaseMarginBottom\n\t\t\t\t\t\t? styles['margin-bottom--9']\n\t\t\t\t\t\t: styles['margin-bottom--6']\n\t\t\t\t}`}\n\t\t\tdata-title={title}\n\t\t\tdata-id={id}\n\t\t>\n\t\t\t{title ? (\n\t\t\t\t<h4 className={styles['blog-section__title']}>{title}</h4>\n\t\t\t) : null}\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n\nexport default BlogSectionStatic;\n"],"names":["generateIdForBlogTitle","_jsxs","styles","_jsx"],"mappings":";;;;;;;;AAWA,MAAM,iBAAiB,GAAG,CAAC,EAC1B,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,EACf,oBAAoB,GAAG,KAAK,GACC,KAAI;AACjC,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE,IAAA,MAAM,EAAE,GAAGA,4BAAsB,CAAC,iBAAiB,CAAC;IAEpD,QACCC,yBACC,SAAS,EAAE,GAAGC,0BAAM,CAAC,cAAc,CAAC;MAElC;AACC,cAAEA,0BAAM,CAAC,kBAAkB;AAC3B,cAAEA,0BAAM,CAAC,kBAAkB,CAC7B,CAAA,CAAE,EAAA,YAAA,EACS,KAAK,EAAA,SAAA,EACR,EAAE,EAAA,QAAA,EAAA,CAEV,KAAK,IACLC,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAED,0BAAM,CAAC,qBAAqB,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAM,IACvD,IAAI,EACP,QAAQ,CAAA,EAAA,CACJ;AAER;;;;"}
1
+ {"version":3,"file":"BlogSectionStatic.js","sources":["../../../src/staticComponents/BlogSectionStatic.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport styles from '../styles/BlogSection.module.scss';\nimport { generateIdForBlogTitle } from '../utils';\n\ninterface BlogSectionStaticProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n}\n\nconst BlogSectionStatic = ({\n\ttitle = '',\n\tcategory = '',\n\tchildren = null,\n}: BlogSectionStaticProperties) => {\n\tconst titleWithCategory = category ? `${category} - ${title}` : title;\n\tconst id = generateIdForBlogTitle(titleWithCategory);\n\n\treturn (\n\t\t<div className={styles['blog-section']} data-title={title} data-id={id}>\n\t\t\t{title ? (\n\t\t\t\t<h3 className={styles['blog-section__title']}>{title}</h3>\n\t\t\t) : null}\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n\nexport default BlogSectionStatic;\n"],"names":["generateIdForBlogTitle","_jsxs","styles","_jsx"],"mappings":";;;;;;;;AAUA,MAAM,iBAAiB,GAAG,CAAC,EAC1B,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,GACc,KAAI;AACjC,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE,IAAA,MAAM,EAAE,GAAGA,4BAAsB,CAAC,iBAAiB,CAAC;AAEpD,IAAA,QACCC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEC,0BAAM,CAAC,cAAc,CAAC,EAAA,YAAA,EAAc,KAAK,aAAW,EAAE,EAAA,QAAA,EAAA,CACpE,KAAK,IACLC,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAED,0BAAM,CAAC,qBAAqB,CAAC,YAAG,KAAK,EAAA,CAAM,IACvD,IAAI,EACP,QAAQ,CAAA,EAAA,CACJ;AAER;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var styles = {"margin-bottom--6":"BlogSection-module_margin-bottom--6__-hlAO","margin-bottom--9":"BlogSection-module_margin-bottom--9__xU5rE","blog-section__title":"BlogSection-module_blog-section__title__5-4Oy","blog-section__title-link":"BlogSection-module_blog-section__title-link__Q4R5T","blog-section":"BlogSection-module_blog-section__NTDM4"};
5
+ var styles = {"blog-section":"BlogSection-module_blog-section__NTDM4","blog-section__title":"BlogSection-module_blog-section__title__5-4Oy","blog-section__title--empty":"BlogSection-module_blog-section__title--empty__-di-F","blog-section__title-link":"BlogSection-module_blog-section__title-link__Q4R5T"};
6
6
 
7
7
  exports.default = styles;
8
8
  //# sourceMappingURL=BlogSection.module.scss.js.map
@@ -4,8 +4,8 @@ import { lazy, forwardRef, Suspense } from 'react';
4
4
  import BlogSectionStatic from '../staticComponents/BlogSectionStatic.js';
5
5
 
6
6
  const BlogSectionDynamic = lazy(() => import('../dynamicComponents/BlogSectionDynamic.js'));
7
- const BlogSection = forwardRef(({ title = '', category = '', children = null, increaseMarginBottom = false, }, ref) => {
8
- return (jsx(Suspense, { fallback: jsx(BlogSectionStatic, { title: title, category: category, increaseMarginBottom: increaseMarginBottom, children: children }), children: jsx(BlogSectionDynamic, { ref: ref, title: title, category: category, increaseMarginBottom: increaseMarginBottom, children: children }) }));
7
+ const BlogSection = forwardRef(({ title = '', category = '', children = null, }, ref) => {
8
+ return (jsx(Suspense, { fallback: jsx(BlogSectionStatic, { title: title, category: category, children: children }), children: jsx(BlogSectionDynamic, { ref: ref, title: title, category: category, children: children }) }));
9
9
  });
10
10
  BlogSection.displayName = 'BlogSection';
11
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"BlogSection.js","sources":["../../../src/components/BlogSection.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, lazy, Suspense } from 'react';\nimport type { ReactNode } from 'react';\nimport BlogSectionStatic from '../staticComponents/BlogSectionStatic';\nimport type { ForwardedReference } from '../dynamicComponents/BlogDynamic';\nexport type { ForwardedReference };\n\nconst BlogSectionDynamic = lazy(\n\t() => import('../dynamicComponents/BlogSectionDynamic')\n);\n\ninterface BlogSectionProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n\tincreaseMarginBottom?: boolean;\n}\n\nconst BlogSection = forwardRef<ForwardedReference, BlogSectionProperties>(\n\t(\n\t\t{\n\t\t\ttitle = '',\n\t\t\tcategory = '',\n\t\t\tchildren = null,\n\t\t\tincreaseMarginBottom = false,\n\t\t},\n\t\tref\n\t) => {\n\t\treturn (\n\t\t\t<Suspense\n\t\t\t\tfallback={\n\t\t\t\t\t<BlogSectionStatic\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\tcategory={category}\n\t\t\t\t\t\tincreaseMarginBottom={increaseMarginBottom}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</BlogSectionStatic>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlogSectionDynamic\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tcategory={category}\n\t\t\t\t\tincreaseMarginBottom={increaseMarginBottom}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</BlogSectionDynamic>\n\t\t\t</Suspense>\n\t\t);\n\t}\n);\n\nBlogSection.displayName = 'BlogSection';\n\nexport default BlogSection;\n"],"names":["_jsx"],"mappings":";;;;AAQA,MAAM,kBAAkB,GAAG,IAAI,CAC9B,MAAM,OAAO,4CAAyC,CAAC,CACvD;AASD,MAAM,WAAW,GAAG,UAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,EACf,oBAAoB,GAAG,KAAK,GAC5B,EACD,GAAG,KACA;IACH,QACCA,IAAC,QAAQ,EAAA,EACR,QAAQ,EACPA,GAAA,CAAC,iBAAiB,EAAA,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,YAGrBA,GAAA,CAAC,kBAAkB,IAClB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,YAEzC,QAAQ,EAAA,CACW,EAAA,CACX;AAEb,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"BlogSection.js","sources":["../../../src/components/BlogSection.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, lazy, Suspense } from 'react';\nimport type { ReactNode } from 'react';\nimport BlogSectionStatic from '../staticComponents/BlogSectionStatic';\nimport type { ForwardedReference } from '../dynamicComponents/BlogDynamic';\nexport type { ForwardedReference };\n\nconst BlogSectionDynamic = lazy(\n\t() => import('../dynamicComponents/BlogSectionDynamic')\n);\n\ninterface BlogSectionProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n}\n\nconst BlogSection = forwardRef<ForwardedReference, BlogSectionProperties>(\n\t(\n\t\t{\n\t\t\ttitle = '',\n\t\t\tcategory = '',\n\t\t\tchildren = null,\n\t\t},\n\t\tref\n\t) => {\n\t\treturn (\n\t\t\t<Suspense\n\t\t\t\tfallback={\n\t\t\t\t\t<BlogSectionStatic\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\tcategory={category}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</BlogSectionStatic>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlogSectionDynamic\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tcategory={category}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</BlogSectionDynamic>\n\t\t\t</Suspense>\n\t\t);\n\t}\n);\n\nBlogSection.displayName = 'BlogSection';\n\nexport default BlogSection;\n"],"names":["_jsx"],"mappings":";;;;AAQA,MAAM,kBAAkB,GAAG,IAAI,CAC9B,MAAM,OAAO,4CAAyC,CAAC,CACvD;AAQD,MAAM,WAAW,GAAG,UAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,GACf,EACD,GAAG,KACA;AACH,IAAA,QACCA,GAAA,CAAC,QAAQ,EAAA,EACR,QAAQ,EACPA,GAAA,CAAC,iBAAiB,EAAA,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,EAAA,CACU,EAAA,QAAA,EAGrBA,GAAA,CAAC,kBAAkB,EAAA,EAClB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAAA,QAAA,EAEjB,QAAQ,EAAA,CACW,EAAA,CACX;AAEb,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
@@ -4,7 +4,7 @@ import { forwardRef, useRef, useImperativeHandle, useEffect, Children, isValidEl
4
4
  import styles from '../styles/BlogSection.module.scss.js';
5
5
  import { generateIdForBlogTitle, generateSectionHref } from '../utils/index.js';
6
6
 
7
- const BlogSection = forwardRef(({ title = '', category = '', children = null, increaseMarginBottom = false, }, forwardedReference) => {
7
+ const BlogSection = forwardRef(({ title = '', category = '', children = null }, forwardedReference) => {
8
8
  const titleWithCategory = category ? `${category} - ${title}` : title;
9
9
  const id = generateIdForBlogTitle(titleWithCategory);
10
10
  const parentReference = useRef(null);
@@ -20,7 +20,8 @@ const BlogSection = forwardRef(({ title = '', category = '', children = null, in
20
20
  });
21
21
  // Re-register when title or category changes so the TOC reflects the updated heading
22
22
  useEffect(() => {
23
- if (typeof forwardedReference === 'function' && imperativeHandleRef.current) {
23
+ if (typeof forwardedReference === 'function' &&
24
+ imperativeHandleRef.current) {
24
25
  forwardedReference(imperativeHandleRef.current);
25
26
  }
26
27
  }, [title, category]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -35,14 +36,12 @@ const BlogSection = forwardRef(({ title = '', category = '', children = null, in
35
36
  if (!alreadyRegistered) {
36
37
  childReferences.current.push(element);
37
38
  }
38
- if (typeof forwardedReference === 'function' && imperativeHandleRef.current) {
39
+ if (typeof forwardedReference === 'function' &&
40
+ imperativeHandleRef.current) {
39
41
  forwardedReference(imperativeHandleRef.current);
40
42
  }
41
43
  };
42
- return (jsxs("div", { className: `${styles['blog-section']}
43
- ${increaseMarginBottom
44
- ? styles['margin-bottom--9']
45
- : styles['margin-bottom--6']}`, "data-title": title, "data-id": id, ref: parentReference, children: [title ? (jsx("h4", { className: styles['blog-section__title'], children: jsx("a", { href: generateSectionHref(id), className: styles['blog-section__title-link'], onClick: e => e.preventDefault(), children: title }) })) : null, Children.map(children, child => {
44
+ return (jsxs("div", { className: styles['blog-section'], "data-title": title, "data-id": id, ref: parentReference, children: [jsx("h3", { className: `${styles['blog-section__title']} ${title ? '' : styles['blog-section__title--empty']}`, children: title ? (jsx("a", { href: generateSectionHref(id), className: styles['blog-section__title-link'], onClick: e => e.preventDefault(), children: title })) : (jsx("p", { children: "No title" })) }), Children.map(children, child => {
46
45
  if (!isValidElement(child))
47
46
  return child;
48
47
  return cloneElement(child, {
@@ -1 +1 @@
1
- {"version":3,"file":"BlogSectionDynamic.js","sources":["../../../src/dynamicComponents/BlogSectionDynamic.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tChildren,\n\tcloneElement,\n\tforwardRef,\n\tisValidElement,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n} from 'react';\n\nimport type { ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/BlogSection.module.scss';\n\nimport type { ForwardedReference } from './BlogDynamic';\nimport { generateIdForBlogTitle, generateSectionHref } from '../utils';\n\ninterface BlogProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n\tincreaseMarginBottom?: boolean;\n}\n\nconst BlogSection = forwardRef<ForwardedReference, BlogProperties>(\n\t(\n\t\t{\n\t\t\ttitle = '',\n\t\t\tcategory = '',\n\t\t\tchildren = null,\n\t\t\tincreaseMarginBottom = false,\n\t\t}: BlogProperties,\n\t\tforwardedReference\n\t) => {\n\t\tconst titleWithCategory = category ? `${category} - ${title}` : title;\n\t\tconst id = generateIdForBlogTitle(titleWithCategory);\n\n\t\tconst parentReference = useRef<ForwardedReference['parentRef']>(null);\n\t\tconst childReferences = useRef<ForwardedReference['childRefs']>([]);\n\t\tconst imperativeHandleRef = useRef<ForwardedReference | null>(null);\n\n\t\tuseImperativeHandle(forwardedReference, () => {\n\t\t\tconst handle = {\n\t\t\t\tparentRef: parentReference.current!,\n\t\t\t\tchildRefs: childReferences.current!,\n\t\t\t};\n\t\t\timperativeHandleRef.current = handle;\n\t\t\treturn handle;\n\t\t});\n\n\t\t// Re-register when title or category changes so the TOC reflects the updated heading\n\t\tuseEffect(() => {\n\t\t\tif (typeof forwardedReference === 'function' && imperativeHandleRef.current) {\n\t\t\t\tforwardedReference(imperativeHandleRef.current);\n\t\t\t}\n\t\t}, [title, category]); // eslint-disable-line react-hooks/exhaustive-deps\n\n\t\tconst handleChildReferences = (element: ForwardedReference | null) => {\n\t\t\tif (!element) return;\n\t\t\tconst { parentRef: subParentReference } = element;\n\t\t\tif (!subParentReference) return;\n\n\t\t\t// Avoid registering the same child section twice\n\t\tconst alreadyRegistered = childReferences.current.some(\n\t\t\t\tref => ref.parentRef === subParentReference\n\t\t\t);\n\t\t\tif (!alreadyRegistered) {\n\t\t\t\tchildReferences.current.push(element);\n\t\t\t}\n\n\t\t\tif (typeof forwardedReference === 'function' && imperativeHandleRef.current) {\n\t\t\t\tforwardedReference(imperativeHandleRef.current);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={`${styles['blog-section']}\n\t\t\t\t\t${\n\t\t\t\t\t\tincreaseMarginBottom\n\t\t\t\t\t\t\t? styles['margin-bottom--9']\n\t\t\t\t\t\t\t: styles['margin-bottom--6']\n\t\t\t\t\t}`}\n\t\t\t\tdata-title={title}\n\t\t\t\tdata-id={id}\n\t\t\t\tref={parentReference}\n\t\t\t>\n\t\t\t\t{title ? (\n\t\t\t\t\t<h4 className={styles['blog-section__title']}>\n\t\t\t\t\t\t<a href={generateSectionHref(id)} className={styles['blog-section__title-link']} onClick={e => e.preventDefault()}>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h4>\n\t\t\t\t) : null}\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: handleChildReferences,\n\t\t\t\t\t} as RefAttributes<ForwardedReference>);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nBlogSection.displayName = 'BlogSection';\n\nexport default BlogSection;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;AA0BA,MAAM,WAAW,GAAG,UAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,EACf,oBAAoB,GAAG,KAAK,GACZ,EACjB,kBAAkB,KACf;AACH,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE,IAAA,MAAM,EAAE,GAAG,sBAAsB,CAAC,iBAAiB,CAAC;AAEpD,IAAA,MAAM,eAAe,GAAG,MAAM,CAAkC,IAAI,CAAC;AACrE,IAAA,MAAM,eAAe,GAAG,MAAM,CAAkC,EAAE,CAAC;AACnE,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAA4B,IAAI,CAAC;AAEnE,IAAA,mBAAmB,CAAC,kBAAkB,EAAE,MAAK;AAC5C,QAAA,MAAM,MAAM,GAAG;YACd,SAAS,EAAE,eAAe,CAAC,OAAQ;YACnC,SAAS,EAAE,eAAe,CAAC,OAAQ;SACnC;AACD,QAAA,mBAAmB,CAAC,OAAO,GAAG,MAAM;AACpC,QAAA,OAAO,MAAM;AACd,IAAA,CAAC,CAAC;;IAGF,SAAS,CAAC,MAAK;QACd,IAAI,OAAO,kBAAkB,KAAK,UAAU,IAAI,mBAAmB,CAAC,OAAO,EAAE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I,EACP,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAG;AAC/B,gBAAA,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;AAAE,oBAAA,OAAO,KAAK;gBACxC,OAAO,YAAY,CAAC,KAAK,EAAE;AAC1B,oBAAA,GAAG,EAAE,qBAAqB;AACW,iBAAA,CAAC;YACxC,CAAC,CAAC,CAAA,EAAA,CACG;AAER,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"BlogSectionDynamic.js","sources":["../../../src/dynamicComponents/BlogSectionDynamic.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tChildren,\n\tcloneElement,\n\tforwardRef,\n\tisValidElement,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n} from 'react';\n\nimport type { ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/BlogSection.module.scss';\n\nimport type { ForwardedReference } from './BlogDynamic';\nimport { generateIdForBlogTitle, generateSectionHref } from '../utils';\n\ninterface BlogProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n}\n\nconst BlogSection = forwardRef<ForwardedReference, BlogProperties>(\n\t(\n\t\t{ title = '', category = '', children = null }: BlogProperties,\n\t\tforwardedReference\n\t) => {\n\t\tconst titleWithCategory = category ? `${category} - ${title}` : title;\n\t\tconst id = generateIdForBlogTitle(titleWithCategory);\n\n\t\tconst parentReference = useRef<ForwardedReference['parentRef']>(null);\n\t\tconst childReferences = useRef<ForwardedReference['childRefs']>([]);\n\t\tconst imperativeHandleRef = useRef<ForwardedReference | null>(null);\n\n\t\tuseImperativeHandle(forwardedReference, () => {\n\t\t\tconst handle = {\n\t\t\t\tparentRef: parentReference.current!,\n\t\t\t\tchildRefs: childReferences.current!,\n\t\t\t};\n\t\t\timperativeHandleRef.current = handle;\n\t\t\treturn handle;\n\t\t});\n\n\t\t// Re-register when title or category changes so the TOC reflects the updated heading\n\t\tuseEffect(() => {\n\t\t\tif (\n\t\t\t\ttypeof forwardedReference === 'function' &&\n\t\t\t\timperativeHandleRef.current\n\t\t\t) {\n\t\t\t\tforwardedReference(imperativeHandleRef.current);\n\t\t\t}\n\t\t}, [title, category]); // eslint-disable-line react-hooks/exhaustive-deps\n\n\t\tconst handleChildReferences = (element: ForwardedReference | null) => {\n\t\t\tif (!element) return;\n\t\t\tconst { parentRef: subParentReference } = element;\n\t\t\tif (!subParentReference) return;\n\n\t\t\t// Avoid registering the same child section twice\n\t\t\tconst alreadyRegistered = childReferences.current.some(\n\t\t\t\tref => ref.parentRef === subParentReference\n\t\t\t);\n\t\t\tif (!alreadyRegistered) {\n\t\t\t\tchildReferences.current.push(element);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof forwardedReference === 'function' &&\n\t\t\t\timperativeHandleRef.current\n\t\t\t) {\n\t\t\t\tforwardedReference(imperativeHandleRef.current);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={styles['blog-section']}\n\t\t\t\tdata-title={title}\n\t\t\t\tdata-id={id}\n\t\t\t\tref={parentReference}\n\t\t\t>\n\t\t\t\t<h3\n\t\t\t\t\tclassName={`${styles['blog-section__title']} ${title ? '' : styles['blog-section__title--empty']}`}\n\t\t\t\t>\n\t\t\t\t\t{title ? (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\thref={generateSectionHref(id)}\n\t\t\t\t\t\t\tclassName={styles['blog-section__title-link']}\n\t\t\t\t\t\t\tonClick={e => e.preventDefault()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<p>No title</p>\n\t\t\t\t\t)}\n\t\t\t\t</h3>\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: handleChildReferences,\n\t\t\t\t\t} as RefAttributes<Forw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