themed-markdown 0.1.35 → 0.1.36

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 CHANGED
@@ -2,10 +2,14 @@ export { IndustryMarkdownSlide } from './industryMarkdown/components/IndustryMar
2
2
  export type { IndustryMarkdownSlideProps } from './industryMarkdown/components/IndustryMarkdownSlide';
3
3
  export { SlidePresentation } from './industryMarkdown/components/SlidePresentation';
4
4
  export type { SlidePresentationProps } from './industryMarkdown/components/SlidePresentation';
5
+ export { SlidePresentationBook } from './industryMarkdown/components/SlidePresentationBook';
6
+ export type { SlidePresentationBookProps } from './industryMarkdown/components/SlidePresentationBook';
5
7
  export { DocumentView } from './industryMarkdown/components/DocumentView';
6
8
  export type { DocumentViewProps } from './industryMarkdown/components/DocumentView';
7
- export { IndustryEditableMarkdownSlide } from './industryMarkdown/components/IndustryEditableMarkdownSlide';
8
- export type { IndustryEditableMarkdownSlideProps } from './industryMarkdown/components/IndustryEditableMarkdownSlide';
9
+ export { SlideNavigationHeader } from './industryMarkdown/components/SlideNavigationHeader';
10
+ export type { SlideNavigationHeaderProps } from './industryMarkdown/components/SlideNavigationHeader';
11
+ export { SlideSearchBar } from './industryMarkdown/components/SlideSearchBar';
12
+ export type { SlideSearchBarProps, SearchResult } from './industryMarkdown/components/SlideSearchBar';
9
13
  export { createIndustryMarkdownComponents } from './industryMarkdown/components/IndustryMarkdownComponents';
10
14
  export { IndustryHtmlModal, useIndustryHtmlModal } from './industryMarkdown/components/IndustryHtmlModal';
11
15
  export { IndustryPlaceholderModal } from './industryMarkdown/components/IndustryPlaceholderModal';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,YAAY,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AAEtG,OAAO,EAAE,iBAAiB,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E,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AACtG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8DAA8D,CAAC;AAG9G,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,uCAAuC,EACvC,sBAAsB,EACtB,iBAAiB,EACjB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAE/C,YAAY,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,SAAS,GACV,MAAM,+CAA+C,CAAC;AAGvD,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACX,MAAM,wBAAwB,CAAC"}
package/dist/index.mjs CHANGED
@@ -4705,8 +4705,517 @@ var SlidePresentation = ({
4705
4705
  onClear: clearSearch
4706
4706
  }));
4707
4707
  };
