@san-siva/blogkit 1.0.12 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +64 -13
  2. package/dist/cjs/components/Blog.js +3 -118
  3. package/dist/cjs/components/Blog.js.map +1 -1
  4. package/dist/cjs/components/BlogHeader.js +4 -4
  5. package/dist/cjs/components/BlogHeader.js.map +1 -1
  6. package/dist/cjs/components/BlogLink.js +4 -23
  7. package/dist/cjs/components/BlogLink.js.map +1 -1
  8. package/dist/cjs/components/BlogSection.js +4 -29
  9. package/dist/cjs/components/BlogSection.js.map +1 -1
  10. package/dist/cjs/components/Callout.js +3 -4
  11. package/dist/cjs/components/Callout.js.map +1 -1
  12. package/dist/cjs/components/CodeBlock.js +3 -25
  13. package/dist/cjs/components/CodeBlock.js.map +1 -1
  14. package/dist/cjs/components/Mermaid.js +3 -46
  15. package/dist/cjs/components/Mermaid.js.map +1 -1
  16. package/dist/cjs/components/Table.js +2 -7
  17. package/dist/cjs/components/Table.js.map +1 -1
  18. package/dist/cjs/dynamicComponents/BlogDynamic.js +178 -0
  19. package/dist/cjs/dynamicComponents/BlogDynamic.js.map +1 -0
  20. package/dist/cjs/dynamicComponents/BlogHeaderDynamic.js +13 -0
  21. package/dist/cjs/dynamicComponents/BlogHeaderDynamic.js.map +1 -0
  22. package/dist/cjs/dynamicComponents/BlogLinkDynamic.js +35 -0
  23. package/dist/cjs/dynamicComponents/BlogLinkDynamic.js.map +1 -0
  24. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +50 -0
  25. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -0
  26. package/dist/cjs/dynamicComponents/CalloutDynamic.js +14 -0
  27. package/dist/cjs/dynamicComponents/CalloutDynamic.js.map +1 -0
  28. package/dist/cjs/dynamicComponents/CodeBlockDynamic.js +38 -0
  29. package/dist/cjs/dynamicComponents/CodeBlockDynamic.js.map +1 -0
  30. package/dist/cjs/dynamicComponents/MermaidDynamic.js +59 -0
  31. package/dist/cjs/dynamicComponents/MermaidDynamic.js.map +1 -0
  32. package/dist/cjs/dynamicComponents/TableDynamic.js +18 -0
  33. package/dist/cjs/dynamicComponents/TableDynamic.js.map +1 -0
  34. package/dist/cjs/index.css +2 -0
  35. package/dist/cjs/index.css.map +1 -0
  36. package/dist/cjs/staticComponents/BlogLinkStatic.js +17 -0
  37. package/dist/cjs/staticComponents/BlogLinkStatic.js.map +1 -0
  38. package/dist/cjs/staticComponents/BlogSectionStatic.js +19 -0
  39. package/dist/cjs/staticComponents/BlogSectionStatic.js.map +1 -0
  40. package/dist/cjs/staticComponents/BlogStatic.js +13 -0
  41. package/dist/cjs/staticComponents/BlogStatic.js.map +1 -0
  42. package/dist/cjs/staticComponents/CodeBlockStatic.js +13 -0
  43. package/dist/cjs/staticComponents/CodeBlockStatic.js.map +1 -0
  44. package/dist/cjs/staticComponents/MermaidStatic.js +13 -0
  45. package/dist/cjs/staticComponents/MermaidStatic.js.map +1 -0
  46. package/dist/cjs/styles/Blog.module.scss.js +0 -4
  47. package/dist/cjs/styles/Blog.module.scss.js.map +1 -1
  48. package/dist/cjs/styles/BlogHeader.module.scss.js +0 -4
  49. package/dist/cjs/styles/BlogHeader.module.scss.js.map +1 -1
  50. package/dist/cjs/styles/BlogLink.module.scss.js +0 -4
  51. package/dist/cjs/styles/BlogLink.module.scss.js.map +1 -1
  52. package/dist/cjs/styles/BlogSection.module.scss.js +0 -4
  53. package/dist/cjs/styles/BlogSection.module.scss.js.map +1 -1
  54. package/dist/cjs/styles/Callout.module.scss.js +0 -4
  55. package/dist/cjs/styles/Callout.module.scss.js.map +1 -1
  56. package/dist/cjs/styles/CodeBlock.module.scss.js +1 -5
  57. package/dist/cjs/styles/CodeBlock.module.scss.js.map +1 -1
  58. package/dist/cjs/styles/Mermaid.module.scss.js +0 -4
  59. package/dist/cjs/styles/Mermaid.module.scss.js.map +1 -1
  60. package/dist/cjs/styles/Table.module.scss.js +0 -4
  61. package/dist/cjs/styles/Table.module.scss.js.map +1 -1
  62. package/dist/esm/components/Blog.js +5 -120
  63. package/dist/esm/components/Blog.js.map +1 -1
  64. package/dist/esm/components/BlogHeader.js +5 -5
  65. package/dist/esm/components/BlogHeader.js.map +1 -1
  66. package/dist/esm/components/BlogLink.js +6 -25
  67. package/dist/esm/components/BlogLink.js.map +1 -1
  68. package/dist/esm/components/BlogSection.js +6 -31
  69. package/dist/esm/components/BlogSection.js.map +1 -1
  70. package/dist/esm/components/Callout.js +4 -5
  71. package/dist/esm/components/Callout.js.map +1 -1
  72. package/dist/esm/components/CodeBlock.js +5 -27
  73. package/dist/esm/components/CodeBlock.js.map +1 -1
  74. package/dist/esm/components/Mermaid.js +5 -48
  75. package/dist/esm/components/Mermaid.js.map +1 -1
  76. package/dist/esm/components/Table.js +3 -8
  77. package/dist/esm/components/Table.js.map +1 -1
  78. package/dist/esm/dynamicComponents/BlogDynamic.js +174 -0
  79. package/dist/esm/dynamicComponents/BlogDynamic.js.map +1 -0
  80. package/dist/esm/dynamicComponents/BlogHeaderDynamic.js +9 -0
  81. package/dist/esm/dynamicComponents/BlogHeaderDynamic.js.map +1 -0
  82. package/dist/esm/dynamicComponents/BlogLinkDynamic.js +31 -0
  83. package/dist/esm/dynamicComponents/BlogLinkDynamic.js.map +1 -0
  84. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +46 -0
  85. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -0
  86. package/dist/esm/dynamicComponents/CalloutDynamic.js +10 -0
  87. package/dist/esm/dynamicComponents/CalloutDynamic.js.map +1 -0
  88. package/dist/esm/dynamicComponents/CodeBlockDynamic.js +34 -0
  89. package/dist/esm/dynamicComponents/CodeBlockDynamic.js.map +1 -0
  90. package/dist/esm/dynamicComponents/MermaidDynamic.js +55 -0
  91. package/dist/esm/dynamicComponents/MermaidDynamic.js.map +1 -0
  92. package/dist/esm/dynamicComponents/TableDynamic.js +14 -0
  93. package/dist/esm/dynamicComponents/TableDynamic.js.map +1 -0
  94. package/dist/esm/index.css +2 -0
  95. package/dist/esm/index.css.map +1 -0
  96. package/dist/esm/staticComponents/BlogLinkStatic.js +13 -0
  97. package/dist/esm/staticComponents/BlogLinkStatic.js.map +1 -0
  98. package/dist/esm/staticComponents/BlogSectionStatic.js +15 -0
  99. package/dist/esm/staticComponents/BlogSectionStatic.js.map +1 -0
  100. package/dist/esm/staticComponents/BlogStatic.js +9 -0
  101. package/dist/esm/staticComponents/BlogStatic.js.map +1 -0
  102. package/dist/esm/staticComponents/CodeBlockStatic.js +9 -0
  103. package/dist/esm/staticComponents/CodeBlockStatic.js.map +1 -0
  104. package/dist/esm/staticComponents/MermaidStatic.js +9 -0
  105. package/dist/esm/staticComponents/MermaidStatic.js.map +1 -0
  106. package/dist/esm/styles/Blog.module.scss.js +0 -4
  107. package/dist/esm/styles/Blog.module.scss.js.map +1 -1
  108. package/dist/esm/styles/BlogHeader.module.scss.js +0 -4
  109. package/dist/esm/styles/BlogHeader.module.scss.js.map +1 -1
  110. package/dist/esm/styles/BlogLink.module.scss.js +0 -4
  111. package/dist/esm/styles/BlogLink.module.scss.js.map +1 -1
  112. package/dist/esm/styles/BlogSection.module.scss.js +0 -4
  113. package/dist/esm/styles/BlogSection.module.scss.js.map +1 -1
  114. package/dist/esm/styles/Callout.module.scss.js +0 -4
  115. package/dist/esm/styles/Callout.module.scss.js.map +1 -1
  116. package/dist/esm/styles/CodeBlock.module.scss.js +1 -5
  117. package/dist/esm/styles/CodeBlock.module.scss.js.map +1 -1
  118. package/dist/esm/styles/Mermaid.module.scss.js +0 -4
  119. package/dist/esm/styles/Mermaid.module.scss.js.map +1 -1
  120. package/dist/esm/styles/Table.module.scss.js +0 -4
  121. package/dist/esm/styles/Table.module.scss.js.map +1 -1
  122. package/dist/types/components/Blog.d.ts +0 -4
  123. package/dist/types/components/Blog.d.ts.map +1 -1
  124. package/dist/types/components/BlogHeader.d.ts +2 -2
  125. package/dist/types/components/BlogHeader.d.ts.map +1 -1
  126. package/dist/types/components/BlogLink.d.ts +2 -2
  127. package/dist/types/components/BlogLink.d.ts.map +1 -1
  128. package/dist/types/components/BlogSection.d.ts +5 -4
  129. package/dist/types/components/BlogSection.d.ts.map +1 -1
  130. package/dist/types/components/Callout.d.ts +1 -1
  131. package/dist/types/components/Callout.d.ts.map +1 -1
  132. package/dist/types/components/CodeBlock.d.ts +2 -3
  133. package/dist/types/components/CodeBlock.d.ts.map +1 -1
  134. package/dist/types/components/Mermaid.d.ts.map +1 -1
  135. package/dist/types/components/Table.d.ts.map +1 -1
  136. package/dist/types/components/index.d.ts +0 -1
  137. package/dist/types/components/index.d.ts.map +1 -1
  138. package/dist/types/dynamicComponents/BlogDynamic.d.ts +12 -0
  139. package/dist/types/dynamicComponents/BlogDynamic.d.ts.map +1 -0
  140. package/dist/types/dynamicComponents/BlogHeaderDynamic.d.ts +8 -0
  141. package/dist/types/dynamicComponents/BlogHeaderDynamic.d.ts.map +1 -0
  142. package/dist/types/dynamicComponents/BlogLinkDynamic.d.ts +9 -0
  143. package/dist/types/dynamicComponents/BlogLinkDynamic.d.ts.map +1 -0
  144. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts +11 -0
  145. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts.map +1 -0
  146. package/dist/types/dynamicComponents/CalloutDynamic.d.ts +10 -0
  147. package/dist/types/dynamicComponents/CalloutDynamic.d.ts.map +1 -0
  148. package/dist/types/dynamicComponents/CodeBlockDynamic.d.ts +10 -0
  149. package/dist/types/dynamicComponents/CodeBlockDynamic.d.ts.map +1 -0
  150. package/dist/types/dynamicComponents/MermaidDynamic.d.ts +9 -0
  151. package/dist/types/dynamicComponents/MermaidDynamic.d.ts.map +1 -0
  152. package/dist/types/dynamicComponents/TableDynamic.d.ts +10 -0
  153. package/dist/types/dynamicComponents/TableDynamic.d.ts.map +1 -0
  154. package/dist/types/index.d.ts +0 -1
  155. package/dist/types/index.d.ts.map +1 -1
  156. package/dist/types/staticComponents/BlogLinkStatic.d.ts +9 -0
  157. package/dist/types/staticComponents/BlogLinkStatic.d.ts.map +1 -0
  158. package/dist/types/staticComponents/BlogSectionStatic.d.ts +10 -0
  159. package/dist/types/staticComponents/BlogSectionStatic.d.ts.map +1 -0
  160. package/dist/types/staticComponents/BlogStatic.d.ts +7 -0
  161. package/dist/types/staticComponents/BlogStatic.d.ts.map +1 -0
  162. package/dist/types/staticComponents/CodeBlockStatic.d.ts +9 -0
  163. package/dist/types/staticComponents/CodeBlockStatic.d.ts.map +1 -0
  164. package/dist/types/staticComponents/MermaidStatic.d.ts +9 -0
  165. package/dist/types/staticComponents/MermaidStatic.d.ts.map +1 -0
  166. package/package.json +8 -2
  167. package/src/components/Blog.tsx +7 -195
  168. package/src/components/BlogHeader.tsx +10 -23
  169. package/src/components/BlogLink.tsx +28 -58
  170. package/src/components/BlogSection.tsx +32 -57
  171. package/src/components/Callout.tsx +12 -11
  172. package/src/components/CodeBlock.tsx +23 -55
  173. package/src/components/Mermaid.tsx +21 -55
  174. package/src/components/Table.tsx +7 -34
  175. package/src/components/index.ts +0 -2
  176. package/src/dynamicComponents/BlogDynamic.tsx +264 -0
  177. package/src/dynamicComponents/BlogHeaderDynamic.tsx +32 -0
  178. package/src/dynamicComponents/BlogLinkDynamic.tsx +74 -0
  179. package/src/dynamicComponents/BlogSectionDynamic.tsx +90 -0
  180. package/src/dynamicComponents/CalloutDynamic.tsx +27 -0
  181. package/src/dynamicComponents/CodeBlockDynamic.tsx +76 -0
  182. package/src/dynamicComponents/MermaidDynamic.tsx +78 -0
  183. package/src/dynamicComponents/TableDynamic.tsx +54 -0
  184. package/src/index.ts +0 -3
  185. package/src/staticComponents/BlogLinkStatic.tsx +45 -0
  186. package/src/staticComponents/BlogSectionStatic.tsx +40 -0
  187. package/src/staticComponents/BlogStatic.tsx +16 -0
  188. package/src/staticComponents/CodeBlockStatic.tsx +34 -0
  189. package/src/staticComponents/MermaidStatic.tsx +26 -0
  190. package/src/styles/Blog.module.scss +19 -7
  191. package/src/styles/CodeBlock.module.scss +46 -41
  192. package/src/styles/CodeBlock.module.scss.d.ts +1 -0
  193. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js +0 -33
  194. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
  195. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +0 -29
  196. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
