@san-siva/blogkit 1.1.0 → 1.1.2

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/BlogHeader.js +2 -2
  2. package/dist/cjs/components/BlogHeader.js.map +1 -1
  3. package/dist/cjs/components/Callout.js +2 -2
  4. package/dist/cjs/components/Callout.js.map +1 -1
  5. package/dist/cjs/components/Table.js +2 -2
  6. package/dist/cjs/components/Table.js.map +1 -1
  7. package/dist/cjs/dynamicComponents/BlogDynamic.js +22 -20
  8. package/dist/cjs/dynamicComponents/BlogDynamic.js.map +1 -1
  9. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +1 -0
  10. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  11. package/dist/cjs/index.css +1 -1
  12. package/dist/cjs/index.css.map +1 -1
  13. package/dist/cjs/staticComponents/BlogHeaderStatic.js +13 -0
  14. package/dist/cjs/staticComponents/BlogHeaderStatic.js.map +1 -0
  15. package/dist/cjs/staticComponents/CalloutStatic.js +14 -0
  16. package/dist/cjs/staticComponents/CalloutStatic.js.map +1 -0
  17. package/dist/cjs/staticComponents/TableStatic.js +18 -0
  18. package/dist/cjs/staticComponents/TableStatic.js.map +1 -0
  19. package/dist/esm/components/BlogHeader.js +1 -1
  20. package/dist/esm/components/BlogHeader.js.map +1 -1
  21. package/dist/esm/components/Callout.js +1 -1
  22. package/dist/esm/components/Callout.js.map +1 -1
  23. package/dist/esm/components/Table.js +1 -1
  24. package/dist/esm/components/Table.js.map +1 -1
  25. package/dist/esm/dynamicComponents/BlogDynamic.js +22 -20
  26. package/dist/esm/dynamicComponents/BlogDynamic.js.map +1 -1
  27. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +1 -0
  28. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -1
  29. package/dist/esm/index.css +1 -1
  30. package/dist/esm/index.css.map +1 -1
  31. package/dist/esm/staticComponents/BlogHeaderStatic.js +9 -0
  32. package/dist/esm/staticComponents/BlogHeaderStatic.js.map +1 -0
  33. package/dist/esm/staticComponents/CalloutStatic.js +10 -0
  34. package/dist/esm/staticComponents/CalloutStatic.js.map +1 -0
  35. package/dist/esm/staticComponents/TableStatic.js +14 -0
  36. package/dist/esm/staticComponents/TableStatic.js.map +1 -0
  37. package/dist/types/dynamicComponents/BlogDynamic.d.ts.map +1 -1
  38. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts.map +1 -1
  39. package/dist/types/staticComponents/BlogHeaderStatic.d.ts +8 -0
  40. package/dist/types/staticComponents/BlogHeaderStatic.d.ts.map +1 -0
  41. package/dist/types/staticComponents/CalloutStatic.d.ts +10 -0
  42. package/dist/types/staticComponents/CalloutStatic.d.ts.map +1 -0
  43. package/dist/types/staticComponents/TableStatic.d.ts +10 -0
  44. package/dist/types/staticComponents/TableStatic.d.ts.map +1 -0
  45. package/package.json +1 -1
  46. package/src/components/BlogHeader.tsx +2 -2
  47. package/src/components/Callout.tsx +3 -3
  48. package/src/components/Table.tsx +2 -2
  49. package/src/dynamicComponents/BlogDynamic.tsx +57 -60
  50. package/src/dynamicComponents/BlogSectionDynamic.tsx +2 -0
  51. package/src/styles/Blog.module.scss +4 -2
  52. package/src/styles/CodeBlock.module.scss +21 -2
  53. /package/src/{dynamicComponents/BlogHeaderDynamic.tsx → staticComponents/BlogHeaderStatic.tsx} +0 -0
  54. /package/src/{dynamicComponents/CalloutDynamic.tsx → staticComponents/CalloutStatic.tsx} +0 -0
  55. /package/src/{dynamicComponents/TableDynamic.tsx → staticComponents/TableStatic.tsx} +0 -0