4708
+ // industryMarkdown/components/SlidePresentationBook.tsx
4709
+ import React16, { useState as useState11, useCallback as useCallback3, useRef as useRef10, useEffect as useEffect10 } from "react";
4710
+ var SlidePresentationBook = ({
4711
+ slides,
4712
+ initialSlide = 0,
4713
+ onSlideChange,
4714
+ onCheckboxChange,
4715
+ showNavigation = true,
4716
+ showSlideCounter = true,
4717
+ showFullscreenButton = false,
4718
+ containerHeight = "100%",
4719
+ viewMode = "single",
4720
+ slideIdPrefix = "slide",
4721
+ enableHtmlPopout = true,
4722
+ enableKeyboardScrolling = true,
4723
+ onLinkClick,
4724
+ handleRunBashCommand,
4725
+ handlePromptCopy,
4726
+ fontSizeScale
4727
+ }) => {
4728
+ const adjustedInitialSlide = viewMode === "book" ? Math.floor(initialSlide / 2) * 2 : initialSlide;
4729
+ const [currentSlide, setCurrentSlide] = useState11(adjustedInitialSlide);
4730
+ const [isFullscreen, setIsFullscreen] = useState11(false);
4731
+ const [showTOC, setShowTOC] = useState11(false);
4732
+ const [showSearch, setShowSearch] = useState11(false);
4733
+ const [searchQuery, setSearchQuery] = useState11("");
4734
+ const [searchResults, setSearchResults] = useState11([]);
4735
+ const [currentSearchResult, setCurrentSearchResult] = useState11(-1);
4736
+ const [searchStartSlide, setSearchStartSlide] = useState11(0);
4737
+ const containerRef = useRef10(null);
4738
+ const { theme: theme2 } = useTheme();
4739
+ const slideTitles = extractAllSlideTitles(slides);
4740
+ const stepSize = viewMode === "book" ? 2 : 1;
4741
+ const navigateToSlide = useCallback3((slideIndex) => {
4742
+ const targetSlide = viewMode === "book" ? Math.floor(slideIndex / 2) * 2 : slideIndex;
4743
+ if (targetSlide >= 0 && targetSlide < slides.length) {
4744
+ setCurrentSlide(targetSlide);
4745
+ onSlideChange?.(targetSlide);
4746
+ setShowTOC(false);
4747
+ }
4748
+ }, [slides.length, onSlideChange, viewMode]);
4749
+ useEffect10(() => {
4750
+ if (!searchQuery.trim()) {
4751
+ setSearchResults([]);
4752
+ setCurrentSearchResult(-1);
4753
+ return;
4754
+ }
4755
+ const query = searchQuery.toLowerCase();
4756
+ const results = [];
4757
+ slides.forEach((slide, index) => {
4758
+ const slideText = slide.toLowerCase();
4759
+ const matches = slideText.split(query).length - 1;
4760
+ if (matches > 0) {
4761
+ results.push({ slideIndex: index, count: matches });
4762
+ }
4763
+ });
4764
+ setSearchResults(results);
4765
+ setCurrentSearchResult(-1);
4766
+ }, [searchQuery, slides]);
4767
+ const navigateToSearchResult = useCallback3((resultIndex) => {
4768
+ if (searchResults.length === 0)
4769
+ return;
4770
+ let newIndex = resultIndex;
4771
+ if (currentSearchResult === -1) {
4772
+ newIndex = resultIndex < 0 ? searchResults.length - 1 : 0;
4773
+ } else {
4774
+ newIndex = (resultIndex % searchResults.length + searchResults.length) % searchResults.length;
4775
+ }
4776
+ setCurrentSearchResult(newIndex);
4777
+ const targetSlide = searchResults[newIndex].slideIndex;
4778
+ if (targetSlide !== currentSlide) {
4779
+ navigateToSlide(targetSlide);
4780
+ }
4781
+ }, [searchResults, navigateToSlide, currentSlide, currentSearchResult]);
4782
+ const closeSearch = useCallback3(() => {
4783
+ setShowSearch(false);
4784
+ }, []);
4785
+ const clearSearch = useCallback3(() => {
4786
+ setSearchQuery("");
4787
+ setSearchResults([]);
4788
+ setCurrentSearchResult(-1);
4789
+ setSearchStartSlide(0);
4790
+ }, []);
4791
+ const goToPreviousSlide = useCallback3(() => {
4792
+ navigateToSlide(currentSlide - stepSize);
4793
+ }, [currentSlide, navigateToSlide, stepSize]);
4794
+ const goToNextSlide = useCallback3(() => {
4795
+ navigateToSlide(currentSlide + stepSize);
4796
+ }, [currentSlide, navigateToSlide, stepSize]);
4797
+ const toggleFullscreen = useCallback3(() => {
4798
+ if (!containerRef.current)
4799
+ return;
4800
+ if (!isFullscreen) {
4801
+ containerRef.current.requestFullscreen?.();
4802
+ setIsFullscreen(true);
4803
+ } else {
4804
+ document.exitFullscreen?.();
4805
+ setIsFullscreen(false);
4806
+ }
4807
+ }, [isFullscreen]);
4808
+ useEffect10(() => {
4809
+ const handleKeyDown = (event) => {
4810
+ if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
4811
+ if (showSearch && (event.key === "Tab" || event.key === "Enter" || event.key === "Escape")) {} else {
4812
+ return;
4813
+ }
4814
+ }
4815
+ if ((event.metaKey || event.ctrlKey) && (event.key === "f" || event.key === "F")) {
4816
+ event.preventDefault();
4817
+ event.stopPropagation();
4818
+ if (!showSearch) {
4819
+ setSearchStartSlide(currentSlide);
4820
+ setShowSearch(true);
4821
+ } else {
4822
+ closeSearch();
4823
+ }
4824
+ return;
4825
+ }
4826
+ if (showSearch) {
4827
+ switch (event.key) {
4828
+ case "Escape":
4829
+ event.preventDefault();
4830
+ closeSearch();
4831
+ return;
4832
+ case "Tab":
4833
+ event.preventDefault();
4834
+ if (event.shiftKey) {
4835
+ navigateToSearchResult(currentSearchResult - 1);
4836
+ } else {
4837
+ navigateToSearchResult(currentSearchResult + 1);
4838
+ }
4839
+ return;
4840
+ case "Enter":
4841
+ event.preventDefault();
4842
+ if (currentSearchResult >= 0 && currentSearchResult < searchResults.length) {
4843
+ const targetSlide = searchResults[currentSearchResult].slideIndex;
4844
+ if (targetSlide !== currentSlide) {
4845
+ navigateToSlide(targetSlide);
4846
+ }
4847
+ }
4848
+ closeSearch();
4849
+ return;
4850
+ }
4851
+ return;
4852
+ }
4853
+ switch (event.key) {
4854
+ case "ArrowLeft":
4855
+ event.preventDefault();
4856
+ goToPreviousSlide();
4857
+ break;
4858
+ case "ArrowRight":
4859
+ event.preventDefault();
4860
+ goToNextSlide();
4861
+ break;
4862
+ case " ":
4863
+ event.preventDefault();
4864
+ goToNextSlide();
4865
+ break;
4866
+ case "Enter":
4867
+ event.preventDefault();
4868
+ goToNextSlide();
4869
+ break;
4870
+ case "Backspace":
4871
+ event.preventDefault();
4872
+ goToPreviousSlide();
4873
+ break;
4874
+ case "Home":
4875
+ event.preventDefault();
4876
+ navigateToSlide(0);
4877
+ break;
4878
+ case "End":
4879
+ event.preventDefault();
4880
+ navigateToSlide(slides.length - 1);
4881
+ break;
4882
+ case "f":
4883
+ case "F":
4884
+ if (!event.ctrlKey && !event.metaKey && !event.altKey) {
4885
+ event.preventDefault();
4886
+ toggleFullscreen();
4887
+ }
4888
+ break;
4889
+ case "Escape":
4890
+ if (showTOC) {
4891
+ event.preventDefault();
4892
+ setShowTOC(false);
4893
+ }
4894
+ break;
4895
+ case "t":
4896
+ case "T":
4897
+ if (!event.ctrlKey && !event.metaKey && !event.altKey) {
4898
+ event.preventDefault();
4899
+ setShowTOC((prev) => !prev);
4900
+ }
4901
+ break;
4902
+ }
4903
+ if (!event.ctrlKey && !event.metaKey && !event.altKey) {
4904
+ const num = parseInt(event.key);
4905
+ if (num >= 1 && num <= 9 && num <= slides.length) {
4906
+ event.preventDefault();
4907
+ navigateToSlide(num - 1);
4908
+ }
4909
+ }
4910
+ };
4911
+ window.addEventListener("keydown", handleKeyDown);
4912
+ return () => window.removeEventListener("keydown", handleKeyDown);
4913
+ }, [goToPreviousSlide, goToNextSlide, navigateToSlide, slides.length, toggleFullscreen, showTOC, showSearch, closeSearch, navigateToSearchResult, currentSearchResult, searchResults]);
4914
+ useEffect10(() => {
4915
+ if (currentSlide >= slides.length && slides.length > 0) {
4916
+ setCurrentSlide(slides.length - 1);
4917
+ }
4918
+ }, [slides.length, currentSlide]);
4919
+ const leftSlideIndex = currentSlide;
4920
+ const rightSlideIndex = viewMode === "book" ? currentSlide + 1 : -1;
4921
+ return /* @__PURE__ */ React16.createElement("div", {
4922
+ ref: containerRef,
4923
+ style: {
4924
+ height: containerHeight,
4925
+ display: "flex",
4926
+ flexDirection: "column",
4927
+ backgroundColor: theme2.colors.background,
4928
+ position: "relative"
4929
+ }
4930
+ }, showNavigation && /* @__PURE__ */ React16.createElement(SlideNavigationHeader, {
4931
+ currentSlide,
4932
+ totalSlides: slides.length,
4933
+ showTOC,
4934
+ isFullscreen,
4935
+ showSlideCounter,
4936
+ showFullscreenButton,
4937
+ theme: theme2,
4938
+ onPrevious: goToPreviousSlide,
4939
+ onNext: goToNextSlide,
4940
+ onToggleTOC: () => setShowTOC((prev) => !prev),
4941
+ onToggleFullscreen: toggleFullscreen
4942
+ }), /* @__PURE__ */ React16.createElement("div", {
4943
+ style: {
4944
+ flex: 1,
4945
+ overflow: "hidden",
4946
+ position: "relative",
4947
+ display: "flex"
4948
+ }
4949
+ }, /* @__PURE__ */ React16.createElement("div", {
4950
+ style: {
4951
+ position: "absolute",
4952
+ top: 0,
4953
+ left: 0,
4954
+ bottom: 0,
4955
+ width: "300px",
4956
+ backgroundColor: theme2.colors.backgroundSecondary,
4957
+ borderRight: `1px solid ${theme2.colors.border}`,
4958
+ transform: showTOC ? "translateX(0)" : "translateX(-100%)",
4959
+ transition: "transform 0.3s ease",
4960
+ zIndex: 10,
4961
+ overflowY: "auto",
4962
+ overflowX: "hidden"
4963
+ }
4964
+ }, /* @__PURE__ */ React16.createElement("div", {
4965
+ style: {
4966
+ padding: theme2.space[3],
4967
+ borderBottom: `1px solid ${theme2.colors.border}`,
4968
+ backgroundColor: theme2.colors.background,
4969
+ position: "sticky",
4970
+ top: 0,
4971
+ zIndex: 1
4972
+ }
4973
+ }, /* @__PURE__ */ React16.createElement("h3", {
4974
+ style: {
4975
+ margin: 0,
4976
+ fontSize: theme2.fontSizes[3],
4977
+ fontFamily: theme2.fonts.heading,
4978
+ color: theme2.colors.text,
4979
+ fontWeight: 600
4980
+ }
4981
+ }, "Table of Contents"), /* @__PURE__ */ React16.createElement("p", {
4982
+ style: {
4983
+ margin: `${theme2.space[1]}px 0 0 0`,
4984
+ fontSize: theme2.fontSizes[0],
4985
+ color: theme2.colors.textSecondary,
4986
+ fontFamily: theme2.fonts.body
4987
+ }
4988
+ }, slides.length, " ", slides.length === 1 ? "slide" : "slides")), /* @__PURE__ */ React16.createElement("div", {
4989
+ style: { padding: theme2.space[2] }
4990
+ }, slideTitles.map((title, index) => {
4991
+ const isCurrentPage = viewMode === "book" ? index === leftSlideIndex || index === rightSlideIndex : index === currentSlide;
4992
+ return /* @__PURE__ */ React16.createElement("button", {
4993
+ key: index,
4994
+ onClick: () => navigateToSlide(index),
4995
+ style: {
4996
+ display: "block",
4997
+ width: "100%",
4998
+ padding: `${theme2.space[2]}px ${theme2.space[3]}px`,
4999
+ marginBottom: theme2.space[1],
5000
+ backgroundColor: isCurrentPage ? theme2.colors.primary : "transparent",
5001
+ border: "none",
5002
+ borderRadius: theme2.radii[1],
5003
+ color: isCurrentPage ? theme2.colors.background : theme2.colors.text,
5004
+ fontSize: theme2.fontSizes[1],
5005
+ fontFamily: theme2.fonts.body,
5006
+ textAlign: "left",
5007
+ cursor: "pointer",
5008
+ transition: "all 0.2s ease",
5009
+ position: "relative"
5010
+ },
5011
+ onMouseOver: (e) => {
5012
+ if (!isCurrentPage) {
5013
+ e.currentTarget.style.backgroundColor = theme2.colors.backgroundHover;
5014
+ }
5015
+ },
5016
+ onMouseOut: (e) => {
5017
+ if (!isCurrentPage) {
5018
+ e.currentTarget.style.backgroundColor = "transparent";
5019
+ }
5020
+ }
5021
+ }, /* @__PURE__ */ React16.createElement("div", {
5022
+ style: { display: "flex", alignItems: "center", gap: theme2.space[2] }
5023
+ }, /* @__PURE__ */ React16.createElement("span", {
5024
+ style: {
5025
+ display: "inline-block",
5026
+ minWidth: "24px",
5027
+ fontSize: theme2.fontSizes[0],
5028
+ fontFamily: theme2.fonts.monospace,
5029
+ opacity: 0.6
5030
+ }
5031
+ }, index + 1, "."), /* @__PURE__ */ React16.createElement("span", {
5032
+ style: {
5033
+ flex: 1,
5034
+ overflow: "hidden",
5035
+ textOverflow: "ellipsis",
5036
+ whiteSpace: "nowrap"
5037
+ }
5038
+ }, title)), isCurrentPage && /* @__PURE__ */ React16.createElement("div", {
5039
+ style: {
5040
+ position: "absolute",
5041
+ left: 0,
5042
+ top: "50%",
5043
+ transform: "translateY(-50%)",
5044
+ width: "3px",
5045
+ height: "60%",
5046
+ backgroundColor: isCurrentPage ? theme2.colors.background : theme2.colors.primary,
5047
+ borderRadius: "0 2px 2px 0"
5048
+ }
5049
+ }));
5050
+ }))), showTOC && /* @__PURE__ */ React16.createElement("div", {
5051
+ onClick: () => setShowTOC(false),
5052
+ style: {
5053
+ position: "absolute",
5054
+ top: 0,
5055
+ left: 0,
5056
+ right: 0,
5057
+ bottom: 0,
5058
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
5059
+ zIndex: 9,
5060
+ cursor: "pointer"
5061
+ }
5062
+ }), /* @__PURE__ */ React16.createElement("div", {
5063
+ style: {
5064
+ flex: 1,
5065
+ position: "relative",
5066
+ display: "flex",
5067
+ gap: 0,
5068
+ padding: 0,
5069
+ backgroundColor: theme2.colors.background
5070
+ }
5071
+ }, slides.length > 0 ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement("div", {
5072
+ style: {
5073
+ flex: 1,
5074
+ backgroundColor: "transparent",
5075
+ borderRadius: 0,
5076
+ boxShadow: "none",
5077
+ overflowY: "auto",
5078
+ overflowX: "hidden",
5079
+ position: "relative"
5080
+ }
5081
+ }, /* @__PURE__ */ React16.createElement(IndustryMarkdownSlide, {
5082
+ content: slides[leftSlideIndex] || "",
5083
+ slideIdPrefix: `${slideIdPrefix}-${leftSlideIndex}`,
5084
+ slideIndex: leftSlideIndex,
5085
+ isVisible: true,
5086
+ theme: theme2,
5087
+ onCheckboxChange,
5088
+ enableHtmlPopout,
5089
+ enableKeyboardScrolling,
5090
+ onLinkClick,
5091
+ handleRunBashCommand,
5092
+ handlePromptCopy,
5093
+ fontSizeScale,
5094
+ searchQuery: showSearch ? searchQuery : undefined,
5095
+ transparentBackground: viewMode === "book",
5096
+ additionalPadding: viewMode === "book" ? {
5097
+ left: `${theme2.space[4]}px`,
5098
+ right: `${theme2.space[2]}px`
5099
+ } : undefined,
5100
+ disableScroll: viewMode === "book"
5101
+ }), viewMode === "book" && /* @__PURE__ */ React16.createElement("div", {
5102
+ style: {
5103
+ position: "absolute",
5104
+ top: 0,
5105
+ right: `${Math.floor(theme2.space[2] / 2)}px`,
5106
+ bottom: 0,
5107
+ width: "1px",
5108
+ backgroundColor: theme2.colors.border
5109
+ }
5110
+ })), viewMode === "book" && rightSlideIndex < slides.length && /* @__PURE__ */ React16.createElement("div", {
5111
+ style: {
5112
+ flex: 1,
5113
+ backgroundColor: "transparent",
5114
+ borderRadius: 0,
5115
+ boxShadow: "none",
5116
+ overflowY: "auto",
5117
+ overflowX: "hidden",
5118
+ position: "relative"
5119
+ }
5120
+ }, /* @__PURE__ */ React16.createElement(IndustryMarkdownSlide, {
5121
+ content: slides[rightSlideIndex] || "",
5122
+ slideIdPrefix: `${slideIdPrefix}-${rightSlideIndex}`,
5123
+ slideIndex: rightSlideIndex,
5124
+ isVisible: true,
5125
+ theme: theme2,
5126
+ onCheckboxChange,
5127
+ enableHtmlPopout,
5128
+ enableKeyboardScrolling,
5129
+ onLinkClick,
5130
+ handleRunBashCommand,
5131
+ handlePromptCopy,
5132
+ fontSizeScale,
5133
+ searchQuery: showSearch ? searchQuery : undefined,
5134
+ transparentBackground: true,
5135
+ additionalPadding: {
5136
+ left: `${theme2.space[2]}px`,
5137
+ right: `${theme2.space[4]}px`
5138
+ },
5139
+ disableScroll: true
5140
+ })), viewMode === "book" && rightSlideIndex >= slides.length && /* @__PURE__ */ React16.createElement("div", {
5141
+ style: {
5142
+ flex: 1,
5143
+ backgroundColor: "transparent",
5144
+ borderRadius: 0,
5145
+ boxShadow: "none",
5146
+ display: "flex",
5147
+ alignItems: "center",
5148
+ justifyContent: "center",
5149
+ color: theme2.colors.muted,
5150
+ fontSize: theme2.fontSizes[1],
5151
+ fontFamily: theme2.fonts.body,
5152
+ fontStyle: "italic",
5153
+ padding: `0 ${theme2.space[4]}px 0 ${theme2.space[2]}px`
5154
+ }
5155
+ }, "End of presentation")) : /* @__PURE__ */ React16.createElement("div", {
5156
+ style: {
5157
+ height: "100%",
5158
+ display: "flex",
5159
+ alignItems: "center",
5160
+ justifyContent: "center",
5161
+ color: theme2.colors.muted,
5162
+ fontSize: theme2.fontSizes[2],
5163
+ fontFamily: theme2.fonts.body
5164
+ }
5165
+ }, "No slides available")), viewMode === "book" && slides.length > 0 && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement("div", {
5166
+ style: {
5167
+ position: "absolute",
5168
+ bottom: theme2.space[3],
5169
+ left: theme2.space[3],
5170
+ fontSize: theme2.fontSizes[0],
5171
+ color: theme2.colors.textSecondary,
5172
+ fontFamily: theme2.fonts.monospace
5173
+ }
5174
+ }, leftSlideIndex + 1), rightSlideIndex < slides.length && /* @__PURE__ */ React16.createElement("div", {
5175
+ style: {
5176
+ position: "absolute",
5177
+ bottom: theme2.space[3],
5178
+ right: theme2.space[3],
5179
+ fontSize: theme2.fontSizes[0],
5180
+ color: theme2.colors.textSecondary,
5181
+ fontFamily: theme2.fonts.monospace
5182
+ }
5183
+ }, rightSlideIndex + 1))), showNavigation && slides.length > 1 && /* @__PURE__ */ React16.createElement("div", {
5184
+ style: {
5185
+ position: "absolute",
5186
+ bottom: 0,
5187
+ left: 0,
5188
+ right: 0,
5189
+ height: "2px",
5190
+ backgroundColor: theme2.colors.border,
5191
+ opacity: 0.3
5192
+ }
5193
+ }, /* @__PURE__ */ React16.createElement("div", {
5194
+ style: {
5195
+ height: "100%",
5196
+ width: `${(currentSlide + stepSize) / slides.length * 100}%`,
5197
+ backgroundColor: theme2.colors.primary,
5198
+ transition: "width 0.3s ease"
5199
+ }
5200
+ })), /* @__PURE__ */ React16.createElement(SlideSearchBar, {
5201
+ showSearch,
5202
+ searchQuery,
5203
+ setSearchQuery,
5204
+ searchResults,
5205
+ currentSearchResult,
5206
+ searchStartSlide,
5207
+ slideTitles,
5208
+ theme: theme2,
5209
+ onResultClick: (index, slideIndex) => {
5210
+ setCurrentSearchResult(index);
5211
+ navigateToSlide(slideIndex);
5212
+ },
5213
+ onClose: closeSearch,
5214
+ onClear: clearSearch
5215
+ }));
5216
+ };
4708
5217
  // industryMarkdown/components/DocumentView.tsx
