@san-siva/blogkit 1.1.30 → 1.1.32

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 (55) hide show
  1. package/dist/cjs/components/BlogSection.js.map +1 -1
  2. package/dist/cjs/components/CheckList.js +4 -1
  3. package/dist/cjs/components/CheckList.js.map +1 -1
  4. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +3 -2
  5. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  6. package/dist/cjs/dynamicComponents/CheckListDynamic.js +33 -0
  7. package/dist/cjs/dynamicComponents/CheckListDynamic.js.map +1 -0
  8. package/dist/cjs/index.css +1 -1
  9. package/dist/cjs/index.css.map +1 -1
  10. package/dist/cjs/staticComponents/BlogSectionStatic.js +3 -2
  11. package/dist/cjs/staticComponents/BlogSectionStatic.js.map +1 -1
  12. package/dist/cjs/staticComponents/CheckListStatic.js +1 -1
  13. package/dist/cjs/staticComponents/CheckListStatic.js.map +1 -1
  14. package/dist/cjs/utils/index.js +14 -0
  15. package/dist/cjs/utils/index.js.map +1 -1
  16. package/dist/esm/components/BlogSection.js.map +1 -1
  17. package/dist/esm/components/CheckList.js +4 -1
  18. package/dist/esm/components/CheckList.js.map +1 -1
  19. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +4 -3
  20. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  21. package/dist/esm/dynamicComponents/CheckListDynamic.js +29 -0
  22. package/dist/esm/dynamicComponents/CheckListDynamic.js.map +1 -0
  23. package/dist/esm/index.css +1 -1
  24. package/dist/esm/index.css.map +1 -1
  25. package/dist/esm/staticComponents/BlogSectionStatic.js +4 -3
  26. package/dist/esm/staticComponents/BlogSectionStatic.js.map +1 -1
  27. package/dist/esm/staticComponents/CheckListStatic.js +1 -1
  28. package/dist/esm/staticComponents/CheckListStatic.js.map +1 -1
  29. package/dist/esm/utils/index.js +14 -1
  30. package/dist/esm/utils/index.js.map +1 -1
  31. package/dist/types/components/BlogSection.d.ts +2 -2
  32. package/dist/types/components/BlogSection.d.ts.map +1 -1
  33. package/dist/types/components/CheckList.d.ts.map +1 -1
  34. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts +2 -2
  35. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts.map +1 -1
  36. package/dist/types/dynamicComponents/CheckListDynamic.d.ts +9 -0
  37. package/dist/types/dynamicComponents/CheckListDynamic.d.ts.map +1 -0
  38. package/dist/types/staticComponents/BlogSectionStatic.d.ts +2 -2
  39. package/dist/types/staticComponents/BlogSectionStatic.d.ts.map +1 -1
  40. package/dist/types/staticComponents/CheckListStatic.d.ts +2 -2
  41. package/dist/types/staticComponents/CheckListStatic.d.ts.map +1 -1
  42. package/dist/types/utils/index.d.ts +2 -0
  43. package/dist/types/utils/index.d.ts.map +1 -1
  44. package/dist/types/utils/index.test.d.ts +2 -0
  45. package/dist/types/utils/index.test.d.ts.map +1 -0
  46. package/package.json +4 -2
  47. package/src/components/BlogSection.tsx +2 -2
  48. package/src/components/CheckList.tsx +12 -1
  49. package/src/dynamicComponents/BlogSectionDynamic.tsx +6 -5
  50. package/src/dynamicComponents/CheckListDynamic.tsx +66 -0
  51. package/src/staticComponents/BlogSectionStatic.tsx +6 -5
  52. package/src/staticComponents/CheckListStatic.tsx +3 -3
  53. package/src/styles/BlogSection.module.scss +9 -5
  54. package/src/utils/index.test.tsx +63 -0
  55. package/src/utils/index.ts +11 -0