package/README.md CHANGED
@@ -1,23 +1,36 @@
1
1
  # Blogkit
2
2
 
3
- A reusable, feature-rich blog component library for React and Next.js applications. Built with TypeScript and SCSS modules, BlogKit provides everything you need to create beautiful, interactive blog posts with code highlighting, diagrams, callouts, and more.
3
+ A comprehensive, production-ready blog component library for React and Next.js applications. Built with TypeScript and SCSS modules, Blogkit provides a complete suite of components for creating professional, interactive blog posts with advanced features including syntax highlighting, diagram rendering, callouts, and more.
4
4
 
5
- **[📚 View Full Documentation](https://blogkit-c367c.web.app/)** | **[🌐 See Live Demo on santhoshsiva.dev](https://santhoshsiva.dev)**
5
+ **[View Full Documentation](https://blogkit-c367c.web.app/)** | **[Live Demo](https://santhoshsiva.dev)**
6
6
 
7
- ## Key Features
7
+ ## Overview
8
8
 
9
- **Blog Layout with TOC** 🎨 **Code Highlighting** 📊 **Mermaid Diagrams** 💬 **Callouts** 📋 **Data Tables** 🔗 **Blog Links** 📝 **TypeScript** 🎯 **React 19 Ready**
9
+ Blogkit is designed to streamline the development of content-rich blog applications by providing a modular, customizable component library. It supports modern React patterns, offers full TypeScript support, and includes responsive design out of the box.
10
+
11
+ ## Features
12
+
13
+ - **Blog Layout System**: Pre-built layout components with table of contents navigation
14
+ - **Syntax Highlighting**: Code block components with multi-language support via Prism.js
15
+ - **Diagram Rendering**: Integrated Mermaid.js support for flowcharts, sequence diagrams, and more
16
+ - **Content Components**: Callouts, data tables, and specialized blog link components
17
+ - **TypeScript Support**: Fully typed API for enhanced developer experience
18
+ - **Responsive Design**: Mobile-first design with SCSS modules
19
+ - **React 19 Compatible**: Built to work seamlessly with the latest React version
20
+ - **Next.js Optimized**: Designed for optimal performance in Next.js applications
10
21
 
11
22
  ## Installation
12
23
 
13
24
  ```bash
14
- npm install @san-siva/blogkit @san-siva/stylekit
25
+ npm install @san-siva/blogkit
15
26
  # or
16
- yarn add @san-siva/blogkit @san-siva/stylekit
27
+ yarn add @san-siva/blogkit
17
28
  # or
18
- pnpm add @san-siva/blogkit @san-siva/stylekit
29
+ pnpm add @san-siva/blogkit
19
30
  ```
20
31
 
32
+ > **Note:** The required `@san-siva/stylekit` package is automatically installed as a dependency.
33
+
21
34
  ### Peer Dependencies
22
35
 
23
36
  Blogkit requires the following peer dependencies:
@@ -31,6 +44,7 @@ npm install react@^19.0.0 react-dom@^19.0.0 next@^16.0.10 @react-spring/web@^10.
31
44
  ```tsx
32
45
  import { Blog, BlogHeader, BlogSection, CodeBlock, Callout } from '@san-siva/blogkit';
33
46
  import '@san-siva/stylekit/index.module.scss';
47
+ import '@san-siva/blogkit/styles.css';
34
48
 
35
49
  export default function MyBlogPost() {
36
50
  return (
@@ -60,22 +74,59 @@ export default function MyBlogPost() {
60
74
 
61
75
  ## Documentation
62
76
 
63
- For detailed documentation, component APIs, live examples, and more:
64
-
65
- 👉 **[Visit the Full Documentation](https://blogkit-c367c.web.app/)**
77
+ Comprehensive documentation is available at [https://blogkit-c367c.web.app/](https://blogkit-c367c.web.app/)
66
78
 
67
79
  The documentation includes:
68
80
 
69
81
  - Complete component API reference
70
82
  - Interactive live examples
83
+ - Implementation guides and best practices
71
84
  - Code snippets for all components
72
- - Customization guide
73
- - TypeScript usage examples
85
+ - Customization and theming guide
86
+ - TypeScript usage examples and type definitions
87
+
88
+ ## Examples
89
+
90
+ See Blogkit in action in these blogs and documentation sites:
91
+
92
+ - **[Gitsy](https://gitsy-56895.web.app/)** - A blog built with Blogkit showcasing various components
93
+ - **[Optimizing Background Tasks with requestIdleCallback](https://santhoshsiva.dev/blog/optimizing-background-tasks-with-requestidlecallback-advanced-scheduling-in-the-javascript-event-loop/)** - Advanced scheduling in the JavaScript event loop
94
+ - **[Linting at Scale](https://santhoshsiva.dev/blog/linting-at-scale-strategies-for-updating-eslint-configs-in-large-applications/)** - Strategies for updating ESLint configs in large applications
95
+
96
+ ## Requirements
97
+
98
+ - React ^19.0.0
99
+ - Next.js ^16.0.10
100
+ - Node.js 18+ recommended
101
+
102
+ ## Browser Support
103
+
104
+ Blogkit supports all modern browsers:
105
+ - Chrome (latest)
106
+ - Firefox (latest)
107
+ - Safari (latest)
108
+ - Edge (latest)
74
109
 
75
110
  ## Contributing
76
111
 
77
- Contributions are welcome! Open an issue or submit a pull request on [GitHub](https://github.com/san-siva/blogkit).
112
+ Contributions are welcome and appreciated. To contribute:
113
+
114
+ 1. Fork the repository
115
+ 2. Create a feature branch (`git checkout -b feature/improvement`)
116
+ 3. Commit your changes (`git commit -am 'Add new feature'`)
117
+ 4. Push to the branch (`git push origin feature/improvement`)
118
+ 5. Open a Pull Request
119
+
120
+ Please ensure your code follows the existing style conventions and includes appropriate tests.
121
+
122
+ For bug reports and feature requests, please [open an issue](https://github.com/san-siva/blogkit/issues) on GitHub.
78
123
 
79
124
  ## License
80
125
 
81
126
  MIT © [Santhosh Siva](https://santhoshsiva.dev)
127
+
128
+ ## Author
129
+
130
+ **Santhosh Siva**
131
+ - Website: [https://santhoshsiva.dev](https://santhoshsiva.dev)
132
+ - GitHub: [@san-siva](https://github.com/san-siva)
@@ -5,126 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
- var Blog_module = require('../styles/Blog.module.scss.js');
8
+ var BlogStatic = require('../staticComponents/BlogStatic.js');
9
9
 
10
+ const BlogDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/BlogDynamic.js'); }));
10
11
  const Blog = ({ children, title = 'In this article' }) => {
11
- const addPaddingTopTimerReference = react.useRef(null);
12
- const highlightCategoryTimerReference = react.useRef(null);
13
- const clearTimers = (addPaddingTopTimerReference_, highlightCategoryTimerReference_) => {
14
- if (addPaddingTopTimerReference_) {
15
- clearTimeout(addPaddingTopTimerReference_);
16
- }
17
- if (highlightCategoryTimerReference_) {
18
- clearTimeout(highlightCategoryTimerReference_);
19
- }
20
- };
21
- const sectionReferences = react.useRef(new Map());
22
- const [categoryTitles, setCategoryTitles] = react.useState(new Map());
23
- const [visibleTitle, setVisibleTitle] = react.useState(null);
24
- react.useEffect(() => {
25
- let firstSectionId = null;
26
- const now = Date.now();
27
- for (const [id, { title, el, isSubSection }] of sectionReferences.current) {
28
- if (!firstSectionId) {
29
- firstSectionId = id;
30
- }
31
- setCategoryTitles((previous) => {
32
- const newState = new Map(previous);
33
- newState.set(id, {
34
- el,
35
- title,
36
- lastUpdatedAt: now,
37
- isSubSection,
38
- });
39
- return newState;
40
- });
41
- }
42
- setVisibleTitle(firstSectionId);
43
- }, []);
44
- react.useEffect(() => {
45
- const observers = new Map();
46
- for (const [id, { el }] of categoryTitles) {
47
- const observer = new IntersectionObserver(([entry]) => {
48
- if (!entry.isIntersecting)
49
- return;
50
- setVisibleTitle(visibleId => {
51
- if (visibleId === id && !entry.isIntersecting)
52
- return null;
53
- if (entry.isIntersecting)
54
- return id;
55
- return visibleId;
56
- });
57
- }, { threshold: 0.1 });
58
- observers.set(id, observer);
59
- observer.observe(el);
60
- }
61
- return () => {
62
- for (const observer of observers.values()) {
63
- observer.disconnect();
64
- }
65
- };
66
- }, [categoryTitles.size]);
67
- react.useEffect(() => clearTimers(addPaddingTopTimerReference.current, highlightCategoryTimerReference.current), [addPaddingTopTimerReference, highlightCategoryTimerReference]);
68
- const addSectionReferences = (element, isSubSection = false) => {
69
- if (!element)
70
- return;
71
- const id = element.dataset.id;
72
- if (!id)
73
- return;
74
- const title = element.dataset.title;
75
- if (!title)
76
- return;
77
- sectionReferences.current.set(id, {
78
- el: element,
79
- title,
80
- isSubSection,
81
- });
82
- };
83
- const handleSectionReference = (element) => {
84
- if (!element)
85
- return;
86
- const { parentRef, childRefs } = element;
87
- if (!parentRef)
88
- return;
89
- addSectionReferences(parentRef);
90
- if (!Array.isArray(childRefs))
91
- return;
92
- for (const childReference of childRefs) {
93
- if (!childReference)
94
- continue;
95
- addSectionReferences(childReference, true);
96
- }
97
- };
98
- const handleClickCategoryTitle = (error) => {
99
- const id = error.currentTarget.dataset.id;
100
- const index = error.currentTarget.dataset.idx;
101
- if (!id || !index)
102
- return;
103
- const { el } = categoryTitles.get(id) || {};
104
- if (!el)
105
- return;
106
- const top = el.getBoundingClientRect().top + document.body.scrollTop - 100;
107
- document.body.scrollTo({
108
- top,
109
- behavior: 'smooth',
110
- });
111
- const timer = setTimeout(() => {
112
- setVisibleTitle(id);
113
- clearTimeout(timer);
114
- }, 1000);
115
- };
116
- return (jsxRuntime.jsxs("div", { className: Blog_module.default.blog, children: [jsxRuntime.jsx("div", { className: Blog_module.default['blog__content'], children: react.Children.map(children, child => {
117
- if (!react.isValidElement(child))
118
- return child;
119
- return react.cloneElement(child, {
120
- ref: handleSectionReference,
121
- });
122
- }) }), jsxRuntime.jsxs("div", { className: Blog_module.default['blog__sidebar'], children: [jsxRuntime.jsx("p", { className: `${Blog_module.default['margin-bottom--3']} ${Blog_module.default['category__header']}`, children: title }), [...categoryTitles].map(([id, { title, isSubSection }], index, array) => {
123
- const isNextSectionSubSection = array[index + 1]?.[1]?.isSubSection;
124
- return (jsxRuntime.jsx("p", { "data-idx": index, "data-id": id, className: `${Blog_module.default['category__title']} ${id === visibleTitle ? Blog_module.default['category__title--active'] : ''} ${isSubSection ? Blog_module.default['category__title--sub'] : ''} ${isSubSection && !isNextSectionSubSection
125
- ? Blog_module.default['margin-bottom-imp--2']
126
- : ''}`, onClick: handleClickCategoryTitle, children: title }, id));
127
- })] })] }));
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(BlogStatic.default, { children: children }), children: jsxRuntime.jsx(BlogDynamic, { title: title, children: children }) }));
128
13
  };
129
14
 
130
15
  exports.default = Blog;
@@ -1 +1 @@
1
- {"version":3,"file":"Blog.js","sources":["../../../src/components/Blog.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tChildren,\n\tcloneElement,\n\tisValidElement,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\n\nimport type { MouseEvent, ReactNode, RefAttributes } from 'react';\n\nimport styles from '../styles/Blog.module.scss';\n\ninterface BlogProperties {\n\tchildren: ReactNode;\n\ttitle?: string;\n}\n\nexport interface ForwardedReference {\n\tparentRef: HTMLDivElement;\n\tchildRefs: HTMLDivElement[];\n}\n\ninterface SectionReferenceValue {\n\tel: HTMLElement;\n\ttitle: string;\n\tisSubSection: boolean;\n}\n\ntype SectionReference = Map<string, SectionReferenceValue>;\n\ninterface CategoryTitleValue extends SectionReferenceValue {\n\tlastUpdatedAt: number;\n}\n\ntype CategoryTitle = Map<string, CategoryTitleValue>;\n\ntype AddPaddingTopTimerReference = ReturnType<typeof setTimeout> | null;\n\nconst Blog = ({ children, title = 'In this article' }: BlogProperties) => {\n\tconst addPaddingTopTimerReference = useRef<AddPaddingTopTimerReference>(null);\n\tconst highlightCategoryTimerReference =\n\t\tuseRef<AddPaddingTopTimerReference>(null);\n\n\tconst clearTimers = (\n\t\taddPaddingTopTimerReference_: AddPaddingTopTimerReference,\n\t\thighlightCategoryTimerReference_: AddPaddingTopTimerReference\n\t) => {\n\t\tif (addPaddingTopTimerReference_) {\n\t\t\tclearTimeout(addPaddingTopTimerReference_);\n\t\t}\n\t\tif (highlightCategoryTimerReference_) {\n\t\t\tclearTimeout(highlightCategoryTimerReference_);\n\t\t}\n\t};\n\n\tconst sectionReferences = useRef<SectionReference>(new Map());\n\tconst [categoryTitles, setCategoryTitles] = useState<CategoryTitle>(\n\t\tnew Map()\n\t);\n\tconst [visibleTitle, setVisibleTitle] = useState<string | null>(null);\n\n\tuseEffect(() => {\n\t\tlet firstSectionId: string | null = null;\n\t\tconst now = Date.now();\n\t\tfor (const [id, { title, el, isSubSection }] of sectionReferences.current) {\n\t\t\tif (!firstSectionId) {\n\t\t\t\tfirstSectionId = id;\n\t\t\t}\n\t\t\tsetCategoryTitles((previous: CategoryTitle) => {\n\t\t\t\tconst newState = new Map(previous);\n\t\t\t\tnewState.set(id, {\n\t\t\t\t\tel,\n\t\t\t\t\ttitle,\n\t\t\t\t\tlastUpdatedAt: now,\n\t\t\t\t\tisSubSection,\n\t\t\t\t});\n\t\t\t\treturn newState;\n\t\t\t});\n\t\t}\n\t\tsetVisibleTitle(firstSectionId);\n\t}, []);\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\t() =>\n\t\t\tclearTimers(\n\t\t\t\taddPaddingTopTimerReference.current,\n\t\t\t\thighlightCategoryTimerReference.current\n\t\t\t),\n\t\t[addPaddingTopTimerReference, highlightCategoryTimerReference]\n\t);\n\n\tconst addSectionReferences = (element: HTMLElement, isSubSection = false) => {\n\t\tif (!element) return;\n\t\tconst id = element.dataset.id;\n\t\tif (!id) return;\n\t\tconst title = element.dataset.title;\n\t\tif (!title) return;\n\n\t\tsectionReferences.current.set(id, {\n\t\t\tel: element,\n\t\t\ttitle,\n\t\t\tisSubSection,\n\t\t});\n\t};\n\n\tconst handleSectionReference = (element: ForwardedReference) => {\n\t\tif (!element) return;\n\t\tconst { parentRef, childRefs } = element;\n\t\tif (!parentRef) return;\n\t\taddSectionReferences(parentRef);\n\t\tif (!Array.isArray(childRefs)) return;\n\t\tfor (const childReference of childRefs) {\n\t\t\tif (!childReference) continue;\n\t\t\taddSectionReferences(childReference, true);\n\t\t}\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\treturn (\n\t\t<div className={styles.blog}>\n\t\t\t<div className={styles['blog__content']}>\n\t\t\t\t{Children.map(children, child => {\n\t\t\t\t\tif (!isValidElement(child)) return child;\n\t\t\t\t\treturn cloneElement(child, {\n\t\t\t\t\t\tref: handleSectionReference,\n\t\t\t\t\t} as RefAttributes<ForwardedReference>);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t\t<div className={styles['blog__sidebar']}>\n\t\t\t\t<p\n\t\t\t\t\tclassName={`${styles['margin-bottom--3']} ${styles['category__header']}`}\n\t\t\t\t>\n\t\t\t\t\t{title}\n\t\t\t\t</p>\n\t\t\t\t{[...categoryTitles].map(\n\t\t\t\t\t([id, { title, isSubSection }], index, array) => {\n\t\t\t\t\t\tconst isNextSectionSubSection = array[index + 1]?.[1]?.isSubSection;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\t\tdata-idx={index}\n\t\t\t\t\t\t\t\tdata-id={id}\n\t\t\t\t\t\t\t\tclassName={`${styles['category__title']} ${\n\t\t\t\t\t\t\t\t\tid === visibleTitle ? styles['category__title--active'] : ''\n\t\t\t\t\t\t\t\t} ${isSubSection ? styles['category__title--sub'] : ''} ${\n\t\t\t\t\t\t\t\t\tisSubSection && !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</div>\n\t\t</div>\n\t);\n};\n\nexport default Blog;\n"],"names":["useRef","useState","useEffect","_jsxs","styles","_jsx","Children","isValidElement","cloneElement"],"mappings":";;;;;;;;AAyCA,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,iBAAiB,EAAkB,KAAI;AACxE,IAAA,MAAM,2BAA2B,GAAGA,YAAM,CAA8B,IAAI,CAAC;AAC7E,IAAA,MAAM,+BAA+B,GACpCA,YAAM,CAA8B,IAAI,CAAC;AAE1C,IAAA,MAAM,WAAW,GAAG,CACnB,4BAAyD,EACzD,gCAA6D,KAC1D;QACH,IAAI,4BAA4B,EAAE;YACjC,YAAY,CAAC,4BAA4B,CAAC;QAC3C;QACA,IAAI,gCAAgC,EAAE;YACrC,YAAY,CAAC,gCAAgC,CAAC;QAC/C;AACD,IAAA,CAAC;IAED,MAAM,iBAAiB,GAAGA,YAAM,CAAmB,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAGC,cAAQ,CACnD,IAAI,GAAG,EAAE,CACT;IACD,MAAM,CAAC,Y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,kBAAY,CAAC,KAAK,EAAE;AAC1B,wBAAA,GAAG,EAAE,sBAAsB;AACU,qBAAA,CAAC;gBACxC,CAAC,CAAC,GACG,EACNL,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEC,mBAAM,CAAC,eAAe,CAAC,EAAA,QAAA,EAAA,CACtCC,sBACC,SAAS,EAAE,CAAA,EAAGD,mBAAM,CAAC,kBAAkB,CAAC,CAAA,CAAA,EAAIA,mBAAM,CAAC,kBAAkB,CAAC,CAAA,CAAE,YAEvE,KAAK,EAAA,CACH,EACH,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,CACvB,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAI;AAC/C,wBAAA,MAAM,uBAAuB,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY;wBACnE,QACCC,kCAEW,KAAK,EAAA,SAAA,EACN,EAAE,EACX,SAAS,EAAE,CAAA,EAAGD,mBAAM,CAAC,iBAAiB,CAAC,IACtC,EAAE,KAAK,YAAY,GAAGA,mBAAM,CAAC,yBAAyB,CAAC,GAAG,EAC3D,IAAI,YAAY,GAAGA,mBAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAA,CAAA,EACrD,YAAY,IAAI,CAAC;AAChB,kCAAEA,mBAAM,CAAC,sBAAsB;AAC/B,kCAAE,EACJ,CAAA,CAAE,EACF,OAAO,EAAE,wBAAwB,EAAA,QAAA,EAEhC,KAAK,EAAA,EAZD,EAAE,CAaJ;AAEN,oBAAA,CAAC,CACD,CAAA,EAAA,CACI,CAAA,EAAA,CACD;AAER;;;;"}
1
+ {"version":3,"file":"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":["lazy","_jsx","Suspense","BlogStatic"],"mappings":";;;;;;;;AAMA,MAAM,WAAW,GAAGA,UAAI,CAAC,MAAM,oDAAO,qCAAkC,KAAC,CAAC;AAO1E,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,iBAAiB,EAAkB,KAAI;IACxE,QACCC,eAACC,cAAQ,EAAA,EAAC,QAAQ,EAAED,cAAA,CAACE,kBAAU,EAAA,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAc,YACtDF,cAAA,CAAC,WAAW,EAAA,EAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,EAAA,CAAe,EAAA,CACzC;AAEb;;;;"}
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
7
- var BlogHeader_module = require('../styles/BlogHeader.module.scss.js');
6
+ var BlogHeaderDynamic = require('../dynamicComponents/BlogHeaderDynamic.js');
8
7
 
9
- const renderLineBreaks = (array) => array.map((element, index, array) => (jsxRuntime.jsxs(react.Fragment, { children: [element, index === array.length - 1 ? null : jsxRuntime.jsx("br", {})] }, element)));
10
- const BlogHeader = ({ title, desc, isDescCite = true }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h1", { className: `${BlogHeader_module.default['blog-header']}`, children: renderLineBreaks(title) }), isDescCite ? (jsxRuntime.jsx("cite", { className: `${BlogHeader_module.default['blog-date']}`, children: renderLineBreaks(desc) })) : (jsxRuntime.jsx("p", { className: `${BlogHeader_module.default['blog-date']}`, children: renderLineBreaks(desc) }))] }));
8
+ const BlogHeader = ({ title, desc, isDescCite = true, }) => {
9
+ return (jsxRuntime.jsx(BlogHeaderDynamic.default, { title: title, desc: desc, isDescCite: isDescCite }));
10
+ };
11
11
 
12
12
  exports.default = BlogHeader;
13
13
  //# sourceMappingURL=BlogHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlogHeader.js","sources":["../../../src/components/BlogHeader.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","styles"],"mappings":";;;;;;;;AAUA,MAAM,gBAAgB,GAAG,CAAC,KAAe,KACxC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,MAC/BA,eAAA,CAACC,cAAQ,eACP,OAAO,EACP,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAGC,cAAA,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,eAAA,CAAAG,mBAAA,EAAA,EAAA,QAAA,EAAA,CACCD,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,GAAGE,yBAAM,CAAC,aAAa,CAAC,EAAE,EAAA,QAAA,EAAG,gBAAgB,CAAC,KAAK,CAAC,EAAA,CAAM,EACxE,UAAU,IACVF,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,CAAA,EAAGE,yBAAM,CAAC,WAAW,CAAC,CAAA,CAAE,EAAA,QAAA,EACvC,gBAAgB,CAAC,IAAI,CAAC,EAAA,CACjB,KAEPF,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,CAAA,EAAGE,yBAAM,CAAC,WAAW,CAAC,CAAA,CAAE,EAAA,QAAA,EAAG,gBAAgB,CAAC,IAAI,CAAC,EAAA,CAAK,CACpE,CAAA,EAAA,CACC;;;;"}
1
+ {"version":3,"file":"BlogHeader.js","sources":["../../../src/components/BlogHeader.tsx"],"sourcesContent":["import BlogHeaderDynamic from '../dynamicComponents/BlogHeaderDynamic';\n\ninterface BlogHeaderProperties {\n\ttitle: string[];\n\tdesc: string[];\n\tisDescCite?: boolean;\n}\n\nconst BlogHeader = ({\n\ttitle,\n\tdesc,\n\tisDescCite = true,\n}: BlogHeaderProperties) => {\n\treturn (\n\t\t<BlogHeaderDynamic title={title} desc={desc} isDescCite={isDescCite} />\n\t);\n};\n\nexport default BlogHeader;\n"],"names":["_jsx","BlogHeaderDynamic"],"mappings":";;;;;;;AAQA,MAAM,UAAU,GAAG,CAAC,EACnB,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,IAAI,GACK,KAAI;AAC1B,IAAA,QACCA,cAAA,CAACC,yBAAiB,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAA,CAAI;AAEzE;;;;"}
@@ -5,30 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
- var web = require('@react-spring/web');
9
- var BlogLink_module = require('../styles/BlogLink.module.scss.js');
10
- var index = require('../utils/index.js');
8
+ var BlogLinkStatic = require('../staticComponents/BlogLinkStatic.js');
11
9
 
12
- const DEFAULT_LINE_END = 18;
13
- const DEFAULT_POLYLINE_POINTS = '12 5, 19 12, 12 19';
14
- const MOVED_POLYLINE_POINTS = '15 5, 22 12, 15 19';
15
- const BlogLink = ({ title = '', desc = '', isInProgress = false, href }) => {
16
- const [isHovered, setIsHovered] = react.useState(false);
17
- const link = href || `/blog/${index.generateUrlForBlogTitle(title)}`;
18
- const svgColor = web.useSpring({
19
- stroke: isHovered ? '#4242fa' : 'transparent',
20
- });
21
- const polyLine = web.useSpring({
22
- points: isHovered ? MOVED_POLYLINE_POINTS : DEFAULT_POLYLINE_POINTS,
23
- config: { duration: 200 },
24
- });
25
- const lineEnd = web.useSpring({
26
- x2: isHovered ? `${DEFAULT_LINE_END + 2}` : `${DEFAULT_LINE_END}`,
27
- config: { duration: 200 },
28
- });
29
- if (isInProgress)
30
- return null;
31
- return (jsxRuntime.jsxs("a", { className: BlogLink_module.default['blog-link'], onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), href: link, rel: "noopener noreferrer", children: [jsxRuntime.jsx("h6", { className: BlogLink_module.default['blog-link__title'], children: title }), jsxRuntime.jsx("p", { className: BlogLink_module.default['blog-link__description'], children: desc }), jsxRuntime.jsxs("div", { className: BlogLink_module.default['blog-link__read-more'], children: [jsxRuntime.jsx("p", { children: "Read More" }), jsxRuntime.jsxs(web.animated.svg, { xmlns: "http://www.w3.org/2000/svg", width: "18px", height: "18px", viewBox: "0 0 24 24", fill: "none", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: svgColor, children: [jsxRuntime.jsx(web.animated.line, { x1: "5", y1: "12", y2: "12", x2: lineEnd.x2 }), jsxRuntime.jsx(web.animated.polyline, { points: polyLine.points })] })] })] }));
10
+ const BlogLinkDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/BlogLinkDynamic.js'); }));
11
+ const BlogLink = ({ title = '', desc = '', isInProgress = false, href, }) => {
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(BlogLinkStatic.default, { title: title, desc: desc, isInProgress: isInProgress, href: href }), children: jsxRuntime.jsx(BlogLinkDynamic, { title: title, desc: desc, isInProgress: isInProgress, href: href }) }));
32
13
  };
