themed-markdown 0.1.86 → 0.1.88

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
@@ -1032,7 +1032,8 @@ function resetFontScale(theme2) {
1032
1032
 
1033
1033
  // industryMarkdown/components/IndustryMarkdownSlide.tsx
1034
1034
  import { defaultSchema } from "hast-util-sanitize";
1035
- import React13, { useRef as useRef7, useEffect as useEffect7, useLayoutEffect, useState as useState9, useMemo as useMemo2, useCallback } from "react";
1035
+ import React13, { useRef as useRef8, useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useState as useState10, useMemo as useMemo3, useCallback as useCallback2 } from "react";
1036
+ import { createPortal as createPortal2 } from "react-dom";
1036
1037
  import ReactMarkdown from "react-markdown";
1037
1038
  import rehypeHighlight from "rehype-highlight";
1038
1039
  import rehypeRaw from "rehype-raw";
@@ -1622,18 +1623,310 @@ function parseSkillMarkdown(content) {
1622
1623
  // industryMarkdown/utils/markdownUtils.ts
1623
1624
  var parseMarkdownChunks2 = parseMarkdownChunks;
1624
1625
 
1626
+ // industryMarkdown/utils/useAnnotations.ts
1627
+ import { useEffect as useEffect2, useLayoutEffect, useMemo, useRef, useState as useState2 } from "react";
1628
+
1629
+ // industryMarkdown/utils/annotationResolver.ts
1630
+ var SKIP_SELECTOR = "script, style, code, pre";
1631
+ function buildTextIndex(root) {
1632
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
1633
+ acceptNode(node) {
1634
+ const parent = node.parentElement;
1635
+ if (!parent)
1636
+ return NodeFilter.FILTER_REJECT;
1637
+ if (parent.closest(SKIP_SELECTOR))
1638
+ return NodeFilter.FILTER_REJECT;
1639
+ if (parent.hasAttribute("data-annotation-marker"))
1640
+ return NodeFilter.FILTER_REJECT;
1641
+ if (!node.nodeValue)
1642
+ return NodeFilter.FILTER_REJECT;
1643
+ return NodeFilter.FILTER_ACCEPT;
1644
+ }
1645
+ });
1646
+ let text = "";
1647
+ const nodes = [];
1648
+ let current = walker.nextNode();
1649
+ while (current) {
1650
+ const value = current.nodeValue ?? "";
1651
+ const start = text.length;
1652
+ text += value;
1653
+ nodes.push({ node: current, start, end: start + value.length });
1654
+ current = walker.nextNode();
1655
+ }
1656
+ return { text, nodes };
1657
+ }
1658
+ function findOffset(index, offset) {
1659
+ for (const entry of index.nodes) {
1660
+ if (offset >= entry.start && offset <= entry.end) {
1661
+ return { node: entry.node, localOffset: offset - entry.start };
1662
+ }
1663
+ }
1664
+ return null;
1665
+ }
1666
+ function resolveTextQuote(root, anchor) {
1667
+ if (!anchor.exact)
1668
+ return null;
1669
+ const index = buildTextIndex(root);
1670
+ const needle = `${anchor.prefix ?? ""}${anchor.exact}${anchor.suffix ?? ""}`;
1671
+ if (!needle)
1672
+ return null;
1673
+ const matchStart = index.text.indexOf(needle);
1674
+ if (matchStart === -1)
1675
+ return null;
1676
+ const exactStart = matchStart + (anchor.prefix?.length ?? 0);
1677
+ const exactEnd = exactStart + anchor.exact.length;
1678
+ const startLoc = findOffset(index, exactStart);
1679
+ const endLoc = findOffset(index, exactEnd);
1680
+ if (!startLoc || !endLoc)
1681
+ return null;
1682
+ const range = document.createRange();
1683
+ range.setStart(startLoc.node, startLoc.localOffset);
1684
+ range.setEnd(endLoc.node, endLoc.localOffset);
1685
+ return range;
1686
+ }
1687
+ function selectionToAnchor(root, selection, contextLength = 32) {
1688
+ if (selection.rangeCount === 0)
1689
+ return null;
1690
+ const range = selection.getRangeAt(0);
1691
+ if (range.collapsed)
1692
+ return null;
1693
+ if (!root.contains(range.commonAncestorContainer))
1694
+ return null;
1695
+ const exact = range.toString();
1696
+ if (!exact.trim())
1697
+ return null;
1698
+ const index = buildTextIndex(root);
1699
+ const startEntry = index.nodes.find((e) => e.node === range.startContainer);
1700
+ const endEntry = index.nodes.find((e) => e.node === range.endContainer);
1701
+ if (!startEntry || !endEntry) {
1702
+ return { exact };
1703
+ }
1704
+ const startOffset = startEntry.start + range.startOffset;
1705
+ const endOffset = endEntry.start + range.endOffset;
1706
+ const prefix = index.text.slice(Math.max(0, startOffset - contextLength), startOffset);
1707
+ const suffix = index.text.slice(endOffset, Math.min(index.text.length, endOffset + contextLength));
1708
+ return { exact, prefix, suffix };
1709
+ }
1710
+
1711
+ // industryMarkdown/utils/useAnnotations.ts
1712
+ var MARKER_CLASS = "industry-md-annotation";
1713
+ var INDICATOR_HOST_CLASS = "industry-md-annotation-indicator";
1714
+ function annotationsSignature(annotations) {
1715
+ return annotations.map((a) => `${a.id}|${a.anchor.exact}|${a.anchor.prefix ?? ""}|${a.anchor.suffix ?? ""}|${a.count ?? ""}`).join("::");
1716
+ }
1717
+ function clearMarkers(root) {
1718
+ const markers = root.querySelectorAll(`.${MARKER_CLASS}`);
1719
+ markers.forEach((marker) => {
1720
+ const parent = marker.parentNode;
1721
+ if (!parent)
1722
+ return;
1723
+ while (marker.firstChild) {
1724
+ parent.insertBefore(marker.firstChild, marker);
1725
+ }
1726
+ parent.removeChild(marker);
1727
+ });
1728
+ const hosts = root.querySelectorAll(`.${INDICATOR_HOST_CLASS}`);
1729
+ hosts.forEach((host) => host.parentNode?.removeChild(host));
1730
+ root.normalize();
1731
+ }
1732
+ function wrapRange(range, annotationId) {
1733
+ const textNodes = [];
1734
+ const walker = document.createTreeWalker(range.commonAncestorContainer, NodeFilter.SHOW_TEXT);
1735
+ let current = walker.nextNode();
1736
+ while (current) {
1737
+ if (range.intersectsNode(current))
1738
+ textNodes.push(current);
1739
+ current = walker.nextNode();
1740
+ }
1741
+ if (range.commonAncestorContainer.nodeType === Node.TEXT_NODE) {
1742
+ textNodes.push(range.commonAncestorContainer);
1743
+ }
1744
+ const markers = [];
1745
+ textNodes.forEach((textNode) => {
1746
+ if (!textNode.parentNode || !textNode.nodeValue)
1747
+ return;
1748
+ const isStart = textNode === range.startContainer;
1749
+ const isEnd = textNode === range.endContainer;
1750
+ const start = isStart ? range.startOffset : 0;
1751
+ const end = isEnd ? range.endOffset : textNode.nodeValue.length;
1752
+ if (start >= end)
1753
+ return;
1754
+ let target = textNode;
1755
+ if (start > 0) {
1756
+ target = target.splitText(start);
1757
+ }
1758
+ if (end - start < target.nodeValue.length) {
1759
+ target.splitText(end - start);
1760
+ }
1761
+ const marker = document.createElement("span");
1762
+ marker.className = MARKER_CLASS;
1763
+ marker.setAttribute("data-annotation-id", annotationId);
1764
+ marker.setAttribute("data-annotation-marker", "true");
1765
+ target.parentNode.insertBefore(marker, target);
1766
+ marker.appendChild(target);
1767
+ markers.push(marker);
1768
+ });
1769
+ return markers;
1770
+ }
1771
+ function useAnnotations({
1772
+ rootRef,
1773
+ annotations,
1774
+ activeAnnotationId,
1775
+ onSelectionChange,
1776
+ onAnnotationClick
1777
+ }) {
1778
+ const [mounts, setMounts] = useState2([]);
1779
+ const signature = useMemo(() => annotationsSignature(annotations ?? []), [annotations]);
1780
+ const annotationsRef = useRef(annotations);
1781
+ annotationsRef.current = annotations;
1782
+ const lastAppliedRef = useRef("");
1783
+ const lastResolvedIdsRef = useRef(new Set);
1784
+ useLayoutEffect(() => {
1785
+ const root = rootRef.current;
1786
+ if (!root)
1787
+ return;
1788
+ const current = annotationsRef.current ?? [];
1789
+ const existingMarkerIds = new Set;
1790
+ root.querySelectorAll(`.${MARKER_CLASS}`).forEach((el) => {
1791
+ const id = el.getAttribute("data-annotation-id");
1792
+ if (id)
1793
+ existingMarkerIds.add(id);
1794
+ });
1795
+ const annotationsChanged = lastAppliedRef.current !== signature;
1796
+ const allResolvedMarkersPresent = Array.from(lastResolvedIdsRef.current).every((id) => existingMarkerIds.has(id));
1797
+ if (!annotationsChanged && allResolvedMarkersPresent) {
1798
+ return;
1799
+ }
1800
+ clearMarkers(root);
1801
+ lastAppliedRef.current = signature;
1802
+ if (current.length === 0) {
1803
+ lastResolvedIdsRef.current = new Set;
1804
+ setMounts((prev) => prev.length === 0 ? prev : []);
1805
+ return;
1806
+ }
1807
+ const next = [];
1808
+ const resolvedIds = new Set;
1809
+ current.forEach((annotation) => {
1810
+ const range = resolveTextQuote(root, annotation.anchor);
1811
+ if (!range) {
1812
+ next.push({ annotation, host: document.createElement("span"), resolved: false });
1813
+ return;
1814
+ }
1815
+ const markers = wrapRange(range, annotation.id);
1816
+ if (markers.length === 0) {
1817
+ next.push({ annotation, host: document.createElement("span"), resolved: false });
1818
+ return;
1819
+ }
1820
+ const last = markers[markers.length - 1];
1821
+ last.classList.add(`${MARKER_CLASS}--last`);
1822
+ if (typeof annotation.count === "number" && annotation.count > 0) {
1823
+ last.setAttribute("data-count", String(annotation.count));
1824
+ }
1825
+ const host = document.createElement("span");
1826
+ host.className = INDICATOR_HOST_CLASS;
1827
+ host.setAttribute("data-annotation-indicator-for", annotation.id);
1828
+ last.parentNode.insertBefore(host, last.nextSibling);
1829
+ next.push({ annotation, host, resolved: true });
1830
+ resolvedIds.add(annotation.id);
1831
+ });
1832
+ lastResolvedIdsRef.current = resolvedIds;
1833
+ setMounts(next);
1834
+ });
1835
+ useEffect2(() => {
1836
+ const root = rootRef.current;
1837
+ if (!root)
1838
+ return;
1839
+ const markers = root.querySelectorAll(`.${MARKER_CLASS}`);
1840
+ markers.forEach((marker) => {
1841
+ const id = marker.getAttribute("data-annotation-id");
1842
+ if (id && id === activeAnnotationId) {
1843
+ marker.setAttribute("data-active", "true");
1844
+ } else {
1845
+ marker.removeAttribute("data-active");
1846
+ }
1847
+ });
1848
+ }, [rootRef, activeAnnotationId, mounts]);
1849
+ useEffect2(() => {
1850
+ if (!onSelectionChange)
1851
+ return;
1852
+ const root = rootRef.current;
1853
+ if (!root)
1854
+ return;
1855
+ const emit = () => {
1856
+ const selection = document.getSelection();
1857
+ if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
1858
+ onSelectionChange(null);
1859
+ return;
1860
+ }
1861
+ const range = selection.getRangeAt(0);
1862
+ if (!root.contains(range.commonAncestorContainer)) {
1863
+ onSelectionChange(null);
1864
+ return;
1865
+ }
1866
+ const anchor = selectionToAnchor(root, selection);
1867
+ if (!anchor) {
1868
+ onSelectionChange(null);
1869
+ return;
1870
+ }
1871
+ onSelectionChange({ anchor, rect: range.getBoundingClientRect() });
1872
+ };
1873
+ const handleMouseUp = () => {
1874
+ window.setTimeout(emit, 0);
1875
+ };
1876
+ const handleKeyUp = (event) => {
1877
+ if (event.key === "Shift" || event.key === "Meta" || event.key === "Control" || event.key === "Alt") {
1878
+ return;
1879
+ }
1880
+ window.setTimeout(emit, 0);
1881
+ };
1882
+ document.addEventListener("mouseup", handleMouseUp);
1883
+ document.addEventListener("keyup", handleKeyUp);
1884
+ return () => {
1885
+ document.removeEventListener("mouseup", handleMouseUp);
1886
+ document.removeEventListener("keyup", handleKeyUp);
1887
+ };
1888
+ }, [rootRef, onSelectionChange]);
1889
+ useEffect2(() => {
1890
+ if (!onAnnotationClick)
1891
+ return;
1892
+ const root = rootRef.current;
1893
+ if (!root)
1894
+ return;
1895
+ const handleClick = (event) => {
1896
+ const selection = document.getSelection();
1897
+ if (selection && !selection.isCollapsed)
1898
+ return;
1899
+ const target = event.target;
1900
+ if (!(target instanceof Element))
1901
+ return;
1902
+ const marker = target.closest(`.${MARKER_CLASS}`);
1903
+ if (!marker)
1904
+ return;
1905
+ const id = marker.getAttribute("data-annotation-id");
1906
+ if (!id)
1907
+ return;
1908
+ onAnnotationClick(id, event);
1909
+ };
1910
+ root.addEventListener("click", handleClick);
1911
+ return () => {
1912
+ root.removeEventListener("click", handleClick);
1913
+ };
1914
+ }, [rootRef, onAnnotationClick]);
1915
+ return mounts;
1916
+ }
1917
+
1625
1918
  // industryMarkdown/components/IndustryHtmlModal.tsx
