@san-siva/blogkit 1.1.14 → 1.1.16

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/Blog.js +2 -2
  3. package/dist/cjs/components/Blog.js.map +1 -1
  4. package/dist/cjs/dynamicComponents/BlogDynamic.js +33 -6
  5. package/dist/cjs/dynamicComponents/BlogDynamic.js.map +1 -1
  6. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +1 -1
  7. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  8. package/dist/cjs/dynamicComponents/lockScrollUpdates.js +24 -0
  9. package/dist/cjs/dynamicComponents/lockScrollUpdates.js.map +1 -0
  10. package/dist/cjs/index.css +1 -1
  11. package/dist/cjs/index.css.map +1 -1
  12. package/dist/cjs/staticComponents/BlogStatic.js +2 -2
  13. package/dist/cjs/staticComponents/BlogStatic.js.map +1 -1
  14. package/dist/cjs/styles/BlogSection.module.scss.js +1 -1
  15. package/dist/cjs/styles/Callout.module.scss.js +1 -1
  16. package/dist/cjs/utils/index.js +2 -0
  17. package/dist/cjs/utils/index.js.map +1 -1
  18. package/dist/cjs/utils/lockScrollUpdates.js +24 -0
  19. package/dist/cjs/utils/lockScrollUpdates.js.map +1 -0
  20. package/dist/esm/components/Blog.js +2 -2
  21. package/dist/esm/components/Blog.js.map +1 -1
  22. package/dist/esm/dynamicComponents/BlogDynamic.js +33 -6
  23. package/dist/esm/dynamicComponents/BlogDynamic.js.map +1 -1
  24. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +2 -2
  25. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  26. package/dist/esm/dynamicComponents/lockScrollUpdates.js +20 -0
  27. package/dist/esm/dynamicComponents/lockScrollUpdates.js.map +1 -0
  28. package/dist/esm/index.css +1 -1
  29. package/dist/esm/index.css.map +1 -1
  30. package/dist/esm/staticComponents/BlogStatic.js +3 -3
  31. package/dist/esm/staticComponents/BlogStatic.js.map +1 -1
  32. package/dist/esm/styles/BlogSection.module.scss.js +1 -1
  33. package/dist/esm/styles/Callout.module.scss.js +1 -1
  34. package/dist/esm/utils/index.js +2 -1
  35. package/dist/esm/utils/index.js.map +1 -1
  36. package/dist/esm/utils/lockScrollUpdates.js +20 -0
  37. package/dist/esm/utils/lockScrollUpdates.js.map +1 -0
  38. package/dist/types/components/Blog.d.ts +3 -1
  39. package/dist/types/components/Blog.d.ts.map +1 -1
  40. package/dist/types/dynamicComponents/BlogDynamic.d.ts +3 -1
  41. package/dist/types/dynamicComponents/BlogDynamic.d.ts.map +1 -1
  42. package/dist/types/dynamicComponents/lockScrollUpdates.d.ts +4 -0
  43. package/dist/types/dynamicComponents/lockScrollUpdates.d.ts.map +1 -0
  44. package/dist/types/staticComponents/BlogStatic.d.ts +3 -1
  45. package/dist/types/staticComponents/BlogStatic.d.ts.map +1 -1
  46. package/package.json +3 -2
  47. package/src/components/Blog.tsx +5 -3
  48. package/src/dynamicComponents/BlogDynamic.tsx +43 -5
  49. package/src/dynamicComponents/BlogSectionDynamic.tsx +6 -2
  50. package/src/staticComponents/BlogStatic.tsx +9 -1
  51. package/src/styles/BlogSection.module.scss +16 -2
  52. package/src/utils/index.ts +2 -0
  53. package/src/utils/lockScrollUpdates.ts +29 -0
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var Blog_module = require('../styles/Blog.module.scss.js');
7
7
 
8
- const BlogStatic = ({ children }) => {
9
- return (jsxRuntime.jsx("div", { className: Blog_module.default.blog, children: jsxRuntime.jsx("div", { className: Blog_module.default['blog__content'], children: children }) }));
8
+ const BlogStatic = ({ children, jsonLd }) => {
9
+ return (jsxRuntime.jsxs("div", { className: Blog_module.default.blog, children: [jsonLd && (jsxRuntime.jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(jsonLd) } })), jsxRuntime.jsx("div", { className: Blog_module.default['blog__content'], children: children })] }));
10
10
  };
11
11
 
12
12
  exports.default = BlogStatic;
@@ -1 +1 @@
1
- {"version":3,"file":"BlogStatic.js","sources":["../../../src/staticComponents/BlogStatic.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport styles from '../styles/Blog.module.scss';\n\ninterface BlogStaticProperties {\n\tchildren: ReactNode;\n}\n\nconst BlogStatic = ({ children }: BlogStaticProperties) => {\n\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t<div className={styles['blog__content']}>{children}</div>\n\t\t</div>\n\t);\n};\n\nexport default BlogStatic;\n"],"names":["_jsx","styles"],"mappings":";;;;;;;AAOA,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAwB,KAAI;IACzD,QACCA,wBAAK,SAAS,EAAEC,mBAAM,CAAC,IAAI,YAC1BD,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEC,mBAAM,CAAC,eAAe,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,EAAA,CACpD;AAER;;;;"}
1
+ {"version":3,"file":"BlogStatic.js","sources":["../../../src/staticComponents/BlogStatic.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { Thing, WithContext } from 'schema-dts';\nimport styles from '../styles/Blog.module.scss';\n\ninterface BlogStaticProperties {\n\tchildren: ReactNode;\n\tjsonLd?: WithContext<Thing>;\n}\n\nconst BlogStatic = ({ children, jsonLd }: BlogStaticProperties) => {\n\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t{jsonLd && (\n\t\t\t\t<script\n\t\t\t\t\ttype=\"application/ld+json\"\n\t\t\t\t\tdangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<div className={styles['blog__content']}>{children}</div>\n\t\t</div>\n\t);\n};\n\nexport default BlogStatic;\n"],"names":["_jsxs","styles","_jsx"],"mappings":";;;;;;;AASA,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAwB,KAAI;AACjE,IAAA,QACCA,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEC,mBAAM,CAAC,IAAI,EAAA,QAAA,EAAA,CACzB,MAAM,KACNC,cAAA,CAAA,QAAA,EAAA,EACC,IAAI,EAAC,qBAAqB,EAC1B,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,EAAA,CAC1D,CACF,EACDA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAED,mBAAM,CAAC,eAAe,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,CAAA,EAAA,CACpD;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":"BlogSection-module_blog-section__NTDM4"};
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"};
6
6
 