33
14
 
34
15
  exports.default = BlogLink;
@@ -1 +1 @@
1
- {"version":3,"file":"BlogLink.js","sources":["../../../src/components/BlogLink.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { animated, useSpring } from '@react-spring/web';\n\nimport styles from '../styles/BlogLink.module.scss';\n\nimport { generateUrlForBlogTitle } from '../utils';\n\ninterface Properties {\n\ttitle: string;\n\tdesc?: string;\n\tisInProgress?: boolean;\n\thref?: string;\n}\n\nconst DEFAULT_LINE_END = 18;\nconst DEFAULT_POLYLINE_POINTS = '12 5, 19 12, 12 19';\nconst MOVED_POLYLINE_POINTS = '15 5, 22 12, 15 19';\n\nconst BlogLink = ({ title = '', desc = '', isInProgress = false, href }: Properties) => {\n\tconst [isHovered, setIsHovered] = useState(false);\n\n\tconst link = href || `/blog/${generateUrlForBlogTitle(title)}`;\n\n\tconst svgColor = useSpring({\n\t\tstroke: isHovered ? '#4242fa' : 'transparent',\n\t});\n\n\tconst polyLine = useSpring({\n\t\tpoints: isHovered ? MOVED_POLYLINE_POINTS : DEFAULT_POLYLINE_POINTS,\n\t\tconfig: { duration: 200 },\n\t});\n\n\tconst lineEnd = useSpring({\n\t\tx2: isHovered ? `${DEFAULT_LINE_END + 2}` : `${DEFAULT_LINE_END}`,\n\t\tconfig: { duration: 200 },\n\t});\n\n\tif (isInProgress) return null;\n\n\treturn (\n\t\t<a\n\t\t\tclassName={styles['blog-link']}\n\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\thref={link}\n\t\t\trel=\"noopener noreferrer\"\n\t\t>\n\t\t\t<h6 className={styles['blog-link__title']}>{title}</h6>\n\t\t\t<p className={styles['blog-link__description']}>{desc}</p>\n\t\t\t<div className={styles['blog-link__read-more']}>\n\t\t\t\t<p>Read More</p>\n\t\t\t\t<animated.svg\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"18px\"\n\t\t\t\t\theight=\"18px\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\tstyle={svgColor as any}\n\t\t\t\t>\n\t\t\t\t\t<animated.line x1=\"5\" y1=\"12\" y2=\"12\" x2={lineEnd.x2 as any}></animated.line>\n\t\t\t\t\t<animated.polyline points={polyLine.points as any} />\n\t\t\t\t</animated.svg>\n\t\t\t</div>\n\t\t</a>\n\t);\n};\n\nexport default BlogLink;\n"],"names":["useState","generateUrlForBlogTitle","useSpring","_jsxs","styles","_jsx","animated"],"mappings":";;;;;;;;;;AAiBA,MAAM,gBAAgB,GAAG,EAAE;AAC3B,MAAM,uBAAuB,GAAG,oBAAoB;AACpD,MAAM,qBAAqB,GAAG,oBAAoB;AAElD,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,YAAY,GAAG,KAAK,EAAE,IAAI,EAAc,KAAI;IACtF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;IAEjD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAA,MAAA,EAASC,6BAAuB,CAAC,KAAK,CAAC,CAAA,CAAE;IAE9D,MAAM,QAAQ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KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,KAAK,EAAE,QAAe,aAEtBD,cAAA,CAACC,YAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAE,OAAO,CAAC,EAAS,EAAA,CAAkB,EAC7ED,cAAA,CAACC,YAAQ,CAAC,QAAQ,IAAC,MAAM,EAAE,QAAQ,CAAC,MAAa,EAAA,CAAI,CAAA,EAAA,CACvC,CAAA,EAAA,CACV,CAAA,EAAA,CACH;AAEN;;;;"}
1
+ {"version":3,"file":"BlogLink.js","sources":["../../../src/components/BlogLink.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport BlogLinkStatic from '../staticComponents/BlogLinkStatic';\n\nconst BlogLinkDynamic = lazy(\n\t() => import('../dynamicComponents/BlogLinkDynamic')\n);\n\ninterface BlogLinkProperties {\n\ttitle: string;\n\tdesc?: string;\n\tisInProgress?: boolean;\n\thref?: string;\n}\n\nconst BlogLink = ({\n\ttitle = '',\n\tdesc = '',\n\tisInProgress = false,\n\thref,\n}: BlogLinkProperties) => {\n\treturn (\n\t\t<Suspense\n\t\t\tfallback={\n\t\t\t\t<BlogLinkStatic\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tdesc={desc}\n\t\t\t\t\tisInProgress={isInProgress}\n\t\t\t\t\thref={href}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<BlogLinkDynamic\n\t\t\t\ttitle={title}\n\t\t\t\tdesc={desc}\n\t\t\t\tisInProgress={isInProgress}\n\t\t\t\thref={href}\n\t\t\t/>\n\t\t</Suspense>\n\t);\n};\n\nexport default BlogLink;\n"],"names":["lazy","_jsx","Suspense","BlogLinkStatic"],"mappings":";;;;;;;;AAKA,MAAM,eAAe,GAAGA,UAAI,CAC3B,MAAM,oDAAO,yCAAsC,KAAC,CACpD;AASD,MAAM,QAAQ,GAAG,CAAC,EACjB,KAAK,GAAG,EAAE,EACV,IAAI,GAAG,EAAE,EACT,YAAY,GAAG,KAAK,EACpB,IAAI,GACgB,KAAI;IACxB,QACCC,eAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,sBAAc,EAAA,EACd,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,EAAA,CACT,EAAA,QAAA,EAGHF,eAAC,eAAe,EAAA,EACf,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,EAAA,CACT,EAAA,CACQ;AAEb;;;;"}
@@ -5,36 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
- var BlogSection_module = require('../styles/BlogSection.module.scss.js');
9
- var index = require('../utils/index.js');
8
+ var BlogSectionStatic = require('../staticComponents/BlogSectionStatic.js');
10
9
 
