themed-markdown 0.1.39 → 0.1.41
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/index.mjs +222 -68
- package/dist/industryMarkdown/components/FullSlideMermaid.stories.d.ts +8 -0
- package/dist/industryMarkdown/components/FullSlideMermaid.stories.d.ts.map +1 -0
- package/dist/industryMarkdown/components/IndustryMermaidDiagram.d.ts +2 -1
- package/dist/industryMarkdown/components/IndustryMermaidDiagram.d.ts.map +1 -1
- package/dist/industryMarkdown/components/IndustryMermaidModal.d.ts.map +1 -1
- package/dist/industryMarkdown/components/IndustryZoomableMermaidDiagram.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1448,7 +1448,7 @@ import { MoveRight } from "lucide-react";
|
|
|
1448
1448
|
import React5, { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
1449
1449
|
|
|
1450
1450
|
// industryMarkdown/components/IndustryMermaidDiagram.tsx
|
|
1451
|
-
import { ZoomIn, ZoomOut, RotateCcw } from "lucide-react";
|
|
1451
|
+
import { ZoomIn, ZoomOut, RotateCcw, Expand } from "lucide-react";
|
|
1452
1452
|
import React4, { useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
1453
1453
|
var getMermaidSync = () => {
|
|
1454
1454
|
if (typeof window !== "undefined") {
|
|
@@ -1466,7 +1466,8 @@ function IndustryMermaidDiagram({
|
|
|
1466
1466
|
onCopyError,
|
|
1467
1467
|
onError,
|
|
1468
1468
|
rootMargin = "200px",
|
|
1469
|
-
isModalMode = false
|
|
1469
|
+
isModalMode = false,
|
|
1470
|
+
isFullSlide = false
|
|
1470
1471
|
}) {
|
|
1471
1472
|
const theme2 = themeOverride || theme;
|
|
1472
1473
|
const [errorDetails, setErrorDetails] = useState3(null);
|
|
@@ -1474,7 +1475,9 @@ function IndustryMermaidDiagram({
|
|
|
1474
1475
|
const [hasRendered, setHasRendered] = useState3(false);
|
|
1475
1476
|
const [containerElement, setContainerElement] = useState3(null);
|
|
1476
1477
|
const [zoomLevel, setZoomLevel] = useState3(1);
|
|
1478
|
+
const [showFullSlide, setShowFullSlide] = useState3(false);
|
|
1477
1479
|
const observerRef = useRef(null);
|
|
1480
|
+
const wrapperRef = useRef(null);
|
|
1478
1481
|
const containerRef = React4.useCallback((node) => {
|
|
1479
1482
|
setContainerElement(node);
|
|
1480
1483
|
if (observerRef.current) {
|
|
@@ -1514,7 +1517,7 @@ function IndustryMermaidDiagram({
|
|
|
1514
1517
|
if (!mermaid || !containerElement)
|
|
1515
1518
|
return;
|
|
1516
1519
|
try {
|
|
1517
|
-
const diagramBackground = theme2.colors.backgroundSecondary || theme2.colors.muted || theme2.colors.background;
|
|
1520
|
+
const diagramBackground = isModalMode ? theme2.colors.background : theme2.colors.backgroundSecondary || theme2.colors.muted || theme2.colors.background;
|
|
1518
1521
|
const nodeBackground = theme2.colors.backgroundTertiary || theme2.colors.backgroundSecondary || theme2.colors.primary + "22";
|
|
1519
1522
|
mermaid.initialize({
|
|
1520
1523
|
startOnLoad: false,
|
|
@@ -1558,21 +1561,35 @@ function IndustryMermaidDiagram({
|
|
|
1558
1561
|
svgElement.style.height = "auto";
|
|
1559
1562
|
svgElement.style.display = "block";
|
|
1560
1563
|
svgElement.style.margin = "0 auto";
|
|
1561
|
-
if (
|
|
1564
|
+
if (!svgElement.getAttribute("preserveAspectRatio")) {
|
|
1565
|
+
svgElement.setAttribute("preserveAspectRatio", "xMidYMid meet");
|
|
1566
|
+
}
|
|
1567
|
+
if (isFullSlide) {
|
|
1568
|
+
svgElement.style.width = "100%";
|
|
1569
|
+
svgElement.style.height = "100%";
|
|
1570
|
+
svgElement.style.maxWidth = "100%";
|
|
1571
|
+
svgElement.style.maxHeight = "100%";
|
|
1572
|
+
svgElement.style.objectFit = "contain";
|
|
1573
|
+
} else if (isModalMode) {
|
|
1562
1574
|
svgElement.style.width = "auto";
|
|
1563
1575
|
svgElement.style.height = "auto";
|
|
1576
|
+
svgElement.style.maxWidth = "none";
|
|
1577
|
+
svgElement.style.maxHeight = "none";
|
|
1578
|
+
svgElement.style.minWidth = "auto";
|
|
1579
|
+
svgElement.style.minHeight = "auto";
|
|
1564
1580
|
const viewBox = svgElement.getAttribute("viewBox");
|
|
1565
1581
|
if (viewBox) {
|
|
1566
1582
|
const [, , width, height] = viewBox.split(" ").map(Number);
|
|
1567
1583
|
if (width && height) {
|
|
1568
|
-
|
|
1569
|
-
svgElement.setAttribute("
|
|
1584
|
+
const scaleFactor = 3;
|
|
1585
|
+
svgElement.setAttribute("width", (width * scaleFactor).toString());
|
|
1586
|
+
svgElement.setAttribute("height", (height * scaleFactor).toString());
|
|
1570
1587
|
}
|
|
1571
1588
|
}
|
|
1572
1589
|
} else {
|
|
1573
1590
|
svgElement.style.maxHeight = "360px";
|
|
1574
|
-
svgElement.style.width = "
|
|
1575
|
-
svgElement.style.maxWidth = "
|
|
1591
|
+
svgElement.style.width = "100%";
|
|
1592
|
+
svgElement.style.maxWidth = "100%";
|
|
1576
1593
|
}
|
|
1577
1594
|
} else {
|
|
1578
1595
|
console.warn("No SVG element found after mermaid render");
|
|
@@ -1609,15 +1626,35 @@ function IndustryMermaidDiagram({
|
|
|
1609
1626
|
}
|
|
1610
1627
|
};
|
|
1611
1628
|
renderDiagram();
|
|
1612
|
-
}, [hasRendered, code, id, theme2, containerElement, onError, isModalMode]);
|
|
1629
|
+
}, [hasRendered, code, id, theme2, containerElement, onError, isModalMode, isFullSlide]);
|
|
1613
1630
|
useEffect2(() => {
|
|
1614
|
-
if (!
|
|
1631
|
+
if (!hasRendered || !containerElement)
|
|
1615
1632
|
return;
|
|
1616
1633
|
const svgElement = containerElement.querySelector("svg");
|
|
1617
1634
|
if (svgElement) {
|
|
1618
|
-
if (
|
|
1635
|
+
if (showFullSlide) {
|
|
1636
|
+
svgElement.style.maxHeight = "none";
|
|
1637
|
+
svgElement.style.maxWidth = "none";
|
|
1638
|
+
const viewBox = svgElement.getAttribute("viewBox");
|
|
1639
|
+
if (viewBox && wrapperRef.current) {
|
|
1640
|
+
const [, , svgWidth, svgHeight] = viewBox.split(" ").map(Number);
|
|
1641
|
+
const wrapperRect = wrapperRef.current.getBoundingClientRect();
|
|
1642
|
+
const availableWidth = wrapperRect.width * 0.9;
|
|
1643
|
+
const availableHeight = wrapperRect.height * 0.9;
|
|
1644
|
+
const scaleX = availableWidth / svgWidth;
|
|
1645
|
+
const scaleY = availableHeight / svgHeight;
|
|
1646
|
+
const optimalScale = Math.min(scaleX, scaleY);
|
|
1647
|
+
svgElement.style.width = `${svgWidth}px`;
|
|
1648
|
+
svgElement.style.height = `${svgHeight}px`;
|
|
1649
|
+
svgElement.style.transform = `scale(${optimalScale})`;
|
|
1650
|
+
svgElement.style.transformOrigin = "center center";
|
|
1651
|
+
} else {
|
|
1652
|
+
svgElement.style.width = "100%";
|
|
1653
|
+
svgElement.style.height = "auto";
|
|
1654
|
+
}
|
|
1655
|
+
} else if (zoomLevel !== 1) {
|
|
1619
1656
|
svgElement.style.transform = `scale(${zoomLevel})`;
|
|
1620
|
-
svgElement.style.transformOrigin = "
|
|
1657
|
+
svgElement.style.transformOrigin = "center center";
|
|
1621
1658
|
const containerRect = containerElement.getBoundingClientRect();
|
|
1622
1659
|
const svgRect = svgElement.getBoundingClientRect();
|
|
1623
1660
|
if (svgRect.width < containerRect.width) {
|
|
@@ -1627,14 +1664,14 @@ function IndustryMermaidDiagram({
|
|
|
1627
1664
|
svgElement.style.transform = "";
|
|
1628
1665
|
svgElement.style.transformOrigin = "";
|
|
1629
1666
|
svgElement.style.margin = "0 auto";
|
|
1630
|
-
if (!isModalMode) {
|
|
1667
|
+
if (!isModalMode && !isFullSlide) {
|
|
1631
1668
|
svgElement.style.maxHeight = "360px";
|
|
1632
|
-
svgElement.style.width = "
|
|
1633
|
-
svgElement.style.maxWidth = "
|
|
1669
|
+
svgElement.style.width = "100%";
|
|
1670
|
+
svgElement.style.maxWidth = "100%";
|
|
1634
1671
|
}
|
|
1635
1672
|
}
|
|
1636
1673
|
}
|
|
1637
|
-
}, [zoomLevel, containerElement, hasRendered, isModalMode]);
|
|
1674
|
+
}, [zoomLevel, containerElement, hasRendered, isModalMode, isFullSlide, showFullSlide]);
|
|
1638
1675
|
useEffect2(() => {
|
|
1639
1676
|
if (errorDetails && onCopyError) {
|
|
1640
1677
|
const handleKeyDown = (e) => {
|
|
@@ -1651,11 +1688,30 @@ function IndustryMermaidDiagram({
|
|
|
1651
1688
|
}
|
|
1652
1689
|
return;
|
|
1653
1690
|
}, [errorDetails, onCopyError, containerElement]);
|
|
1654
|
-
const containerStyle =
|
|
1691
|
+
const containerStyle = isFullSlide ? {
|
|
1692
|
+
position: "absolute",
|
|
1693
|
+
top: 0,
|
|
1694
|
+
left: 0,
|
|
1695
|
+
right: 0,
|
|
1696
|
+
bottom: 0,
|
|
1697
|
+
width: "100%",
|
|
1698
|
+
height: "100%",
|
|
1699
|
+
display: "flex",
|
|
1700
|
+
alignItems: "center",
|
|
1701
|
+
justifyContent: "center",
|
|
1702
|
+
backgroundColor: "transparent",
|
|
1703
|
+
border: "none",
|
|
1704
|
+
borderRadius: 0,
|
|
1705
|
+
padding: theme2.space[4],
|
|
1706
|
+
margin: 0,
|
|
1707
|
+
overflow: "auto"
|
|
1708
|
+
} : isModalMode ? {
|
|
1655
1709
|
position: "relative",
|
|
1656
|
-
width: "
|
|
1657
|
-
height: "
|
|
1658
|
-
display: "
|
|
1710
|
+
width: "100%",
|
|
1711
|
+
height: "100%",
|
|
1712
|
+
display: "flex",
|
|
1713
|
+
alignItems: "center",
|
|
1714
|
+
justifyContent: "center",
|
|
1659
1715
|
backgroundColor: "transparent",
|
|
1660
1716
|
border: "none",
|
|
1661
1717
|
borderRadius: 0,
|
|
@@ -1664,8 +1720,6 @@ function IndustryMermaidDiagram({
|
|
|
1664
1720
|
overflow: "visible"
|
|
1665
1721
|
} : {
|
|
1666
1722
|
position: "relative",
|
|
1667
|
-
width: "100%",
|
|
1668
|
-
minHeight: "200px",
|
|
1669
1723
|
maxHeight: "400px",
|
|
1670
1724
|
display: "block",
|
|
1671
1725
|
backgroundColor: hasRendered ? "transparent" : theme2.colors.backgroundSecondary,
|
|
@@ -1682,16 +1736,38 @@ function IndustryMermaidDiagram({
|
|
|
1682
1736
|
fontSize: theme2.fontSizes[2],
|
|
1683
1737
|
fontFamily: theme2.fonts.body
|
|
1684
1738
|
};
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1739
|
+
if (isModalMode || isFullSlide) {
|
|
1740
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1741
|
+
ref: containerRef,
|
|
1742
|
+
style: containerStyle,
|
|
1743
|
+
className: "mermaid-container"
|
|
1744
|
+
}, !hasRendered && /* @__PURE__ */ React4.createElement("div", {
|
|
1745
|
+
style: placeholderStyle
|
|
1746
|
+
}, /* @__PURE__ */ React4.createElement("div", null, "\uD83D\uDCCA Mermaid Diagram"), /* @__PURE__ */ React4.createElement("div", {
|
|
1747
|
+
style: { fontSize: theme2.fontSizes[1], marginTop: theme2.space[2], opacity: 0.7 }
|
|
1748
|
+
}, "Loading...")));
|
|
1749
|
+
}
|
|
1750
|
+
const wrapperStyle = showFullSlide && !isFullSlide && !isModalMode ? {
|
|
1751
|
+
position: "fixed",
|
|
1752
|
+
top: 0,
|
|
1753
|
+
left: 0,
|
|
1754
|
+
right: 0,
|
|
1755
|
+
bottom: 0,
|
|
1756
|
+
backgroundColor: theme2.colors.background,
|
|
1757
|
+
zIndex: 1000,
|
|
1758
|
+
display: "flex",
|
|
1759
|
+
flexDirection: "column",
|
|
1760
|
+
padding: theme2.space[4]
|
|
1761
|
+
} : {
|
|
1762
|
+
position: "relative",
|
|
1763
|
+
width: "100%"
|
|
1764
|
+
};
|
|
1765
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1766
|
+
ref: wrapperRef,
|
|
1767
|
+
style: wrapperStyle,
|
|
1768
|
+
onClick: showFullSlide ? () => setShowFullSlide(false) : undefined
|
|
1769
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
1770
|
+
style: { position: "relative", width: "100%", height: showFullSlide ? "100%" : "auto" }
|
|
1695
1771
|
}, hasRendered && /* @__PURE__ */ React4.createElement("div", {
|
|
1696
1772
|
style: {
|
|
1697
1773
|
position: "absolute",
|
|
@@ -1701,7 +1777,48 @@ function IndustryMermaidDiagram({
|
|
|
1701
1777
|
display: "flex",
|
|
1702
1778
|
gap: theme2.space[1]
|
|
1703
1779
|
}
|
|
1704
|
-
}, /* @__PURE__ */ React4.createElement("button", {
|
|
1780
|
+
}, showFullSlide ? /* @__PURE__ */ React4.createElement("button", {
|
|
1781
|
+
onClick: (e) => {
|
|
1782
|
+
e.stopPropagation();
|
|
1783
|
+
setShowFullSlide(false);
|
|
1784
|
+
},
|
|
1785
|
+
style: {
|
|
1786
|
+
padding: `${theme2.space[2]}px ${theme2.space[3]}px`,
|
|
1787
|
+
backgroundColor: theme2.colors.background,
|
|
1788
|
+
color: theme2.colors.text,
|
|
1789
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
1790
|
+
borderRadius: theme2.radii[1],
|
|
1791
|
+
fontSize: theme2.fontSizes[1],
|
|
1792
|
+
fontWeight: theme2.fontWeights.medium,
|
|
1793
|
+
cursor: "pointer",
|
|
1794
|
+
fontFamily: theme2.fonts.body
|
|
1795
|
+
}
|
|
1796
|
+
}, "Close") : /* @__PURE__ */ React4.createElement("button", {
|
|
1797
|
+
onClick: (e) => {
|
|
1798
|
+
e.stopPropagation();
|
|
1799
|
+
setShowFullSlide(true);
|
|
1800
|
+
setTimeout(() => {
|
|
1801
|
+
setZoomLevel(0.99);
|
|
1802
|
+
setTimeout(() => setZoomLevel(1), 10);
|
|
1803
|
+
}, 50);
|
|
1804
|
+
},
|
|
1805
|
+
style: {
|
|
1806
|
+
padding: theme2.space[1],
|
|
1807
|
+
backgroundColor: theme2.colors.backgroundSecondary,
|
|
1808
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
1809
|
+
borderRadius: theme2.radii[1],
|
|
1810
|
+
color: theme2.colors.text,
|
|
1811
|
+
cursor: "pointer",
|
|
1812
|
+
display: "flex",
|
|
1813
|
+
alignItems: "center",
|
|
1814
|
+
justifyContent: "center",
|
|
1815
|
+
width: "28px",
|
|
1816
|
+
height: "28px"
|
|
1817
|
+
},
|
|
1818
|
+
title: "Expand to full slide"
|
|
1819
|
+
}, /* @__PURE__ */ React4.createElement(Expand, {
|
|
1820
|
+
size: 14
|
|
1821
|
+
})), /* @__PURE__ */ React4.createElement("button", {
|
|
1705
1822
|
onClick: () => setZoomLevel(Math.min(3, zoomLevel + 0.25)),
|
|
1706
1823
|
disabled: zoomLevel >= 3,
|
|
1707
1824
|
style: {
|
|
@@ -1742,8 +1859,15 @@ function IndustryMermaidDiagram({
|
|
|
1742
1859
|
}, /* @__PURE__ */ React4.createElement(ZoomOut, {
|
|
1743
1860
|
size: 14
|
|
1744
1861
|
})), /* @__PURE__ */ React4.createElement("button", {
|
|
1745
|
-
onClick: () =>
|
|
1746
|
-
|
|
1862
|
+
onClick: () => {
|
|
1863
|
+
if (showFullSlide) {
|
|
1864
|
+
setZoomLevel(0.99);
|
|
1865
|
+
setTimeout(() => setZoomLevel(1), 10);
|
|
1866
|
+
} else {
|
|
1867
|
+
setZoomLevel(1);
|
|
1868
|
+
}
|
|
1869
|
+
},
|
|
1870
|
+
disabled: zoomLevel === 1 && !showFullSlide,
|
|
1747
1871
|
style: {
|
|
1748
1872
|
padding: theme2.space[1],
|
|
1749
1873
|
backgroundColor: theme2.colors.backgroundSecondary,
|
|
@@ -1762,14 +1886,38 @@ function IndustryMermaidDiagram({
|
|
|
1762
1886
|
}, /* @__PURE__ */ React4.createElement(RotateCcw, {
|
|
1763
1887
|
size: 14
|
|
1764
1888
|
}))), /* @__PURE__ */ React4.createElement("div", {
|
|
1889
|
+
style: showFullSlide ? {
|
|
1890
|
+
width: "100%",
|
|
1891
|
+
height: "100%",
|
|
1892
|
+
display: "flex",
|
|
1893
|
+
alignItems: "center",
|
|
1894
|
+
justifyContent: "center",
|
|
1895
|
+
overflow: "visible",
|
|
1896
|
+
padding: theme2.space[6]
|
|
1897
|
+
} : {},
|
|
1898
|
+
onClick: (e) => e.stopPropagation()
|
|
1899
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
1765
1900
|
ref: containerRef,
|
|
1766
|
-
style:
|
|
1901
|
+
style: showFullSlide ? {
|
|
1902
|
+
position: "relative",
|
|
1903
|
+
width: "auto",
|
|
1904
|
+
height: "auto",
|
|
1905
|
+
display: "flex",
|
|
1906
|
+
alignItems: "center",
|
|
1907
|
+
justifyContent: "center",
|
|
1908
|
+
backgroundColor: "transparent",
|
|
1909
|
+
border: "none",
|
|
1910
|
+
borderRadius: 0,
|
|
1911
|
+
padding: 0,
|
|
1912
|
+
margin: 0,
|
|
1913
|
+
overflow: "visible"
|
|
1914
|
+
} : containerStyle,
|
|
1767
1915
|
className: "mermaid-container"
|
|
1768
1916
|
}, !hasRendered && /* @__PURE__ */ React4.createElement("div", {
|
|
1769
1917
|
style: placeholderStyle
|
|
1770
1918
|
}, /* @__PURE__ */ React4.createElement("div", null, "\uD83D\uDCCA Mermaid Diagram"), /* @__PURE__ */ React4.createElement("div", {
|
|
1771
1919
|
style: { fontSize: theme2.fontSizes[1], marginTop: theme2.space[2], opacity: 0.7 }
|
|
1772
|
-
}, isIntersecting ? "Loading..." : "Scroll to view"))));
|
|
1920
|
+
}, isIntersecting ? "Loading..." : "Scroll to view"))))));
|
|
1773
1921
|
}
|
|
1774
1922
|
|
|
1775
1923
|
// industryMarkdown/components/IndustryLazyMermaidDiagram.tsx
|
|
@@ -1856,7 +2004,7 @@ function IndustryLazyMermaidDiagram({
|
|
|
1856
2004
|
}
|
|
1857
2005
|
return /* @__PURE__ */ React5.createElement("div", {
|
|
1858
2006
|
ref: containerRef,
|
|
1859
|
-
style: { position: "relative" }
|
|
2007
|
+
style: { position: "relative", width: "100%" }
|
|
1860
2008
|
}, hasRendered && onShowInPanel && !hasError && /* @__PURE__ */ React5.createElement("button", {
|
|
1861
2009
|
onClick: (e) => {
|
|
1862
2010
|
e.stopPropagation();
|
|
@@ -2725,11 +2873,11 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2725
2873
|
id,
|
|
2726
2874
|
theme: themeOverride,
|
|
2727
2875
|
fitStrategy = "contain",
|
|
2728
|
-
padding =
|
|
2876
|
+
padding = 1
|
|
2729
2877
|
}) {
|
|
2730
2878
|
const { theme: contextTheme } = useTheme();
|
|
2731
2879
|
const theme2 = themeOverride || contextTheme;
|
|
2732
|
-
const [calculatedScale, setCalculatedScale] = useState7(
|
|
2880
|
+
const [calculatedScale, setCalculatedScale] = useState7(1);
|
|
2733
2881
|
const containerRef = useRef5(null);
|
|
2734
2882
|
const diagramRef = useRef5(null);
|
|
2735
2883
|
const [isCalculating, setIsCalculating] = useState7(true);
|
|
@@ -2747,15 +2895,22 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2747
2895
|
return;
|
|
2748
2896
|
}
|
|
2749
2897
|
let svgWidth, svgHeight;
|
|
2750
|
-
const
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
svgWidth =
|
|
2754
|
-
svgHeight =
|
|
2898
|
+
const explicitWidth = svg.getAttribute("width");
|
|
2899
|
+
const explicitHeight = svg.getAttribute("height");
|
|
2900
|
+
if (explicitWidth && explicitHeight) {
|
|
2901
|
+
svgWidth = parseFloat(explicitWidth);
|
|
2902
|
+
svgHeight = parseFloat(explicitHeight);
|
|
2755
2903
|
} else {
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2758
|
-
|
|
2904
|
+
const viewBox = svg.getAttribute("viewBox");
|
|
2905
|
+
if (viewBox) {
|
|
2906
|
+
const [, , width, height] = viewBox.split(" ").map(Number);
|
|
2907
|
+
svgWidth = width;
|
|
2908
|
+
svgHeight = height;
|
|
2909
|
+
} else {
|
|
2910
|
+
const svgRect = svg.getBoundingClientRect();
|
|
2911
|
+
svgWidth = svgRect.width;
|
|
2912
|
+
svgHeight = svgRect.height;
|
|
2913
|
+
}
|
|
2759
2914
|
}
|
|
2760
2915
|
const containerWidth = container.clientWidth;
|
|
2761
2916
|
const containerHeight = container.clientHeight;
|
|
@@ -2775,7 +2930,7 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2775
2930
|
scale = Math.min(containerWidth * padding / svgWidth, containerHeight * padding / svgHeight);
|
|
2776
2931
|
break;
|
|
2777
2932
|
}
|
|
2778
|
-
scale = Math.min(Math.max(scale, 0.3),
|
|
2933
|
+
scale = Math.min(Math.max(scale, 0.3), 3);
|
|
2779
2934
|
setCalculatedScale(scale);
|
|
2780
2935
|
setIsCalculating(false);
|
|
2781
2936
|
};
|
|
@@ -2783,7 +2938,8 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2783
2938
|
calculateOptimalScale();
|
|
2784
2939
|
});
|
|
2785
2940
|
resizeObserver.observe(containerRef.current);
|
|
2786
|
-
setTimeout(calculateOptimalScale,
|
|
2941
|
+
setTimeout(calculateOptimalScale, 100);
|
|
2942
|
+
setTimeout(calculateOptimalScale, 500);
|
|
2787
2943
|
return () => {
|
|
2788
2944
|
resizeObserver.disconnect();
|
|
2789
2945
|
};
|
|
@@ -2809,11 +2965,11 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2809
2965
|
};
|
|
2810
2966
|
return /* @__PURE__ */ React9.createElement("div", {
|
|
2811
2967
|
ref: containerRef,
|
|
2812
|
-
style: { width: "100%", height: "100%", position: "relative" }
|
|
2968
|
+
style: { width: "100%", height: "100%", position: "relative", backgroundColor: theme2.colors.background }
|
|
2813
2969
|
}, /* @__PURE__ */ React9.createElement(TransformWrapper, {
|
|
2814
2970
|
limitToBounds: true,
|
|
2815
2971
|
doubleClick: { disabled: true },
|
|
2816
|
-
minScale: 0.
|
|
2972
|
+
minScale: 0.1,
|
|
2817
2973
|
maxScale: 10,
|
|
2818
2974
|
initialScale: calculatedScale,
|
|
2819
2975
|
initialPositionX: 0,
|
|
@@ -2870,16 +3026,15 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2870
3026
|
wrapperStyle: {
|
|
2871
3027
|
width: "100%",
|
|
2872
3028
|
height: "100%",
|
|
3029
|
+
backgroundColor: theme2.colors.background,
|
|
2873
3030
|
overflow: "hidden"
|
|
2874
3031
|
},
|
|
2875
3032
|
contentStyle: {
|
|
2876
|
-
width: "
|
|
2877
|
-
height: "
|
|
3033
|
+
width: "100%",
|
|
3034
|
+
height: "100%",
|
|
2878
3035
|
display: "flex",
|
|
2879
3036
|
alignItems: "center",
|
|
2880
|
-
justifyContent: "center"
|
|
2881
|
-
minWidth: "100%",
|
|
2882
|
-
minHeight: "100%"
|
|
3037
|
+
justifyContent: "center"
|
|
2883
3038
|
}
|
|
2884
3039
|
}, /* @__PURE__ */ React9.createElement("div", {
|
|
2885
3040
|
ref: diagramRef,
|
|
@@ -2887,10 +3042,8 @@ function IndustryZoomableMermaidDiagram({
|
|
|
2887
3042
|
display: "flex",
|
|
2888
3043
|
alignItems: "center",
|
|
2889
3044
|
justifyContent: "center",
|
|
2890
|
-
width: "
|
|
2891
|
-
height: "
|
|
2892
|
-
minWidth: "100%",
|
|
2893
|
-
minHeight: "100%"
|
|
3045
|
+
width: "100%",
|
|
3046
|
+
height: "100%"
|
|
2894
3047
|
}
|
|
2895
3048
|
}, /* @__PURE__ */ React9.createElement(IndustryMermaidDiagram, {
|
|
2896
3049
|
code,
|
|
@@ -2936,7 +3089,7 @@ function IndustryMermaidModal({
|
|
|
2936
3089
|
left: 0,
|
|
2937
3090
|
right: 0,
|
|
2938
3091
|
bottom: 0,
|
|
2939
|
-
backgroundColor: "rgba(0, 0, 0, 0.
|
|
3092
|
+
backgroundColor: "rgba(0, 0, 0, 0.9)",
|
|
2940
3093
|
display: "flex",
|
|
2941
3094
|
alignItems: "center",
|
|
2942
3095
|
justifyContent: "center",
|
|
@@ -2950,9 +3103,9 @@ function IndustryMermaidModal({
|
|
|
2950
3103
|
position: "relative",
|
|
2951
3104
|
backgroundColor: theme2.colors.background,
|
|
2952
3105
|
borderRadius: theme2.radii[3],
|
|
2953
|
-
padding:
|
|
2954
|
-
width: "
|
|
2955
|
-
height: "
|
|
3106
|
+
padding: 0,
|
|
3107
|
+
width: "95vw",
|
|
3108
|
+
height: "95vh",
|
|
2956
3109
|
display: "flex",
|
|
2957
3110
|
flexDirection: "column",
|
|
2958
3111
|
overflow: "hidden",
|
|
@@ -2962,8 +3115,9 @@ function IndustryMermaidModal({
|
|
|
2962
3115
|
onClick: onClose,
|
|
2963
3116
|
style: {
|
|
2964
3117
|
position: "absolute",
|
|
2965
|
-
top: theme2.space[
|
|
2966
|
-
right: theme2.space[
|
|
3118
|
+
top: theme2.space[3],
|
|
3119
|
+
right: theme2.space[3],
|
|
3120
|
+
zIndex: 100,
|
|
2967
3121
|
background: "none",
|
|
2968
3122
|
border: "none",
|
|
2969
3123
|
fontSize: theme2.fontSizes[5],
|
|
@@ -2989,7 +3143,7 @@ function IndustryMermaidModal({
|
|
|
2989
3143
|
},
|
|
2990
3144
|
"aria-label": "Close"
|
|
2991
3145
|
}, "×"), /* @__PURE__ */ React10.createElement("div", {
|
|
2992
|
-
style: { flex: 1, overflow: "hidden", position: "relative" }
|
|
3146
|
+
style: { flex: 1, overflow: "hidden", position: "relative", backgroundColor: theme2.colors.background, padding: theme2.space[2] }
|
|
2993
3147
|
}, /* @__PURE__ */ React10.createElement(IndustryZoomableMermaidDiagram, {
|
|
2994
3148
|
id: "mermaid-modal-diagram",
|
|
2995
3149
|
code: mermaidCode,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SlidePresentation } from './SlidePresentation';
|
|
3
|
+
declare const meta: Meta<typeof SlidePresentation>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const ExpandableDiagrams: Story;
|
|
7
|
+
export declare const MixedContent: Story;
|
|
8
|
+
//# sourceMappingURL=FullSlideMermaid.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullSlideMermaid.stories.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/FullSlideMermaid.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAexC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA4LnC,eAAO,MAAM,kBAAkB,EAAE,KAKhC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA+E1B,CAAC"}
|
|
@@ -14,7 +14,8 @@ interface IndustryMermaidDiagramProps {
|
|
|
14
14
|
onError?: (hasError: boolean) => void;
|
|
15
15
|
rootMargin?: string;
|
|
16
16
|
isModalMode?: boolean;
|
|
17
|
+
isFullSlide?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function IndustryMermaidDiagram({ code, id, theme: themeOverride, onCopyError, onError, rootMargin, isModalMode, }: IndustryMermaidDiagramProps): React.JSX.Element;
|
|
19
|
+
export declare function IndustryMermaidDiagram({ code, id, theme: themeOverride, onCopyError, onError, rootMargin, isModalMode, isFullSlide, }: IndustryMermaidDiagramProps): React.JSX.Element;
|
|
19
20
|
export {};
|
|
20
21
|
//# sourceMappingURL=IndustryMermaidDiagram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustryMermaidDiagram.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMermaidDiagram.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAyB,MAAM,qBAAqB,CAAC;AAEnE,UAAU,2BAA2B;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAmBD,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,EAAE,EACF,KAAK,EAAE,aAAa,EACpB,WAAW,EACX,OAAO,EACP,UAAoB,EACpB,WAAmB,GACpB,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"IndustryMermaidDiagram.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMermaidDiagram.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAyB,MAAM,qBAAqB,CAAC;AAEnE,UAAU,2BAA2B;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAmBD,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,EAAE,EACF,KAAK,EAAE,aAAa,EACpB,WAAW,EACX,OAAO,EACP,UAAoB,EACpB,WAAmB,EACnB,WAAmB,GACpB,EAAE,2BAA2B,qBAsiB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustryMermaidModal.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMermaidModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,UAAU,yBAAyB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GACN,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"IndustryMermaidModal.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMermaidModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,UAAU,yBAAyB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GACN,EAAE,yBAAyB,4BA0G3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustryZoomableMermaidDiagram.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryZoomableMermaidDiagram.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAItD,UAAU,mCAAmC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,IAAI,EACJ,EAAE,EACF,KAAK,EAAE,aAAa,EACpB,WAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"IndustryZoomableMermaidDiagram.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryZoomableMermaidDiagram.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAItD,UAAU,mCAAmC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,IAAI,EACJ,EAAE,EACF,KAAK,EAAE,aAAa,EACpB,WAAuB,EACvB,OAAa,GACd,EAAE,mCAAmC,qBAyPrC"}
|