7
7
  exports.default = styles;
8
8
  //# sourceMappingURL=BlogSection.module.scss.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var styles = {"margin-top":"Callout-module_margin-top__dS2UF","padding-top":"Callout-module_padding-top__aJrE4","margin-top--1":"Callout-module_margin-top--1__eBfEL","padding-top--1":"Callout-module_padding-top--1__rrL2e","margin-top--2":"Callout-module_margin-top--2__Ej-fE","padding-top--2":"Callout-module_padding-top--2__NtBHH","margin-top--3":"Callout-module_margin-top--3__AsHPR","padding-top--3":"Callout-module_padding-top--3__CjXpH","margin-top--4":"Callout-module_margin-top--4__3ji03","padding-top--4":"Callout-module_padding-top--4__BdcKb","margin-top--5":"Callout-module_margin-top--5__j3Qds","padding-top--5":"Callout-module_padding-top--5__TWT9C","margin-top--6":"Callout-module_margin-top--6__GQFRt","padding-top--6":"Callout-module_padding-top--6__4bYvI","margin-top--7":"Callout-module_margin-top--7__ArvNz","padding-top--7":"Callout-module_padding-top--7__PnU3M","margin-top--8":"Callout-module_margin-top--8__DvN7J","padding-top--8":"Callout-module_padding-top--8__qunY9","margin-top--9":"Callout-module_margin-top--9__mSjxY","padding-top--9":"Callout-module_padding-top--9__N4Z2b","margin-bottom":"Callout-module_margin-bottom__UlOKu","padding-bottom":"Callout-module_padding-bottom__-XwJQ","margin-bottom--1":"Callout-module_margin-bottom--1__LxnVH","padding-bottom--1":"Callout-module_padding-bottom--1__MfyXw","margin-bottom--2":"Callout-module_margin-bottom--2__nelQj","padding-bottom--2":"Callout-module_padding-bottom--2__9MX1j","margin-bottom--3":"Callout-module_margin-bottom--3__VfA8y","padding-bottom--3":"Callout-module_padding-bottom--3__FRllS","margin-bottom--4":"Callout-module_margin-bottom--4__-j-tS","padding-bottom--4":"Callout-module_padding-bottom--4__sJzsQ","margin-bottom--5":"Callout-module_margin-bottom--5__0hYDy","padding-bottom--5":"Callout-module_padding-bottom--5__c4BQo","margin-bottom--6":"Callout-module_margin-bottom--6__8Ny2B","padding-bottom--6":"Callout-module_padding-bottom--6__wNeJk","margin-bottom--7":"Callout-module_margin-bottom--7__0dYmE","padding-bottom--7":"Callout-module_padding-bottom--7__FueIs","margin-bottom--8":"Callout-module_margin-bottom--8__r93zU","padding-bottom--8":"Callout-module_padding-bottom--8__APcyf","margin-bottom--9":"Callout-module_margin-bottom--9__f6KUQ","padding-bottom--9":"Callout-module_padding-bottom--9__KVgqO","margin-left":"Callout-module_margin-left__mb1jm","padding-left":"Callout-module_padding-left__cgzip","margin-left--1":"Callout-module_margin-left--1__DWFsG","padding-left--1":"Callout-module_padding-left--1__3nWMz","margin-left--2":"Callout-module_margin-left--2__ByTNO","padding-left--2":"Callout-module_padding-left--2__9-PLw","margin-left--3":"Callout-module_margin-left--3__0Iz7m","padding-left--3":"Callout-module_padding-left--3__FQgJY","margin-left--4":"Callout-module_margin-left--4__cmAQ4","padding-left--4":"Callout-module_padding-left--4__pW9OV","margin-left--5":"Callout-module_margin-left--5__qD5bN","padding-left--5":"Callout-module_padding-left--5__FaZO8","margin-left--6":"Callout-module_margin-left--6__h-dBW","padding-left--6":"Callout-module_padding-left--6__RT6JH","margin-left--7":"Callout-module_margin-left--7__9wZFI","padding-left--7":"Callout-module_padding-left--7__-31-c","margin-left--8":"Callout-module_margin-left--8__bbcki","padding-left--8":"Callout-module_padding-left--8__f3ctw","margin-left--9":"Callout-module_margin-left--9__0xlWQ","padding-left--9":"Callout-module_padding-left--9__QsNKP","margin-right":"Callout-module_margin-right__CN33J","padding-right":"Callout-module_padding-right__Cn14a","margin-right--1":"Callout-module_margin-right--1__GAGZO","padding-right--1":"Callout-module_padding-right--1__qh8gH","margin-right--2":"Callout-module_margin-right--2__MjxOE","padding-right--2":"Callout-module_padding-right--2__CDawi","margin-right--3":"Callout-module_margin-right--3__w3PO-","padding-right--3":"Callout-module_padding-right--3__bOIL3","margin-right--4":"Callout-module_margin-right--4__wjZRG","padding-right--4":"Callout-module_padding-right--4__DNn-A","margin-right--5":"Callout-module_margin-right--5__JUYoz","padding-right--5":"Callout-module_padding-right--5__V1t3c","margin-right--6":"Callout-module_margin-right--6__UXR9-","padding-right--6":"Callout-module_padding-right--6__pVwQj","margin-right--7":"Callout-module_margin-right--7__ZwUec","padding-right--7":"Callout-module_padding-right--7__EHY0p","margin-right--8":"Callout-module_margin-right--8__k9asQ","padding-right--8":"Callout-module_padding-right--8__1Nqrm","margin-right--9":"Callout-module_margin-right--9__J8sMZ","padding-right--9":"Callout-module_padding-right--9__QYnAq","error":"Callout-module_error__UeboU","font--primary":"Callout-module_font--primary__Ayv9J","font--secondary":"Callout-module_font--secondary__mBXUH","font--code":"Callout-module_font--code__fG36F","font-weight--400":"Callout-module_font-weight--400__VYsxM","font-weight--500":"Callout-module_font-weight--500__zXuRq","font-weight--600":"Callout-module_font-weight--600__fJDVt","font-weight--700":"Callout-module_font-weight--700__3kQTh","font-weight--800":"Callout-module_font-weight--800__5POjB","font-size--h1":"Callout-module_font-size--h1__9fzEM","font-size--h2":"Callout-module_font-size--h2__EowCg","font-size--h3":"Callout-module_font-size--h3__8EcUJ","font-size--h4":"Callout-module_font-size--h4__ferQ7","font-size--h5":"Callout-module_font-size--h5__43lHF","font-size--h6":"Callout-module_font-size--h6__GpBej","font-size--big":"Callout-module_font-size--big__-BXjA","font-size--button":"Callout-module_font-size--button__9KupW","font-size--p":"Callout-module_font-size--p__RJTna","font-size--small":"Callout-module_font-size--small__YEsJl","line-height--large":"Callout-module_line-height--large__OStzV","line-height--normal":"Callout-module_line-height--normal__p5UA7","line-height--small":"Callout-module_line-height--small__2kXv9","text-align--center":"Callout-module_text-align--center__5JXeQ","category__header":"Callout-module_category__header__Edg04","a--highlighted":"Callout-module_a--highlighted__JmfE5","grecaptcha-badge":"Callout-module_grecaptcha-badge__7vWF5","container":"Callout-module_container__FV7VM","container--contents-centered":"Callout-module_container--contents-centered__zx2lp","container--no-padding":"Callout-module_container--no-padding__wI9Pc","page":"Callout-module_page__2bQ0P","page--contents-max-width":"Callout-module_page--contents-max-width__4p2pL","page--no-extra-padding":"Callout-module_page--no-extra-padding__lGzpM","page--no-max-width":"Callout-module_page--no-max-width__cF1qn","hr":"Callout-module_hr__iz4ZP","li--disabled":"Callout-module_li--disabled__09IJ1","block":"Callout-module_block__cdSSP","callout":"Callout-module_callout__kEgS8","callout__icon":"Callout-module_callout__icon__z-ZHp","callout--info":"Callout-module_callout--info__zpyMT","callout--info__icon":"Callout-module_callout--info__icon__hHBbh","callout--warning":"Callout-module_callout--warning__QhFli","callout--error":"Callout-module_callout--error__-HDOj","callout--success":"Callout-module_callout--success__f1lTK","callout__wrapper":"Callout-module_callout__wrapper__jooXm","loading_animation":"Callout-module_loading_animation__9m516","MoveInTop":"Callout-module_MoveInTop__fio2m","fadeInDown":"Callout-module_fadeInDown__webmy","fadeUp":"Callout-module_fadeUp__uXBP6"};