@@ -0,0 +1,9 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { Fragment as Fragment$1 } from 'react';
3
+ import styles from '../styles/BlogHeader.module.scss.js';
4
+
5
+ const renderLineBreaks = (array) => array.map((element, index, array) => (jsxs(Fragment$1, { children: [element, index === array.length - 1 ? null : jsx("br", {})] }, element)));
6
+ const BlogHeader = ({ title, desc, isDescCite = true }) => (jsxs(Fragment, { children: [jsx("h1", { className: `${styles['blog-header']}`, children: renderLineBreaks(title) }), isDescCite ? (jsx("cite", { className: `${styles['blog-date']}`, children: renderLineBreaks(desc) })) : (jsx("p", { className: `${styles['blog-date']}`, children: renderLineBreaks(desc) }))] }));
7
+
8
+ export { BlogHeader as default };
9
+ //# sourceMappingURL=BlogHeaderStatic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlogHeaderStatic.js","sources":["../../../src/staticComponents/BlogHeaderStatic.tsx"],"sourcesContent":["import { Fragment } from 'react';\n\nimport styles from '../styles/BlogHeader.module.scss';\n\ninterface BlogProperties {\n\ttitle: string[];\n\tdesc: string[];\n\tisDescCite?: boolean;\n}\n\nconst renderLineBreaks = (array: string[]) =>\n\tarray.map((element, index, array) => (\n\t\t<Fragment key={element}>\n\t\t\t{element}\n\t\t\t{index === array.length - 1 ? null : <br />}\n\t\t</Fragment>\n\t));\n\nconst BlogHeader = ({ title, desc, isDescCite = true }: BlogProperties) => (\n\t\t<>\n\t\t\t<h1 className={`${styles['blog-header']}`}>{renderLineBreaks(title)}</h1>\n\t\t\t{isDescCite ? (\n\t\t\t\t<cite className={`${styles['blog-date']}`}>\n\t\t\t\t\t{renderLineBreaks(desc)}\n\t\t\t\t</cite>\n\t\t\t) : (\n\t\t\t\t<p className={`${styles['blog-date']}`}>{renderLineBreaks(desc)}</p>\n\t\t\t)}\n\t\t</>\n\t);\n\nexport default BlogHeader;\n"],"names":["_jsxs","Fragment","_jsx","_Fragment"],"mappings":";;;;AAUA,MAAM,gBAAgB,GAAG,CAAC,KAAe,KACxC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,MAC/BA,IAAA,CAACC,UAAQ,eACP,OAAO,EACP,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAGC,GAAA,CAAA,IAAA,EAAA,EAAA,CAAM,KAF7B,OAAO,CAGX,CACX,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,EAAkB,MACpEF,IAAA,CAAAG,QAAA,EAAA,EAAA,QAAA,EAAA,CACCD,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,EAAE,EAAA,QAAA,EAAG,gBAAgB,CAAC,KAAK,CAAC,EAAA,CAAM,EACxE,UAAU,IACVA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,WAAW,CAAC,CAAA,CAAE,EAAA,QAAA,EACvC,gBAAgB,CAAC,IAAI,CAAC,EAAA,CACjB,KAEPA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,WAAW,CAAC,CAAA,CAAE,EAAA,QAAA,EAAG,gBAAgB,CAAC,IAAI,CAAC,EAAA,CAAK,CACpE,CAAA,EAAA,CACC;;;;"}
@@ -0,0 +1,10 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import styles from '../styles/Callout.module.scss.js';
3
+
4
+ const Callout = ({ children, type = 'info', hasMarginUp = false, hasMarginDown = false }) => {
5
+ const className = `${styles.callout} ${styles[`callout--${type}`]} ${hasMarginUp ? styles['margin-top--1'] : ''} ${hasMarginDown ? styles['margin-bottom--2'] : ''}`;
6
+ return (jsxs("div", { className: className, children: [jsx("div", { className: styles.callout__icon }), jsx("div", { className: styles.callout__wrapper, children: children })] }));
7
+ };
8
+
9
+ export { Callout as default };
10
+ //# sourceMappingURL=CalloutStatic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalloutStatic.js","sources":["../../../src/staticComponents/CalloutStatic.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport styles from '../styles/Callout.module.scss';\n\ninterface CalloutProperties {\n\tchildren?: ReactNode;\n\ttype: 'info' | 'warning' | 'error' | 'success';\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst Callout = ({ children, type = 'info',\n\thasMarginUp = false,\n\thasMarginDown = false\n}: CalloutProperties) => {\n\tconst className = `${styles.callout} ${styles[`callout--${type}`]} ${\n\t\thasMarginUp ? styles['margin-top--1'] : ''\n\t} ${hasMarginDown ? styles['margin-bottom--2'] : ''}`;\n\treturn (\n\t\t<div className={className}>\n\t\t\t<div className={styles.callout__icon}/>\n\t\t\t<div className={styles.callout__wrapper}>{children}</div>\n\t\t</div>\n\t);\n};\n\nexport default Callout;\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAWA,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EACzC,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,EACF,KAAI;AACvB,IAAA,MAAM,SAAS,GAAG,CAAA,EAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAA,SAAA,EAAY,IAAI,EAAE,CAAC,CAAA,CAAA,EAChE,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,EACzC,CAAA,CAAA,EAAI,aAAa,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE;IACrD,QACCA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,aACxBC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,GAAG,EACvCA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,CAAA,EAAA,CACpD;AAER;;;;"}
@@ -0,0 +1,14 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import styles from '../styles/Table.module.scss.js';
3
+
4
+ const Table = ({ rows = [], headers = [], hasMarginUp = false, hasMarginDown = false, }) => {
5
+ const columnCount = headers.length;
6
+ return (jsxs("div", { className: `${styles.table}
7
+ ${hasMarginUp ? styles['margin-top--1'] : ''}
8
+ ${hasMarginDown ? styles['margin-bottom--2'] : ''}`, style: {
9
+ gridTemplateColumns: `repeat(${columnCount}, 1fr)`,
10
+ }, children: [jsx("div", { className: `${styles['table__header']}`, children: headers.map((header, index) => (jsx("div", { className: `${styles['table__header__cell']}`, children: header }, typeof header === 'string' ? header : index))) }), rows.map((row, index) => (jsx("div", { className: `${styles['table__row']}`, children: row.map((cell, cellIndex) => (jsx("div", { className: `${styles['table__row__cell']}`, children: cell }, typeof cell === 'string' ? cell : cellIndex))) }, index)))] }));
11
+ };
12
+
13
+ export { Table as default };
14
+ //# sourceMappingURL=TableStatic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableStatic.js","sources":["../../../src/staticComponents/TableStatic.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport styles from '../styles/Table.module.scss';\n\ninterface TableProperties {\n\trows?: ReactNode[][];\n\theaders?: ReactNode[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst Table = ({\n\trows = [],\n\theaders = [],\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: TableProperties) => {\n\tconst columnCount = headers.length;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles.table}\n\t\t\t\t${hasMarginUp ? styles['margin-top--1'] : ''}\n\t\t\t\t${hasMarginDown ? styles['margin-bottom--2'] : ''}`}\n\t\t\tstyle={{\n\t\t\t\tgridTemplateColumns: `repeat(${columnCount}, 1fr)`,\n\t\t\t}}\n\t\t>\n\t\t\t<div className={`${styles['table__header']}`}>\n\t\t\t\t{headers.map((header, index) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={typeof header === 'string' ? header : index}\n\t\t\t\t\t\tclassName={`${styles['table__header__cell']}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{header}\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t{rows.map((row, index) => (\n\t\t\t\t<div key={index} className={`${styles['table__row']}`}>\n\t\t\t\t\t{row.map((cell, cellIndex) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={typeof cell === 'string' ? cell : cellIndex}\n\t\t\t\t\t\t\tclassName={`${styles['table__row__cell']}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{cell}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n\nexport default Table;\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAUA,MAAM,KAAK,GAAG,CAAC,EACd,IAAI,GAAG,EAAE,EACT,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACJ,KAAI;AACrB,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM;AAElC,IAAA,QACCA,IAAA,CAAA,KAAA,EAAA,EACC,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,KAAK;MACvB,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE;AAC1C,IAAA,EAAA,aAAa,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAA,CAAE,EACpD,KAAK,EAAE;YACN,mBAAmB,EAAE,CAAA,OAAA,EAAU,WAAW,CAAA,MAAA,CAAQ;SAClD,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,eAAe,CAAC,CAAA,CAAE,EAAA,QAAA,EAC1C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,MAC1BA,GAAA,CAAA,KAAA,EAAA,EAEC,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA,CAAE,EAAA,QAAA,EAE5C,MAAM,EAAA,EAHF,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,KAAK,CAI3C,CACN,CAAC,EAAA,CACG,EACL,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,MACpBA,GAAA,CAAA,KAAA,EAAA,EAAiB,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,YAAY,CAAC,CAAA,CAAE,EAAA,QAAA,EACnD,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,MACxBA,GAAA,CAAA,KAAA,EAAA,EAEC,SAAS,EAAE,CAAA,EAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA,CAAE,EAAA,QAAA,EAEzC,IAAI,EAAA,EAHA,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,SAAS,CAI3C,CACN,CAAC,EAAA,EARO,KAAK,CAST,CACN,CAAC,CAAA,EAAA,CACG;AAER;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlogDynamic.d.ts","sourceRoot":"","sources":["../../../src/dynamicComponents/BlogDynamic.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAc,SAAS,EAAiB,MAAM,OAAO,CAAC;AAIlE,UAAU,cAAc;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,cAAc,EAAE,CAAC;CAC5B;AAkBD,QAAA,MAAM,IAAI,GAAI,qBAAyC,cAAc,4CAoNpE,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"BlogDynamic.d.ts","sourceRoot":"","sources":["../../../src/dynamicComponents/BlogDynamic.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAc,SAAS,EAAiB,MAAM,OAAO,CAAC;AAIlE,UAAU,cAAc;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,cAAc,EAAE,CAAC;CAC5B;AAgBD,QAAA,MAAM,IAAI,GAAI,qBAAyC,cAAc,4CAkNpE,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlogSectionDynamic.d.ts","sourceRoot":"","sources":["../../../src/dynamicComponents/BlogSectionDynamic.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,UAAU,cAAc;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,QAAA,MAAM,WAAW,+FA8DhB,CAAC;AAIF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"BlogSectionDynamic.d.ts","sourceRoot":"","sources":["../../../src/dynamicComponents/BlogSectionDynamic.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,UAAU,cAAc;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,QAAA,MAAM,WAAW,+FA8DhB,CAAC;AAIF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface BlogProperties {
2
+ title: string[];
3
+ desc: string[];
4
+ isDescCite?: boolean;
5
+ }
6
+ declare const BlogHeader: ({ title, desc, isDescCite }: BlogProperties) => import("react/jsx-runtime").JSX.Element;
7
+ export default BlogHeader;
8
+ //# sourceMappingURL=BlogHeaderStatic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlogHeaderStatic.d.ts","sourceRoot":"","sources":["../../../src/staticComponents/BlogHeaderStatic.tsx"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACvB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAUD,QAAA,MAAM,UAAU,GAAI,6BAAoC,cAAc,4CAWpE,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ interface CalloutProperties {
3
+ children?: ReactNode;
4
+ type: 'info' | 'warning' | 'error' | 'success';
5
+ hasMarginUp?: boolean;
6
+ hasMarginDown?: boolean;
7
+ }
8
+ declare const Callout: ({ children, type, hasMarginUp, hasMarginDown }: CalloutProperties) => import("react/jsx-runtime").JSX.Element;
9
+ export default Callout;
10
+ //# sourceMappingURL=CalloutStatic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalloutStatic.d.ts","sourceRoot":"","sources":["../../../src/staticComponents/CalloutStatic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,iBAAiB;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,OAAO,GAAI,gDAGd,iBAAiB,4CAUnB,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ interface TableProperties {
3
+ rows?: ReactNode[][];
4
+ headers?: ReactNode[];
5
+ hasMarginUp?: boolean;
6
+ hasMarginDown?: boolean;
7
+ }
8
+ declare const Table: ({ rows, headers, hasMarginUp, hasMarginDown, }: TableProperties) => import("react/jsx-runtime").JSX.Element;
9
+ export default Table;
10
+ //# sourceMappingURL=TableStatic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableStatic.d.ts","sourceRoot":"","sources":["../../../src/staticComponents/TableStatic.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,UAAU,eAAe;IACxB,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,KAAK,GAAI,gDAKZ,eAAe,4CAoCjB,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@san-siva/blogkit",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A reusable blog component library for React/Next.js applications with code highlighting, diagrams, and rich content features",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,4 +1,4 @@
1
- import BlogHeaderDynamic from '../dynamicComponents/BlogHeaderDynamic';
1
+ import BlogHeaderStatic from '../staticComponents/BlogHeaderStatic';
2
2
 
