@san-siva/blogkit 1.0.6 → 1.0.10
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.
- package/dist/assets/copy.svg +1 -0
- package/dist/assets/done_copying.svg +1 -0
- package/dist/assets/error.svg +3 -0
- package/dist/assets/info.svg +3 -0
- package/dist/assets/success.svg +3 -0
- package/dist/assets/warning.svg +3 -0
- package/dist/cjs/components/Blog.js +131 -0
- package/dist/cjs/components/Blog.js.map +1 -0
- package/dist/cjs/components/BlogHeader.js +13 -0
- package/dist/cjs/components/BlogHeader.js.map +1 -0
- package/dist/cjs/components/BlogLink.js +35 -0
- package/dist/cjs/components/BlogLink.js.map +1 -0
- package/dist/cjs/components/BlogSection.js +42 -0
- package/dist/cjs/components/BlogSection.js.map +1 -0
- package/dist/cjs/components/Callout.js +14 -0
- package/dist/cjs/components/Callout.js.map +1 -0
- package/dist/cjs/components/CodeBlock.js +38 -0
- package/dist/cjs/components/CodeBlock.js.map +1 -0
- package/dist/cjs/components/Mermaid.js +59 -0
- package/dist/cjs/components/Mermaid.js.map +1 -0
- package/dist/cjs/components/Table.js +18 -0
- package/dist/cjs/components/Table.js.map +1 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js +33 -0
- package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
- package/dist/cjs/styles/Blog.module.scss.js +12 -0
- package/dist/cjs/styles/Blog.module.scss.js.map +1 -0
- package/dist/cjs/styles/BlogHeader.module.scss.js +12 -0
- package/dist/cjs/styles/BlogHeader.module.scss.js.map +1 -0
- package/dist/cjs/styles/BlogLink.module.scss.js +12 -0
- package/dist/cjs/styles/BlogLink.module.scss.js.map +1 -0
- package/dist/cjs/styles/BlogSection.module.scss.js +12 -0
- package/dist/cjs/styles/BlogSection.module.scss.js.map +1 -0
- package/dist/cjs/styles/Callout.module.scss.js +12 -0
- package/dist/cjs/styles/Callout.module.scss.js.map +1 -0
- package/dist/cjs/styles/CodeBlock.module.scss.js +12 -0
- package/dist/cjs/styles/CodeBlock.module.scss.js.map +1 -0
- package/dist/cjs/styles/Mermaid.module.scss.js +12 -0
- package/dist/cjs/styles/Mermaid.module.scss.js.map +1 -0
- package/dist/cjs/styles/Table.module.scss.js +12 -0
- package/dist/cjs/styles/Table.module.scss.js.map +1 -0
- package/dist/cjs/utils/index.js +8 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/esm/components/Blog.js +127 -0
- package/dist/esm/components/Blog.js.map +1 -0
- package/dist/esm/components/BlogHeader.js +9 -0
- package/dist/esm/components/BlogHeader.js.map +1 -0
- package/dist/esm/components/BlogLink.js +31 -0
- package/dist/esm/components/BlogLink.js.map +1 -0
- package/dist/esm/components/BlogSection.js +38 -0
- package/dist/esm/components/BlogSection.js.map +1 -0
- package/dist/esm/components/Callout.js +10 -0
- package/dist/esm/components/Callout.js.map +1 -0
- package/dist/esm/components/CodeBlock.js +34 -0
- package/dist/esm/components/CodeBlock.js.map +1 -0
- package/dist/esm/components/Mermaid.js +55 -0
- package/dist/esm/components/Mermaid.js.map +1 -0
- package/dist/esm/components/Table.js +14 -0
- package/dist/esm/components/Table.js.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +29 -0
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
- package/dist/esm/styles/Blog.module.scss.js +8 -0
- package/dist/esm/styles/Blog.module.scss.js.map +1 -0
- package/dist/esm/styles/BlogHeader.module.scss.js +8 -0
- package/dist/esm/styles/BlogHeader.module.scss.js.map +1 -0
- package/dist/esm/styles/BlogLink.module.scss.js +8 -0
- package/dist/esm/styles/BlogLink.module.scss.js.map +1 -0
- package/dist/esm/styles/BlogSection.module.scss.js +8 -0
- package/dist/esm/styles/BlogSection.module.scss.js.map +1 -0
- package/dist/esm/styles/Callout.module.scss.js +8 -0
- package/dist/esm/styles/Callout.module.scss.js.map +1 -0
- package/dist/esm/styles/CodeBlock.module.scss.js +8 -0
- package/dist/esm/styles/CodeBlock.module.scss.js.map +1 -0
- package/dist/esm/styles/Mermaid.module.scss.js +8 -0
- package/dist/esm/styles/Mermaid.module.scss.js.map +1 -0
- package/dist/esm/styles/Table.module.scss.js +8 -0
- package/dist/esm/styles/Table.module.scss.js.map +1 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/types/components/Blog.d.ts.map +1 -0
- package/dist/types/components/BlogHeader.d.ts.map +1 -0
- package/dist/types/components/BlogLink.d.ts.map +1 -0
- package/dist/types/components/BlogSection.d.ts.map +1 -0
- package/dist/types/components/Callout.d.ts.map +1 -0
- package/dist/types/components/CodeBlock.d.ts.map +1 -0
- package/dist/types/components/Mermaid.d.ts.map +1 -0
- package/dist/types/components/Table.d.ts.map +1 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/components/Blog.d.ts.map +0 -1
- package/dist/components/BlogHeader.d.ts.map +0 -1
- package/dist/components/BlogLink.d.ts.map +0 -1
- package/dist/components/BlogSection.d.ts.map +0 -1
- package/dist/components/Callout.d.ts.map +0 -1
- package/dist/components/CodeBlock.d.ts.map +0 -1
- package/dist/components/Mermaid.d.ts.map +0 -1
- package/dist/components/Table.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.esm.js +0 -332
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -343
- package/dist/index.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- /package/dist/{components → types/components}/Blog.d.ts +0 -0
- /package/dist/{components → types/components}/BlogHeader.d.ts +0 -0
- /package/dist/{components → types/components}/BlogLink.d.ts +0 -0
- /package/dist/{components → types/components}/BlogSection.d.ts +0 -0
- /package/dist/{components → types/components}/Callout.d.ts +0 -0
- /package/dist/{components → types/components}/CodeBlock.d.ts +0 -0
- /package/dist/{components → types/components}/Mermaid.d.ts +0 -0
- /package/dist/{components → types/components}/Table.d.ts +0 -0
- /package/dist/{components → types/components}/index.d.ts +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{utils → types/utils}/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="copy" class="svg-inline--fa fa-copy fa-fw fa-1x " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#e8f1fc" d="M384 336l-192 0c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l140.1 0L400 115.9 400 320c0 8.8-7.2 16-16 16zM192 384l192 0c35.3 0 64-28.7 64-64l0-204.1c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1L192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-32-48 0 0 32c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l32 0 0-48-32 0z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="copy" class="svg-inline--fa fa-copy fa-fw fa-1x " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="#e8f1fc" d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"></path></svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM11 13H13V7H11V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" fill="#FF4232"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM11 13H13V7H11V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" fill="#4242FA"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM11 13H13V7H11V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" fill="#3DAD84"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 17C12.2833 17 12.5208 16.9042 12.7125 16.7125C12.9042 16.5208 13 16.2833 13 16C13 15.7167 12.9042 15.4792 12.7125 15.2875C12.5208 15.0958 12.2833 15 12 15C11.7167 15 11.4792 15.0958 11.2875 15.2875C11.0958 15.4792 11 15.7167 11 16C11 16.2833 11.0958 16.5208 11.2875 16.7125C11.4792 16.9042 11.7167 17 12 17ZM11 13H13V7H11V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22Z" fill="#FED600"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var Blog_module = require('../styles/Blog.module.scss.js');
|
|
9
|
+
|
|
10
|
+
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
|
+
})] })] }));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
exports.default = Blog;
|
|
131
|
+
//# sourceMappingURL=Blog.js.map
|
|
@@ -0,0 +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,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAgB,IAAI,CAAC;IAErEC,eAAS,CAAC,MAAK;QACd,IAAI,cAAc,GAAkB,IAAI;AACxC,QAAA,MAAM,GAA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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;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var BlogHeader_module = require('../styles/BlogHeader.module.scss.js');
|
|
8
|
+
|
|
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) }))] }));
|
|
11
|
+
|
|
12
|
+
exports.default = BlogHeader;
|
|
13
|
+
//# sourceMappingURL=BlogHeader.js.map
|
|
@@ -0,0 +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;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var web = require('@react-spring/web');
|
|
9
|
+
var BlogLink_module = require('../styles/BlogLink.module.scss.js');
|
|
10
|
+
var index = require('../utils/index.js');
|
|
11
|
+
|
|
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 })] })] })] }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.default = BlogLink;
|
|
35
|
+
//# sourceMappingURL=BlogLink.js.map
|
|
@@ -0,0 +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,GAAGC,aAAS,CAAC;QAC1B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa;AAC7C,KAAA,CAAC;IAEF,MAAM,QAAQ,GAAGA,aAAS,CAAC;QAC1B,MAAM,EAAE,SAAS,GAAG,qBAAqB,GAAG,uBAAuB;AACnE,QAAA,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AACzB,KAAA,CAAC;IAEF,MAAM,OAAO,GAAGA,aAAS,CAAC;AACzB,QAAA,EAAE,EAAE,SAAS,GAAG,CAAA,EAAG,gBAAgB,GAAG,CAAC,EAAE,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ACC,YAAQ,CAAC,QAAQ,IAAC,MAAM,EAAE,QAAQ,CAAC,MAAa,EAAA,CAAI,CAAA,EAAA,CACvC,CAAA,EAAA,CACV,CAAA,EAAA,CACH;AAEN;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var BlogSection_module = require('../styles/BlogSection.module.scss.js');
|
|
9
|
+
var index = require('../utils/index.js');
|
|
10
|
+
|
|
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
|
+
})] }));
|
|
38
|
+
});
|
|
39
|
+
BlogSection.displayName = 'BlogSection';
|
|
40
|
+
|
|
41
|
+
exports.default = BlogSection;
|
|
42
|
+
//# sourceMappingURL=BlogSection.js.map
|
|
@@ -0,0 +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,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE,IAAA,MAAM,EAAE,GAAGC,4BAAsB,CAAC,iBAAiB,CAAC;AAEpD,IAAA,MAAM,eAAe,GAAGC,YAAM,CAAkC,IAAI,CAAC;AACrE,IAAA,MAAM,eAAe,GAAGA,YAAM,CAAkC,EAAE,CAAC;AAEnE,IAAAC,yBAAmB,CAAC,kBAAkB,EAAE,OAAO;QAC9C,SAAS,EAAE,eAAe,CAAC,OAAQ;QACnC,SAAS,EAAE,eAAe,CAAC,OAAQ;AACnC,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,qBAAqB,GAAG,CAAC,OAAkC,KAAI;AACpE,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,OAAO;AACjD,QAAA,IAAI,CAAC,kBAAkB;YAAE;AACzB,QAAA,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC;AACjD,IAAA,CAAC;IAED,QACCC,yBACC,SAAS,EAAE,GAAGC,0BAAM,CAAC,cAAc,CAAC;OAElC;AACC,cAAEA,0BAAM,CAAC,kBAAkB;cACzBA,0BAAM,CAAC,kBAAkB,CAC7B,CAAA,CAAE,EAAA,YAAA,EACS,KAAK,EAAA,SAAA,EACR,EAAE,EACX,GAAG,EAAE,eAAe,EAAA,QAAA,EAAA,CAEnB,KAAK,IACLC,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAED,0BAAM,CAAC,qBAAqB,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAM,IACvD,IAAI,EACPE,cAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAG;AAC/B,gBAAA,IAAI,CAACC,oBAAc,CAAC,KAAK,CAAC;AAAE,oBAAA,OAAO,KAAK;gBACxC,OAAOC,kBAAY,CAAC,KAAK,EAAE;AAC1B,oBAAA,GAAG,EAAE,qBAAqB;AACW,iBAAA,CAAC;YACxC,CAAC,CAAC,CAAA,EAAA,CACG;AAER,CAAC;AAGF,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var Callout_module = require('../styles/Callout.module.scss.js');
|
|
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 })] }));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.default = Callout;
|
|
14
|
+
//# sourceMappingURL=Callout.js.map
|
|
@@ -0,0 +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;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var 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');
|
|
12
|
+
|
|
13
|
+
const SH = reactSyntaxHighlighter.Prism;
|
|
14
|
+
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 }) })] }));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.default = CodeBlock;
|
|
38
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +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\t\t\t{code}\n\t\t\t\t</SH>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default CodeBlock;\n"],"names":["SyntaxHighlighter","useState","_jsxs","styles","_jsx","dracula"],"mappings":";;;;;;;;;;;AAQA,MAAM,EAAE,GAAGA,4BAAwB;AAWnC,MAAM,SAAS,GAAG,CAAC,EAClB,QAAQ,GAAG,YAAY,EACvB,IAAI,GAAG,EAAE,EACT,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACT,KAAI;IAChB,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;AAEjD,IAAA,MAAM,eAAe,GA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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;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var mermaid = require('mermaid');
|
|
9
|
+
var Mermaid_module = require('../styles/Mermaid.module.scss.js');
|
|
10
|
+
|
|
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
|
+
});
|
|
27
|
+
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 })] }));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.default = Mermaid;
|
|
59
|
+
//# sourceMappingURL=Mermaid.js.map
|
|
@@ -0,0 +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"],"mappings":";;;;;;;;;AAeA,OAAO,CAAC,UAAU,CAAC;AAClB,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,QAAQ,EAAE;AACT,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,cAAc,EAAE,CAAC;AACjB,KAAA;AACD,IAAA,SAAS,EAAE;AACV,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,cAAc,EAAE,CAAC;AACjB,KAAA;AACD,IAAA,QAAQ,EAAE;AACT,QAAA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C,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;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var Table_module = require('../styles/Table.module.scss.js');
|
|
7
|
+
|
|
8
|
+
const Table = ({ rows = [], headers = [], hasMarginUp = false, hasMarginDown = false, }) => {
|
|
9
|
+
const columnCount = headers.length;
|
|
10
|
+
return (jsxRuntime.jsxs("div", { className: `${Table_module.default.table}
|
|
11
|
+
${hasMarginUp ? Table_module.default['margin-top--1'] : ''}
|
|
12
|
+
${hasMarginDown ? Table_module.default['margin-bottom--2'] : ''}`, style: {
|
|
13
|
+
gridTemplateColumns: `repeat(${columnCount}, 1fr)`,
|
|
14
|
+
}, children: [jsxRuntime.jsx("div", { className: `${Table_module.default['table__header']}`, children: headers.map((header, index) => (jsxRuntime.jsx("div", { className: `${Table_module.default['table__header__cell']}`, children: header }, typeof header === 'string' ? header : index))) }), rows.map((row, index) => (jsxRuntime.jsx("div", { className: `${Table_module.default['table__row']}`, children: row.map((cell, cellIndex) => (jsxRuntime.jsx("div", { className: `${Table_module.default['table__row__cell']}`, children: cell }, typeof cell === 'string' ? cell : cellIndex))) }, index)))] }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.default = Table;
|
|
18
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../src/components/Table.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);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E,CAAA,EAAGD,oBAAM,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;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Blog = require('./components/Blog.js');
|
|
4
|
+
var BlogHeader = require('./components/BlogHeader.js');
|
|
5
|
+
var BlogSection = require('./components/BlogSection.js');
|
|
6
|
+
var CodeBlock = require('./components/CodeBlock.js');
|
|
7
|
+
var Callout = require('./components/Callout.js');
|
|
8
|
+
var Mermaid = require('./components/Mermaid.js');
|
|
9
|
+
var BlogLink = require('./components/BlogLink.js');
|
|
10
|
+
var Table = require('./components/Table.js');
|
|
11
|
+
var index = require('./utils/index.js');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.Blog = Blog.default;
|
|
16
|
+
exports.BlogHeader = BlogHeader.default;
|
|
17
|
+
exports.BlogSection = BlogSection.default;
|
|
18
|
+
exports.CodeBlock = CodeBlock.default;
|
|
19
|
+
exports.Callout = Callout.default;
|
|
20
|
+
exports.Mermaid = Mermaid.default;
|
|
21
|
+
exports.BlogLink = BlogLink.default;
|
|
22
|
+
exports.Table = Table.default;
|
|
23
|
+
exports.generateIdForBlogTitle = index.generateIdForBlogTitle;
|
|
24
|
+
exports.generateUrlForBlogTitle = index.generateUrlForBlogTitle;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function styleInject(css, ref) {
|
|
6
|
+
if ( ref === void 0 ) ref = {};
|
|
7
|
+
var insertAt = ref.insertAt;
|
|
8
|
+
|
|
9
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
10
|
+
|
|
11
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
12
|
+
var style = document.createElement('style');
|
|
13
|
+
style.type = 'text/css';
|
|
14
|
+
|
|
15
|
+
if (insertAt === 'top') {
|
|
16
|
+
if (head.firstChild) {
|
|
17
|
+
head.insertBefore(style, head.firstChild);
|
|
18
|
+
} else {
|
|
19
|
+
head.appendChild(style);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
head.appendChild(style);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (style.styleSheet) {
|
|
26
|
+
style.styleSheet.cssText = css;
|
|
27
|
+
} else {
|
|
28
|
+
style.appendChild(document.createTextNode(css));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.default = styleInject;
|
|
33
|
+
//# sourceMappingURL=style-inject.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.es.js","sources":["../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;","x_google_ignoreList":[0]}
|