5
+ var styles = {"margin-top":"Callout-module_margin-top__dS2UF","padding-top":"Callout-module_padding-top__aJrE4","margin-top--1":"Callout-module_margin-top--1__eBfEL","padding-top--1":"Callout-module_padding-top--1__rrL2e","margin-top--2":"Callout-module_margin-top--2__Ej-fE","padding-top--2":"Callout-module_padding-top--2__NtBHH","margin-top--3":"Callout-module_margin-top--3__AsHPR","padding-top--3":"Callout-module_padding-top--3__CjXpH","margin-top--4":"Callout-module_margin-top--4__3ji03","padding-top--4":"Callout-module_padding-top--4__BdcKb","margin-top--5":"Callout-module_margin-top--5__j3Qds","padding-top--5":"Callout-module_padding-top--5__TWT9C","margin-top--6":"Callout-module_margin-top--6__GQFRt","padding-top--6":"Callout-module_padding-top--6__4bYvI","margin-top--7":"Callout-module_margin-top--7__ArvNz","padding-top--7":"Callout-module_padding-top--7__PnU3M","margin-top--8":"Callout-module_margin-top--8__DvN7J","padding-top--8":"Callout-module_padding-top--8__qunY9","margin-top--9":"Callout-module_margin-top--9__mSjxY","padding-top--9":"Callout-module_padding-top--9__N4Z2b","margin-bottom":"Callout-module_margin-bottom__UlOKu","padding-bottom":"Callout-module_padding-bottom__-XwJQ","margin-bottom--1":"Callout-module_margin-bottom--1__LxnVH","padding-bottom--1":"Callout-module_padding-bottom--1__MfyXw","margin-bottom--2":"Callout-module_margin-bottom--2__nelQj","padding-bottom--2":"Callout-module_padding-bottom--2__9MX1j","margin-bottom--3":"Callout-module_margin-bottom--3__VfA8y","padding-bottom--3":"Callout-module_padding-bottom--3__FRllS","margin-bottom--4":"Callout-module_margin-bottom--4__-j-tS","padding-bottom--4":"Callout-module_padding-bottom--4__sJzsQ","margin-bottom--5":"Callout-module_margin-bottom--5__0hYDy","padding-bottom--5":"Callout-module_padding-bottom--5__c4BQo","margin-bottom--6":"Callout-module_margin-bottom--6__8Ny2B","padding-bottom--6":"Callout-module_padding-bottom--6__wNeJk","margin-bottom--7":"Callout-module_margin-bottom--7__0dYmE","padding-bottom--7":"Callout-module_padding-bottom--7__FueIs","margin-bottom--8":"Callout-module_margin-bottom--8__r93zU","padding-bottom--8":"Callout-module_padding-bottom--8__APcyf","margin-bottom--9":"Callout-module_margin-bottom--9__f6KUQ","padding-bottom--9":"Callout-module_padding-bottom--9__KVgqO","margin-left":"Callout-module_margin-left__mb1jm","padding-left":"Callout-module_padding-left__cgzip","margin-left--1":"Callout-module_margin-left--1__DWFsG","padding-left--1":"Callout-module_padding-left--1__3nWMz","margin-left--2":"Callout-module_margin-left--2__ByTNO","padding-left--2":"Callout-module_padding-left--2__9-PLw","margin-left--3":"Callout-module_margin-left--3__0Iz7m","padding-left--3":"Callout-module_padding-left--3__FQgJY","margin-left--4":"Callout-module_margin-left--4__cmAQ4","padding-left--4":"Callout-module_padding-left--4__pW9OV","margin-left--5":"Callout-module_margin-left--5__qD5bN","padding-left--5":"Callout-module_padding-left--5__FaZO8","margin-left--6":"Callout-module_margin-left--6__h-dBW","padding-left--6":"Callout-module_padding-left--6__RT6JH","margin-left--7":"Callout-module_margin-left--7__9wZFI","padding-left--7":"Callout-module_padding-left--7__-31-c","margin-left--8":"Callout-module_margin-left--8__bbcki","padding-left--8":"Callout-module_padding-left--8__f3ctw","margin-left--9":"Callout-module_margin-left--9__0xlWQ","padding-left--9":"Callout-module_padding-left--9__QsNKP","margin-right":"Callout-module_margin-right__CN33J","padding-right":"Callout-module_padding-right__Cn14a","margin-right--1":"Callout-module_margin-right--1__GAGZO","padding-right--1":"Callout-module_padding-right--1__qh8gH","margin-right--2":"Callout-module_margin-right--2__MjxOE","padding-right--2":"Callout-module_padding-right--2__CDawi","margin-right--3":"Callout-module_margin-right--3__w3PO-","padding-right--3":"Callout-module_padding-right--3__bOIL3","margin-right--4":"Callout-module_margin-right--4__wjZRG","padding-right--4":"Callout-module_padding-right--4__DNn-A","margin-right--5":"Callout-module_margin-right--5__JUYoz","padding-right--5":"Callout-module_padding-right--5__V1t3c","margin-right--6":"Callout-module_margin-right--6__UXR9-","padding-right--6":"Callout-module_padding-right--6__pVwQj","margin-right--7":"Callout-module_margin-right--7__ZwUec","padding-right--7":"Callout-module_padding-right--7__EHY0p","margin-right--8":"Callout-module_margin-right--8__k9asQ","padding-right--8":"Callout-module_padding-right--8__1Nqrm","margin-right--9":"Callout-module_margin-right--9__J8sMZ","padding-right--9":"Callout-module_padding-right--9__QYnAq","error":"Callout-module_error__UeboU","font--primary":"Callout-module_font--primary__Ayv9J","font--secondary":"Callout-module_font--secondary__mBXUH","font--code":"Callout-module_font--code__fG36F","font-weight--400":"Callout-module_font-weight--400__VYsxM","font-weight--500":"Callout-module_font-weight--500__zXuRq","font-weight--600":"Callout-module_font-weight--600__fJDVt","font-weight--700":"Callout-module_font-weight--700__3kQTh","font-weight--800":"Callout-module_font-weight--800__5POjB","font-size--h1":"Callout-module_font-size--h1__9fzEM","font-size--h2":"Callout-module_font-size--h2__EowCg","font-size--h3":"Callout-module_font-size--h3__8EcUJ","font-size--h4":"Callout-module_font-size--h4__ferQ7","font-size--h5":"Callout-module_font-size--h5__43lHF","font-size--h6":"Callout-module_font-size--h6__GpBej","font-size--big":"Callout-module_font-size--big__-BXjA","font-size--button":"Callout-module_font-size--button__9KupW","font-size--p":"Callout-module_font-size--p__RJTna","font-size--small":"Callout-module_font-size--small__YEsJl","line-height--large":"Callout-module_line-height--large__OStzV","line-height--normal":"Callout-module_line-height--normal__p5UA7","line-height--small":"Callout-module_line-height--small__2kXv9","line-height--very-small":"Callout-module_line-height--very-small__AS59u","text-align--center":"Callout-module_text-align--center__5JXeQ","category__header":"Callout-module_category__header__Edg04","a--highlighted":"Callout-module_a--highlighted__JmfE5","grecaptcha-badge":"Callout-module_grecaptcha-badge__7vWF5","container":"Callout-module_container__FV7VM","container--contents-centered":"Callout-module_container--contents-centered__zx2lp","container--no-padding":"Callout-module_container--no-padding__wI9Pc","page":"Callout-module_page__2bQ0P","page--contents-max-width":"Callout-module_page--contents-max-width__4p2pL","page--no-extra-padding":"Callout-module_page--no-extra-padding__lGzpM","page--no-max-width":"Callout-module_page--no-max-width__cF1qn","hr":"Callout-module_hr__iz4ZP","li--disabled":"Callout-module_li--disabled__09IJ1","block":"Callout-module_block__cdSSP","callout":"Callout-module_callout__kEgS8","callout__icon":"Callout-module_callout__icon__z-ZHp","callout--info":"Callout-module_callout--info__zpyMT","callout--info__icon":"Callout-module_callout--info__icon__hHBbh","callout--warning":"Callout-module_callout--warning__QhFli","callout--error":"Callout-module_callout--error__-HDOj","callout--success":"Callout-module_callout--success__f1lTK","callout__wrapper":"Callout-module_callout__wrapper__jooXm","loading_animation":"Callout-module_loading_animation__9m516","MoveInTop":"Callout-module_MoveInTop__fio2m","fadeInDown":"Callout-module_fadeInDown__webmy","fadeUp":"Callout-module_fadeUp__uXBP6"};
6
6
 