@@ -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}\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":["lazy","forwardRef","_jsx","Suspense","BlogSectionStatic"],"mappings":";;;;;;;;AAQA,MAAM,kBAAkB,GAAGA,UAAI,CAC9B,MAAM,oDAAO,4CAAyC,KAAC,CACvD;AAQD,MAAM,WAAW,GAAGC,gBAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,GACf,EACD,GAAG,KACA;AACH,IAAA,QACCC,cAAA,CAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,yBAAiB,EAAA,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,EAAA,CACU,EAAA,QAAA,EAGrBF,cAAA,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;;;;"}
1
+ {"version":3,"file":"BlogSection.js","sources":["../../../src/components/BlogSection.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, lazy, Suspense } from 'react';\nimport type { HTMLAttributes, ReactElement, 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 | ReactElement<HTMLAttributes<HTMLParagraphElement>, 'p'>;\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":["lazy","forwardRef","_jsx","Suspense","BlogSectionStatic"],"mappings":";;;;;;;;AAQA,MAAM,kBAAkB,GAAGA,UAAI,CAC9B,MAAM,oDAAO,4CAAyC,KAAC,CACvD;AAQD,MAAM,WAAW,GAAGC,gBAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,GACf,EACD,GAAG,KACA;AACH,IAAA,QACCC,cAAA,CAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,yBAAiB,EAAA,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,EAAA,CACU,EAAA,QAAA,EAGrBF,cAAA,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;;;;"}
@@ -1,12 +1,15 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
4
5
 
5
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var react = require('react');
6
8
  var CheckListStatic = require('../staticComponents/CheckListStatic.js');
7
9
 
10
+ const CheckListDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/CheckListDynamic.js'); }));
8
11
  const CheckList = ({ items, hasMarginUp = false, hasMarginDown = false, }) => {
9
- return (jsxRuntime.jsx(CheckListStatic.default, { items: items, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }));
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(CheckListStatic.default, { items: items, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }), children: jsxRuntime.jsx(CheckListDynamic, { items: items, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }) }));
10
13
  };
11
14
 
12
15
  exports.default = CheckList;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckList.js","sources":["../../../src/components/CheckList.tsx"],"sourcesContent":["import CheckListStatic, { type CheckListItem } from '../staticComponents/CheckListStatic';\n\ninterface CheckListProperties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CheckList = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: CheckListProperties) => {\n\treturn (\n\t\t<CheckListStatic items={items} hasMarginUp={hasMarginUp} hasMarginDown={hasMarginDown} />\n\t);\n};\n\nexport { type CheckListItem };\nexport default CheckList;\n"],"names":["_jsx","CheckListStatic"],"mappings":";;;;;;;AAQA,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACA,KAAI;AACzB,IAAA,QACCA,cAAA,CAACC,uBAAe,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAA,CAAI;AAE3F;;;;"}
1
+ {"version":3,"file":"CheckList.js","sources":["../../../src/components/CheckList.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport CheckListStatic, { type CheckListItem } from '../staticComponents/CheckListStatic';\n\nconst CheckListDynamic = lazy(() => import('../dynamicComponents/CheckListDynamic'));\n\ninterface CheckListProperties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CheckList = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: CheckListProperties) => {\n\treturn (\n\t\t<Suspense\n\t\t\tfallback={\n\t\t\t\t<CheckListStatic items={items} hasMarginUp={hasMarginUp} hasMarginDown={hasMarginDown} />\n\t\t\t}\n\t\t>\n\t\t\t<CheckListDynamic items={items} hasMarginUp={hasMarginUp} hasMarginDown={hasMarginDown} />\n\t\t</Suspense>\n\t);\n};\n\nexport { type CheckListItem };\nexport default CheckList;\n"],"names":["lazy","_jsx","Suspense","CheckListStatic"],"mappings":";;;;;;;;AAKA,MAAM,gBAAgB,GAAGA,UAAI,CAAC,MAAM,oDAAO,0CAAuC,KAAC,CAAC;AAQpF,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACA,KAAI;AACzB,IAAA,QACCC,cAAA,CAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,uBAAe,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAA,CAAI,YAG1FF,cAAA,CAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAA,CAAI,EAAA,CAChF;AAEb;;;;"}
@@ -9,7 +9,8 @@ var BlogSection_module = require('../styles/BlogSection.module.scss.js');
9
9
  var index = require('../utils/index.js');
10
10
 