11
- const BlogSection = react.forwardRef(({ title = '', category = '', children = null, increaseMarginBottom = false, }, forwardedReference) => {
12
- const titleWithCategory = category ? `${category} - ${title}` : title;
13
- const id = index.generateIdForBlogTitle(titleWithCategory);
14
- const parentReference = react.useRef(null);
15
- const childReferences = react.useRef([]);
16
- react.useImperativeHandle(forwardedReference, () => ({
17
- parentRef: parentReference.current,
18
- childRefs: childReferences.current,
19
- }));
20
- const handleChildReferences = (element) => {
21
- if (!element)
22
- return;
23
- const { parentRef: subParentReference } = element;
24
- if (!subParentReference)
25
- return;
26
- childReferences.current.push(subParentReference);
27
- };
28
- return (jsxRuntime.jsxs("div", { className: `${BlogSection_module.default['blog-section']}
29
- ${increaseMarginBottom
30
- ? BlogSection_module.default['margin-bottom--9']
31
- : BlogSection_module.default['margin-bottom--6']}`, "data-title": title, "data-id": id, ref: parentReference, children: [title ? (jsxRuntime.jsx("h4", { className: BlogSection_module.default['blog-section__title'], children: title })) : null, react.Children.map(children, child => {
32
- if (!react.isValidElement(child))
33
- return child;
34
- return react.cloneElement(child, {
35
- ref: handleChildReferences,
36
- });
37
- })] }));
10
+ const BlogSectionDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/BlogSectionDynamic.js'); }));
11
+ const BlogSection = react.forwardRef(({ title = '', category = '', children = null, increaseMarginBottom = false, }, ref) => {
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(BlogSectionStatic.default, { title: title, category: category, increaseMarginBottom: increaseMarginBottom, children: children }), children: jsxRuntime.jsx(BlogSectionDynamic, { ref: ref, title: title, category: category, increaseMarginBottom: increaseMarginBottom, children: children }) }));
38
13
  });