7
7
  exports.default = styles;
8
8
  //# sourceMappingURL=Callout.module.scss.js.map
@@ -2,7 +2,9 @@
2
2
 
3
3
  const generateIdForBlogTitle = (title) => title.toLowerCase().replace(/[^\w\d]/g, '-');
4
4
  const generateUrlForBlogTitle = (title) => encodeURIComponent(title.replace(/[^\w]+/g, '-').toLowerCase());
5
+ const generateSectionHref = (id) => `?section=${id}`;
5
6
 
6
7
  exports.generateIdForBlogTitle = generateIdForBlogTitle;
8
+ exports.generateSectionHref = generateSectionHref;
7
9
  exports.generateUrlForBlogTitle = generateUrlForBlogTitle;
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["export const generateIdForBlogTitle = (title: string) => title.toLowerCase().replace(/[^\\w\\d]/g, '-');\n\nexport const generateUrlForBlogTitle = (title: string) => encodeURIComponent(title.replace(/[^\\w]+/g, '-').toLowerCase());\n"],"names":[],"mappings":";;MAAa,sBAAsB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG;MAEvF,uBAAuB,GAAG,CAAC,KAAa,KAAK,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["export const generateIdForBlogTitle = (title: string) => title.toLowerCase().replace(/[^\\w\\d]/g, '-');\n\nexport const generateUrlForBlogTitle = (title: string) => encodeURIComponent(title.replace(/[^\\w]+/g, '-').toLowerCase());\n\nexport const generateSectionHref = (id: string) => `?section=${id}`;\n"],"names":[],"mappings":";;MAAa,sBAAsB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG;MAEvF,uBAAuB,GAAG,CAAC,KAAa,KAAK,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;AAEjH,MAAM,mBAAmB,GAAG,CAAC,EAAU,KAAK,CAAA,SAAA,EAAY,EAAE,CAAA;;;;;;"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const lockScrollUpdates = (id, isClickScrolling, scrollEndHandlerRef, setVisibleTitle) => {
6
+ if (scrollEndHandlerRef.current) {
7
+ document.body.removeEventListener('scrollend', scrollEndHandlerRef.current);
8
+ }
9
+ isClickScrolling.current = true;
10
+ scrollEndHandlerRef.current = () => {
11
+ isClickScrolling.current = false;
12
+ scrollEndHandlerRef.current = null;
13
+ setVisibleTitle(id);
14
+ const url = new URL(window.location.href);
15
+ url.searchParams.set('section', id);
16
+ window.history.replaceState({}, '', url.toString());
17
+ };
18
+ document.body.addEventListener('scrollend', scrollEndHandlerRef.current, {
19
+ once: true,
20
+ });
21
+ };
22
+
23
+ exports.default = lockScrollUpdates;
24
+ //# sourceMappingURL=lockScrollUpdates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockScrollUpdates.js","sources":["../../../src/utils/lockScrollUpdates.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\n\nconst lockScrollUpdates = (\n\tid: string,\n\tisClickScrolling: MutableRefObject<boolean>,\n\tscrollEndHandlerRef: MutableRefObject<(() => void) | null>,\n\tsetVisibleTitle: (id: string) => void\n) => {\n\tif (scrollEndHandlerRef.current) {\n\t\tdocument.body.removeEventListener('scrollend', scrollEndHandlerRef.current);\n\t}\n\n\tisClickScrolling.current = true;\n\n\tscrollEndHandlerRef.current = () => {\n\t\tisClickScrolling.current = false;\n\t\tscrollEndHandlerRef.current = null;\n\t\tsetVisibleTitle(id);\n\t\tconst url = new URL(window.location.href);\n\t\turl.searchParams.set('section', id);\n\t\twindow.history.replaceState({}, '', url.toString());\n\t};\n\n\tdocument.body.addEventListener('scrollend', scrollEndHandlerRef.current, {\n\t\tonce: true,\n\t});\n};\n\nexport default lockScrollUpdates;\n"],"names":[],"mappings":";;;;AAEA,MAAM,iBAAiB,GAAG,CACzB,EAAU,EACV,gBAA2C,EAC3C,mBAA0D,EAC1D,eAAqC,KAClC;AACH,IAAA,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAChC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC;IAC5E;AAEA,IAAA,gBAAgB,CAAC,OAAO,GAAG,IAAI;AAE/B,IAAA,mBAAmB,CAAC,OAAO,GAAG,MAAK;AAClC,QAAA,gBAAgB,CAAC,OAAO,GAAG,KAAK;AAChC,QAAA,mBAAmB,CAAC,OAAO,GAAG,IAAI;QAClC,eAAe,CAAC,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;AACnC,QAAA,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;AACpD,IAAA,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE;AACxE,QAAA,IAAI,EAAE,IAAI;AACV,KAAA,CAAC;AACH;;;;"}
@@ -4,8 +4,8 @@ import { lazy, Suspense } from 'react';
4
4
  import BlogStatic from '../staticComponents/BlogStatic.js';