1626
- import React3, { useState as useState2 } from "react";
1919
+ import React3, { useCallback, useState as useState3 } from "react";
1627
1920
  var useIndustryHtmlModal = () => {
1628
- const [htmlModalOpen, setHtmlModalOpen] = useState2(false);
1629
- const [htmlModalContent, setHtmlModalContent] = useState2("");
1630
- const openHtmlModal = (content) => {
1921
+ const [htmlModalOpen, setHtmlModalOpen] = useState3(false);
1922
+ const [htmlModalContent, setHtmlModalContent] = useState3("");
1923
+ const openHtmlModal = useCallback((content) => {
1631
1924
  setHtmlModalContent(content);
1632
1925
  setHtmlModalOpen(true);
1633
- };
1634
- const closeHtmlModal = () => {
1926
+ }, []);
1927
+ const closeHtmlModal = useCallback(() => {
1635
1928
  setHtmlModalOpen(false);
1636
- };
1929
+ }, []);
1637
1930
  return { htmlModalOpen, htmlModalContent, openHtmlModal, closeHtmlModal };
1638
1931
  };
1639
1932
  function IndustryHtmlModal({ isOpen, onClose, htmlContent, theme: theme2 }) {
@@ -1737,11 +2030,11 @@ function IndustryHtmlModal({ isOpen, onClose, htmlContent, theme: theme2 }) {
1737
2030
 
1738
2031
  // industryMarkdown/components/IndustryLazyMermaidDiagram.tsx
1739
2032
  import { MoveRight } from "lucide-react";
1740
- import React6, { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
2033
+ import React6, { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
1741
2034
 
1742
2035
  // industryMarkdown/components/IndustryMermaidDiagram.tsx
1743
2036
  import { Expand, Copy, Check } from "lucide-react";
1744
- import React5, { useEffect as useEffect2, useRef, useState as useState3 } from "react";
2037
+ import React5, { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
1745
2038
  var getMermaidSync = () => {
1746
2039
  if (typeof window !== "undefined") {
1747
2040
  const mermaid = window.mermaid;
@@ -1763,12 +2056,12 @@ function IndustryMermaidDiagram({
1763
2056
  onExpandClick
1764
2057
  }) {
1765
2058
  const theme2 = themeOverride ?? theme;
1766
- const [errorDetails, setErrorDetails] = useState3(null);
1767
- const [isIntersecting, setIsIntersecting] = useState3(false);
1768
- const [hasRendered, setHasRendered] = useState3(false);
1769
- const [containerElement, setContainerElement] = useState3(null);
1770
- const [copiedError, setCopiedError] = useState3(false);
1771
- const observerRef = useRef(null);
2059
+ const [errorDetails, setErrorDetails] = useState4(null);
2060
+ const [isIntersecting, setIsIntersecting] = useState4(false);
2061
+ const [hasRendered, setHasRendered] = useState4(false);
2062
+ const [containerElement, setContainerElement] = useState4(null);
2063
+ const [copiedError, setCopiedError] = useState4(false);
2064
+ const observerRef = useRef2(null);
1772
2065
  const containerRef = React5.useCallback((node) => {
1773
2066
  setContainerElement(node);
1774
2067
  if (observerRef.current) {
@@ -1793,14 +2086,14 @@ function IndustryMermaidDiagram({
1793
2086
  observerRef.current.observe(node);
1794
2087
  }
1795
2088
  }, [rootMargin, hasRendered, isModalMode]);
1796
- useEffect2(() => {
2089
+ useEffect3(() => {
1797
2090
  return () => {
1798
2091
  if (observerRef.current) {
1799
2092
  observerRef.current.disconnect();
1800
2093
  }
1801
2094
  };
1802
2095
  }, []);
1803
- useEffect2(() => {
2096
+ useEffect3(() => {
1804
2097
  if (!hasRendered)
1805
2098
  return;
1806
2099
  const renderDiagram = async () => {
@@ -2135,15 +2428,15 @@ function IndustryLazyMermaidDiagram({
2135
2428
  onExpandClick
2136
2429
  }) {
2137
2430
  const theme2 = themeOverride ?? theme;
2138
- const [isIntersecting, setIsIntersecting] = useState4(false);
2139
- const [hasRendered, setHasRendered] = useState4(false);
2140
- const [isMounted, setIsMounted] = useState4(false);
2141
- const [hasError, setHasError] = useState4(false);
2142
- const containerRef = useRef2(null);
2143
- useEffect3(() => {
2431
+ const [isIntersecting, setIsIntersecting] = useState5(false);
2432
+ const [hasRendered, setHasRendered] = useState5(false);
2433
+ const [isMounted, setIsMounted] = useState5(false);
2434
+ const [hasError, setHasError] = useState5(false);
2435
+ const containerRef = useRef3(null);
2436
+ useEffect4(() => {
2144
2437
  setIsMounted(true);
2145
2438
  }, []);
2146
- useEffect3(() => {
2439
+ useEffect4(() => {
2147
2440
  if (!isMounted)
2148
2441
  return;
2149
2442
  if (typeof IntersectionObserver === "undefined") {
@@ -2264,7 +2557,7 @@ function IndustryLazyMermaidDiagram({
2264
2557
 
2265
2558
  // industryMarkdown/components/IndustryMarkdownComponents.tsx
2266
2559
  import { Copy as Copy2, Monitor, FileText, Check as Check2 } from "lucide-react";
2267
- import React9, { useMemo, useState as useState6, useRef as useRef4 } from "react";
2560
+ import React9, { useMemo as useMemo2, useState as useState7, useRef as useRef5 } from "react";
2268
2561
 
2269
2562
  // industryMarkdown/utils/componentUtils.tsx
2270
2563
  import React7 from "react";
@@ -2300,7 +2593,7 @@ var LinkWithLoadingIndicator = ({ href, children, onClick, className }) => {
2300
2593
  };
2301
2594
  // industryMarkdown/components/IndustryBashCommandDropdown.tsx
2302
2595
  import { Play, ChevronDown } from "lucide-react";
2303
- import React8, { useState as useState5, useRef as useRef3, useEffect as useEffect4 } from "react";
2596
+ import React8, { useState as useState6, useRef as useRef4, useEffect as useEffect5 } from "react";
2304
2597
  var IndustryBashCommandDropdown = ({
2305
2598
  commands,
2306
2599
  allCommands,
@@ -2309,11 +2602,11 @@ var IndustryBashCommandDropdown = ({
2309
2602
  slideIdPrefix: _slideIdPrefix,
2310
2603
  theme: themeOverride
2311
2604
  }) => {
2312
- const [isOpen, setIsOpen] = useState5(false);
2313
- const [isRunning, setIsRunning] = useState5(false);
2314
- const dropdownRef = useRef3(null);
2605
+ const [isOpen, setIsOpen] = useState6(false);
2606
+ const [isRunning, setIsRunning] = useState6(false);
2607
+ const dropdownRef = useRef4(null);
2315
2608
  const theme2 = themeOverride ?? theme;
2316
- useEffect4(() => {
2609
+ useEffect5(() => {
2317
2610
  const handleClickOutside = (event) => {
2318
2611
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2319
2612
  setIsOpen(false);
@@ -2432,7 +2725,7 @@ var IndustryBashCommandDropdown = ({
2432
2725
  e.currentTarget.style.backgroundColor = theme2.colors.muted;
2433
2726
  }
2434
2727
  }, "\uD83D\uDE80 Run all (", commands.length, " commands)"), commands.map((cmd, index) => {
2435
- const [isHovered, setIsHovered] = useState5(false);
2728
+ const [isHovered, setIsHovered] = useState6(false);
2436
2729
  return /* @__PURE__ */ React8.createElement("div", {
2437
2730
  key: index,
2438
2731
  style: dropdownItemStyle(isHovered),
@@ -2485,12 +2778,12 @@ var OptimizedMarkdownMedia = React9.memo(({
2485
2778
  theme: theme2,
2486
2779
  ...props
2487
2780
  }) => {
2488
- const transformedSrc = useMemo(() => {
2781
+ const transformedSrc = useMemo2(() => {
2489
2782
  return transformImageUrl(src, repositoryInfo);
2490
2783
  }, [src, repositoryInfo]);
2491
- const [hasErrored, setHasErrored] = useState6(() => failedImageCache.has(transformedSrc));
2492
- const retryCount = useRef4(0);
2493
- const mediaStyle = useMemo(() => ({
2784
+ const [hasErrored, setHasErrored] = useState7(() => failedImageCache.has(transformedSrc));
2785
+ const retryCount = useRef5(0);
2786
+ const mediaStyle = useMemo2(() => ({
2494
2787
  maxWidth: "100%",
2495
2788
  height: "auto",
2496
2789
  display: "block",
@@ -2862,7 +3155,7 @@ var createIndustryMarkdownComponents = ({
2862
3155
  }, children),
2863
3156
  source: ({ srcset, srcSet, ...props }) => {
2864
3157
  const srcsetValue = srcset || srcSet;
2865
- const transformedSrcset = useMemo(() => {
3158
+ const transformedSrcset = useMemo2(() => {
2866
3159
  if (!srcsetValue || !repositoryInfo)
2867
3160
  return srcsetValue;
2868
3161
  return srcsetValue.split(",").map((src) => {
@@ -2884,7 +3177,7 @@ var createIndustryMarkdownComponents = ({
2884
3177
  const codeString = extractTextFromChildren(children);
2885
3178
  const matchLang = /language-(\w+)/.exec(className || "");
2886
3179
  const language = matchLang ? matchLang[1] : null;
2887
- const [copied, setCopied] = useState6(false);
3180
+ const [copied, setCopied] = useState7(false);
2888
3181
  let isInline;
2889
3182
  let isCodeBlock;
2890
3183
  const hasNewlines = codeString.includes(`
@@ -3109,11 +3402,11 @@ var createIndustryMarkdownComponents = ({
3109
3402
  };
3110
3403
 
3111
3404
  // industryMarkdown/components/IndustryMermaidModal.tsx
3112
- import React11, { useEffect as useEffect6, useRef as useRef6 } from "react";
3405
+ import React11, { useEffect as useEffect7, useRef as useRef7 } from "react";
3113
3406
  import { createPortal } from "react-dom";
3114
3407
 
3115
3408
  // industryMarkdown/components/IndustryZoomableMermaidDiagram.tsx
3116
- import React10, { useEffect as useEffect5, useRef as useRef5, useState as useState7 } from "react";
3409
+ import React10, { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
3117
3410
  import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
3118
3411
  function IndustryZoomableMermaidDiagram({
3119
3412
  code,
@@ -3123,13 +3416,13 @@ function IndustryZoomableMermaidDiagram({
3123
3416
  padding = 0.9
3124
3417
  }) {
3125
3418
  const theme2 = themeOverride ?? theme;
3126
- const [calculatedScale, setCalculatedScale] = useState7(1);
3127
- const [hasInitialized, setHasInitialized] = useState7(false);
3128
- const containerRef = useRef5(null);
3129
- const diagramRef = useRef5(null);
3130
- const [isCalculating, setIsCalculating] = useState7(true);
3131
- const transformRef = useRef5(null);
3132
- useEffect5(() => {
3419
+ const [calculatedScale, setCalculatedScale] = useState8(1);
3420
+ const [hasInitialized, setHasInitialized] = useState8(false);
3421
+ const containerRef = useRef6(null);
3422
+ const diagramRef = useRef6(null);
3423
+ const [isCalculating, setIsCalculating] = useState8(true);
3424
+ const transformRef = useRef6(null);
3425
+ useEffect6(() => {
3133
3426
  if (!containerRef.current || !diagramRef.current)
3134
3427
  return;
3135
3428
  const calculateOptimalScale = () => {
@@ -3193,7 +3486,7 @@ function IndustryZoomableMermaidDiagram({
3193
3486
  resizeObserver.disconnect();
3194
3487
  };
3195
3488
  }, [code, fitStrategy, padding]);
3196
- useEffect5(() => {
3489
+ useEffect6(() => {
3197
3490
  if (hasInitialized && transformRef.current) {
3198
3491
  const { centerView } = transformRef.current;
3199
3492
  centerView(calculatedScale, 0, "easeOut");
@@ -3303,8 +3596,8 @@ function IndustryMermaidModal({
3303
3596
  mermaidCode,
3304
3597
  theme: theme2
3305
3598
  }) {
3306
- const modalRef = useRef6(null);
3307
- useEffect6(() => {
3599
+ const modalRef = useRef7(null);
3600
+ useEffect7(() => {
3308
3601
  const handleEscape = (event) => {
3309
3602
  if (event.key === "Escape") {
3310
3603
  onClose();
@@ -3406,7 +3699,7 @@ function IndustryMermaidModal({
3406
3699
  }
3407
3700
 
3408
3701
  // industryMarkdown/components/IndustryPlaceholderModal.tsx
3409
- import React12, { useState as useState8 } from "react";
3702
+ import React12, { useState as useState9 } from "react";
3410
3703
  function IndustryPlaceholderModal({
3411
3704
  isOpen,
3412
3705
  onClose,
@@ -3415,7 +3708,7 @@ function IndustryPlaceholderModal({
3415
3708
  onCopy,
3416
3709
  theme: theme2
3417
3710
  }) {
3418
- const [values, setValues] = useState8({});
3711
+ const [values, setValues] = useState9({});
3419
3712
  if (!isOpen)
3420
3713
  return null;
3421
3714
  const handleSubmit = (e) => {
@@ -3784,6 +4077,54 @@ var highlightOverrides = `
3784
4077
  text-decoration: none !important;
3785
4078
  }
3786
4079
  `;
4080
+ var annotationCSS = `
4081
+ .industry-md-annotation {
4082
+ background-color: var(--industry-md-annotation-bg, rgba(255, 193, 7, 0.22));
4083
+ padding: 0.15em 0.25em;
4084
+ margin: 0 -0.05em;
4085
+ border-radius: 3px;
4086
+ cursor: pointer;
4087
+ /* Re-apply padding/radius on each line fragment when the highlight wraps. */
4088
+ -webkit-box-decoration-break: clone;
4089
+ box-decoration-break: clone;
4090
+ }
4091
+ .industry-md-annotation[data-active="true"] {
4092
+ background-color: var(
4093
+ --industry-md-annotation-active-bg,
4094
+ rgba(255, 193, 7, 0.5)
4095
+ );
4096
+ }
4097
+ .industry-md-annotation--last {
4098
+ position: relative;
4099
+ }
4100
+ .industry-md-annotation--last[data-count]::after {
4101
+ content: attr(data-count);
4102
+ position: absolute;
4103
+ top: -0.85em;
4104
+ right: -0.8em;
4105
+ min-width: 1.1em;
4106
+ height: 1.1em;
4107
+ padding: 0 0.3em;
4108
+ box-sizing: border-box;
4109
+ border-radius: 4px;
4110
+ background-color: var(
4111
+ --industry-md-annotation-badge-bg,
4112
+ rgba(180, 120, 0, 0.95)
4113
+ );
4114
+ color: var(--industry-md-annotation-badge-color, #fff);
4115
+ font-size: 0.65em;
4116
+ font-weight: 600;
4117
+ line-height: 1.1em;
4118
+ text-align: center;
4119
+ pointer-events: none;
4120
+ box-shadow: 0 0 0 1.5px var(--industry-md-annotation-badge-ring, #fff);
4121
+ }
4122
+ .industry-md-annotation-indicator {
4123
+ display: inline;
4124
+ margin-left: 0.25em;
4125
+ vertical-align: baseline;
4126
+ }
4127
+ `;
3787
4128
  var fontTransitionCSS = `
3788
4129
  .markdown-slide * {
3789
4130
  transition: font-size 0.2s ease-in-out;
@@ -3841,6 +4182,12 @@ var injectStyles = () => {
3841
4182
  transitionStyle.textContent = fontTransitionCSS;
3842
4183
  document.head.appendChild(transitionStyle);
3843
4184
  }
4185
+ if (!document.getElementById("markdown-slide-annotations")) {
4186
+ const annotationStyle = document.createElement("style");
4187
+ annotationStyle.id = "markdown-slide-annotations";
4188
+ annotationStyle.textContent = annotationCSS;
4189
+ document.head.appendChild(annotationStyle);
4190
+ }
3844
4191
  stylesInjected = true;
3845
4192
  }
3846
4193
  };
@@ -3870,29 +4217,37 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
3870
4217
  enableKeyboardScrolling = true,
3871
4218
  keyboardScrollConfig,
3872
4219
  repositoryInfo,
3873
- editable = false
4220
+ editable = false,
4221
+ annotations,
4222
+ activeAnnotationId,
4223
+ renderAnnotation,
4224
+ onSelectionChange,
4225
+ onAnnotationClick,
4226
+ annotationStyle
3874
4227
  }) {
3875
- const slideRef = useRef7(null);
3876
- const scrollPositionsRef = useRef7(new Map);
3877
- const [measuredContainerWidth, setMeasuredContainerWidth] = useState9(null);
3878
- let chunks = [];
3879
- try {
3880
- if (typeof content === "string") {
3881
- chunks = parseMarkdownChunks2(content, slideIdPrefix);
3882
- } else {}
3883
- } catch (error) {
3884
- console.error("Error parsing markdown chunks:", error);
3885
- }
3886
- const [checkedItems, setCheckedItems] = useState9({});
4228
+ const slideRef = useRef8(null);
4229
+ const scrollPositionsRef = useRef8(new Map);
4230
+ const [measuredContainerWidth, setMeasuredContainerWidth] = useState10(null);
4231
+ const chunks = useMemo3(() => {
4232
+ if (typeof content !== "string")
4233
+ return [];
4234
+ try {
4235
+ return parseMarkdownChunks2(content, slideIdPrefix);
4236
+ } catch (error) {
4237
+ console.error("Error parsing markdown chunks:", error);
4238
+ return [];
4239
+ }
4240
+ }, [content, slideIdPrefix]);
4241
+ const [checkedItems, setCheckedItems] = useState10({});
3887
4242
  const { htmlModalOpen, htmlModalContent, openHtmlModal, closeHtmlModal } = useIndustryHtmlModal();
3888
- const [mermaidModalOpen, setMermaidModalOpen] = useState9(false);
3889
- const [mermaidModalCode, setMermaidModalCode] = useState9("");
3890
- const [placeholderModalOpen, setPlaceholderModalOpen] = useState9(false);
3891
- const [placeholderModalData, setPlaceholderModalData] = useState9(null);
3892
- useEffect7(() => {
4243
+ const [mermaidModalOpen, setMermaidModalOpen] = useState10(false);
4244
+ const [mermaidModalCode, setMermaidModalCode] = useState10("");
4245
+ const [placeholderModalOpen, setPlaceholderModalOpen] = useState10(false);
4246
+ const [placeholderModalData, setPlaceholderModalData] = useState10(null);
4247
+ useEffect8(() => {
3893
4248
  injectStyles();
3894
4249
  }, []);
3895
- useEffect7(() => {
4250
+ useEffect8(() => {
3896
4251
  if (containerWidth !== undefined) {
3897
4252
  return;
3898
4253
  }
@@ -3951,7 +4306,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
3951
4306
  ...keyboardScrollConfig?.keys
3952
4307
  }
3953
4308
  };
3954
- const handleKeyDown = useCallback((event) => {
4309
+ const handleKeyDown = useCallback2((event) => {
3955
4310
  if (!enableKeyboardScrolling) {
3956
4311
  return;
3957
4312
  }
@@ -4061,7 +4416,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4061
4416
  }, scrollConfig.smoothScroll ? 100 : 0);
4062
4417
  }
4063
4418
  }, [enableKeyboardScrolling, isVisible, slideIndex, scrollConfig]);
4064
- useEffect7(() => {
4419
+ useEffect8(() => {
4065
4420
  if (autoFocusOnVisible && isVisible && slideRef.current) {
4066
4421
  slideRef.current.focus({ preventScroll: true });
4067
4422
  }
@@ -4085,7 +4440,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4085
4440
  setMermaidModalCode("");
4086
4441
  };
4087
4442
  const baseTheme = themeOverride ?? theme;
4088
- const theme2 = useMemo2(() => {
4443
+ const theme2 = useMemo3(() => {
4089
4444
  if (fontSizeScale === 1)
4090
4445
  return baseTheme;
4091
4446
  return {
@@ -4093,7 +4448,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4093
4448
  fontSizes: baseTheme.fontSizes.map((size) => Math.round(size * fontSizeScale))
4094
4449
  };
4095
4450
  }, [baseTheme, fontSizeScale]);
4096
- const calculateSlidePadding = useMemo2(() => {
4451
+ const calculateSlidePadding = useMemo3(() => {
4097
4452
  const effectiveContainerWidth = containerWidth ?? measuredContainerWidth ?? 800;
4098
4453
  const paddingPercentage = 0.03;
4099
4454
  const horizontalPadding = Math.max(5, Math.round(effectiveContainerWidth * paddingPercentage));
@@ -4104,7 +4459,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4104
4459
  };
4105
4460
  return result;
4106
4461
  }, [containerWidth, measuredContainerWidth]);
4107
- const finalPadding = useMemo2(() => {
4462
+ const finalPadding = useMemo3(() => {
4108
4463
  const basePadding = calculateSlidePadding.horizontal;
4109
4464
  const baseVerticalPadding = calculateSlidePadding.vertical;
4110
4465
  const baseHorizontalValue = parseInt(basePadding.replace("px", ""), 10);
@@ -4119,7 +4474,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4119
4474
  const left = baseHorizontalValue + leftExtra;
4120
4475
  return `${top}px ${right}px ${bottom}px ${left}px`;
4121
4476
  }, [calculateSlidePadding.horizontal, calculateSlidePadding.vertical, additionalPadding]);
4122
- useEffect7(() => {
4477
+ useEffect8(() => {
4123
4478
  const slideElement = slideRef.current;
4124
4479
  if (slideElement) {
4125
4480
  const handleScroll = () => {
@@ -4132,13 +4487,13 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4132
4487
  }
4133
4488
  return;
4134
4489
  }, [slideIndex]);
4135
- useLayoutEffect(() => {
4490
+ useLayoutEffect2(() => {
4136
4491
  if (slideRef.current) {
4137
4492
  const savedPosition = scrollPositionsRef.current.get(slideIndex) ?? 0;
4138
4493
  slideRef.current.scrollTop = savedPosition;
4139
4494
  }
4140
4495
  }, [slideIndex]);
4141
- const sanitizeSchema = useMemo2(() => ({
4496
+ const sanitizeSchema = useMemo3(() => ({
4142
4497
  ...defaultSchema,
4143
4498
  tagNames: [...defaultSchema.tagNames || [], "picture", "source", "mark"],
4144
4499
  attributes: {
@@ -4206,7 +4561,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4206
4561
  }
4207
4562
  }), []);
4208
4563
  const rootMargin = isVisible ? "0px" : "100px";
4209
- const getMarkdownComponents = useCallback((chunkIndex) => {
4564
+ const getMarkdownComponents = useCallback2((chunkIndex) => {
4210
4565
  const baseComponents = createIndustryMarkdownComponents({
4211
4566
  theme: theme2,
4212
4567
  slideIdPrefix,
@@ -4258,6 +4613,76 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4258
4613
  searchQuery,
4259
4614
  editable
4260
4615
  ]);
4616
+ const renderedChunks = useMemo3(() => {
4617
+ if (chunks.length === 0) {
4618
+ return /* @__PURE__ */ React13.createElement("div", {
4619
+ style: {
4620
+ padding: theme2.space[4],
4621
+ textAlign: "center",
4622
+ color: theme2.colors.muted,
4623
+ fontSize: theme2.fontSizes[2]
4624
+ }
4625
+ }, "No content to display");
4626
+ }
4627
+ return chunks.map((chunk, index) => {
4628
+ if (chunk.type === "markdown_chunk") {
4629
+ const processedContent = searchQuery ? highlightSearchMatches(chunk.content, searchQuery) : chunk.content;
4630
+ return /* @__PURE__ */ React13.createElement(ReactMarkdown, {
4631
+ key: `${chunk.id}-${JSON.stringify(theme2.colors.accent)}`,
4632
+ remarkPlugins: [remarkGfm],
4633
+ rehypePlugins: [
4634
+ rehypeRaw,
4635
+ [rehypeSanitize, sanitizeSchema],
4636
+ rehypeSlug,
4637
+ rehypeHighlight
4638
+ ],
4639
+ components: getMarkdownComponents(index)
4640
+ }, processedContent);
4641
+ }
4642
+ if (chunk.type === "mermaid_chunk") {
4643
+ const mermaidProps = {
4644
+ id: chunk.id,
4645
+ code: chunk.content,
4646
+ onCopyError: onCopyMermaidError,
4647
+ rootMargin,
4648
+ theme: theme2,
4649
+ onExpandClick: () => openMermaidModal(chunk.content)
4650
+ };
4651
+ if (onShowMermaidInPanel) {
4652
+ mermaidProps.onShowInPanel = onShowMermaidInPanel;
4653
+ }
4654
+ return /* @__PURE__ */ React13.createElement(IndustryLazyMermaidDiagram, {
4655
+ key: chunk.id,
4656
+ ...mermaidProps
4657
+ });
4658
+ }
4659
+ return null;
4660
+ });
4661
+ }, [
4662
+ chunks,
4663
+ content,
4664
+ searchQuery,
4665
+ theme2,
4666
+ sanitizeSchema,
4667
+ getMarkdownComponents,
4668
+ rootMargin,
4669
+ onCopyMermaidError,
4670
+ onShowMermaidInPanel
4671
+ ]);
4672
+ const annotationMounts = useAnnotations({
4673
+ rootRef: slideRef,
4674
+ annotations: annotations ?? [],
4675
+ activeAnnotationId,
4676
+ onSelectionChange,
4677
+ onAnnotationClick
4678
+ });
4679
+ const annotationCSSVars = {};
4680
+ if (annotationStyle?.backgroundColor) {
4681
+ annotationCSSVars["--industry-md-annotation-bg"] = annotationStyle.backgroundColor;
4682
+ }
4683
+ if (annotationStyle?.activeBackgroundColor) {
4684
+ annotationCSSVars["--industry-md-annotation-active-bg"] = annotationStyle.activeBackgroundColor;
4685
+ }
4261
4686
  return /* @__PURE__ */ React13.createElement("div", {
4262
4687
  className: "markdown-slide",
4263
4688
  ref: slideRef,
@@ -4273,7 +4698,8 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4273
4698
  outline: "none",
4274
4699
  border: "2px solid transparent",
4275
4700
  transition: "border-color 0.2s ease",
4276
- boxSizing: "border-box"
4701
+ boxSizing: "border-box",
4702
+ ...annotationCSSVars
4277
4703
  },
4278
4704
  tabIndex: 0,
4279
4705
  onKeyDown: handleKeyDown,
@@ -4282,47 +4708,9 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4282
4708
  slideRef.current.focus();
4283
4709
  }
4284
4710
  }
4285
- }, chunks.length === 0 ? /* @__PURE__ */ React13.createElement("div", {
4286
- style: {
4287
- padding: theme2.space[4],
4288
- textAlign: "center",
4289
- color: theme2.colors.muted,
4290
- fontSize: theme2.fontSizes[2]
4291
- }
4292
- }, "No content to display") : chunks.map((chunk, index) => {
4293
- if (chunk.type === "markdown_chunk") {
4294
- const processedContent = searchQuery ? highlightSearchMatches(chunk.content, searchQuery) : chunk.content;
4295
- return /* @__PURE__ */ React13.createElement(ReactMarkdown, {
4296
- key: `${chunk.id}-${JSON.stringify(theme2.colors.accent)}`,
4297
- remarkPlugins: [remarkGfm],
4298
- rehypePlugins: [
4299
- rehypeRaw,
4300
- [rehypeSanitize, sanitizeSchema],
4301
- rehypeSlug,
4302
- rehypeHighlight
4303
- ],
4304
- components: getMarkdownComponents(index)
4305
- }, processedContent);
4306
- }
4307
- if (chunk.type === "mermaid_chunk") {
4308
- const mermaidProps = {
4309
- id: chunk.id,
4310
- code: chunk.content,
4311
- onCopyError: onCopyMermaidError,
4312
- rootMargin,
4313
- theme: theme2,
4314
- onExpandClick: () => openMermaidModal(chunk.content)
4315
- };
4316
- if (onShowMermaidInPanel) {
4317
- mermaidProps.onShowInPanel = onShowMermaidInPanel;
4318
- }
4319
- return /* @__PURE__ */ React13.createElement(IndustryLazyMermaidDiagram, {
4320
- key: chunk.id,
4321
- ...mermaidProps
4322
- });
4323
- }
4324
- return null;
4325
- }), /* @__PURE__ */ React13.createElement(IndustryHtmlModal, {
4711
+ }, renderedChunks, renderAnnotation && annotationMounts.filter((mount) => mount.resolved).map((mount) => createPortal2(/* @__PURE__ */ React13.createElement(React13.Fragment, {
4712
+ key: mount.annotation.id
4713
+ }, renderAnnotation(mount.annotation)), mount.host)), /* @__PURE__ */ React13.createElement(IndustryHtmlModal, {
4326
4714
  isOpen: htmlModalOpen,
4327
4715
  onClose: closeHtmlModal,
4328
4716
  htmlContent: htmlModalContent,
@@ -4343,7 +4731,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4343
4731
  });
4344
4732
  // industryMarkdown/components/SlidePresentation.tsx
4345
4733
  import { AnimatedResizableLayout } from "@principal-ade/panels";
4346
- import React17, { useState as useState10, useCallback as useCallback2, useRef as useRef9, useEffect as useEffect9 } from "react";
4734
+ import React17, { useState as useState11, useCallback as useCallback3, useRef as useRef10, useEffect as useEffect10 } from "react";
4347
4735
 
4348
4736
  // industryMarkdown/utils/extractSlideTitles.ts
4349
4737
  function extractSlideTitle2(content, slideIndex) {
@@ -4614,7 +5002,7 @@ var SlideNavigationHeader = ({
4614
5002
 
4615
5003
  // industryMarkdown/components/SlideSearchBar.tsx
4616
5004
  import { Search, X as X2 } from "lucide-react";
4617
- import React16, { useRef as useRef8, useEffect as useEffect8 } from "react";
5005
+ import React16, { useRef as useRef9, useEffect as useEffect9 } from "react";
4618
5006
  var SlideSearchBar = ({
4619
5007
  showSearch,
4620
5008
  searchQuery,
@@ -4628,8 +5016,8 @@ var SlideSearchBar = ({
4628
5016
  onClose,
4629
5017
  onClear
4630
5018
  }) => {
4631
- const searchInputRef = useRef8(null);
4632
- useEffect8(() => {
5019
+ const searchInputRef = useRef9(null);
5020
+ useEffect9(() => {
4633
5021
  if (showSearch && searchInputRef.current) {
4634
5022
  searchInputRef.current.focus();
4635
5023
  }
@@ -4831,8 +5219,8 @@ var SlidePresentation = ({
4831
5219
  fontSizeScale,
4832
5220
  theme: theme2
4833
5221
  }) => {
4834
- const [isMobile, setIsMobile] = useState10(false);
4835
- useEffect9(() => {
5222
+ const [isMobile, setIsMobile] = useState11(false);
5223
+ useEffect10(() => {
4836
5224
  const checkMobile = () => {
4837
5225
  setIsMobile(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768);
4838
5226
  };
@@ -4842,17 +5230,17 @@ var SlidePresentation = ({
4842
5230
  }, []);
4843
5231
  const effectiveTocDisplayMode = isMobile ? "overlay" : tocDisplayMode;
4844
5232
  const defaultTocOpen = initialTocOpen ?? effectiveTocDisplayMode === "sidebar";
4845
- const [currentSlide, setCurrentSlide] = useState10(initialSlide);
4846
- const [isFullscreen, setIsFullscreen] = useState10(false);
4847
- const [showTOC, setShowTOC] = useState10(defaultTocOpen);
4848
- const [showSearch, setShowSearch] = useState10(false);
4849
- const [searchQuery, setSearchQuery] = useState10("");
4850
- const [searchResults, setSearchResults] = useState10([]);
4851
- const [currentSearchResult, setCurrentSearchResult] = useState10(-1);
4852
- const [searchStartSlide, setSearchStartSlide] = useState10(0);
4853
- const containerRef = useRef9(null);
5233
+ const [currentSlide, setCurrentSlide] = useState11(initialSlide);
5234
+ const [isFullscreen, setIsFullscreen] = useState11(false);
5235
+ const [showTOC, setShowTOC] = useState11(defaultTocOpen);
5236
+ const [showSearch, setShowSearch] = useState11(false);
5237
+ const [searchQuery, setSearchQuery] = useState11("");
5238
+ const [searchResults, setSearchResults] = useState11([]);
5239
+ const [currentSearchResult, setCurrentSearchResult] = useState11(-1);
5240
+ const [searchStartSlide, setSearchStartSlide] = useState11(0);
5241
+ const containerRef = useRef10(null);
4854
5242
  const slideTitles = extractAllSlideTitles(slides);
4855
- const navigateToSlide = useCallback2((slideIndex) => {
5243
+ const navigateToSlide = useCallback3((slideIndex) => {
4856
5244
  if (slideIndex >= 0 && slideIndex < slides.length) {
4857
5245
  setCurrentSlide(slideIndex);
4858
5246
  onSlideChange?.(slideIndex);
@@ -4861,7 +5249,7 @@ var SlidePresentation = ({
4861
5249
  }
4862
5250
  }
4863
5251
  }, [slides.length, onSlideChange, effectiveTocDisplayMode]);
4864
- useEffect9(() => {
5252
+ useEffect10(() => {
4865
5253
  if (!searchQuery.trim()) {
4866
5254
  setSearchResults([]);
4867
5255
  setCurrentSearchResult(-1);
@@ -4879,7 +5267,7 @@ var SlidePresentation = ({
4879
5267
  setSearchResults(results);
4880
5268
  setCurrentSearchResult(-1);
4881
5269
  }, [searchQuery, slides]);
4882
- const navigateToSearchResult = useCallback2((resultIndex) => {
5270
+ const navigateToSearchResult = useCallback3((resultIndex) => {
4883
5271
  if (searchResults.length === 0)
4884
5272
  return;
4885
5273
  let newIndex = resultIndex;
@@ -4894,22 +5282,22 @@ var SlidePresentation = ({
4894
5282
  navigateToSlide(targetSlide);
4895
5283
  }
4896
5284
  }, [searchResults, navigateToSlide, currentSlide, currentSearchResult]);
4897
- const closeSearch = useCallback2(() => {
5285
+ const closeSearch = useCallback3(() => {
4898
5286
  setShowSearch(false);
4899
5287
  }, []);
4900
- const clearSearch = useCallback2(() => {
5288
+ const clearSearch = useCallback3(() => {
4901
5289
  setSearchQuery("");
4902
5290
  setSearchResults([]);
4903
5291
  setCurrentSearchResult(-1);
4904
5292
  setSearchStartSlide(0);
4905
5293
  }, []);
4906
- const goToPreviousSlide = useCallback2(() => {
5294
+ const goToPreviousSlide = useCallback3(() => {
4907
5295
  navigateToSlide(currentSlide - 1);
4908
5296
  }, [currentSlide, navigateToSlide]);
4909
- const goToNextSlide = useCallback2(() => {
5297
+ const goToNextSlide = useCallback3(() => {
4910
5298
  navigateToSlide(currentSlide + 1);
4911
5299
  }, [currentSlide, navigateToSlide]);
4912
- const toggleFullscreen = useCallback2(() => {
5300
+ const toggleFullscreen = useCallback3(() => {
4913
5301
  if (!containerRef.current)
4914
5302
  return;
4915
5303
  if (!isFullscreen) {
@@ -4920,7 +5308,7 @@ var SlidePresentation = ({
4920
5308
  setIsFullscreen(false);
4921
5309
  }
4922
5310
  }, [isFullscreen]);
4923
- useEffect9(() => {
5311
+ useEffect10(() => {
4924
5312
  const handleKeyDown = (event) => {
4925
5313
  if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
4926
5314
  if (showSearch && (event.key === "Tab" || event.key === "Enter" || event.key === "Escape")) {} else {
@@ -5038,7 +5426,7 @@ var SlidePresentation = ({
5038
5426
  currentSearchResult,
5039
5427
  tocDisplayMode
5040
5428
  ]);
5041
- useEffect9(() => {
5429
+ useEffect10(() => {
5042
5430
  if (currentSlide >= slides.length && slides.length > 0) {
5043
5431
  setCurrentSlide(slides.length - 1);
5044
5432
  }
@@ -5499,7 +5887,7 @@ var SlidePresentation = ({
5499
5887
  };
5500
5888
  // industryMarkdown/components/SlidePresentationBook.tsx
5501
5889
  import { AnimatedResizableLayout as AnimatedResizableLayout2 } from "@principal-ade/panels";
5502
- import React18, { useState as useState11, useCallback as useCallback3, useRef as useRef10, useEffect as useEffect10 } from "react";
5890
+ import React18, { useState as useState12, useCallback as useCallback4, useRef as useRef11, useEffect as useEffect11 } from "react";
5503
5891
  var SlidePresentationBook = ({
5504
5892
  slides,
5505
5893
  initialSlide = 0,
@@ -5529,8 +5917,8 @@ var SlidePresentationBook = ({
5529
5917
  repositoryInfo,
5530
5918
  width
5531
5919
  }) => {
5532
- const [isMobile, setIsMobile] = useState11(false);
5533
- useEffect10(() => {
5920
+ const [isMobile, setIsMobile] = useState12(false);
5921
+ useEffect11(() => {
5534
5922
  const checkMobile = () => {
5535
5923
  setIsMobile(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768);
5536
5924
  };
@@ -5541,20 +5929,20 @@ var SlidePresentationBook = ({
5541
5929
  const effectiveTocDisplayMode = isMobile && viewMode === "single" ? "overlay" : tocDisplayMode ?? (viewMode === "single" ? "sidebar" : "overlay");
5542
5930
  const defaultTocOpen = initialTocOpen ?? false;
5543
5931
  const adjustedInitialSlide = viewMode === "book" ? Math.floor(initialSlide / 2) * 2 : initialSlide;
5544
- const [currentSlide, setCurrentSlide] = useState11(adjustedInitialSlide);
5545
- const [isFullscreen, setIsFullscreen] = useState11(false);
5546
- const [showTOC, setShowTOC] = useState11(defaultTocOpen);
5547
- const [showSearch, setShowSearch] = useState11(false);
5548
- const [searchQuery, setSearchQuery] = useState11("");
5549
- const [searchResults, setSearchResults] = useState11([]);
5550
- const [currentSearchResult, setCurrentSearchResult] = useState11(-1);
5551
- const [searchStartSlide, setSearchStartSlide] = useState11(0);
5552
- const [collapsedSide, setCollapsedSide] = useState11(null);
5553
- const [lastInteractedSide, setLastInteractedSide] = useState11("left");
5554
- const containerRef = useRef10(null);
5932
+ const [currentSlide, setCurrentSlide] = useState12(adjustedInitialSlide);
5933
+ const [isFullscreen, setIsFullscreen] = useState12(false);
5934
+ const [showTOC, setShowTOC] = useState12(defaultTocOpen);
5935
+ const [showSearch, setShowSearch] = useState12(false);
5936
+ const [searchQuery, setSearchQuery] = useState12("");
5937
+ const [searchResults, setSearchResults] = useState12([]);
5938
+ const [currentSearchResult, setCurrentSearchResult] = useState12(-1);
5939
+ const [searchStartSlide, setSearchStartSlide] = useState12(0);
5940
+ const [collapsedSide, setCollapsedSide] = useState12(null);
5941
+ const [lastInteractedSide, setLastInteractedSide] = useState12("left");
5942
+ const containerRef = useRef11(null);
5555
5943
  const slideTitles = extractAllSlideTitles(slides);
5556
5944
  const stepSize = viewMode === "book" ? 2 : 1;
5557
- const navigateToSlide = useCallback3((slideIndex) => {
5945
+ const navigateToSlide = useCallback4((slideIndex) => {
5558
5946
  const targetSlide = viewMode === "book" ? Math.floor(slideIndex / 2) * 2 : slideIndex;
5559
5947
  if (targetSlide >= 0 && targetSlide < slides.length) {
5560
5948
  setCurrentSlide(targetSlide);
@@ -5564,7 +5952,7 @@ var SlidePresentationBook = ({
5564
5952
  }
5565
5953
  }
5566
5954
  }, [slides.length, onSlideChange, viewMode, effectiveTocDisplayMode]);
5567
- useEffect10(() => {
5955
+ useEffect11(() => {
5568
5956
  if (!searchQuery.trim()) {
5569
5957
  setSearchResults([]);
5570
5958
  setCurrentSearchResult(-1);
@@ -5582,7 +5970,7 @@ var SlidePresentationBook = ({
5582
5970
  setSearchResults(results);
5583
5971
  setCurrentSearchResult(-1);
5584
5972
  }, [searchQuery, slides]);
5585
- const navigateToSearchResult = useCallback3((resultIndex) => {
5973
+ const navigateToSearchResult = useCallback4((resultIndex) => {
5586
5974
  if (searchResults.length === 0)
5587
5975
  return;
5588
5976
  let newIndex = resultIndex;
@@ -5597,22 +5985,22 @@ var SlidePresentationBook = ({
5597
5985
  navigateToSlide(targetSlide);
5598
5986
  }
5599
5987
  }, [searchResults, navigateToSlide, currentSlide, currentSearchResult]);
5600
- const closeSearch = useCallback3(() => {
5988
+ const closeSearch = useCallback4(() => {
5601
5989
  setShowSearch(false);
5602
5990
  }, []);
5603
- const clearSearch = useCallback3(() => {
5991
+ const clearSearch = useCallback4(() => {
5604
5992
  setSearchQuery("");
5605
5993
  setSearchResults([]);
5606
5994
  setCurrentSearchResult(-1);
5607
5995
  setSearchStartSlide(0);
5608
5996
  }, []);
5609
- const goToPreviousSlide = useCallback3(() => {
5997
+ const goToPreviousSlide = useCallback4(() => {
5610
5998
  navigateToSlide(currentSlide - stepSize);
5611
5999
  }, [currentSlide, navigateToSlide, stepSize]);
5612
- const goToNextSlide = useCallback3(() => {
6000
+ const goToNextSlide = useCallback4(() => {
5613
6001
  navigateToSlide(currentSlide + stepSize);
5614
6002
  }, [currentSlide, navigateToSlide, stepSize]);
5615
- const handleCollapseLeft = useCallback3(() => {
6003
+ const handleCollapseLeft = useCallback4(() => {
5616
6004
  if (collapsedSide === "left") {
5617
6005
  setCollapsedSide(null);
5618
6006
  } else if (collapsedSide === "right") {
@@ -5622,7 +6010,7 @@ var SlidePresentationBook = ({
5622
6010
  setCollapsedSide("right");
5623
6011
  }
5624
6012
  }, [collapsedSide]);
5625
- const handleCollapseRight = useCallback3(() => {
6013
+ const handleCollapseRight = useCallback4(() => {
5626
6014
  if (collapsedSide === "right") {
5627
6015
  setCollapsedSide(null);
5628
6016
  } else if (collapsedSide === "left") {
@@ -5632,7 +6020,7 @@ var SlidePresentationBook = ({
5632
6020
  setCollapsedSide("left");
5633
6021
  }
5634
6022
  }, [collapsedSide]);
5635
- const toggleFullscreen = useCallback3(() => {
6023
+ const toggleFullscreen = useCallback4(() => {
5636
6024
  if (!containerRef.current)
5637
6025
  return;
5638
6026
  if (!isFullscreen) {
@@ -5643,7 +6031,7 @@ var SlidePresentationBook = ({
5643
6031
  setIsFullscreen(false);
5644
6032
  }
5645
6033
  }, [isFullscreen]);
5646
- useEffect10(() => {
6034
+ useEffect11(() => {
5647
6035
  const handleKeyDown = (event) => {
5648
6036
  if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
5649
6037
  if (showSearch && (event.key === "Tab" || event.key === "Enter" || event.key === "Escape")) {} else {
@@ -5762,7 +6150,7 @@ var SlidePresentationBook = ({
5762
6150
  searchResults,
5763
6151
  effectiveTocDisplayMode
5764
6152
  ]);
5765
- useEffect10(() => {
6153
+ useEffect11(() => {
5766
6154
  if (currentSlide >= slides.length && slides.length > 0) {
5767
6155
  setCurrentSlide(slides.length - 1);
5768
6156
  }
@@ -6425,7 +6813,7 @@ var SlidePresentationBook = ({
6425
6813
  }));
6426
6814
  };
6427
6815
  // industryMarkdown/components/DocumentView.tsx
6428
- import React19, { useRef as useRef11 } from "react";
6816
+ import React19, { useRef as useRef12 } from "react";
6429
6817
  var DocumentView = ({
6430
6818
  content,
6431
6819
  onCheckboxChange,
@@ -6442,9 +6830,15 @@ var DocumentView = ({
6442
6830
  fontSizeScale,
6443
6831
  theme: theme2,
6444
6832
  transparentBackground = false,
6445
- editable = false
6833
+ editable = false,
6834
+ annotations,
6835
+ activeAnnotationId,
6836
+ renderAnnotation,
6837
+ onSelectionChange,
6838
+ onAnnotationClick,
6839
+ annotationStyle
6446
6840
  }) => {
6447
- const containerRef = useRef11(null);
6841
+ const containerRef = useRef12(null);
6448
6842
  const backgroundColor = transparentBackground ? "transparent" : theme2.colors.background;
6449
6843
  return /* @__PURE__ */ React19.createElement("div", {
6450
6844
  ref: containerRef,
@@ -6476,7 +6870,13 @@ var DocumentView = ({
6476
6870
  repositoryInfo,
6477
6871
  transparentBackground,
6478
6872
  editable,
6479
- containerWidth: width
6873
+ containerWidth: width,
6874
+ annotations,
6875
+ activeAnnotationId,
6876
+ renderAnnotation,
6877
+ onSelectionChange,
6878
+ onAnnotationClick,
6879
+ annotationStyle
6480
6880
  })));
6481
6881
  };
6482
6882
  // industryMarkdown/components/SkillMarkdown.tsx