themed-markdown 0.1.86 → 0.1.87
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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +563 -175
- package/dist/industryMarkdown/components/IndustryHtmlModal.d.ts.map +1 -1
- package/dist/industryMarkdown/components/IndustryMarkdownSlide.d.ts +15 -0
- package/dist/industryMarkdown/components/IndustryMarkdownSlide.d.ts.map +1 -1
- package/dist/industryMarkdown/types/annotations.d.ts +32 -0
- package/dist/industryMarkdown/types/annotations.d.ts.map +1 -0
- package/dist/industryMarkdown/utils/annotationResolver.d.ts +17 -0
- package/dist/industryMarkdown/utils/annotationResolver.d.ts.map +1 -0
- package/dist/industryMarkdown/utils/useAnnotations.d.ts +17 -0
- package/dist/industryMarkdown/utils/useAnnotations.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export { parseMarkdownIntoPresentation, serializePresentationToMarkdown, updateP
|
|
|
23
23
|
export { parseMarkdownChunks } from './industryMarkdown/utils/markdownUtils';
|
|
24
24
|
export type { MarkdownPresentation, MarkdownSlide, MarkdownSource, MarkdownSourceType, RepositoryInfo, MarkdownSlideLocation, } from './industryMarkdown/types/presentation';
|
|
25
25
|
export type { ContentChunk, MarkdownChunk, MermaidChunk, CodeChunk, } from './industryMarkdown/types/customMarkdownChunks';
|
|
26
|
+
export type { Annotation, TextQuoteAnchor, AnnotationSelection, ResolvedAnnotation, } from './industryMarkdown/types/annotations';
|
|
26
27
|
export type { Theme } from '@principal-ade/industry-theme';
|
|
27
28
|
export { theme as defaultTheme } from '@principal-ade/industry-theme';
|
|
28
29
|
export { ThemeProvider, withTheme } from '@principal-ade/industry-theme';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings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B,UAAU,GACX,MAAM,+BAA+B,CAAC"}
|
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
|
|
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
|
|
1919
|
+
import React3, { useCallback, useState as useState3 } from "react";
|
|
1627
1920
|
var useIndustryHtmlModal = () => {
|
|
1628
|
-
const [htmlModalOpen, setHtmlModalOpen] =
|
|
1629
|
-
const [htmlModalContent, setHtmlModalContent] =
|
|
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
|
|
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
|
|
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] =
|
|
1767
|
-
const [isIntersecting, setIsIntersecting] =
|
|
1768
|
-
const [hasRendered, setHasRendered] =
|
|
1769
|
-
const [containerElement, setContainerElement] =
|
|
1770
|
-
const [copiedError, setCopiedError] =
|
|
1771
|
-
const observerRef =
|
|
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
|
-
|
|
2089
|
+
useEffect3(() => {
|
|
1797
2090
|
return () => {
|
|
1798
2091
|
if (observerRef.current) {
|
|
1799
2092
|
observerRef.current.disconnect();
|
|
1800
2093
|
}
|
|
1801
2094
|
};
|
|
1802
2095
|
}, []);
|
|
1803
|
-
|
|
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] =
|
|
2139
|
-
const [hasRendered, setHasRendered] =
|
|
2140
|
-
const [isMounted, setIsMounted] =
|
|
2141
|
-
const [hasError, setHasError] =
|
|
2142
|
-
const containerRef =
|
|
2143
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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] =
|
|
2313
|
-
const [isRunning, setIsRunning] =
|
|
2314
|
-
const dropdownRef =
|
|
2605
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
2606
|
+
const [isRunning, setIsRunning] = useState6(false);
|
|
2607
|
+
const dropdownRef = useRef4(null);
|
|
2315
2608
|
const theme2 = themeOverride ?? theme;
|
|
2316
|
-
|
|
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] =
|
|
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 =
|
|
2781
|
+
const transformedSrc = useMemo2(() => {
|
|
2489
2782
|
return transformImageUrl(src, repositoryInfo);
|
|
2490
2783
|
}, [src, repositoryInfo]);
|
|
2491
|
-
const [hasErrored, setHasErrored] =
|
|
2492
|
-
const retryCount =
|
|
2493
|
-
const mediaStyle =
|
|
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 =
|
|
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] =
|
|
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
|
|
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
|
|
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] =
|
|
3127
|
-
const [hasInitialized, setHasInitialized] =
|
|
3128
|
-
const containerRef =
|
|
3129
|
-
const diagramRef =
|
|
3130
|
-
const [isCalculating, setIsCalculating] =
|
|
3131
|
-
const transformRef =
|
|
3132
|
-
|
|
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
|
-
|
|
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 =
|
|
3307
|
-
|
|
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
|
|
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] =
|
|
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 =
|
|
3876
|
-
const scrollPositionsRef =
|
|
3877
|
-
const [measuredContainerWidth, setMeasuredContainerWidth] =
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
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] =
|
|
3889
|
-
const [mermaidModalCode, setMermaidModalCode] =
|
|
3890
|
-
const [placeholderModalOpen, setPlaceholderModalOpen] =
|
|
3891
|
-
const [placeholderModalData, setPlaceholderModalData] =
|
|
3892
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
},
|
|
4286
|
-
|
|
4287
|
-
|
|
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
|
|
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
|
|
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 =
|
|
4632
|
-
|
|
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] =
|
|
4835
|
-
|
|
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] =
|
|
4846
|
-
const [isFullscreen, setIsFullscreen] =
|
|
4847
|
-
const [showTOC, setShowTOC] =
|
|
4848
|
-
const [showSearch, setShowSearch] =
|
|
4849
|
-
const [searchQuery, setSearchQuery] =
|
|
4850
|
-
const [searchResults, setSearchResults] =
|
|
4851
|
-
const [currentSearchResult, setCurrentSearchResult] =
|
|
4852
|
-
const [searchStartSlide, setSearchStartSlide] =
|
|
4853
|
-
const containerRef =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
5285
|
+
const closeSearch = useCallback3(() => {
|
|
4898
5286
|
setShowSearch(false);
|
|
4899
5287
|
}, []);
|
|
4900
|
-
const clearSearch =
|
|
5288
|
+
const clearSearch = useCallback3(() => {
|
|
4901
5289
|
setSearchQuery("");
|
|
4902
5290
|
setSearchResults([]);
|
|
4903
5291
|
setCurrentSearchResult(-1);
|
|
4904
5292
|
setSearchStartSlide(0);
|
|
4905
5293
|
}, []);
|
|
4906
|
-
const goToPreviousSlide =
|
|
5294
|
+
const goToPreviousSlide = useCallback3(() => {
|
|
4907
5295
|
navigateToSlide(currentSlide - 1);
|
|
4908
5296
|
}, [currentSlide, navigateToSlide]);
|
|
4909
|
-
const goToNextSlide =
|
|
5297
|
+
const goToNextSlide = useCallback3(() => {
|
|
4910
5298
|
navigateToSlide(currentSlide + 1);
|
|
4911
5299
|
}, [currentSlide, navigateToSlide]);
|
|
4912
|
-
const toggleFullscreen =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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] =
|
|
5533
|
-
|
|
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] =
|
|
5545
|
-
const [isFullscreen, setIsFullscreen] =
|
|
5546
|
-
const [showTOC, setShowTOC] =
|
|
5547
|
-
const [showSearch, setShowSearch] =
|
|
5548
|
-
const [searchQuery, setSearchQuery] =
|
|
5549
|
-
const [searchResults, setSearchResults] =
|
|
5550
|
-
const [currentSearchResult, setCurrentSearchResult] =
|
|
5551
|
-
const [searchStartSlide, setSearchStartSlide] =
|
|
5552
|
-
const [collapsedSide, setCollapsedSide] =
|
|
5553
|
-
const [lastInteractedSide, setLastInteractedSide] =
|
|
5554
|
-
const containerRef =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
5988
|
+
const closeSearch = useCallback4(() => {
|
|
5601
5989
|
setShowSearch(false);
|
|
5602
5990
|
}, []);
|
|
5603
|
-
const clearSearch =
|
|
5991
|
+
const clearSearch = useCallback4(() => {
|
|
5604
5992
|
setSearchQuery("");
|
|
5605
5993
|
setSearchResults([]);
|
|
5606
5994
|
setCurrentSearchResult(-1);
|
|
5607
5995
|
setSearchStartSlide(0);
|
|
5608
5996
|
}, []);
|
|
5609
|
-
const goToPreviousSlide =
|
|
5997
|
+
const goToPreviousSlide = useCallback4(() => {
|
|
5610
5998
|
navigateToSlide(currentSlide - stepSize);
|
|
5611
5999
|
}, [currentSlide, navigateToSlide, stepSize]);
|
|
5612
|
-
const goToNextSlide =
|
|
6000
|
+
const goToNextSlide = useCallback4(() => {
|
|
5613
6001
|
navigateToSlide(currentSlide + stepSize);
|
|
5614
6002
|
}, [currentSlide, navigateToSlide, stepSize]);
|
|
5615
|
-
const handleCollapseLeft =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
6816
|
+
import React19, { useRef as useRef12 } from "react";
|
|
6429
6817
|
var DocumentView = ({
|
|
6430
6818
|
content,
|
|
6431
6819
|
onCheckboxChange,
|
|
@@ -6444,7 +6832,7 @@ var DocumentView = ({
|
|
|
6444
6832
|
transparentBackground = false,
|
|
6445
6833
|
editable = false
|
|
6446
6834
|
}) => {
|
|
6447
|
-
const containerRef =
|
|
6835
|
+
const containerRef = useRef12(null);
|
|
6448
6836
|
const backgroundColor = transparentBackground ? "transparent" : theme2.colors.background;
|
|
6449
6837
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
6450
6838
|
ref: containerRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustryHtmlModal.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryHtmlModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"IndustryHtmlModal.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryHtmlModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,eAAO,MAAM,oBAAoB;;;6BAIa,MAAM;;CAUnD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,sBAAsB,4BAyGhG"}
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
import { Theme } from '@principal-ade/industry-theme';
|
|
62
62
|
import { BashCommandOptions, BashCommandResult, RepositoryInfo } from '@principal-ade/markdown-utils';
|
|
63
63
|
import React from 'react';
|
|
64
|
+
import type { Annotation, AnnotationSelection } from '../types/annotations';
|
|
64
65
|
import { KeyboardBinding } from '../types/keyboard';
|
|
65
66
|
export interface IndustryMarkdownSlideProps {
|
|
66
67
|
content: string;
|
|
@@ -94,6 +95,20 @@ export interface IndustryMarkdownSlideProps {
|
|
|
94
95
|
keyboardScrollConfig?: KeyboardScrollConfig;
|
|
95
96
|
repositoryInfo?: RepositoryInfo;
|
|
96
97
|
editable?: boolean;
|
|
98
|
+
annotations?: Annotation[];
|
|
99
|
+
activeAnnotationId?: string | null;
|
|
100
|
+
renderAnnotation?: (annotation: Annotation) => React.ReactNode;
|
|
101
|
+
onSelectionChange?: (selection: AnnotationSelection | null) => void;
|
|
102
|
+
onAnnotationClick?: (annotationId: string, event: MouseEvent) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Color overrides for annotation highlights. Each field is any valid CSS
|
|
105
|
+
* color (hex, rgba, var(...), etc.). Omit a field to keep the default
|
|
106
|
+
* amber palette.
|
|
107
|
+
*/
|
|
108
|
+
annotationStyle?: {
|
|
109
|
+
backgroundColor?: string;
|
|
110
|
+
activeBackgroundColor?: string;
|
|
111
|
+
};
|
|
97
112
|
}
|
|
98
113
|
export interface KeyboardScrollConfig {
|
|
99
114
|
scrollAmount?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustryMarkdownSlide.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMarkdownSlide.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAE,KAAK,EAAyB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAA6E,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IndustryMarkdownSlide.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/components/IndustryMarkdownSlide.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAA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pB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAGD,wBAAgB,4BAA4B,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,eAAe,EAAE,CA8D7F;AAED,eAAO,MAAM,qBAAqB,wDAwuBhC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline annotation types.
|
|
3
|
+
*
|
|
4
|
+
* Anchors follow the W3C text-quote selector model: callers identify a
|
|
5
|
+
* span by quoted text plus optional surrounding context, and the renderer
|
|
6
|
+
* resolves it against the live DOM. See:
|
|
7
|
+
* https://www.w3.org/TR/annotation-model/#text-quote-selector
|
|
8
|
+
*/
|
|
9
|
+
export interface TextQuoteAnchor {
|
|
10
|
+
exact: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
suffix?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Annotation<TMetadata = unknown> {
|
|
15
|
+
id: string;
|
|
16
|
+
anchor: TextQuoteAnchor;
|
|
17
|
+
metadata?: TMetadata;
|
|
18
|
+
/**
|
|
19
|
+
* Optional count rendered as a small badge in the top-right of the
|
|
20
|
+
* highlight (e.g. number of notes attached to this anchor). Omit, or set
|
|
21
|
+
* to 0, to hide.
|
|
22
|
+
*/
|
|
23
|
+
count?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolvedAnnotation<TMetadata = unknown> extends Annotation<TMetadata> {
|
|
26
|
+
resolved: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface AnnotationSelection {
|
|
29
|
+
anchor: TextQuoteAnchor;
|
|
30
|
+
rect: DOMRect;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/types/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU,CAAC,SAAS,GAAG,OAAO;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB,CAAC,SAAS,GAAG,OAAO,CAAE,SAAQ,UAAU,CAAC,SAAS,CAAC;IACpF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;CACf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TextQuoteAnchor } from '../types/annotations';
|
|
2
|
+
/**
|
|
3
|
+
* Locate `anchor` in `root`'s rendered text and return a Range covering the
|
|
4
|
+
* matched span. Returns null when the anchor cannot be resolved (orphan).
|
|
5
|
+
*
|
|
6
|
+
* Strategy: build a flat string of the visible text content (skipping code
|
|
7
|
+
* blocks and our own marker spans), search for `prefix + exact + suffix`,
|
|
8
|
+
* then map the offsets back to the underlying Text nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveTextQuote(root: HTMLElement, anchor: TextQuoteAnchor): Range | null;
|
|
11
|
+
/**
|
|
12
|
+
* Build a text-quote anchor for the current Selection inside `root`. Uses up
|
|
13
|
+
* to `contextLength` characters on each side as prefix/suffix so the anchor
|
|
14
|
+
* survives non-local edits.
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectionToAnchor(root: HTMLElement, selection: Selection, contextLength?: number): TextQuoteAnchor | null;
|
|
17
|
+
//# sourceMappingURL=annotationResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotationResolver.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/utils/annotationResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA2C5D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,KAAK,GAAG,IAAI,CAoBzF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS,EACpB,aAAa,SAAK,GACjB,eAAe,GAAG,IAAI,CAsBxB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { Annotation, AnnotationSelection, TextQuoteAnchor } from '../types/annotations';
|
|
3
|
+
interface UseAnnotationsParams<TMetadata> {
|
|
4
|
+
rootRef: RefObject<HTMLElement | null>;
|
|
5
|
+
annotations: Annotation<TMetadata>[];
|
|
6
|
+
activeAnnotationId?: string | null;
|
|
7
|
+
onSelectionChange?: (selection: AnnotationSelection | null) => void;
|
|
8
|
+
onAnnotationClick?: (annotationId: string, event: MouseEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AnnotationMount<TMetadata> {
|
|
11
|
+
annotation: Annotation<TMetadata>;
|
|
12
|
+
host: HTMLElement;
|
|
13
|
+
resolved: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function useAnnotations<TMetadata>({ rootRef, annotations, activeAnnotationId, onSelectionChange, onAnnotationClick, }: UseAnnotationsParams<TMetadata>): AnnotationMount<TMetadata>[];
|
|
16
|
+
export type { TextQuoteAnchor };
|
|
17
|
+
//# sourceMappingURL=useAnnotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnotations.d.ts","sourceRoot":"","sources":["../../../industryMarkdown/utils/useAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9F,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAgB7F,UAAU,oBAAoB,CAAC,SAAS;IACtC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACvC,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;IACpE,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,eAAe,CAAC,SAAS;IACxC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AA4DD,wBAAgB,cAAc,CAAC,SAAS,EAAE,EACxC,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,EAAE,oBAAoB,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAqKhE;AAED,YAAY,EAAE,eAAe,EAAE,CAAC"}
|