5
5
 
6
6
  const BlogDynamic = lazy(() => import('../dynamicComponents/BlogDynamic.js'));
7
- const Blog = ({ children, title = 'In this article' }) => {
8
- return (jsx(Suspense, { fallback: jsx(BlogStatic, { children: children }), children: jsx(BlogDynamic, { title: title, children: children }) }));
7
+ const Blog = ({ children, title = 'In this article', jsonLd }) => {
8
+ return (jsx(Suspense, { fallback: jsx(BlogStatic, { jsonLd: jsonLd, children: children }), children: jsx(BlogDynamic, { title: title, jsonLd: jsonLd, children: children }) }));
9
9
  };
10
10
 
11
11
  export { Blog as default };
@@ -1 +1 @@
1
- {"version":3,"file":"Blog.js","sources":["../../../src/components/Blog.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport type { ReactNode } from 'react';\nimport BlogStatic from '../staticComponents/BlogStatic';\n\nconst BlogDynamic = lazy(() => import('../dynamicComponents/BlogDynamic'));\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n}\n\nconst Blog = ({ children, title = 'In this article' }: BlogProperties) => {\n\treturn (\n\t\t<Suspense fallback={<BlogStatic>{children}</BlogStatic>}>\n\t\t\t<BlogDynamic title={title}>{children}</BlogDynamic>\n\t\t</Suspense>\n\t);\n};\n\nexport default Blog;\n"],"names":["_jsx"],"mappings":";;;;AAMA,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,OAAO,qCAAkC,CAAC,CAAC;AAO1E,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,iBAAiB,EAAkB,KAAI;IACxE,QACCA,IAAC,QAAQ,EAAA,EAAC,QAAQ,EAAEA,GAAA,CAAC,UAAU,EAAA,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAc,YACtDA,GAAA,CAAC,WAAW,EAAA,EAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,EAAA,CAAe,EAAA,CACzC;AAEb;;;;"}
1
+ {"version":3,"file":"Blog.js","sources":["../../../src/components/Blog.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport type { ReactNode } from 'react';\nimport type { Thing, WithContext } from 'schema-dts';\nimport BlogStatic from '../staticComponents/BlogStatic';\n\nconst BlogDynamic = lazy(() => import('../dynamicComponents/BlogDynamic'));\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n\tjsonLd?: WithContext<Thing>;\n}\n\nconst Blog = ({ children, title = 'In this article', jsonLd }: BlogProperties) => {\n\treturn (\n\t\t<Suspense fallback={<BlogStatic jsonLd={jsonLd}>{children}</BlogStatic>}>\n\t\t\t<BlogDynamic title={title} jsonLd={jsonLd}>{children}</BlogDynamic>\n\t\t</Suspense>\n\t);\n};\n\nexport default Blog;\n"],"names":["_jsx"],"mappings":";;;;AAOA,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,OAAO,qCAAkC,CAAC,CAAC;AAQ1E,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,iBAAiB,EAAE,MAAM,EAAkB,KAAI;AAChF,IAAA,QACCA,GAAA,CAAC,QAAQ,EAAA,EAAC,QAAQ,EAAEA,GAAA,CAAC,UAAU,EAAA,EAAC,MAAM,EAAE,MAAM,YAAG,QAAQ,EAAA,CAAc,EAAA,QAAA,EACtEA,GAAA,CAAC,WAAW,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAe,EAAA,CACzD;AAEb;;;;"}
@@ -3,14 +3,18 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useCallback, useEffect, Children, isValidElement, cloneElement } from 'react';
4
4
  import { useSpring, config, animated } from '@react-spring/web';