11
11
  const BlogSection = react.forwardRef(({ title = '', category = '', children = null }, forwardedReference) => {
12
- const titleWithCategory = category ? `${category} - ${title}` : title;
12
+ const titleString = typeof title === 'string' ? title : index.extractTextFromReactNode(title);
13
+ const titleWithCategory = category ? `${category} - ${titleString}` : titleString;
13
14
  const id = index.generateIdForBlogTitle(titleWithCategory);
14
15
  const parentReference = react.useRef(null);
15
16
  const childReferences = react.useRef([]);
@@ -45,7 +46,7 @@ const BlogSection = react.forwardRef(({ title = '', category = '', children = nu
45
46
  forwardedReference(imperativeHandleRef.current);
46
47
  }
47
48
  };
48
- return (jsxRuntime.jsxs("div", { className: BlogSection_module.default['blog-section'], "data-title": title, "data-id": id, ref: parentReference, children: [jsxRuntime.jsx("h3", { className: `${BlogSection_module.default['blog-section__title']} ${title ? '' : BlogSection_module.default['blog-section__title--empty']}`, children: title ? (jsxRuntime.jsx("a", { href: index.generateSectionHref(id), className: BlogSection_module.default['blog-section__title-link'], onClick: e => e.preventDefault(), children: title })) : (jsxRuntime.jsx("p", { children: "No title" })) }), react.Children.map(children, child => {
49
+ return (jsxRuntime.jsxs("div", { className: BlogSection_module.default['blog-section'], "data-title": titleString, "data-id": id, ref: parentReference, children: [jsxRuntime.jsx("h3", { className: `${BlogSection_module.default['blog-section__title']} ${title ? '' : BlogSection_module.default['blog-section__title--empty']}`, children: title ? (jsxRuntime.jsx("a", { href: index.generateSectionHref(id), className: BlogSection_module.default['blog-section__title-link'], onClick: e => e.preventDefault(), children: title })) : (jsxRuntime.jsx("p", { children: "No title" })) }), react.Children.map(children, child => {
49
50
  if (!react.isValidElement(child))
50
51
  return child;
51
52
  return react.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}\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<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":["forwardRef","generateIdForBlogTitle","useRef","useImperativeHandle","useEffect","_jsxs","styles","_jsx","generateSectionHref","Children","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAyBA,MAAM,WAAW,GAAGA,gBAAU,CAC7B,CACC,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,GAAG,IAAI,EAAkB,EAC9D,kBAAkB,KACf;AACH,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE,IAAA,MAAM,EAAE,GAAGC,4BAAsB,CAAC,iBAAiB,CAAC;AAEpD,IAAA,MAAM,eAAe,GAAGC,YAAM,CAAkC,IAAI,CAAC;AACrE,IAAA,MAAM,eAAe,GAAGA,YAAM,CAAkC,EAAE,CAAC;AACnE,IAAA,MAAM,mBAAmB,GAAGA,YAAM,CAA4B,IAAI,CAAC;AAEnE,IAAAC,yBAAmB,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;;IAGFC,eAAS,CAAC,MAAK;QACd,IACC,OAAO,kBAAkB,KAAK,UAAU;YACxC,mBAAmB,CAAC,OAAO,EAC1B;AACD,YAAA,kBAAkB,CAAC,mBAAmB,CAAC,OAAO,CAAC;QAChD;IACD,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEtB,IAAA,MAAM,qBAAqB,GAAG,CAAC,OAAkC,KAAI;AACpE,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,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,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 { HTMLAttributes, ReactElement, ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/BlogSection.module.scss';\n\nimport type { ForwardedReference } from './BlogDynamic';\nimport { extractTextFromReactNode, generateIdForBlogTitle, generateSectionHref } from '../utils';\n\ninterface BlogProperties {\n\ttitle?: string | ReactElement<HTMLAttributes<HTMLParagraphElement>, 'p'>;\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 titleString = typeof title === 'string' ? title : extractTextFromReactNode(title);\n\t\tconst titleWithCategory = category ? `${category} - ${titleString}` : titleString;\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={titleString}\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<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":["forwardRef","extractTextFromReactNode","generateIdForBlogTitle","useRef","useImperativeHandle","useEffect","_jsxs","styles","_jsx","generateSectionHref","Children","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAyBA,MAAM,WAAW,GAAGA,gBAAU,CAC7B,CACC,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,GAAG,IAAI,EAAkB,EAC9D,kBAAkB,KACf;AACH,IAAA,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAGC,8BAAwB,CAAC,KAAK,CAAC;AACvF,IAAA,MAAM,iBAAiB,GAAG,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,WAAW,CAAA,CAAE,GAAG,WAAW;AACjF,IAAA,MAAM,EAAE,GAAGC,4BAAsB,CAAC,iBAAiB,CAAC;AAEpD,IAAA,MAAM,eAAe,GAAGC,YAAM,CAAkC,IAAI,CAAC;AACrE,IAAA,MAAM,eAAe,GAAGA,YAAM,CAAkC,EAAE,CAAC;AACnE,IAAA,MAAM,mBAAmB,GAAGA,YAAM,CAA4B,IAAI,CAAC;AAEnE,IAAAC,yBAAmB,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;;IAGFC,eAAS,CAAC,MAAK;QACd,IACC,OAAO,kBAAkB,KAAK,UAAU;YACxC,mBAAmB,CAAC,OAAO,EAC1B;AACD,YAAA,kBAAkB,CAAC,mBAAmB,CAAC,OAAO,CAAC;QAChD;IACD,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,C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C,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAG;AAC/B,gBAAA,IAAI,CAACC,oBAAc,CAAC,KAAK,CAAC;AAAE,oBAAA,OAAO,KAAK;gBACxC,OAAOC,kBAAY,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,33 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var react = require('react');
8
+ var CheckList_module = require('../styles/CheckList.module.scss.js');
9
+
10
+ const CHECKBOX_SIZE = 12;
11
+ const P_TAG_FONT_SIZE = 16;
12
+ const CheckListDynamic = ({ items, hasMarginUp = false, hasMarginDown = false, }) => {
13
+ const [checkboxMarginTop, setCheckboxMarginTop] = react.useState(0);
14
+ const measureRef = react.useRef(null);
15
+ react.useEffect(() => {
16
+ if (!measureRef.current)
17
+ return;
18
+ const p = measureRef.current.querySelector('p');
19
+ if (!p)
20
+ return;
21
+ const rawLineHeight = getComputedStyle(p).lineHeight;
22
+ const lineHeight = rawLineHeight === 'normal'
23
+ ? P_TAG_FONT_SIZE * 1.2
24
+ : parseFloat(rawLineHeight);
25
+ if (!isNaN(lineHeight)) {
26
+ setCheckboxMarginTop(Math.max(0, (lineHeight - CHECKBOX_SIZE) / 2));
27
+ }
28
+ }, []);
29
+ return (jsxRuntime.jsx("div", { className: `${CheckList_module.default['check-list']} ${hasMarginUp ? CheckList_module.default['margin-top--1'] : ''} ${hasMarginDown ? CheckList_module.default['margin-bottom--2'] : ''}`, children: items.map((item, index) => (jsxRuntime.jsxs("div", { className: CheckList_module.default['check-list__item'], style: { alignItems: 'flex-start' }, "data-id": item.id, ref: index === 0 ? measureRef : undefined, children: [jsxRuntime.jsx("div", { className: `${CheckList_module.default['check-list__item__input']} ${item.isChecked ? CheckList_module.default['check-list__item__input--checked'] : ''}`, style: { marginTop: `${checkboxMarginTop}px` } }), item.children] }, item.id))) }));
30
+ };
31
+
32
+ exports.default = CheckListDynamic;
33
+ //# sourceMappingURL=CheckListDynamic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckListDynamic.js","sources":["../../../src/dynamicComponents/CheckListDynamic.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { CheckListItem } from '../staticComponents/CheckListStatic';\nimport styles from '../styles/CheckList.module.scss';\n\ninterface Properties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CHECKBOX_SIZE = 12;\nconst P_TAG_FONT_SIZE = 16;\n\nconst CheckListDynamic = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: Properties) => {\n\tconst [checkboxMarginTop, setCheckboxMarginTop] = useState(0);\n\tconst measureRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tif (!measureRef.current) return;\n\t\tconst p = measureRef.current.querySelector('p');\n\t\tif (!p) return;\n\t\tconst rawLineHeight = getComputedStyle(p).lineHeight;\n\t\tconst lineHeight =\n\t\t\trawLineHeight === 'normal'\n\t\t\t\t? P_TAG_FONT_SIZE * 1.2\n\t\t\t\t: parseFloat(rawLineHeight);\n\t\tif (!isNaN(lineHeight)) {\n\t\t\tsetCheckboxMarginTop(Math.max(0, (lineHeight - CHECKBOX_SIZE) / 2));\n\t\t}\n\t}, []);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles['check-list']} ${hasMarginUp ? styles['margin-top--1'] : ''} ${\n\t\t\t\thasMarginDown ? styles['margin-bottom--2'] : ''\n\t\t\t}`}\n\t\t>\n\t\t\t{items.map((item, index) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={item.id}\n\t\t\t\t\tclassName={styles['check-list__item']}\n\t\t\t\t\tstyle={{ alignItems: 'flex-start' }}\n\t\t\t\t\tdata-id={item.id}\n\t\t\t\t\tref={index === 0 ? measureRef : undefined}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`${styles['check-list__item__input']} ${\n\t\t\t\t\t\t\titem.isChecked ? styles['check-list__item__input--checked'] : ''\n\t\t\t\t\t\t}`}\n\t\t\t\t\t\tstyle={{ marginTop: `${checkboxMarginTop}px` }}\n\t\t\t\t\t/>\n\t\t\t\t\t{item.children}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n\nexport default CheckListDynamic;\n"],"names":["useState","useRef","useEffect","_jsx","styles","_jsxs"],"mappings":";;;;;;;;AAaA,MAAM,aAAa,GAAG,EAAE;AACxB,MAAM,eAAe,GAAG,EAAE;AAE1B,MAAM,gBAAgB,GAAG,CAAC,EACzB,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACT,KAAI;IAChB,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;AAC7D,IAAA,MAAM,UAAU,GAAGC,YAAM,CAAiB,IAAI,CAAC;IAE/CC,eAAS,CAAC,MAAK;QACd,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE;QACzB,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC;AAC/C,QAAA,IAAI,CAAC,CAAC;YAAE;QACR,MAAM,aAAa,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU;AACpD,QAAA,MAAM,UAAU,GACf,aAAa,KAAK;cACf,eAAe,GAAG;AACpB,cAAE,UAAU,CAAC,aAAa,CAAC;AAC7B,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;AACvB,YAAA,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,UAAU,GAAG,aAAa,IAAI,CAAC,CAAC,CAA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