39
14
  BlogSection.displayName = 'BlogSection';
40
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"BlogSection.js","sources":["../../../src/components/BlogSection.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 './Blog';\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\n\t\tuseImperativeHandle(forwardedReference, () => ({\n\t\t\tparentRef: parentReference.current!,\n\t\t\tchildRefs: childReferences.current!,\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\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":["forwardRef","generateIdForBlogTitle","useRef","useImperativeHandle","_jsxs","styles","_jsx","Children","isValidElement","cloneElement"],"mappings":";;;;;;;;;AAyBA,MAAM,WAAW,GAAGA,gBAAU,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,CAA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AqB;AACW,iBAAA,CAAC;YACxC,CAAC,CAAC,CAAA,EAAA,CACG;AAER,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"BlogSection.js","sources":["../../../src/components/BlogSection.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, lazy, Suspense } from 'react';\nimport type { ReactNode } from 'react';\nimport BlogSectionStatic from '../staticComponents/BlogSectionStatic';\nimport type { ForwardedReference } from '../dynamicComponents/BlogDynamic';\nexport type { ForwardedReference };\n\nconst BlogSectionDynamic = lazy(\n\t() => import('../dynamicComponents/BlogSectionDynamic')\n);\n\ninterface BlogSectionProperties {\n\ttitle?: string;\n\tcategory?: string;\n\tchildren?: ReactNode;\n\tincreaseMarginBottom?: boolean;\n}\n\nconst BlogSection = forwardRef<ForwardedReference, BlogSectionProperties>(\n\t(\n\t\t{\n\t\t\ttitle = '',\n\t\t\tcategory = '',\n\t\t\tchildren = null,\n\t\t\tincreaseMarginBottom = false,\n\t\t},\n\t\tref\n\t) => {\n\t\treturn (\n\t\t\t<Suspense\n\t\t\t\tfallback={\n\t\t\t\t\t<BlogSectionStatic\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\tcategory={category}\n\t\t\t\t\t\tincreaseMarginBottom={increaseMarginBottom}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</BlogSectionStatic>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlogSectionDynamic\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tcategory={category}\n\t\t\t\t\tincreaseMarginBottom={increaseMarginBottom}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</BlogSectionDynamic>\n\t\t\t</Suspense>\n\t\t);\n\t}\n);\n\nBlogSection.displayName = 'BlogSection';\n\nexport default BlogSection;\n"],"names":["lazy","forwardRef","_jsx","Suspense","BlogSectionStatic"],"mappings":";;;;;;;;AAQA,MAAM,kBAAkB,GAAGA,UAAI,CAC9B,MAAM,oDAAO,4CAAyC,KAAC,CACvD;AASD,MAAM,WAAW,GAAGC,gBAAU,CAC7B,CACC,EACC,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,IAAI,EACf,oBAAoB,GAAG,KAAK,GAC5B,EACD,GAAG,KACA;IACH,QACCC,eAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,yBAAiB,EAAA,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,YAGrBF,cAAA,CAAC,kBAAkB,IAClB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,YAEzC,QAAQ,EAAA,CACW,EAAA,CACX;AAEb,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var Callout_module = require('../styles/Callout.module.scss.js');
6
+ var CalloutDynamic = require('../dynamicComponents/CalloutDynamic.js');
7
7
 
8
- const Callout = ({ children, type = 'info', hasMarginUp = false, hasMarginDown = false }) => {
9
- const className = `${Callout_module.default.callout} ${Callout_module.default[`callout--${type}`]} ${hasMarginUp ? Callout_module.default['margin-top--1'] : ''} ${hasMarginDown ? Callout_module.default['margin-bottom--2'] : ''}`;
10
- return (jsxRuntime.jsxs("div", { className: className, children: [jsxRuntime.jsx("div", { className: Callout_module.default.callout__icon }), jsxRuntime.jsx("div", { className: Callout_module.default.callout__wrapper, children: children })] }));
8
+ const Callout = ({ children, type = 'info', hasMarginUp = false, hasMarginDown = false, }) => {
9
+ return (jsxRuntime.jsx(CalloutDynamic.default, { type: type, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown, children: children }));
11
10
  };
12
11
 
13
12
  exports.default = Callout;
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","sources":["../../../src/components/Callout.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":["styles","_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,EAAGA,sBAAM,CAAC,OAAO,IAAIA,sBAAM,CAAC,CAAA,SAAA,EAAY,IAAI,EAAE,CAAC,CAAA,CAAA,EAChE,WAAW,GAAGA,sBAAM,CAAC,eAAe,CAAC,GAAG,EACzC,CAAA,CAAA,EAAI,aAAa,GAAGA,sBAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE;IACrD,QACCC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,aACxBC,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEF,sBAAM,CAAC,aAAa,GAAG,EACvCE,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEF,sBAAM,CAAC,gBAAgB,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,CAAA,EAAA,CACpD;AAER;;;;"}
1
+ {"version":3,"file":"Callout.js","sources":["../../../src/components/Callout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport CalloutDynamic from '../dynamicComponents/CalloutDynamic';\n\ninterface CalloutProperties {\n\tchildren?: ReactNode;\n\ttype: 'info' | 'warning' | 'error' | 'success';\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst Callout = ({\n\tchildren,\n\ttype = 'info',\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: CalloutProperties) => {\n\treturn (\n\t\t<CalloutDynamic\n\t\t\ttype={type}\n\t\t\thasMarginUp={hasMarginUp}\n\t\t\thasMarginDown={hasMarginDown}\n\t\t>\n\t\t\t{children}\n\t\t</CalloutDynamic>\n\t);\n};\n\nexport default Callout;\n"],"names":["_jsx","CalloutDynamic"],"mappings":";;;;;;;AAUA,MAAM,OAAO,GAAG,CAAC,EAChB,QAAQ,EACR,IAAI,GAAG,MAAM,EACb,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACF,KAAI;AACvB,IAAA,QACCA,cAAA,CAACC,sBAAc,IACd,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,YAE3B,QAAQ,EAAA,CACO;AAEnB;;;;"}
@@ -5,33 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
- var reactSyntaxHighlighter = require('react-syntax-highlighter');
9
- var prism = require('react-syntax-highlighter/dist/esm/styles/prism');
10
- require('prismjs/themes/prism-tomorrow.css');
11
- var CodeBlock_module = require('../styles/CodeBlock.module.scss.js');
8
+ var CodeBlockStatic = require('../staticComponents/CodeBlockStatic.js');
12
9
 
13
- const SH = reactSyntaxHighlighter.Prism;
10
+ const CodeBlockDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/CodeBlockDynamic.js'); }));
14
11
  const CodeBlock = ({ language = 'javascript', code = '', hasMarginUp = false, hasMarginDown = false, }) => {
15
- const [isCopyMode, setCopyMode] = react.useState(false);
16
- const copyToClipboard = async () => {
17
- try {
18
- await navigator.clipboard.writeText(code);
19
- setCopyMode(true);
20
- setTimeout(() => {
21
- setCopyMode(false);
22
- }, 1000);
23
- }
24
- catch (error) {
25
- console.error('Failed to copy:', error);
26
- }
27
- };
28
- const lineNumberStyle = {
29
- color: '#95a1b1',
30
- fontSize: '0.9em',
31
- paddingRight: '1em',
32
- marginRight: '8px',
33
- };
34
- return (jsxRuntime.jsxs("div", { className: `${CodeBlock_module.default['code-block']} ${hasMarginUp ? CodeBlock_module.default['margin-top--1'] : ''} ${hasMarginDown ? CodeBlock_module.default['margin-bottom--2'] : ''}`, children: [jsxRuntime.jsxs("div", { className: CodeBlock_module.default['code-block__header'], children: [jsxRuntime.jsx("div", { className: CodeBlock_module.default['code-block__header__title'], children: language }), jsxRuntime.jsx("div", { className: `${CodeBlock_module.default['code-block__header__copy']} ${isCopyMode ? CodeBlock_module.default['code-block__header__copy--active'] : ''}`, onClick: copyToClipboard })] }), jsxRuntime.jsx("div", { className: CodeBlock_module.default['code-block__wrapper'], children: jsxRuntime.jsx(SH, { language: language, style: prism.dracula, showLineNumbers: true, lineNumberStyle: lineNumberStyle, children: code }) })] }));
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(CodeBlockStatic.default, { language: language, code: code, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }), children: jsxRuntime.jsx(CodeBlockDynamic, { language: language, code: code, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }) }));
35
13
  };