5
5
  import styles from '../styles/Blog.module.scss.js';
6
+ import lockScrollUpdates from '../utils/lockScrollUpdates.js';
6
7
 
7
- const Blog = ({ children, title = 'In this article' }) => {
8
+ const Blog = ({ children, title = 'In this article', jsonLd, }) => {
8
9
  const sectionReferences = useRef(new Map());
9
10
  const [categoryTitles, setCategoryTitles] = useState(new Map());
10
11
  const [visibleTitle, setVisibleTitle] = useState(null);
11
12
  const [showTOC, setShowTOC] = useState(false);
12
13
  const updateTimerRef = useRef(null);
13
14
  const showTOCTimerRef = useRef(null);
15
+ const hasScrolledToInitialSection = useRef(false);
16
+ const isClickScrolling = useRef(false);
17
+ const scrollEndHandlerRef = useRef(null);
14
18
  const sortByDomPosition = useCallback(([, a], [, b]) => {
15
19
  const position = a.el.compareDocumentPosition(b.el);
16
20
  if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
@@ -63,6 +67,8 @@ const Blog = ({ children, title = 'In this article' }) => {
63
67
  const observer = new IntersectionObserver(([entry]) => {
64
68
  if (!entry.isIntersecting)
65
69
  return;
70
+ if (isClickScrolling.current)
71
+ return;
66
72
  setVisibleTitle(visibleId => {
67
73
  if (visibleId === id && !entry.isIntersecting)
68
74
  return null;
@@ -88,8 +94,29 @@ const Blog = ({ children, title = 'In this article' }) => {
88
94
  if (showTOCTimerRef.current) {
89
95
  clearTimeout(showTOCTimerRef.current);
90
96
  }
97
+ if (scrollEndHandlerRef.current) {
98
+ document.body.removeEventListener('scrollend', scrollEndHandlerRef.current);
99
+ }
91
100
  };
92
101
  }, []);
102
+ // On initial load, scroll to section specified in URL
103
+ useEffect(() => {
104
+ if (hasScrolledToInitialSection.current)
105
+ return;
106
+ if (categoryTitles.size === 0)
107
+ return;
108
+ const url = new URL(window.location.href);
109
+ const section = url.searchParams.get('section');
110
+ if (!section)
111
+ return;
112
+ const entry = categoryTitles.get(section);
113
+ if (!entry)
114
+ return;
115
+ hasScrolledToInitialSection.current = true;
116
+ const top = entry.el.getBoundingClientRect().top + document.body.scrollTop - 100;
117
+ document.body.scrollTo({ top, behavior: 'smooth' });
118
+ lockScrollUpdates(section, isClickScrolling, scrollEndHandlerRef, setVisibleTitle);
119
+ }, [categoryTitles]);
93
120
  const handleSectionReference = useCallback((element) => {
94
121
  if (!element)
95
122
  return;
@@ -133,21 +160,21 @@ const Blog = ({ children, title = 'In this article' }) => {
133
160
  if (!el)
134
161
  return;
135
162
  const top = el.getBoundingClientRect().top + document.body.scrollTop - 100;
163
+ const url = new URL(window.location.href);
164
+ url.searchParams.set('section', id);
165
+ window.history.replaceState({}, '', url.toString());
136
166
  document.body.scrollTo({
137
167
  top,
138
168
  behavior: 'smooth',
139
169
  });
140
- const timer = setTimeout(() => {
141
- setVisibleTitle(id);
142
- clearTimeout(timer);
143
- }, 1000);
170
+ lockScrollUpdates(id, isClickScrolling, scrollEndHandlerRef, setVisibleTitle);
144
171
  };
145
172
  const sidebarStyle = useSpring({
146
173
  opacity: showTOC ? 1 : 0,
147
174
  transform: showTOC ? 'translateX(0)' : 'translateX(40px)',
148
175
  config: config.gentle,
149
176
  });
150
- return (jsxs("div", { className: styles.blog, children: [jsx("div", { className: styles['blog__content'], children: Children.map(children, child => {
177
+ return (jsxs("div", { className: styles.blog, children: [jsonLd && (jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(jsonLd) } })), jsx("div", { className: styles['blog__content'], children: Children.map(children, child => {
151
178
  if (!isValidElement(child))
152
179
  return child;
153
180
  return cloneElement(child, {
@@ -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';\nimport { useSpring, animated, config } 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 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\tif (!showTOC) setShowTOC(true);\n\n\t\tif (visibleTitle) return;\n\t\tsetVisibleTitle(firstSectionId);\n\t}, [visibleTitle, sortByDomPosition, showTOC, setShowTOC]);\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}, 200);\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(40px)',\n\t\tconfig: config.gentle,\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\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AC,EAAE,KAAK,EAAE,YAAY,EAAA,QAAA,EAAA,CACpEC,GAAA,CAAA,GAAA,EAAA,EACC,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA,CAAA,EAAI,MAAM,CAAC,kBAAkB,CAAC,CAAA,CAAE,EAAA,QAAA,EAEvE,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,CACa,CAAA,EAAA,CACV;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, config } from '@react-spring/web';\n\nimport type { MouseEvent, ReactNode, RefAttributes } from 'react';\nimport type { Thing, WithContext } from 'schema-dts';\n\nimport styles from '../styles/Blog.module.scss';\nimport lockScrollUpdates from '../utils/lockScrollUpdates';\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n\tjsonLd?: WithContext<Thing>;\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 = ({\n\tchildren,\n\ttitle = 'In this article',\n\tjsonLd,\n}: 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\tconst hasScrolledToInitialSection = useRef(false);\n\tconst isClickScrolling = useRef(false);\n\tconst scrollEndHandlerRef = useRef<(() => void) | 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 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\tif (!showTOC) setShowTOC(true);\n\n\t\tif (visibleTitle) return;\n\t\tsetVisibleTitle(firstSectionId);\n\t}, [visibleTitle, sortByDomPosition, showTOC, setShowTOC]);\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}, 200);\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\tif (isClickScrolling.current) 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\tif (scrollEndHandlerRef.current) {\n\t\t\t\tdocument.body.removeEventListener('scrollend', scrollEndHandlerRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t// On initial load, scroll to section specified in URL\n\tuseEffect(() => {\n\t\tif (hasScrolledToInitialSection.current) return;\n\t\tif (categoryTitles.size === 0) return;\n\t\tconst url = new URL(window.location.href);\n\t\tconst section = url.searchParams.get('section');\n\t\tif (!section) return;\n\t\tconst entry = categoryTitles.get(section);\n\t\tif (!entry) return;\n\t\thasScrolledToInitialSection.current = true;\n\t\tconst top =\n\t\t\tentry.el.getBoundingClientRect().top + document.body.scrollTop - 100;\n\t\tdocument.body.scrollTo({ top, behavior: 'smooth' });\n\t\tlockScrollUpdates(section, isClickScrolling, scrollEndHandlerRef, setVisibleTitle);\n\t}, [categoryTitles]);\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\n\t\tconst url = new URL(window.location.href);\n\t\turl.searchParams.set('section', id);\n\t\twindow.history.replaceState({}, '', url.toString());\n\n\t\tdocument.body.scrollTo({\n\t\t\ttop,\n\t\t\tbehavior: 'smooth',\n\t\t});\n\n\t\tlockScrollUpdates(id, isClickScrolling, scrollEndHandlerRef, setVisibleTitle);\n\t};\n\n\tconst sidebarStyle = useSpring({\n\t\topacity: showTOC ? 1 : 0,\n\t\ttransform: showTOC ? 'translateX(0)' : 'translateX(40px)',\n\t\tconfig: config.gentle,\n\t});\n\n\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t{jsonLd && (\n\t\t\t\t<script\n\t\t\t\t\ttype=\"application/ld+json\"\n\t\t\t\t\tdangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}\n\t\t\t\t/>\n\t\t\t)}\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{title}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t</animated.div>\n\t\t</div>\n\t);\n};\n\nexport default Blog;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;AA4CA,MAAM,IAAI,GAAG,CAAC,EACb,QAAQ,EACR,KAAK,GAAG,iBAAiB,EACzB,MAAM,GACU,KAAI;IACpB,MAAM,iBAAiB,GAAG,MAAM,CAAmB,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CACnD,IAA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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,CACa,CAAA,EAAA,CACV;AAER;;;;"}
@@ -2,7 +2,7 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useRef, useImperativeHandle, Children, isValidElement, cloneElement } from 'react';
4
4
  import styles from '../styles/BlogSection.module.scss.js';
5
- import { generateIdForBlogTitle } from '../utils/index.js';
5
+ import { generateIdForBlogTitle, generateSectionHref } from '../utils/index.js';
6
6
 
7
7
  const BlogSection = forwardRef(({ title = '', category = '', children = null, increaseMarginBottom = false, }, forwardedReference) => {
8
8
  const titleWithCategory = category ? `${category} - ${title}` : title;
@@ -33,7 +33,7 @@ const BlogSection = forwardRef(({ title = '', category = '', children = null, in
33
33
  return (jsxs("div", { className: `${styles['blog-section']}
34
34
  ${increaseMarginBottom
35
35
  ? styles['margin-bottom--9']
36
- : styles['margin-bottom--6']}`, "data-title": title, "data-id": id, ref: parentReference, children: [title ? (jsx("h4", { className: styles['blog-section__title'], children: title })) : null, Children.map(children, child => {
36
+ : 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 => {
37
37
  if (!isValidElement(child))
38
38
  return child;
39
39
  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\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 } 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\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\t\t\tchildReferences.current.push(subParentReference);\n\n\t\t\t// Re-trigger parent ref callback with updated children\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']}>{title}</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":";;;;;AAyBA,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,IA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AAA,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\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\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\t\t\tchildReferences.current.push(subParentReference);\n\n\t\t\t// Re-trigger parent ref callback with updated children\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":";;;;;AAyBA,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,C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CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAA,QAAA,EAC/G,KAAK,EAAA,CACH,EAAA,CACA,IACF,IAAI,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;;;;"}
@@ -0,0 +1,20 @@
1
+ const lockScrollUpdates = (id, isClickScrolling, scrollEndHandlerRef, setVisibleTitle) => {
2
+ if (scrollEndHandlerRef.current) {
3
+ document.body.removeEventListener('scrollend', scrollEndHandlerRef.current);
4
+ }
5
+ isClickScrolling.current = true;
6
+ scrollEndHandlerRef.current = () => {
7
+ isClickScrolling.current = false;
8
+ scrollEndHandlerRef.current = null;
9
+ setVisibleTitle(id);
10
+ const url = new URL(window.location.href);
11
+ url.searchParams.set('section', id);
12
+ window.history.replaceState({}, '', url.toString());
13
+ };
14
+ document.body.addEventListener('scrollend', scrollEndHandlerRef.current, {
15
+ once: true,
16
+ });
17
+ };
18
+
19
+ export { lockScrollUpdates as default };
20
+ //# sourceMappingURL=lockScrollUpdates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockScrollUpdates.js","sources":["../../../src/dynamicComponents/lockScrollUpdates.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { generateSectionHref } from '../utils';\n\nconst lockScrollUpdates = (\n\tid: string,\n\tisClickScrolling: MutableRefObject<boolean>,\n\tscrollEndHandlerRef: MutableRefObject<(() => void) | null>,\n\tsetVisibleTitle: (id: string) => void\n) => {\n\tif (scrollEndHandlerRef.current) {\n\t\tdocument.body.removeEventListener('scrollend', scrollEndHandlerRef.current);\n\t}\n\n\tisClickScrolling.current = true;\n\n\tscrollEndHandlerRef.current = () => {\n\t\tisClickScrolling.current = false;\n\t\tscrollEndHandlerRef.current = null;\n\t\tsetVisibleTitle(id);\n\t\tconst url = new URL(window.location.href);\n\t\turl.searchParams.set('section', id);\n\t\twindow.history.replaceState({}, '', url.toString());\n\t};\n\n\tdocument.body.addEventListener('scrollend', scrollEndHandlerRef.current, {\n\t\tonce: true,\n\t});\n};\n\nexport default lockScrollUpdates;\n"],"names":[],"mappings":"AAGA,MAAM,iBAAiB,GAAG,CACzB,EAAU,EACV,gBAA2C,EAC3C,mBAA0D,EAC1D,eAAqC,KAClC;AACH,IAAA,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAChC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC;IAC5E;AAEA,IAAA,gBAAgB,CAAC,OAAO,GAAG,IAAI;AAE/B,IAAA,mBAAmB,CAAC,OAAO,GAAG,MAAK;AAClC,QAAA,gBAAgB,CAAC,OAAO,GAAG,KAAK;AAChC,QAAA,mBAAmB,CAAC,OAAO,GAAG,IAAI;QAClC,eAAe,CAAC,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;AACnC,QAAA,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;AACpD,IAAA,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE;AACxE,QAAA,IAAI,EAAE,IAAI;AACV,KAAA,CAAC;AACH;;;;"}