4709
- import React16, { useRef as useRef10, useCallback as useCallback3 } from "react";
5218
+ import React17, { useRef as useRef11, useCallback as useCallback4 } from "react";
4710
5219
  var DocumentView = ({
4711
5220
  content,
4712
5221
  showSegmented = true,
@@ -4725,10 +5234,10 @@ var DocumentView = ({
4725
5234
  repositoryInfo,
4726
5235
  fontSizeScale
4727
5236
  }) => {
4728
- const containerRef = useRef10(null);
4729
- const sectionRefs = useRef10([]);
5237
+ const containerRef = useRef11(null);
5238
+ const sectionRefs = useRef11([]);
4730
5239
  const { theme: theme2 } = useTheme();
4731
- const scrollToSection = useCallback3((sectionIndex) => {
5240
+ const scrollToSection = useCallback4((sectionIndex) => {
4732
5241
  if (sectionRefs.current[sectionIndex]) {
4733
5242
  sectionRefs.current[sectionIndex]?.scrollIntoView({
4734
5243
  behavior: "smooth",
@@ -4736,12 +5245,12 @@ var DocumentView = ({
4736
5245
  });
4737
5246
  }
4738
5247
  }, []);
4739
- const handleSectionClick = useCallback3((index) => {
5248
+ const handleSectionClick = useCallback4((index) => {
4740
5249
  scrollToSection(index);
4741
5250
  onSectionClick?.(index);
4742
5251
  }, [scrollToSection, onSectionClick]);
4743
5252
  if (typeof content === "string") {
4744
- return /* @__PURE__ */ React16.createElement("div", {
5253
+ return /* @__PURE__ */ React17.createElement("div", {
4745
5254
  ref: containerRef,
4746
5255
  style: {
4747
5256
  height: "100%",
@@ -4749,12 +5258,12 @@ var DocumentView = ({
4749
5258
  backgroundColor: theme2.colors.background,
4750
5259
  padding: typeof padding === "number" ? `${padding}px` : padding
4751
5260
  }
4752
- }, /* @__PURE__ */ React16.createElement("div", {
5261
+ }, /* @__PURE__ */ React17.createElement("div", {
4753
5262
  style: {
4754
5263
  maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth,
4755
5264
  margin: "0 auto"
4756
5265
  }
4757
- }, /* @__PURE__ */ React16.createElement(IndustryMarkdownSlide, {
5266
+ }, /* @__PURE__ */ React17.createElement(IndustryMarkdownSlide, {
4758
5267
  content,
4759
5268
  slideIdPrefix,
4760
5269
  slideIndex: 0,
@@ -4776,7 +5285,7 @@ var DocumentView = ({
4776
5285
  ---
4777
5286
 
4778
5287
  `);
4779
- return /* @__PURE__ */ React16.createElement("div", {
5288
+ return /* @__PURE__ */ React17.createElement("div", {
4780
5289
  ref: containerRef,
4781
5290
  style: {
4782
5291
  height: "100%",
@@ -4784,12 +5293,12 @@ var DocumentView = ({
4784
5293
  backgroundColor: theme2.colors.background,
4785
5294
  padding: typeof padding === "number" ? `${padding}px` : padding
4786
5295
  }
4787
- }, /* @__PURE__ */ React16.createElement("div", {
5296
+ }, /* @__PURE__ */ React17.createElement("div", {
4788
5297
  style: {
4789
5298
  maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth,
4790
5299
  margin: "0 auto"
4791
5300
  }
4792
- }, /* @__PURE__ */ React16.createElement(IndustryMarkdownSlide, {
5301
+ }, /* @__PURE__ */ React17.createElement(IndustryMarkdownSlide, {
4793
5302
  content: fullContent,
4794
5303
  slideIdPrefix,
4795
5304
  slideIndex: 0,
@@ -4805,7 +5314,7 @@ var DocumentView = ({
4805
5314
  repositoryInfo
4806
5315
  })));
4807
5316
  }
4808
- return /* @__PURE__ */ React16.createElement("div", {
5317
+ return /* @__PURE__ */ React17.createElement("div", {
4809
5318
  ref: containerRef,
4810
5319
  style: {
4811
5320
  height: "100%",
@@ -4813,12 +5322,12 @@ var DocumentView = ({
4813
5322
  backgroundColor: theme2.colors.background,
4814
5323
  padding: typeof padding === "number" ? `${padding}px` : padding
4815
5324
  }
4816
- }, /* @__PURE__ */ React16.createElement("div", {
5325
+ }, /* @__PURE__ */ React17.createElement("div", {
4817
5326
  style: {
4818
5327
  maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth,
4819
5328
  margin: "0 auto"
4820
5329
  }
4821
- }, content.map((slideContent, index) => /* @__PURE__ */ React16.createElement("div", {
5330
+ }, content.map((slideContent, index) => /* @__PURE__ */ React17.createElement("div", {
4822
5331
  key: index,
4823
5332
  ref: (el) => {
4824
5333
  if (el)
@@ -4828,7 +5337,7 @@ var DocumentView = ({
4828
5337
  marginBottom: index < content.length - 1 ? "48px" : "0",
4829
5338
  scrollMarginTop: "20px"
4830
5339
  }
4831
- }, showSectionHeaders && /* @__PURE__ */ React16.createElement("div", {
5340
+ }, showSectionHeaders && /* @__PURE__ */ React17.createElement("div", {
4832
5341
  onClick: () => handleSectionClick(index),
4833
5342
  style: {
4834
5343
  display: "flex",
@@ -4847,7 +5356,7 @@ var DocumentView = ({
4847
5356
  onMouseOut: (e) => {
4848
5357
  e.currentTarget.style.opacity = "0.7";
4849
5358
  }
4850
- }, /* @__PURE__ */ React16.createElement("span", {
5359
+ }, /* @__PURE__ */ React17.createElement("span", {
4851
5360
  style: {
4852
5361
  fontSize: "11px",
4853
5362
  fontWeight: 600,
@@ -4855,7 +5364,7 @@ var DocumentView = ({
4855
5364
  textTransform: "uppercase",
4856
5365
  letterSpacing: "0.5px"
4857
5366
  }
4858
- }, "Section ", index + 1, " of ", content.length)), /* @__PURE__ */ React16.createElement(IndustryMarkdownSlide, {
5367
+ }, "Section ", index + 1, " of ", content.length)), /* @__PURE__ */ React17.createElement(IndustryMarkdownSlide, {
4859
5368
  content: slideContent,
4860
5369
  slideIdPrefix: `${slideIdPrefix}-${index}`,
4861
5370
  slideIndex: index,
@@ -4869,7 +5378,7 @@ var DocumentView = ({
4869
5378
  fontSizeScale,
4870
5379
  handlePromptCopy,
4871
5380
  repositoryInfo
4872
- }), showSeparators && index < content.length - 1 && /* @__PURE__ */ React16.createElement("div", {
5381
+ }), showSeparators && index < content.length - 1 && /* @__PURE__ */ React17.createElement("div", {
4873
5382
  style: {
4874
5383
  marginTop: "32px",
4875
5384
  marginBottom: "32px",
@@ -4879,221 +5388,6 @@ var DocumentView = ({
4879
5388
  }
4880
5389
  })))));
4881
5390
  };
4882
- // industryMarkdown/components/IndustryEditableMarkdownSlide.tsx
4883
- import { Pencil, Save, X as X3 } from "lucide-react";
4884
- import React17, { useState as useState11, useCallback as useCallback4, useRef as useRef11, useEffect as useEffect10 } from "react";
4885
- var IndustryEditableMarkdownSlide = ({
4886
- content,
4887
- onContentChange,
4888
- onSave,
4889
- autoSaveDelay = 1000,
4890
- editable = true,
4891
- showEditButton = true,
4892
- theme: themeProp,
4893
- ...slideProps
4894
- }) => {
4895
- let contextTheme;
4896
- try {
4897
- const themeContext = useTheme();
4898
- contextTheme = themeContext.theme;
4899
- } catch {}
4900
- const theme2 = themeProp || contextTheme;
4901
- if (!theme2) {
4902
- throw new Error("IndustryEditableMarkdownSlide: theme must be provided either as a prop or through ThemeProvider");
4903
- }
4904
- const [isEditing, setIsEditing] = useState11(false);
4905
- const [editContent, setEditContent] = useState11(content);
4906
- const [isSaving, setIsSaving] = useState11(false);
4907
- const textareaRef = useRef11(null);
4908
- const saveTimeoutRef = useRef11(undefined);
4909
- useEffect10(() => {
4910
- setEditContent(content);
4911
- }, [content]);
4912
- useEffect10(() => {
4913
- if (isEditing && autoSaveDelay && onSave) {
4914
- if (saveTimeoutRef.current) {
4915
- clearTimeout(saveTimeoutRef.current);
4916
- }
4917
- saveTimeoutRef.current = setTimeout(() => {
4918
- handleSave(false);
4919
- }, autoSaveDelay);
4920
- }
4921
- return () => {
4922
- if (saveTimeoutRef.current) {
4923
- clearTimeout(saveTimeoutRef.current);
4924
- }
4925
- };
4926
- }, [editContent, isEditing, autoSaveDelay]);
4927
- const handleEdit = useCallback4(() => {
4928
- setIsEditing(true);
4929
- setTimeout(() => {
4930
- textareaRef.current?.focus();
4931
- textareaRef.current?.setSelectionRange(0, 0);
4932
- }, 100);
4933
- }, []);
4934
- const handleCancel = useCallback4(() => {
4935
- setEditContent(content);
4936
- setIsEditing(false);
4937
- }, [content]);
4938
- const handleSave = useCallback4(async (exitEditMode = true) => {
4939
- if (onContentChange) {
4940
- onContentChange(editContent);
4941
- }
4942
- if (onSave) {
4943
- setIsSaving(true);
4944
- try {
4945
- await onSave(editContent);
4946
- } catch (error) {
4947
- console.error("Failed to save:", error);
4948
- } finally {
4949
- setIsSaving(false);
4950
- }
4951
- }
4952
- if (exitEditMode) {
4953
- setIsEditing(false);
4954
- }
4955
- }, [editContent, onContentChange, onSave]);
4956
- const handleKeyDown = useCallback4((e) => {
4957
- if (e.key === "Escape") {
4958
- handleCancel();
4959
- } else if ((e.metaKey || e.ctrlKey) && e.key === "s") {
4960
- e.preventDefault();
4961
- handleSave();
4962
- }
4963
- }, [handleCancel, handleSave]);
4964
- const handleTextareaChange = useCallback4((e) => {
4965
- const textarea = e.target;
4966
- setEditContent(textarea.value);
4967
- textarea.style.height = "auto";
4968
- textarea.style.height = `${textarea.scrollHeight}px`;
4969
- }, []);
4970
- if (isEditing) {
4971
- return /* @__PURE__ */ React17.createElement("div", {
4972
- style: {
4973
- height: "100%",
4974
- display: "flex",
4975
- flexDirection: "column",
4976
- backgroundColor: theme2.colors.background,
4977
- color: theme2.colors.text
4978
- }
4979
- }, /* @__PURE__ */ React17.createElement("div", {
4980
- style: {
4981
- display: "flex",
4982
- justifyContent: "space-between",
4983
- alignItems: "center",
4984
- padding: theme2.space[3],
4985
- borderBottom: `1px solid ${theme2.colors.border}`,
4986
- backgroundColor: theme2.colors.muted
4987
- }
4988
- }, /* @__PURE__ */ React17.createElement("div", {
4989
- style: {
4990
- display: "flex",
4991
- alignItems: "center",
4992
- gap: theme2.space[2],
4993
- fontSize: theme2.fontSizes[1],
4994
- color: theme2.colors.textSecondary
4995
- }
4996
- }, /* @__PURE__ */ React17.createElement(Pencil, {
4997
- size: 16
4998
- }), /* @__PURE__ */ React17.createElement("span", null, "Editing Mode"), autoSaveDelay && /* @__PURE__ */ React17.createElement("span", null, "(Auto-save enabled)")), /* @__PURE__ */ React17.createElement("div", {
4999
- style: {
5000
- display: "flex",
5001
- gap: theme2.space[2]
5002
- }
5003
- }, /* @__PURE__ */ React17.createElement("button", {
5004
- onClick: () => handleSave(),
5005
- disabled: isSaving,
5006
- style: {
5007
- display: "flex",
5008
- alignItems: "center",
5009
- gap: theme2.space[1],
5010
- padding: `${theme2.space[1]}px ${theme2.space[3]}px`,
5011
- backgroundColor: theme2.colors.primary,
5012
- color: theme2.colors.background,
5013
- border: "none",
5014
- borderRadius: theme2.radii[1],
5015
- fontSize: theme2.fontSizes[1],
5016
- cursor: isSaving ? "not-allowed" : "pointer",
5017
- opacity: isSaving ? 0.7 : 1
5018
- }
5019
- }, /* @__PURE__ */ React17.createElement(Save, {
5020
- size: 14
5021
- }), isSaving ? "Saving..." : "Save"), /* @__PURE__ */ React17.createElement("button", {
5022
- onClick: handleCancel,
5023
- style: {
5024
- display: "flex",
5025
- alignItems: "center",
5026
- gap: theme2.space[1],
5027
- padding: `${theme2.space[1]}px ${theme2.space[3]}px`,
5028
- backgroundColor: theme2.colors.secondary,
5029
- color: theme2.colors.text,
5030
- border: "none",
5031
- borderRadius: theme2.radii[1],
5032
- fontSize: theme2.fontSizes[1],
5033
- cursor: "pointer"
5034
- }
5035
- }, /* @__PURE__ */ React17.createElement(X3, {
5036
- size: 14
5037
- }), "Cancel"))), /* @__PURE__ */ React17.createElement("div", {
5038
- style: {
5039
- flex: 1,
5040
- padding: theme2.space[4],
5041
- overflow: "auto"
5042
- }
5043
- }, /* @__PURE__ */ React17.createElement("textarea", {
5044
- ref: textareaRef,
5045
- value: editContent,
5046
- onChange: handleTextareaChange,
5047
- onKeyDown: handleKeyDown,
5048
- style: {
5049
- width: "100%",
5050
- minHeight: "100%",
5051
- padding: theme2.space[3],
5052
- backgroundColor: theme2.colors.background,
5053
- color: theme2.colors.text,
5054
- border: `1px solid ${theme2.colors.border}`,
5055
- borderRadius: theme2.radii[2],
5056
- fontFamily: theme2.fonts.monospace,
5057
- fontSize: theme2.fontSizes[1],
5058
- lineHeight: theme2.lineHeights.relaxed,
5059
- resize: "none",
5060
- outline: "none"
5061
- },
5062
- placeholder: "Enter your markdown content here..."
5063
- })));
5064
- }
5065
- return /* @__PURE__ */ React17.createElement("div", {
5066
- style: { position: "relative", height: "100%" }
5067
- }, editable && showEditButton && /* @__PURE__ */ React17.createElement("button", {
5068
- onClick: handleEdit,
5069
- style: {
5070
- position: "absolute",
5071
- top: theme2.space[3],
5072
- right: theme2.space[3],
5073
- display: "flex",
5074
- alignItems: "center",
5075
- gap: theme2.space[1],
5076
- padding: `${theme2.space[1]}px ${theme2.space[3]}px`,
5077
- backgroundColor: theme2.colors.secondary,
5078
- color: theme2.colors.background,
5079
- border: "none",
5080
- borderRadius: theme2.radii[1],
5081
- fontSize: theme2.fontSizes[1],
5082
- cursor: "pointer",
5083
- zIndex: 10,
5084
- transition: "opacity 0.2s",
5085
- opacity: 0.8
5086
- },
5087
- onMouseEnter: (e) => e.currentTarget.style.opacity = "1",
5088
- onMouseLeave: (e) => e.currentTarget.style.opacity = "0.8"
5089
- }, /* @__PURE__ */ React17.createElement(Pencil, {
5090
- size: 14
5091
- }), "Edit"), /* @__PURE__ */ React17.createElement(IndustryMarkdownSlide, {
5092
- ...slideProps,
5093
- content,
5094
- theme: theme2
5095
- }));
5096
- };
5097
5391
  // industryMarkdown/utils/presentationUtils.ts
5098
5392
  var extractSlideTitle3 = extractSlideTitle;
5099
5393
  function parseMarkdownIntoPresentationFromSource(source) {
@@ -5226,13 +5520,15 @@ export {
5226
5520
  createIndustryMarkdownComponents,
5227
5521
  createGithubFileSource,
5228
5522
  ThemeProvider,
5523
+ SlideSearchBar,
5524
+ SlidePresentationBook,
5229
5525
  SlidePresentation,
5526
+ SlideNavigationHeader,
5230
5527
  IndustryZoomableMermaidDiagram,
5231
5528
  IndustryPlaceholderModal,
5232
5529
  IndustryMermaidModal,
5233
5530
  IndustryMarkdownSlide,
5234
5531
  IndustryLazyMermaidDiagram,
5235
5532
  IndustryHtmlModal,
5236
- IndustryEditableMarkdownSlide,
5237
5533
  DocumentView
5238
5534
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "themed-markdown",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Industry-themed markdown renderer with presentation capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",