36
14
 
37
15
  exports.default = CodeBlock;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.js","sources":["../../../src/components/CodeBlock.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';\n\nimport 'prismjs/themes/prism-tomorrow.css';\n\nconst SH = SyntaxHighlighter as any;\n\nimport styles from '../styles/CodeBlock.module.scss';\n\ninterface Properties {\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tlanguage?: string;\n\tcode?: string;\n}\n\nconst CodeBlock = ({\n\tlanguage = 'javascript',\n\tcode = '',\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: Properties) => {\n\tconst [isCopyMode, setCopyMode] = useState(false);\n\n\tconst copyToClipboard = async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(code);\n\t\t\tsetCopyMode(true);\n\t\t\tsetTimeout(() => {\n\t\t\t\tsetCopyMode(false);\n\t\t\t}, 1000);\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to copy:', error);\n\t\t}\n\t};\n\n\tconst lineNumberStyle = {\n\t\tcolor: '#95a1b1',\n\t\tfontSize: '0.9em',\n\t\tpaddingRight: '1em',\n\t\tmarginRight: '8px',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles['code-block']} ${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<div className={styles['code-block__header']}>\n\t\t\t\t<div className={styles['code-block__header__title']}>{language}</div>\n\t\t\t\t<div\n\t\t\t\t\tclassName={`${styles['code-block__header__copy']} ${\n\t\t\t\t\t\tisCopyMode ? styles['code-block__header__copy--active'] : ''\n\t\t\t\t\t}`}\n\t\t\t\t\tonClick={copyToClipboard}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className={styles['code-block__wrapper']}>\n\t\t\t\t<SH\n\t\t\t\t\tlanguage={language}\n\t\t\t\t\tstyle={dracula}\n\t\t\t\t\tshowLineNumbers\n\t\t\t\t\tlineNumberStyle={lineNumberStyle}\n\t\t\t\t>\n\t\t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EAAA,QAAA,EAAA,CAC3CC,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAED,wBAAM,CAAC,2BAA2B,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,EACrEC,cAAA,CAAA,KAAA,EAAA,EACC,SAAS,EAAE,CAAA,EAAGD,wBAAM,CAAC,0BAA0B,CAAC,CAAA,CAAA,EAC/C,UAAU,GAAGA,wBAAM,CAAC,kCAAkC,CAAC,GAAG,EAC3D,CAAA,CAAE,EACF,OAAO,EAAE,eAAe,EAAA,CACvB,CAAA,EAAA,CACG,EACNC,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAED,wBAAM,CAAC,qBAAqB,CAAC,EAAA,QAAA,EAC5CC,cAAA,CAAC,EAAE,EAAA,EACF,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAEC,aAAO,EACd,eAAe,EAAA,IAAA,EACf,eAAe,EAAE,eAAe,EAAA,QAAA,EAE/B,IAAI,EAAA,CACD,EAAA,CACA,CAAA,EAAA,CACD;AAER;;;;"}
1
+ {"version":3,"file":"CodeBlock.js","sources":["../../../src/components/CodeBlock.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport CodeBlockStatic from '../staticComponents/CodeBlockStatic';\n\nconst CodeBlockDynamic = lazy(\n\t() => import('../dynamicComponents/CodeBlockDynamic')\n);\n\ninterface CodeBlockProperties {\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tlanguage?: string;\n\tcode?: string;\n}\n\nconst CodeBlock = ({\n\tlanguage = 'javascript',\n\tcode = '',\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: CodeBlockProperties) => {\n\treturn (\n\t\t<Suspense\n\t\t\tfallback={\n\t\t\t\t<CodeBlockStatic\n\t\t\t\t\tlanguage={language}\n\t\t\t\t\tcode={code}\n\t\t\t\t\thasMarginUp={hasMarginUp}\n\t\t\t\t\thasMarginDown={hasMarginDown}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<CodeBlockDynamic\n\t\t\t\tlanguage={language}\n\t\t\t\tcode={code}\n\t\t\t\thasMarginUp={hasMarginUp}\n\t\t\t\thasMarginDown={hasMarginDown}\n\t\t\t/>\n\t\t</Suspense>\n\t);\n};\n\nexport default CodeBlock;\n"],"names":["lazy","_jsx","Suspense","CodeBlockStatic"],"mappings":";;;;;;;;AAKA,MAAM,gBAAgB,GAAGA,UAAI,CAC5B,MAAM,oDAAO,0CAAuC,KAAC,CACrD;AASD,MAAM,SAAS,GAAG,CAAC,EAClB,QAAQ,GAAG,YAAY,EACvB,IAAI,GAAG,EAAE,EACT,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACA,KAAI;IACzB,QACCC,eAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,uBAAe,EAAA,EACf,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAAA,CAC3B,EAAA,QAAA,EAGHF,eAAC,gBAAgB,EAAA,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAAA,CAC3B,EAAA,CACQ;AAEb;;;;"}
@@ -5,54 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
- var mermaid = require('mermaid');
9
- var Mermaid_module = require('../styles/Mermaid.module.scss.js');
8
+ var MermaidStatic = require('../staticComponents/MermaidStatic.js');
10
9
 
11
- mermaid.initialize({
12
- startOnLoad: false,
13
- theme: 'default',
14
- timeline: {
15
- useMaxWidth: true,
16
- diagramMarginX: 0,
17
- },
18
- flowchart: {
19
- useMaxWidth: true,
20
- diagramPadding: 0,
21
- },
22
- sequence: {
23
- useMaxWidth: true,
24
- diagramMarginX: 0,
25
- },
26
- });
10
+ const MermaidDynamic = react.lazy(() => Promise.resolve().then(function () { return require('../dynamicComponents/MermaidDynamic.js'); }));
27
11
  const Mermaid = ({ code = '', id = '', hasMarginUp = false, hasMarginDown = false, }) => {
28
- const [enabled, setEnabled] = react.useState(false);
29
- const mermaidReference = react.useRef(null);
30
- const initializeMermaid = react.useCallback(async () => {
31
- try {
32
- if (!mermaidReference.current || !code)
33
- return;
34
- const { svg, bindFunctions } = await mermaid.render(`mermaid-diagram-${id}`, code);
35
- if (!svg)
36
- return;
37
- mermaidReference.current.innerHTML = svg || '';
38
- bindFunctions?.(mermaidReference.current);
39
- setEnabled(true);
40
- }
41
- catch (error) {
42
- console.error('Failed to render Mermaid diagram:', error);
43
- }
44
- }, [code, id]);
45
- react.useEffect(() => {
46
- if (!code || !mermaidReference.current)
47
- return;
48
- const timer = setTimeout(async () => {
49
- await initializeMermaid();
50
- }, 100);
51
- return () => clearTimeout(timer);
52
- }, [code, initializeMermaid]);
53
- return (jsxRuntime.jsxs("div", { className: `${Mermaid_module.default.mermaid}
54
- ${hasMarginUp ? Mermaid_module.default['margin-top--1'] : ''}
55
- ${hasMarginDown ? Mermaid_module.default['margin-bottom--2'] : ''}`, children: [enabled ? null : jsxRuntime.jsx("p", { children: "Diagram Loading..." }), jsxRuntime.jsx("div", { ref: mermaidReference, id: id })] }));
12
+ return (jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(MermaidStatic.default, { code: code, id: id, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }), children: jsxRuntime.jsx(MermaidDynamic, { code: code, id: id, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }) }));
56
13
  };
