themed-markdown 0.1.39 → 0.1.40

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 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) {
@@ -1558,7 +1561,13 @@ function IndustryMermaidDiagram({
1558
1561
  svgElement.style.height = "auto";
1559
1562
  svgElement.style.display = "block";
1560
1563
  svgElement.style.margin = "0 auto";
1561
- if (isModalMode) {
1564
+ if (isFullSlide) {
1565
+ svgElement.style.width = "100%";
1566
+ svgElement.style.height = "100%";
1567
+ svgElement.style.maxWidth = "100%";
1568
+ svgElement.style.maxHeight = "100%";
1569
+ svgElement.style.objectFit = "contain";
1570
+ } else if (isModalMode) {
1562
1571
  svgElement.style.width = "auto";
1563
1572
  svgElement.style.height = "auto";
1564
1573
  const viewBox = svgElement.getAttribute("viewBox");
@@ -1609,15 +1618,15 @@ function IndustryMermaidDiagram({
1609
1618
  }
1610
1619
  };
1611
1620
  renderDiagram();
1612
- }, [hasRendered, code, id, theme2, containerElement, onError, isModalMode]);
1621
+ }, [hasRendered, code, id, theme2, containerElement, onError, isModalMode, isFullSlide]);
1613
1622
  useEffect2(() => {
1614
- if (!containerElement || !hasRendered)
1623
+ if (!hasRendered || !containerElement)
1615
1624
  return;
1616
1625
  const svgElement = containerElement.querySelector("svg");
1617
1626
  if (svgElement) {
1618
1627
  if (zoomLevel !== 1) {
1619
1628
  svgElement.style.transform = `scale(${zoomLevel})`;
1620
- svgElement.style.transformOrigin = "top center";
1629
+ svgElement.style.transformOrigin = "center center";
1621
1630
  const containerRect = containerElement.getBoundingClientRect();
1622
1631
  const svgRect = svgElement.getBoundingClientRect();
1623
1632
  if (svgRect.width < containerRect.width) {
@@ -1627,14 +1636,14 @@ function IndustryMermaidDiagram({
1627
1636
  svgElement.style.transform = "";
1628
1637
  svgElement.style.transformOrigin = "";
1629
1638
  svgElement.style.margin = "0 auto";
1630
- if (!isModalMode) {
1639
+ if (!isModalMode && !isFullSlide) {
1631
1640
  svgElement.style.maxHeight = "360px";
1632
1641
  svgElement.style.width = "auto";
1633
1642
  svgElement.style.maxWidth = "none";
1634
1643
  }
1635
1644
  }
1636
1645
  }
1637
- }, [zoomLevel, containerElement, hasRendered, isModalMode]);
1646
+ }, [zoomLevel, containerElement, hasRendered, isModalMode, isFullSlide]);
1638
1647
  useEffect2(() => {
1639
1648
  if (errorDetails && onCopyError) {
1640
1649
  const handleKeyDown = (e) => {
@@ -1651,7 +1660,24 @@ function IndustryMermaidDiagram({
1651
1660
  }
1652
1661
  return;
1653
1662
  }, [errorDetails, onCopyError, containerElement]);
1654
- const containerStyle = isModalMode ? {
1663
+ const containerStyle = isFullSlide ? {
1664
+ position: "absolute",
1665
+ top: 0,
1666
+ left: 0,
1667
+ right: 0,
1668
+ bottom: 0,
1669
+ width: "100%",
1670
+ height: "100%",
1671
+ display: "flex",
1672
+ alignItems: "center",
1673
+ justifyContent: "center",
1674
+ backgroundColor: "transparent",
1675
+ border: "none",
1676
+ borderRadius: 0,
1677
+ padding: theme2.space[4],
1678
+ margin: 0,
1679
+ overflow: "auto"
1680
+ } : isModalMode ? {
1655
1681
  position: "relative",
1656
1682
  width: "fit-content",
1657
1683
  height: "fit-content",
@@ -1682,16 +1708,37 @@ function IndustryMermaidDiagram({
1682
1708
  fontSize: theme2.fontSizes[2],
1683
1709
  fontFamily: theme2.fonts.body
1684
1710
  };
1685
- return isModalMode ? /* @__PURE__ */ React4.createElement("div", {
1686
- ref: containerRef,
1687
- style: containerStyle,
1688
- className: "mermaid-container"
1689
- }, !hasRendered && /* @__PURE__ */ React4.createElement("div", {
1690
- style: placeholderStyle
1691
- }, /* @__PURE__ */ React4.createElement("div", null, "\uD83D\uDCCA Mermaid Diagram"), /* @__PURE__ */ React4.createElement("div", {
1692
- style: { fontSize: theme2.fontSizes[1], marginTop: theme2.space[2], opacity: 0.7 }
1693
- }, "Loading..."))) : /* @__PURE__ */ React4.createElement("div", {
1694
- style: { position: "relative" }
1711
+ if (isModalMode || isFullSlide) {
1712
+ return /* @__PURE__ */ React4.createElement("div", {
1713
+ ref: containerRef,
1714
+ style: containerStyle,
1715
+ className: "mermaid-container"
1716
+ }, !hasRendered && /* @__PURE__ */ React4.createElement("div", {
1717
+ style: placeholderStyle
1718
+ }, /* @__PURE__ */ React4.createElement("div", null, "\uD83D\uDCCA Mermaid Diagram"), /* @__PURE__ */ React4.createElement("div", {
1719
+ style: { fontSize: theme2.fontSizes[1], marginTop: theme2.space[2], opacity: 0.7 }
1720
+ }, "Loading...")));
1721
+ }
1722
+ const wrapperStyle = showFullSlide && !isFullSlide && !isModalMode ? {
1723
+ position: "fixed",
1724
+ top: 0,
1725
+ left: 0,
1726
+ right: 0,
1727
+ bottom: 0,
1728
+ backgroundColor: theme2.colors.background,
1729
+ zIndex: 1000,
1730
+ display: "flex",
1731
+ flexDirection: "column",
1732
+ padding: theme2.space[4]
1733
+ } : {
1734
+ position: "relative"
1735
+ };
1736
+ return /* @__PURE__ */ React4.createElement("div", {
1737
+ ref: wrapperRef,
1738
+ style: wrapperStyle,
1739
+ onClick: showFullSlide ? () => setShowFullSlide(false) : undefined
1740
+ }, /* @__PURE__ */ React4.createElement("div", {
1741
+ style: { position: "relative", width: "100%", height: showFullSlide ? "100%" : "auto" }
1695
1742
  }, hasRendered && /* @__PURE__ */ React4.createElement("div", {
1696
1743
  style: {
1697
1744
  position: "absolute",
@@ -1701,7 +1748,44 @@ function IndustryMermaidDiagram({
1701
1748
  display: "flex",
1702
1749
  gap: theme2.space[1]
1703
1750
  }
1704
- }, /* @__PURE__ */ React4.createElement("button", {
1751
+ }, showFullSlide ? /* @__PURE__ */ React4.createElement("button", {
1752
+ onClick: (e) => {
1753
+ e.stopPropagation();
1754
+ setShowFullSlide(false);
1755
+ },
1756
+ style: {
1757
+ padding: `${theme2.space[2]}px ${theme2.space[3]}px`,
1758
+ backgroundColor: theme2.colors.background,
1759
+ color: theme2.colors.text,
1760
+ border: `1px solid ${theme2.colors.border}`,
1761
+ borderRadius: theme2.radii[1],
1762
+ fontSize: theme2.fontSizes[1],
1763
+ fontWeight: theme2.fontWeights.medium,
1764
+ cursor: "pointer",
1765
+ fontFamily: theme2.fonts.body
1766
+ }
1767
+ }, "Close") : /* @__PURE__ */ React4.createElement("button", {
1768
+ onClick: (e) => {
1769
+ e.stopPropagation();
1770
+ setShowFullSlide(true);
1771
+ },
1772
+ style: {
1773
+ padding: theme2.space[1],
1774
+ backgroundColor: theme2.colors.backgroundSecondary,
1775
+ border: `1px solid ${theme2.colors.border}`,
1776
+ borderRadius: theme2.radii[1],
1777
+ color: theme2.colors.text,
1778
+ cursor: "pointer",
1779
+ display: "flex",
1780
+ alignItems: "center",
1781
+ justifyContent: "center",
1782
+ width: "28px",
1783
+ height: "28px"
1784
+ },
1785
+ title: "Expand to full slide"
1786
+ }, /* @__PURE__ */ React4.createElement(Expand, {
1787
+ size: 14
1788
+ })), /* @__PURE__ */ React4.createElement("button", {
1705
1789
  onClick: () => setZoomLevel(Math.min(3, zoomLevel + 0.25)),
1706
1790
  disabled: zoomLevel >= 3,
1707
1791
  style: {
@@ -1762,14 +1846,31 @@ function IndustryMermaidDiagram({
1762
1846
  }, /* @__PURE__ */ React4.createElement(RotateCcw, {
1763
1847
  size: 14
1764
1848
  }))), /* @__PURE__ */ React4.createElement("div", {
1849
+ style: showFullSlide ? {
1850
+ width: "100%",
1851
+ height: "100%",
1852
+ display: "flex",
1853
+ alignItems: "center",
1854
+ justifyContent: "center",
1855
+ overflow: "auto"
1856
+ } : {},
1857
+ onClick: (e) => e.stopPropagation()
1858
+ }, /* @__PURE__ */ React4.createElement("div", {
1765
1859
  ref: containerRef,
1766
- style: containerStyle,
1860
+ style: showFullSlide ? {
1861
+ ...containerStyle,
1862
+ maxHeight: "90%",
1863
+ maxWidth: "90%",
1864
+ margin: "auto",
1865
+ border: "none",
1866
+ backgroundColor: "transparent"
1867
+ } : containerStyle,
1767
1868
  className: "mermaid-container"
1768
1869
  }, !hasRendered && /* @__PURE__ */ React4.createElement("div", {
1769
1870
  style: placeholderStyle
1770
1871
  }, /* @__PURE__ */ React4.createElement("div", null, "\uD83D\uDCCA Mermaid Diagram"), /* @__PURE__ */ React4.createElement("div", {
1771
1872
  style: { fontSize: theme2.fontSizes[1], marginTop: theme2.space[2], opacity: 0.7 }
1772
- }, isIntersecting ? "Loading..." : "Scroll to view"))));
1873
+ }, isIntersecting ? "Loading..." : "Scroll to view"))))));
1773
1874
  }
1774
1875
 
1775
1876
  // industryMarkdown/components/IndustryLazyMermaidDiagram.tsx
@@ -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,qBAyX7B"}
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,qBAwe7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "themed-markdown",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "Industry-themed markdown renderer with presentation capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",