3
3
  interface BlogHeaderProperties {
4
4
  title: string[];
@@ -12,7 +12,7 @@ const BlogHeader = ({
12
12
  isDescCite = true,
13
13
  }: BlogHeaderProperties) => {
14
14
  return (
15
- <BlogHeaderDynamic title={title} desc={desc} isDescCite={isDescCite} />
15
+ <BlogHeaderStatic title={title} desc={desc} isDescCite={isDescCite} />
16
16
  );
17
17
  };
18
18
 
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import CalloutDynamic from '../dynamicComponents/CalloutDynamic';
2
+ import CalloutStatic from '../staticComponents/CalloutStatic';
3
3
 
4
4
  interface CalloutProperties {
5
5
  children?: ReactNode;
@@ -15,13 +15,13 @@ const Callout = ({
15
15
  hasMarginDown = false,
16
16
  }: CalloutProperties) => {
17
17
  return (
18
- <CalloutDynamic
18
+ <CalloutStatic
19
19
  type={type}
20
20
  hasMarginUp={hasMarginUp}
21
21
  hasMarginDown={hasMarginDown}
22
22
  >
23
23
  {children}
24
- </CalloutDynamic>
24
+ </CalloutStatic>
25
25
  );
26
26
  };
27
27
 
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import TableDynamic from '../dynamicComponents/TableDynamic';
2
+ import TableStatic from '../staticComponents/TableStatic';
3
3
 
4
4
  interface TableProperties {
5
5
  rows?: ReactNode[][];
@@ -15,7 +15,7 @@ const Table = ({
15
15
  hasMarginDown = false,
16
16
  }: TableProperties) => {
17
17
  return (
18
- <TableDynamic
18
+ <TableStatic
19
19
  rows={rows}
20
20
  headers={headers}
21
21
  hasMarginUp={hasMarginUp}
@@ -9,6 +9,7 @@ import {
9
9
  useRef,
10
10
  useState,
11
11
  } from 'react';
12
+ import { useSpring, animated } from '@react-spring/web';
12
13
 
13
14
  import type { MouseEvent, ReactNode, RefAttributes } from 'react';
14
15
 
@@ -38,34 +39,22 @@ interface CategoryTitleValue extends SectionReferenceValue {
38
39
 
39
40
  type CategoryTitle = Map<string, CategoryTitleValue>;
40
41
 
41
- type AddPaddingTopTimerReference = ReturnType<typeof setTimeout> | null;
42
-
43
42
  const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
44
- const addPaddingTopTimerReference = useRef<AddPaddingTopTimerReference>(null);
45
- const highlightCategoryTimerReference =
46
- useRef<AddPaddingTopTimerReference>(null);
47
-
48
- const clearTimers = (
49
- addPaddingTopTimerReference_: AddPaddingTopTimerReference,
50
- highlightCategoryTimerReference_: AddPaddingTopTimerReference
51
- ) => {
52
- if (addPaddingTopTimerReference_) {
53
- clearTimeout(addPaddingTopTimerReference_);
54
- }
55
- if (highlightCategoryTimerReference_) {
56
- clearTimeout(highlightCategoryTimerReference_);
57
- }
58
- };
59
-
60
43
  const sectionReferences = useRef<SectionReference>(new Map());
61
44
  const [categoryTitles, setCategoryTitles] = useState<CategoryTitle>(
62
45
  new Map()
63
46
  );
64
47
  const [visibleTitle, setVisibleTitle] = useState<string | null>(null);
48
+ const [showTOC, setShowTOC] = useState(false);
49
+
65
50
  const updateTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
51
+ const showTOCTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
66
52
 
67
53
  const sortByDomPosition = useCallback(
68
- ([, a]: [string, SectionReferenceValue], [, b]: [string, SectionReferenceValue]) => {
54
+ (
55
+ [, a]: [string, SectionReferenceValue],
56
+ [, b]: [string, SectionReferenceValue]
57
+ ) => {
69
58
  const position = a.el.compareDocumentPosition(b.el);
70
59
  if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
71
60
  return -1; // a comes before b
@@ -98,13 +87,14 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
98
87
  });
99
88
  }
100
89
 
101
- if (newCategoryTitles.size > 0) {
102
- setCategoryTitles(newCategoryTitles);
103
- if (!visibleTitle) {
104
- setVisibleTitle(firstSectionId);
105
- }
106
- }
107
- }, [visibleTitle, sortByDomPosition]);
90
+ if (newCategoryTitles.size === 0) return;
91
+
92
+ setCategoryTitles(newCategoryTitles);
93
+ if (!showTOC) setShowTOC(true);
94
+
95
+ if (visibleTitle) return;
96
+ setVisibleTitle(firstSectionId);
97
+ }, [visibleTitle, sortByDomPosition, showTOC, setShowTOC]);
108
98
 
109
99
  const debounceUpdateCategoryTitles = useCallback(() => {
110
100
  // Clear existing timer and set a new one to batch updates
@@ -113,7 +103,7 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
113
103
  }
114
104
  updateTimerRef.current = setTimeout(() => {
115
105
  updateCategoryTitles();
116
- }, 50);
106
+ }, 200);
117
107
  }, [updateCategoryTitles]);