57
14
 
58
15
  exports.default = Mermaid;
@@ -1 +1 @@
1
- {"version":3,"file":"Mermaid.js","sources":["../../../src/components/Mermaid.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport mermaid from 'mermaid';\n\nimport styles from '../styles/Mermaid.module.scss';\n\ninterface MermaidProperties {\n\tcode: string;\n\tid: string;\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nmermaid.initialize({\n\tstartOnLoad: false,\n\ttheme: 'default',\n\ttimeline: {\n\t\tuseMaxWidth: true,\n\t\tdiagramMarginX: 0,\n\t},\n\tflowchart: {\n\t\tuseMaxWidth: true,\n\t\tdiagramPadding: 0,\n\t},\n\tsequence: {\n\t\tuseMaxWidth: true,\n\t\tdiagramMarginX: 0,\n\t},\n});\n\nconst Mermaid = ({\n\tcode = '',\n\tid = '',\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: MermaidProperties) => {\n\tconst [enabled, setEnabled] = useState(false);\n\tconst mermaidReference = useRef<HTMLDivElement>(null);\n\n\tconst initializeMermaid = useCallback(async () => {\n\t\ttry {\n\t\t\tif (!mermaidReference.current || !code) return;\n\t\t\tconst { svg, bindFunctions } = await mermaid.render(\n\t\t\t\t`mermaid-diagram-${id}`,\n\t\t\t\tcode\n\t\t\t);\n\t\t\tif (!svg) return;\n\t\t\tmermaidReference.current.innerHTML = svg || '';\n\t\t\tbindFunctions?.(mermaidReference.current);\n\t\t\tsetEnabled(true);\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to render Mermaid diagram:', error);\n\t\t}\n\t}, [code, id]);\n\n\tuseEffect(() => {\n\t\tif (!code || !mermaidReference.current) return;\n\t\tconst timer = setTimeout(async () => {\n\t\t\tawait initializeMermaid();\n\t\t}, 100);\n\t\treturn () => clearTimeout(timer);\n\t}, [code, initializeMermaid]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles.mermaid}\n\t\t\t\t${hasMarginUp ? styles['margin-top--1'] : ''}\n\t\t\t\t${hasMarginDown ? styles['margin-bottom--2'] : ''}`}\n\t\t>\n\t\t\t{enabled ? null : <p>Diagram Loading...</p>}\n\t\t\t<div ref={mermaidReference} id={id}></div>\n\t\t</div>\n\t);\n};\n\nexport default Mermaid;\n"],"names":["useState","useRef","useCallback","useEffect","_jsxs","styles","_jsx"],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ACD,IAAA,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEdC,eAAS,CAAC,MAAK;AACd,QAAA,IAAI,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO;YAAE;AACxC,QAAA,MAAM,KAAK,GAAG,UAAU,CAAC,YAAW;YACnC,MAAM,iBAAiB,EAAE;QAC1B,CAAC,EAAE,GAAG,CAAC;AACP,QAAA,OAAO,MAAM,YAAY,CAAC,KAAK,CAAC;AACjC,IAAA,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAE7B,IAAA,QACCC,eAAA,CAAA,KAAA,EAAA,EACC,SAAS,EAAE,CAAA,EAAGC,sBAAM,CAAC,OAAO;MACzB,WAAW,GAAGA,sBAAM,CAAC,eAAe,CAAC,GAAG,EAAE;AAC1C,IAAA,EAAA,aAAa,GAAGA,sBAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAA,CAAE,EAAA,QAAA,EAAA,CAEnD,OAAO,GAAG,IAAI,GAAGC,cAAA,CAAA,GAAA,EAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,CAAyB,EAC3CA,wBAAK,GAAG,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,EAAA,CAAQ,CAAA,EAAA,CACrC;AAER;;;;"}
1
+ {"version":3,"file":"Mermaid.js","sources":["../../../src/components/Mermaid.tsx"],"sourcesContent":["'use client';\n\nimport { lazy, Suspense } from 'react';\nimport MermaidStatic from '../staticComponents/MermaidStatic';\n\nconst MermaidDynamic = lazy(\n\t() => import('../dynamicComponents/MermaidDynamic')\n);\n\ninterface MermaidProperties {\n\tcode: string;\n\tid: string;\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst Mermaid = ({\n\tcode = '',\n\tid = '',\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: MermaidProperties) => {\n\treturn (\n\t\t<Suspense\n\t\t\tfallback={\n\t\t\t\t<MermaidStatic\n\t\t\t\t\tcode={code}\n\t\t\t\t\tid={id}\n\t\t\t\t\thasMarginUp={hasMarginUp}\n\t\t\t\t\thasMarginDown={hasMarginDown}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<MermaidDynamic\n\t\t\t\tcode={code}\n\t\t\t\tid={id}\n\t\t\t\thasMarginUp={hasMarginUp}\n\t\t\t\thasMarginDown={hasMarginDown}\n\t\t\t/>\n\t\t</Suspense>\n\t);\n};\n\nexport default Mermaid;\n"],"names":["lazy","_jsx","Suspense","MermaidStatic"],"mappings":";;;;;;;;AAKA,MAAM,cAAc,GAAGA,UAAI,CAC1B,MAAM,oDAAO,wCAAqC,KAAC,CACnD;AASD,MAAM,OAAO,GAAG,CAAC,EAChB,IAAI,GAAG,EAAE,EACT,EAAE,GAAG,EAAE,EACP,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACF,KAAI;IACvB,QACCC,eAACC,cAAQ,EAAA,EACR,QAAQ,EACPD,cAAA,CAACE,qBAAa,EAAA,EACb,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAAA,CAC3B,EAAA,QAAA,EAGHF,eAAC,cAAc,EAAA,EACd,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAAA,CAC3B,EAAA,CACQ;AAEb;;;;"}