@industry-theme/markdown-panels 0.3.0 → 0.3.1
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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MarkdownPanel } from './panels/MarkdownPanel';
|
|
2
|
-
import type { MarkdownPanelProps } from './panels/MarkdownPanel';
|
|
2
|
+
import type { MarkdownPanelProps, ContentChangeInfo } from './panels/MarkdownPanel';
|
|
3
3
|
import type { PanelDefinition, MarkdownPanelActions, MarkdownPanelContext } from './types';
|
|
4
4
|
export { MarkdownPanel };
|
|
5
|
-
export type { MarkdownPanelProps };
|
|
5
|
+
export type { MarkdownPanelProps, ContentChangeInfo };
|
|
6
6
|
/**
|
|
7
7
|
* Export array of panel definitions.
|
|
8
8
|
* This is the required export for panel extensions.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EACV,eAAe,EAEf,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,EA2B/E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAEzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAE3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'themed-markdown/dist/index.css';
|
|
3
3
|
import type { PanelComponentProps, MarkdownPanelActions, MarkdownPanelContext } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Information about a content change event
|
|
6
|
+
*/
|
|
7
|
+
export interface ContentChangeInfo {
|
|
8
|
+
/** The file path that changed */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Previous content before the change */
|
|
11
|
+
previousContent: string;
|
|
12
|
+
/** New content after the change */
|
|
13
|
+
newContent: string;
|
|
14
|
+
/** Character count difference (positive = added, negative = removed) */
|
|
15
|
+
charDiff: number;
|
|
16
|
+
/** Timestamp of when the change was detected */
|
|
17
|
+
timestamp: number;
|
|
18
|
+
}
|
|
4
19
|
export interface MarkdownPanelProps extends PanelComponentProps<MarkdownPanelActions, MarkdownPanelContext> {
|
|
5
20
|
/**
|
|
6
21
|
* Optional file path to display.
|
|
@@ -13,6 +28,12 @@ export interface MarkdownPanelProps extends PanelComponentProps<MarkdownPanelAct
|
|
|
13
28
|
* Useful when embedding in panels that need responsive width handling.
|
|
14
29
|
*/
|
|
15
30
|
width?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Optional callback when file content changes externally.
|
|
33
|
+
* Called with info about the change including previous/new content.
|
|
34
|
+
* Useful for implementing diff visualization or change animations.
|
|
35
|
+
*/
|
|
36
|
+
onContentChange?: (change: ContentChangeInfo) => void;
|
|
16
37
|
}
|
|
17
38
|
/**
|
|
18
39
|
* MarkdownPanel - A panel for rendering markdown documents with industry theming
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownPanel.d.ts","sourceRoot":"","sources":["../../src/panels/MarkdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MarkdownPanel.d.ts","sourceRoot":"","sources":["../../src/panels/MarkdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AASpE,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAmBlB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBACf,SAAQ,mBAAmB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACvE;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACvD;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsgBtD,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -47721,15 +47721,17 @@ const MarkdownPanel = ({
|
|
|
47721
47721
|
actions,
|
|
47722
47722
|
events,
|
|
47723
47723
|
filePath: filePathProp,
|
|
47724
|
-
width
|
|
47724
|
+
width,
|
|
47725
|
+
onContentChange
|
|
47725
47726
|
}) => {
|
|
47726
|
-
var _a, _b, _c, _d, _e2;
|
|
47727
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
47727
47728
|
const { theme: theme2 } = useTheme();
|
|
47728
47729
|
const [viewMode, setViewMode] = useState("document");
|
|
47729
47730
|
const [currentSlide, setCurrentSlide] = useState(0);
|
|
47730
47731
|
const [fontSizeScale, setFontSizeScale] = useState(1);
|
|
47731
47732
|
const [isMobile, setIsMobile] = useState(false);
|
|
47732
47733
|
const [preferencesLoaded, setPreferencesLoaded] = useState(false);
|
|
47734
|
+
const previousContentRef = useRef(null);
|
|
47733
47735
|
const [propBasedContent, setPropBasedContent] = useState(null);
|
|
47734
47736
|
useEffect(() => {
|
|
47735
47737
|
if (!filePathProp) {
|
|
@@ -47806,6 +47808,36 @@ const MarkdownPanel = ({
|
|
|
47806
47808
|
} : activeFileSlice;
|
|
47807
47809
|
const isMarkdown = ((_a = activeFile == null ? void 0 : activeFile.data) == null ? void 0 : _a.type) === "markdown" || ((_c = (_b = activeFile == null ? void 0 : activeFile.data) == null ? void 0 : _b.path) == null ? void 0 : _c.match(/\.(md|mdx|markdown)$/i));
|
|
47808
47810
|
const markdownContent = ((_d = activeFile == null ? void 0 : activeFile.data) == null ? void 0 : _d.content) || "";
|
|
47811
|
+
const currentFilePath = ((_e2 = activeFile == null ? void 0 : activeFile.data) == null ? void 0 : _e2.path) || "";
|
|
47812
|
+
useEffect(() => {
|
|
47813
|
+
const prev = previousContentRef.current;
|
|
47814
|
+
if (!markdownContent || !currentFilePath) {
|
|
47815
|
+
return;
|
|
47816
|
+
}
|
|
47817
|
+
if (prev && prev.path === currentFilePath && prev.content !== markdownContent) {
|
|
47818
|
+
const changeInfo = {
|
|
47819
|
+
path: currentFilePath,
|
|
47820
|
+
previousContent: prev.content,
|
|
47821
|
+
newContent: markdownContent,
|
|
47822
|
+
charDiff: markdownContent.length - prev.content.length,
|
|
47823
|
+
timestamp: Date.now()
|
|
47824
|
+
};
|
|
47825
|
+
if (onContentChange) {
|
|
47826
|
+
onContentChange(changeInfo);
|
|
47827
|
+
}
|
|
47828
|
+
events.emit({
|
|
47829
|
+
type: "markdown-panel:content-changed",
|
|
47830
|
+
source: "markdown-panel",
|
|
47831
|
+
timestamp: Date.now(),
|
|
47832
|
+
payload: changeInfo
|
|
47833
|
+
});
|
|
47834
|
+
console.log("[MarkdownPanel] Content changed:", {
|
|
47835
|
+
path: currentFilePath,
|
|
47836
|
+
charDiff: changeInfo.charDiff
|
|
47837
|
+
});
|
|
47838
|
+
}
|
|
47839
|
+
previousContentRef.current = { path: currentFilePath, content: markdownContent };
|
|
47840
|
+
}, [markdownContent, currentFilePath, onContentChange, events]);
|
|
47809
47841
|
const presentation = useMemo(
|
|
47810
47842
|
() => parseMarkdownIntoPresentation2(markdownContent),
|
|
47811
47843
|
[markdownContent]
|
|
@@ -47873,7 +47905,7 @@ const MarkdownPanel = ({
|
|
|
47873
47905
|
},
|
|
47874
47906
|
children: /* @__PURE__ */ jsx("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsxs("p", { style: { color: theme2.colors.textSecondary }, children: [
|
|
47875
47907
|
"Loading ",
|
|
47876
|
-
((
|
|
47908
|
+
((_f = activeFile.data) == null ? void 0 : _f.path) || "file",
|
|
47877
47909
|
"..."
|
|
47878
47910
|
] }) })
|
|
47879
47911
|
}
|