118
108
 
119
109
  useEffect(() => {
@@ -142,51 +132,53 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
142
132
 
143
133
  useEffect(() => {
144
134
  return () => {
145
- clearTimers(
146
- addPaddingTopTimerReference.current,
147
- highlightCategoryTimerReference.current
148
- );
149
135
  if (updateTimerRef.current) {
150
136
  clearTimeout(updateTimerRef.current);
151
137
  }
138
+ if (showTOCTimerRef.current) {
139
+ clearTimeout(showTOCTimerRef.current);
140
+ }
152
141
  };
153
142
  }, []);
154
143
 
155
- const handleSectionReference = useCallback((element: ForwardedReference) => {
156
- if (!element) return;
157
- const { parentRef, childRefs } = element;
158
-
159
- // Add parent section reference
160
- if (parentRef) {
161
- const id = parentRef.dataset.id;
162
- const title = parentRef.dataset.title;
163
- if (id && title) {
164
- sectionReferences.current.set(id, {
165
- el: parentRef,
166
- title,
167
- isSubSection: false,
168
- });
169
- }
170
- }
144
+ const handleSectionReference = useCallback(
145
+ (element: ForwardedReference) => {
146
+ if (!element) return;
147
+ const { parentRef, childRefs } = element;
171
148
 
172
- // Add child section references
173
- if (Array.isArray(childRefs)) {
174
- for (const childRef of childRefs) {
175
- if (!childRef) continue;
176
- const id = childRef.dataset.id;
177
- const title = childRef.dataset.title;
149
+ // Add parent section reference
150
+ if (parentRef) {
151
+ const id = parentRef.dataset.id;
152
+ const title = parentRef.dataset.title;
178
153
  if (id && title) {
179
154
  sectionReferences.current.set(id, {
180
- el: childRef,
155
+ el: parentRef,
181
156
  title,
182
- isSubSection: true,
157
+ isSubSection: false,
183
158
  });
184
159
  }
185
160
  }
186
- }
187
161
 
188
- debounceUpdateCategoryTitles();
189
- }, [debounceUpdateCategoryTitles]);
162
+ // Add child section references
163
+ if (Array.isArray(childRefs)) {
164
+ for (const childRef of childRefs) {
165
+ if (!childRef) continue;
166
+ const id = childRef.dataset.id;
167
+ const title = childRef.dataset.title;
168
+ if (id && title) {
169
+ sectionReferences.current.set(id, {
170
+ el: childRef,
171
+ title,
172
+ isSubSection: true,
173
+ });
174
+ }
175
+ }
176
+ }
177
+
178
+ debounceUpdateCategoryTitles();
179
+ },
180
+ [debounceUpdateCategoryTitles]
181
+ );
190
182
 
191
183
  const handleClickCategoryTitle = (
192
184
  error: MouseEvent<HTMLParagraphElement>
@@ -210,6 +202,11 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
210
202
  }, 1000);
211
203
  };
212
204
 
205
+ const sidebarStyle = useSpring({
206
+ opacity: showTOC ? 1 : 0,
207
+ transform: showTOC ? 'translateX(0)' : 'translateX(80px)',
208
+ config: { tension: 280, friction: 60 },
209
+ });
213
210
 
214
211
  return (
215
212
  <div className={styles.blog}>
@@ -221,7 +218,7 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
221
218
  } as RefAttributes<ForwardedReference>);
222
219
  })}
223
220
  </div>
224
- <div className={styles['blog__sidebar']}>
221
+ <animated.div className={styles['blog__sidebar']} style={sidebarStyle}>
225
222
  <p
226
223
  className={`${styles['margin-bottom--3']} ${styles['category__header']}`}
227
224
  >
@@ -249,7 +246,7 @@ const Blog = ({ children, title = 'In this article' }: BlogProperties) => {
249
246
  );
250
247
  }
251
248
  )}
252
- </div>
249
+ </animated.div>
253
250
  </div>
254
251
  );
255
252
  };
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import {
2
4
  Children,
3
5
  cloneElement,
@@ -21,11 +21,13 @@
21
21
  top: calc(var(--topbar-height) + #{styles.space(6)});
22
22
  padding: styles.space(6);
23
23
  min-width: calc(
24
- #{styles.rem(380)} - #{styles.space(6)} - #{styles.space(6)}
24
+ #{styles.rem(320)} - #{styles.space(6)} - #{styles.space(6)}
25
25
  );
26
26
  border-radius: styles.$border-radius--1;
27
27
  background-color: styles.$color--code;
28
- box-shadow: 0 0 0 1px styles.$color--border, 0 styles.space(1) styles.space(2) 0 styles.$color--border;
28
+ box-shadow:
29
+ 0 0 0 1px styles.$color--border,
30
+ 0 styles.space(1) styles.space(2) 0 styles.$color--border;
29
31
 
30
32
  margin-left: styles.space(9);
31
33
 
@@ -1,5 +1,7 @@
1
1
  @use '@san-siva/stylekit/index.module.scss' as stylekit;
2
2
 
3
+ $code-block-background-color: #282a36;
4
+
3
5
  .code-block {
4
6
  code {
5
7
  font-size: unset;
@@ -8,7 +10,7 @@
8
10
  padding: unset;
9
11
  }
10
12
 
11
- background-color: #282a36 !important;
13
+ background-color: $code-block-background-color !important;
12
14
  filter: stylekit.$color--shadow-dark;
13
15
  border-radius: stylekit.$border-radius;
14
16
 
@@ -26,6 +28,23 @@
26
28
 
27
29
  overflow-x: auto;
28
30
 
31
+ // Custom scrollbar styling
32
+ scrollbar-width: thin;
33
+ scrollbar-color: stylekit.$color--grey-dark $code-block-background-color;
34
+
35
+ &::-webkit-scrollbar {
36
+ height: 8px;
37
+ }
38
+
39
+ &::-webkit-scrollbar-track {
40
+ background: $code-block-background-color;
41
+ }
42
+
43
+ &::-webkit-scrollbar-thumb {
44
+ background-color: stylekit.$color--grey-dark;
45
+ border-radius: 4px;
46
+ }
47
+
29
48
  padding-top: 0px;
30
49
  padding-right: stylekit.rem(18);
31
50
  padding-bottom: stylekit.rem(18);
@@ -101,5 +120,5 @@
101
120
  .code-block--static code {
102
121
  color: stylekit.$color--base !important;
103
122
  font-family: stylekit.$font-family--code !important;
104
- font-size: stylekit.$font-size--small !important;
123
+ font-size: stylekit.$font-size--p-small !important;
105
124
  }