@trebired/frontend 1.8.0 → 1.9.0
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/CHANGELOG.md +9 -0
- package/dist/config/normalize.d.ts.map +1 -1
- package/dist/config/normalize.js +1 -0
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/scss.d.ts.map +1 -1
- package/dist/config/scss.js +1 -0
- package/dist/config/scss.js.map +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/editor/components/types.d.ts +1 -0
- package/dist/editor/components/types.d.ts.map +1 -1
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +1 -0
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/styles/index.scss +10 -0
- package/dist/editor/viewer/app.d.ts +21 -0
- package/dist/editor/viewer/app.d.ts.map +1 -0
- package/dist/editor/viewer/app.js +137 -0
- package/dist/editor/viewer/app.js.map +1 -0
- package/dist/editor/viewer/fullscreen.d.ts +6 -0
- package/dist/editor/viewer/fullscreen.d.ts.map +1 -0
- package/dist/editor/viewer/fullscreen.js +30 -0
- package/dist/editor/viewer/fullscreen.js.map +1 -0
- package/dist/editor/viewer/hooks.d.ts +43 -0
- package/dist/editor/viewer/hooks.d.ts.map +1 -0
- package/dist/editor/viewer/hooks.js +208 -0
- package/dist/editor/viewer/hooks.js.map +1 -0
- package/dist/editor/viewer/image.d.ts +3 -0
- package/dist/editor/viewer/image.d.ts.map +1 -0
- package/dist/editor/viewer/image.js +17 -0
- package/dist/editor/viewer/image.js.map +1 -0
- package/dist/editor/viewer/index.d.ts +15 -0
- package/dist/editor/viewer/index.d.ts.map +1 -0
- package/dist/editor/viewer/index.js +39 -0
- package/dist/editor/viewer/index.js.map +1 -0
- package/dist/editor/viewer/monaco.d.ts +4 -0
- package/dist/editor/viewer/monaco.d.ts.map +1 -0
- package/dist/editor/viewer/monaco.js +220 -0
- package/dist/editor/viewer/monaco.js.map +1 -0
- package/dist/editor/viewer/readonly.d.ts +5 -0
- package/dist/editor/viewer/readonly.d.ts.map +1 -0
- package/dist/editor/viewer/readonly.js +37 -0
- package/dist/editor/viewer/readonly.js.map +1 -0
- package/dist/editor/viewer/shared.d.ts +13 -0
- package/dist/editor/viewer/shared.d.ts.map +1 -0
- package/dist/editor/viewer/shared.js +157 -0
- package/dist/editor/viewer/shared.js.map +1 -0
- package/dist/explorer/components/file/tree/parts.d.ts +19 -0
- package/dist/explorer/components/file/tree/parts.d.ts.map +1 -0
- package/dist/explorer/components/file/tree/parts.js +29 -0
- package/dist/explorer/components/file/tree/parts.js.map +1 -0
- package/dist/explorer/components/file/tree/row.d.ts +21 -0
- package/dist/explorer/components/file/tree/row.d.ts.map +1 -0
- package/dist/explorer/components/file/tree/row.js +78 -0
- package/dist/explorer/components/file/tree/row.js.map +1 -0
- package/dist/explorer/components/file/tree/shell.d.ts +12 -0
- package/dist/explorer/components/file/tree/shell.d.ts.map +1 -0
- package/dist/explorer/components/file/tree/shell.js +9 -0
- package/dist/explorer/components/file/tree/shell.js.map +1 -0
- package/dist/explorer/components/file/tree.d.ts +20 -0
- package/dist/explorer/components/file/tree.d.ts.map +1 -0
- package/dist/explorer/components/file/tree.js +141 -0
- package/dist/explorer/components/file/tree.js.map +1 -0
- package/dist/explorer/components/index.d.ts +6 -0
- package/dist/explorer/components/index.d.ts.map +1 -0
- package/dist/explorer/components/index.js +6 -0
- package/dist/explorer/components/index.js.map +1 -0
- package/dist/explorer/components/static-file-tree.d.ts +15 -0
- package/dist/explorer/components/static-file-tree.d.ts.map +1 -0
- package/dist/explorer/components/static-file-tree.js +105 -0
- package/dist/explorer/components/static-file-tree.js.map +1 -0
- package/dist/explorer/index.d.ts +7 -0
- package/dist/explorer/index.d.ts.map +1 -0
- package/dist/explorer/index.js +46 -0
- package/dist/explorer/index.js.map +1 -0
- package/dist/explorer/styles/index.scss +7 -0
- package/dist/explorer/tree.d.ts +26 -0
- package/dist/explorer/tree.d.ts.map +1 -0
- package/dist/explorer/tree.js +130 -0
- package/dist/explorer/tree.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -1
- package/dist/src/config/normalize.d.ts.map +1 -1
- package/dist/src/config/normalize.js +1 -0
- package/dist/src/config/normalize.js.map +1 -1
- package/dist/src/config/scss.d.ts.map +1 -1
- package/dist/src/config/scss.js +1 -0
- package/dist/src/config/scss.js.map +1 -1
- package/dist/src/config/types.d.ts +1 -1
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/editor/components/types.d.ts +1 -0
- package/dist/src/editor/components/types.d.ts.map +1 -1
- package/dist/src/editor/index.d.ts +1 -0
- package/dist/src/editor/index.d.ts.map +1 -1
- package/dist/src/editor/index.js +1 -0
- package/dist/src/editor/index.js.map +1 -1
- package/dist/src/editor/viewer/app.d.ts +21 -0
- package/dist/src/editor/viewer/app.d.ts.map +1 -0
- package/dist/src/editor/viewer/app.js +137 -0
- package/dist/src/editor/viewer/app.js.map +1 -0
- package/dist/src/editor/viewer/fullscreen.d.ts +6 -0
- package/dist/src/editor/viewer/fullscreen.d.ts.map +1 -0
- package/dist/src/editor/viewer/fullscreen.js +30 -0
- package/dist/src/editor/viewer/fullscreen.js.map +1 -0
- package/dist/src/editor/viewer/hooks.d.ts +43 -0
- package/dist/src/editor/viewer/hooks.d.ts.map +1 -0
- package/dist/src/editor/viewer/hooks.js +208 -0
- package/dist/src/editor/viewer/hooks.js.map +1 -0
- package/dist/src/editor/viewer/image.d.ts +3 -0
- package/dist/src/editor/viewer/image.d.ts.map +1 -0
- package/dist/src/editor/viewer/image.js +17 -0
- package/dist/src/editor/viewer/image.js.map +1 -0
- package/dist/src/editor/viewer/index.d.ts +15 -0
- package/dist/src/editor/viewer/index.d.ts.map +1 -0
- package/dist/src/editor/viewer/index.js +39 -0
- package/dist/src/editor/viewer/index.js.map +1 -0
- package/dist/src/editor/viewer/monaco.d.ts +4 -0
- package/dist/src/editor/viewer/monaco.d.ts.map +1 -0
- package/dist/src/editor/viewer/monaco.js +220 -0
- package/dist/src/editor/viewer/monaco.js.map +1 -0
- package/dist/src/editor/viewer/readonly.d.ts +5 -0
- package/dist/src/editor/viewer/readonly.d.ts.map +1 -0
- package/dist/src/editor/viewer/readonly.js +37 -0
- package/dist/src/editor/viewer/readonly.js.map +1 -0
- package/dist/src/editor/viewer/shared.d.ts +13 -0
- package/dist/src/editor/viewer/shared.d.ts.map +1 -0
- package/dist/src/editor/viewer/shared.js +157 -0
- package/dist/src/editor/viewer/shared.js.map +1 -0
- package/dist/src/explorer/components/file/tree/parts.d.ts +19 -0
- package/dist/src/explorer/components/file/tree/parts.d.ts.map +1 -0
- package/dist/src/explorer/components/file/tree/parts.js +29 -0
- package/dist/src/explorer/components/file/tree/parts.js.map +1 -0
- package/dist/src/explorer/components/file/tree/row.d.ts +21 -0
- package/dist/src/explorer/components/file/tree/row.d.ts.map +1 -0
- package/dist/src/explorer/components/file/tree/row.js +78 -0
- package/dist/src/explorer/components/file/tree/row.js.map +1 -0
- package/dist/src/explorer/components/file/tree/shell.d.ts +12 -0
- package/dist/src/explorer/components/file/tree/shell.d.ts.map +1 -0
- package/dist/src/explorer/components/file/tree/shell.js +9 -0
- package/dist/src/explorer/components/file/tree/shell.js.map +1 -0
- package/dist/src/explorer/components/file/tree.d.ts +20 -0
- package/dist/src/explorer/components/file/tree.d.ts.map +1 -0
- package/dist/src/explorer/components/file/tree.js +141 -0
- package/dist/src/explorer/components/file/tree.js.map +1 -0
- package/dist/src/explorer/components/index.d.ts +6 -0
- package/dist/src/explorer/components/index.d.ts.map +1 -0
- package/dist/src/explorer/components/index.js +6 -0
- package/dist/src/explorer/components/index.js.map +1 -0
- package/dist/src/explorer/components/static-file-tree.d.ts +15 -0
- package/dist/src/explorer/components/static-file-tree.d.ts.map +1 -0
- package/dist/src/explorer/components/static-file-tree.js +105 -0
- package/dist/src/explorer/components/static-file-tree.js.map +1 -0
- package/dist/src/explorer/index.d.ts +7 -0
- package/dist/src/explorer/index.d.ts.map +1 -0
- package/dist/src/explorer/index.js +46 -0
- package/dist/src/explorer/index.js.map +1 -0
- package/dist/src/explorer/tree.d.ts +26 -0
- package/dist/src/explorer/tree.d.ts.map +1 -0
- package/dist/src/explorer/tree.js +130 -0
- package/dist/src/explorer/tree.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/react/index.d.ts +2 -0
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/index.js +2 -0
- package/dist/src/react/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { buildFileApiUrl, findTreeNodeByPath, normalizePath, readViewerPathFromUrl, syncViewerPathInUrl, text, } from "./shared.js";
|
|
3
|
+
import { useFullscreenState } from "./fullscreen.js";
|
|
4
|
+
function useInitialTree(props) {
|
|
5
|
+
return useMemo(() => Array.isArray(props.tree) ? props.tree : [], [props.tree]);
|
|
6
|
+
}
|
|
7
|
+
function useInitialFileState(props, initialTree) {
|
|
8
|
+
const initialFile = props.initialFile && typeof props.initialFile === "object" ? props.initialFile : null;
|
|
9
|
+
const requestedPath = normalizePath(props.requestedPath);
|
|
10
|
+
const requestedNode = findTreeNodeByPath(initialTree, requestedPath);
|
|
11
|
+
const requestedIsDir = text(requestedNode?.kind).toLowerCase() === "dir";
|
|
12
|
+
return { initialFile, requestedIsDir, requestedPath };
|
|
13
|
+
}
|
|
14
|
+
function useTreeState(props, initialTree) {
|
|
15
|
+
const [treeLoaded, setTreeLoaded] = useState(props.treeLoaded === true || initialTree.length > 0 || !text(props.treeApiUrl));
|
|
16
|
+
const [tree, setTree] = useState(initialTree);
|
|
17
|
+
const [treeLoading, setTreeLoading] = useState(!treeLoaded && Boolean(text(props.treeApiUrl)));
|
|
18
|
+
const [treeError, setTreeError] = useState("");
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (treeLoaded || !text(props.treeApiUrl))
|
|
21
|
+
return undefined;
|
|
22
|
+
return fetchTree(props.treeApiUrl, setTree, setTreeLoaded, setTreeLoading, setTreeError);
|
|
23
|
+
}, [props.treeApiUrl, treeLoaded]);
|
|
24
|
+
return { setTree, tree, treeError, treeLoaded, treeLoading };
|
|
25
|
+
}
|
|
26
|
+
function fetchTree(treeApiUrl, setTree, setTreeLoaded, setTreeLoading, setTreeError) {
|
|
27
|
+
let active = true;
|
|
28
|
+
const loadFailed = "File tree failed to load.";
|
|
29
|
+
setTreeLoading(true);
|
|
30
|
+
setTreeError("");
|
|
31
|
+
fetch(String(treeApiUrl), {
|
|
32
|
+
cache: "no-store",
|
|
33
|
+
credentials: "same-origin",
|
|
34
|
+
headers: { "x-requested-with": "editor-viewer" },
|
|
35
|
+
})
|
|
36
|
+
.then(readJsonOrThrow(loadFailed))
|
|
37
|
+
.then((payload) => {
|
|
38
|
+
if (!active)
|
|
39
|
+
return;
|
|
40
|
+
setTreeLoaded(true);
|
|
41
|
+
setTree(Array.isArray(payload?.data?.tree) ? payload.data.tree : []);
|
|
42
|
+
})
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
if (!active)
|
|
45
|
+
return;
|
|
46
|
+
setTreeLoaded(true);
|
|
47
|
+
setTreeError(text(error?.message, loadFailed));
|
|
48
|
+
})
|
|
49
|
+
.finally(() => {
|
|
50
|
+
if (active)
|
|
51
|
+
setTreeLoading(false);
|
|
52
|
+
});
|
|
53
|
+
return () => {
|
|
54
|
+
active = false;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function readJsonOrThrow(defaultMessage) {
|
|
58
|
+
return async function readJsonResponse(response) {
|
|
59
|
+
const payload = await response.json().catch(() => null);
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw new Error(text(payload?.message || payload?.error, defaultMessage));
|
|
62
|
+
}
|
|
63
|
+
return payload;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function useSelectedPaths(initial) {
|
|
67
|
+
const [focusedPath, setFocusedPath] = useState(initial.requestedPath || normalizePath(initial.initialFile?.path));
|
|
68
|
+
const [openedFilePath, setOpenedFilePath] = useState(initial.requestedIsDir
|
|
69
|
+
? ""
|
|
70
|
+
: normalizePath(initial.initialFile?.path) || initial.requestedPath);
|
|
71
|
+
return { focusedPath, openedFilePath, setFocusedPath, setOpenedFilePath };
|
|
72
|
+
}
|
|
73
|
+
function useFileState(initialFile) {
|
|
74
|
+
return useState(() => {
|
|
75
|
+
const initialPath = normalizePath(initialFile?.path);
|
|
76
|
+
return {
|
|
77
|
+
content: initialFile && initialPath ? String(initialFile.content || "") : "",
|
|
78
|
+
error: "",
|
|
79
|
+
languageName: text(initialFile?.language_name),
|
|
80
|
+
loading: false,
|
|
81
|
+
path: initialPath,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function useInitialFileCache(initialFile) {
|
|
86
|
+
const fileCacheRef = useRef(new Map());
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const initialPath = normalizePath(initialFile?.path);
|
|
89
|
+
if (!initialFile || !initialPath)
|
|
90
|
+
return;
|
|
91
|
+
fileCacheRef.current.set(initialPath, {
|
|
92
|
+
content: String(initialFile.content || ""),
|
|
93
|
+
languageName: text(initialFile?.language_name),
|
|
94
|
+
path: initialPath,
|
|
95
|
+
});
|
|
96
|
+
}, [initialFile]);
|
|
97
|
+
return fileCacheRef;
|
|
98
|
+
}
|
|
99
|
+
function useFocusedTreeSync(treeState, pathState) {
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!treeState.tree.length || !pathState.focusedPath)
|
|
102
|
+
return;
|
|
103
|
+
const targetNode = findTreeNodeByPath(treeState.tree, pathState.focusedPath);
|
|
104
|
+
const targetKind = text(targetNode?.kind).toLowerCase();
|
|
105
|
+
if (targetKind === "dir") {
|
|
106
|
+
if (pathState.openedFilePath)
|
|
107
|
+
pathState.setOpenedFilePath("");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!pathState.openedFilePath && targetNode) {
|
|
111
|
+
pathState.setOpenedFilePath(pathState.focusedPath);
|
|
112
|
+
}
|
|
113
|
+
}, [pathState.focusedPath, pathState.openedFilePath, treeState.tree]);
|
|
114
|
+
}
|
|
115
|
+
function useUrlPathSync(tree, pathState, allowUrlPathSyncRef) {
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (allowUrlPathSyncRef.current)
|
|
118
|
+
syncViewerPathInUrl(pathState.focusedPath);
|
|
119
|
+
}, [pathState.focusedPath]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
function restorePathFromUrl() {
|
|
122
|
+
const nextPath = readViewerPathFromUrl();
|
|
123
|
+
if (!nextPath) {
|
|
124
|
+
pathState.setFocusedPath("");
|
|
125
|
+
pathState.setOpenedFilePath("");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const nextNode = findTreeNodeByPath(tree, nextPath);
|
|
129
|
+
const nextKind = text(nextNode?.kind).toLowerCase();
|
|
130
|
+
pathState.setFocusedPath(nextPath);
|
|
131
|
+
pathState.setOpenedFilePath(nextKind === "dir" ? "" : nextPath);
|
|
132
|
+
}
|
|
133
|
+
window.addEventListener("popstate", restorePathFromUrl);
|
|
134
|
+
return () => window.removeEventListener("popstate", restorePathFromUrl);
|
|
135
|
+
}, [tree]);
|
|
136
|
+
}
|
|
137
|
+
function useOpenedFile(props, openedFilePath, fileCacheRef, setFileState) {
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const relPath = normalizePath(openedFilePath);
|
|
140
|
+
if (!relPath) {
|
|
141
|
+
setFileState({ content: "", error: "", languageName: "", loading: false, path: "" });
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const cached = fileCacheRef.current.get(relPath);
|
|
145
|
+
if (cached) {
|
|
146
|
+
setFileState({ ...cached, error: "", loading: false });
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return fetchFile(props.fileApiUrl, relPath, fileCacheRef, setFileState);
|
|
150
|
+
}, [openedFilePath, props.fileApiUrl]);
|
|
151
|
+
}
|
|
152
|
+
function fetchFile(fileApiUrlInput, relPath, fileCacheRef, setFileState) {
|
|
153
|
+
const fileApiUrl = buildFileApiUrl(fileApiUrlInput, relPath);
|
|
154
|
+
if (!fileApiUrl) {
|
|
155
|
+
setFileState({
|
|
156
|
+
content: "",
|
|
157
|
+
error: "File API is unavailable.",
|
|
158
|
+
languageName: "",
|
|
159
|
+
loading: false,
|
|
160
|
+
path: relPath,
|
|
161
|
+
});
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
let active = true;
|
|
165
|
+
const loadFailed = "File failed to load.";
|
|
166
|
+
setFileState({ content: "", error: "", languageName: "", loading: true, path: relPath });
|
|
167
|
+
fetch(fileApiUrl, {
|
|
168
|
+
credentials: "same-origin",
|
|
169
|
+
headers: { "x-requested-with": "editor-viewer" },
|
|
170
|
+
})
|
|
171
|
+
.then(readJsonOrThrow(loadFailed))
|
|
172
|
+
.then((payload) => {
|
|
173
|
+
if (active)
|
|
174
|
+
applyLoadedFile(payload, relPath, fileCacheRef, setFileState);
|
|
175
|
+
})
|
|
176
|
+
.catch((error) => {
|
|
177
|
+
if (active) {
|
|
178
|
+
setFileState({
|
|
179
|
+
content: "",
|
|
180
|
+
error: text(error?.message, loadFailed),
|
|
181
|
+
languageName: "",
|
|
182
|
+
loading: false,
|
|
183
|
+
path: relPath,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
return () => {
|
|
188
|
+
active = false;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function applyLoadedFile(payload, relPath, fileCacheRef, setFileState) {
|
|
192
|
+
const data = payload?.data && typeof payload.data === "object" ? payload.data : {};
|
|
193
|
+
const nextState = {
|
|
194
|
+
content: String(data.content || ""),
|
|
195
|
+
error: "",
|
|
196
|
+
languageName: text(data.language_name),
|
|
197
|
+
loading: false,
|
|
198
|
+
path: relPath,
|
|
199
|
+
};
|
|
200
|
+
fileCacheRef.current.set(relPath, {
|
|
201
|
+
content: nextState.content,
|
|
202
|
+
languageName: nextState.languageName,
|
|
203
|
+
path: relPath,
|
|
204
|
+
});
|
|
205
|
+
setFileState(nextState);
|
|
206
|
+
}
|
|
207
|
+
export { useFileState, useFocusedTreeSync, useFullscreenState, useInitialFileCache, useInitialFileState, useInitialTree, useOpenedFile, useSelectedPaths, useTreeState, useUrlPathSync, };
|
|
208
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/editor/viewer/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,SAAS,cAAc,CAAC,KAAU;IAChC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAU,EAAE,WAAkB;IACzD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,OAAO,KAAK,CAAC,WAAW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AAE,OAAO;KACd,CAAC;IACF,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE;QAChC,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/editor/viewer/image.tsx"],"names":[],"mappings":"AAEA,iBAAS,gBAAgB,CAAC,KAAK,EAAE,GAAG,+BAuBnC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { text } from "./shared.js";
|
|
3
|
+
function ImagePreviewPane(props) {
|
|
4
|
+
return (_jsx("div", { className: "column gap-sm center ver-center bg-canvas", style: {
|
|
5
|
+
height: "100%",
|
|
6
|
+
minHeight: Number.isFinite(props.minHeight) ? Number(props.minHeight) : 560,
|
|
7
|
+
padding: 16,
|
|
8
|
+
}, children: _jsx("img", { alt: text(props.path, "Image preview"), src: String(props.src || ""), style: {
|
|
9
|
+
display: "block",
|
|
10
|
+
height: "auto",
|
|
11
|
+
maxHeight: "72vh",
|
|
12
|
+
maxWidth: "100%",
|
|
13
|
+
objectFit: "contain",
|
|
14
|
+
} }) }));
|
|
15
|
+
}
|
|
16
|
+
export { ImagePreviewPane };
|
|
17
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/editor/viewer/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,SAAS,gBAAgB,CAAC,KAAU;IAClC,OAAO,CACL,cACE,SAAS,EAAC,2CAA2C,EACrD,KAAK,EAAE;YACL,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;YAC3E,OAAO,EAAE,EAAE;SACZ,YAED,cACE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,EACtC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,EAC5B,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,MAAM;gBACd,SAAS,EAAE,MAAM;gBACjB,QAAQ,EAAE,MAAM;gBAChB,SAAS,EAAE,SAAS;aACrB,GACD,GACE,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReadonlyMonacoDiffPane } from "./monaco.js";
|
|
2
|
+
import { ReadonlyEditorContentApp, ReadonlyEditorDiffApp } from "./readonly.js";
|
|
3
|
+
declare function mountEditorViewer(container: HTMLElement | null, input: any): void;
|
|
4
|
+
declare function mountReadonlyEditorContent(container: HTMLElement | null, input: any): void;
|
|
5
|
+
declare function mountReadonlyEditorDiff(container: HTMLElement | null, input: any): void;
|
|
6
|
+
declare function unmountEditorViewer(container: HTMLElement | null): void;
|
|
7
|
+
export * from "./app.js";
|
|
8
|
+
export * from "./fullscreen.js";
|
|
9
|
+
export * from "./hooks.js";
|
|
10
|
+
export * from "./image.js";
|
|
11
|
+
export * from "./monaco.js";
|
|
12
|
+
export * from "./readonly.js";
|
|
13
|
+
export * from "./shared.js";
|
|
14
|
+
export { ReadonlyEditorContentApp, ReadonlyEditorDiffApp, ReadonlyMonacoDiffPane, mountEditorViewer, mountReadonlyEditorContent, mountReadonlyEditorDiff, unmountEditorViewer, };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/editor/viewer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAGvB,iBAAS,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,QAInE;AAED,iBAAS,0BAA0B,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,QAM5E;AAED,iBAAS,uBAAuB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,QAIzE;AAED,iBAAS,mBAAmB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,QAKzD;AAED,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,GACpB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EditorViewerApp } from "./app.js";
|
|
3
|
+
import { ReadonlyMonacoDiffPane } from "./monaco.js";
|
|
4
|
+
import { ReadonlyEditorContentApp, ReadonlyEditorDiffApp, } from "./readonly.js";
|
|
5
|
+
import { deleteRoot, getEditorViewerRoot } from "./shared.js";
|
|
6
|
+
function mountEditorViewer(container, input) {
|
|
7
|
+
const root = getEditorViewerRoot(container);
|
|
8
|
+
if (!root)
|
|
9
|
+
return;
|
|
10
|
+
root.render(_jsx(EditorViewerApp, { ...(input && typeof input === "object" ? input : {}) }));
|
|
11
|
+
}
|
|
12
|
+
function mountReadonlyEditorContent(container, input) {
|
|
13
|
+
const root = getEditorViewerRoot(container);
|
|
14
|
+
if (!root)
|
|
15
|
+
return;
|
|
16
|
+
root.render(_jsx(ReadonlyEditorContentApp, { ...(input && typeof input === "object" ? input : {}) }));
|
|
17
|
+
}
|
|
18
|
+
function mountReadonlyEditorDiff(container, input) {
|
|
19
|
+
const root = getEditorViewerRoot(container);
|
|
20
|
+
if (!root)
|
|
21
|
+
return;
|
|
22
|
+
root.render(_jsx(ReadonlyEditorDiffApp, { ...(input && typeof input === "object" ? input : {}) }));
|
|
23
|
+
}
|
|
24
|
+
function unmountEditorViewer(container) {
|
|
25
|
+
const root = getEditorViewerRoot(container);
|
|
26
|
+
if (!root)
|
|
27
|
+
return;
|
|
28
|
+
root.unmount();
|
|
29
|
+
deleteRoot(container);
|
|
30
|
+
}
|
|
31
|
+
export * from "./app.js";
|
|
32
|
+
export * from "./fullscreen.js";
|
|
33
|
+
export * from "./hooks.js";
|
|
34
|
+
export * from "./image.js";
|
|
35
|
+
export * from "./monaco.js";
|
|
36
|
+
export * from "./readonly.js";
|
|
37
|
+
export * from "./shared.js";
|
|
38
|
+
export { ReadonlyEditorContentApp, ReadonlyEditorDiffApp, ReadonlyMonacoDiffPane, mountEditorViewer, mountReadonlyEditorContent, mountReadonlyEditorDiff, unmountEditorViewer, };
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/viewer/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,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C5C,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,UAAU,CAAC,SAAS,CAAC,CAAC;AACxB,CAAC;AAED,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,GACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco.d.ts","sourceRoot":"","sources":["../../../../src/editor/viewer/monaco.tsx"],"names":[],"mappings":"AAsLA,iBAAS,kBAAkB,CAAC,KAAK,EAAE,GAAG,+BA6BrC;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,GAAG,+BA+BzC;AAeD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { defineMonacoThemes, ensureMonaco, getPreferredMonacoThemeName, } from "../../code/monaco.js";
|
|
4
|
+
import { activateEditorLanguage, nextEditorViewerModelInstanceId, normalizePath, text, upsertReadonlyModel, } from "./shared.js";
|
|
5
|
+
const editorViewerThemeHandlers = new WeakMap();
|
|
6
|
+
function showMonacoError(host, error, fallback) {
|
|
7
|
+
if (!(host instanceof HTMLElement))
|
|
8
|
+
return;
|
|
9
|
+
host.innerHTML = "";
|
|
10
|
+
const message = document.createElement("div");
|
|
11
|
+
message.className = "text-muted";
|
|
12
|
+
message.textContent = text(error?.message, fallback);
|
|
13
|
+
host.appendChild(message);
|
|
14
|
+
}
|
|
15
|
+
function installThemeChange(host, monaco) {
|
|
16
|
+
const handleThemeChange = () => {
|
|
17
|
+
if (monaco?.editor)
|
|
18
|
+
monaco.editor.setTheme(getPreferredMonacoThemeName());
|
|
19
|
+
};
|
|
20
|
+
window.addEventListener("tbf:themechange", handleThemeChange);
|
|
21
|
+
editorViewerThemeHandlers.set(host, handleThemeChange);
|
|
22
|
+
}
|
|
23
|
+
function removeThemeChange(host) {
|
|
24
|
+
if (!(host instanceof HTMLElement))
|
|
25
|
+
return;
|
|
26
|
+
const handleThemeChange = editorViewerThemeHandlers.get(host);
|
|
27
|
+
if (!handleThemeChange)
|
|
28
|
+
return;
|
|
29
|
+
window.removeEventListener("tbf:themechange", handleThemeChange);
|
|
30
|
+
editorViewerThemeHandlers.delete(host);
|
|
31
|
+
}
|
|
32
|
+
function createReadonlyEditor(monaco, host) {
|
|
33
|
+
defineMonacoThemes(monaco);
|
|
34
|
+
monaco.editor.setTheme(getPreferredMonacoThemeName());
|
|
35
|
+
return monaco.editor.create(host, {
|
|
36
|
+
automaticLayout: true,
|
|
37
|
+
fontSize: 13,
|
|
38
|
+
lineNumbers: "on",
|
|
39
|
+
minimap: { enabled: false },
|
|
40
|
+
overviewRulerBorder: false,
|
|
41
|
+
readOnly: true,
|
|
42
|
+
renderLineHighlight: "all",
|
|
43
|
+
scrollBeyondLastLine: false,
|
|
44
|
+
tabSize: 2,
|
|
45
|
+
value: "",
|
|
46
|
+
wordWrap: "on",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function createReadonlyDiffEditor(monaco, host) {
|
|
50
|
+
defineMonacoThemes(monaco);
|
|
51
|
+
monaco.editor.setTheme(getPreferredMonacoThemeName());
|
|
52
|
+
return monaco.editor.createDiffEditor(host, {
|
|
53
|
+
automaticLayout: true,
|
|
54
|
+
diffCodeLens: false,
|
|
55
|
+
diffWordWrap: "off",
|
|
56
|
+
fontSize: 13,
|
|
57
|
+
hideUnchangedRegions: { enabled: false },
|
|
58
|
+
minimap: { enabled: false },
|
|
59
|
+
originalEditable: false,
|
|
60
|
+
overviewRulerBorder: false,
|
|
61
|
+
readOnly: true,
|
|
62
|
+
renderOverviewRuler: false,
|
|
63
|
+
renderSideBySide: true,
|
|
64
|
+
renderSideBySideInlineBreakpoint: 0,
|
|
65
|
+
scrollbar: {
|
|
66
|
+
alwaysConsumeMouseWheel: false,
|
|
67
|
+
horizontalScrollbarSize: 10,
|
|
68
|
+
verticalScrollbarSize: 10,
|
|
69
|
+
},
|
|
70
|
+
scrollBeyondLastLine: false,
|
|
71
|
+
useInlineViewWhenSpaceIsLimited: false,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async function applyReadonlyModel(refs, props) {
|
|
75
|
+
if (!refs.editor.current || !refs.monaco.current)
|
|
76
|
+
return;
|
|
77
|
+
const applySequence = ++refs.sequence.current;
|
|
78
|
+
const languageId = await activateEditorLanguage(refs.monaco.current, props.path, props.languageName);
|
|
79
|
+
if (!refs.editor.current || !refs.monaco.current || applySequence !== refs.sequence.current)
|
|
80
|
+
return;
|
|
81
|
+
refs.model.current = upsertReadonlyModel(refs.monaco.current, refs.model.current, `readonly-view://viewer-${refs.instanceId.current}/${normalizePath(props.path || "untitled.txt")}`, languageId, String(props.content || ""));
|
|
82
|
+
refs.editor.current.setModel(refs.model.current);
|
|
83
|
+
refs.editor.current.setScrollTop(0);
|
|
84
|
+
refs.editor.current.setScrollLeft(0);
|
|
85
|
+
}
|
|
86
|
+
function resetDiffScroll(editor) {
|
|
87
|
+
const originalEditor = typeof editor.getOriginalEditor === "function" ? editor.getOriginalEditor() : null;
|
|
88
|
+
const modifiedEditor = typeof editor.getModifiedEditor === "function" ? editor.getModifiedEditor() : null;
|
|
89
|
+
for (const pane of [originalEditor, modifiedEditor]) {
|
|
90
|
+
if (!pane || typeof pane.setScrollTop !== "function")
|
|
91
|
+
continue;
|
|
92
|
+
pane.setScrollTop(0);
|
|
93
|
+
pane.setScrollLeft(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async function applyReadonlyDiffModels(refs, props) {
|
|
97
|
+
if (!refs.editor.current || !refs.monaco.current)
|
|
98
|
+
return;
|
|
99
|
+
const applySequence = ++refs.sequence.current;
|
|
100
|
+
const languageId = await activateEditorLanguage(refs.monaco.current, props.modifiedPath || props.originalPath || props.path, props.languageName);
|
|
101
|
+
if (!refs.editor.current || !refs.monaco.current || applySequence !== refs.sequence.current)
|
|
102
|
+
return;
|
|
103
|
+
refs.models.current.original = upsertReadonlyModel(refs.monaco.current, refs.models.current.original, `readonly-diff://viewer-${refs.instanceId.current}/original/${normalizePath(props.originalPath || props.path || "original.txt")}`, languageId, String(props.originalContent || ""));
|
|
104
|
+
refs.models.current.modified = upsertReadonlyModel(refs.monaco.current, refs.models.current.modified, `readonly-diff://viewer-${refs.instanceId.current}/modified/${normalizePath(props.modifiedPath || props.path || "modified.txt")}`, languageId, String(props.modifiedContent || ""));
|
|
105
|
+
refs.editor.current.setModel({
|
|
106
|
+
original: refs.models.current.original,
|
|
107
|
+
modified: refs.models.current.modified,
|
|
108
|
+
});
|
|
109
|
+
refs.editor.current.layout?.();
|
|
110
|
+
resetDiffScroll(refs.editor.current);
|
|
111
|
+
}
|
|
112
|
+
function useViewerInstanceId() {
|
|
113
|
+
const instanceIdRef = useRef(0);
|
|
114
|
+
if (!instanceIdRef.current)
|
|
115
|
+
instanceIdRef.current = nextEditorViewerModelInstanceId();
|
|
116
|
+
return instanceIdRef;
|
|
117
|
+
}
|
|
118
|
+
function useReadonlyDiffRefs() {
|
|
119
|
+
return {
|
|
120
|
+
editor: useRef(null),
|
|
121
|
+
host: useRef(null),
|
|
122
|
+
instanceId: useViewerInstanceId(),
|
|
123
|
+
models: useRef({ original: null, modified: null }),
|
|
124
|
+
monaco: useRef(null),
|
|
125
|
+
sequence: useRef(0),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function cleanupReadonlyDiffRefs(refs) {
|
|
129
|
+
removeThemeChange(refs.host.current);
|
|
130
|
+
refs.editor.current?.dispose();
|
|
131
|
+
refs.models.current.original?.dispose();
|
|
132
|
+
refs.models.current.modified?.dispose();
|
|
133
|
+
refs.editor.current = null;
|
|
134
|
+
refs.models.current = { original: null, modified: null };
|
|
135
|
+
refs.monaco.current = null;
|
|
136
|
+
}
|
|
137
|
+
function useReadonlyPaneRefs() {
|
|
138
|
+
return {
|
|
139
|
+
editor: useRef(null),
|
|
140
|
+
host: useRef(null),
|
|
141
|
+
instanceId: useViewerInstanceId(),
|
|
142
|
+
model: useRef(null),
|
|
143
|
+
monaco: useRef(null),
|
|
144
|
+
sequence: useRef(0),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function ReadonlyMonacoPane(props) {
|
|
148
|
+
const refs = useReadonlyPaneRefs();
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
let active = true;
|
|
151
|
+
ensureMonaco()
|
|
152
|
+
.then((monaco) => {
|
|
153
|
+
if (!active || !(refs.host.current instanceof HTMLElement))
|
|
154
|
+
return;
|
|
155
|
+
refs.monaco.current = monaco;
|
|
156
|
+
refs.editor.current = createReadonlyEditor(monaco, refs.host.current);
|
|
157
|
+
installThemeChange(refs.host.current, monaco);
|
|
158
|
+
void applyReadonlyModel(refs, props);
|
|
159
|
+
})
|
|
160
|
+
.catch((error) => {
|
|
161
|
+
if (active)
|
|
162
|
+
showMonacoError(refs.host.current, error, "Editor failed to load.");
|
|
163
|
+
});
|
|
164
|
+
return () => {
|
|
165
|
+
active = false;
|
|
166
|
+
removeThemeChange(refs.host.current);
|
|
167
|
+
refs.editor.current?.dispose();
|
|
168
|
+
refs.model.current?.dispose();
|
|
169
|
+
refs.editor.current = null;
|
|
170
|
+
refs.model.current = null;
|
|
171
|
+
refs.monaco.current = null;
|
|
172
|
+
};
|
|
173
|
+
}, []);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
void applyReadonlyModel(refs, props).catch(() => { });
|
|
176
|
+
}, [props.content, props.languageName, props.path]);
|
|
177
|
+
return _jsx(MonacoHost, { hostRef: refs.host, minHeight: props.minHeight });
|
|
178
|
+
}
|
|
179
|
+
function ReadonlyMonacoDiffPane(props) {
|
|
180
|
+
const refs = useReadonlyDiffRefs();
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
let active = true;
|
|
183
|
+
ensureMonaco()
|
|
184
|
+
.then((monaco) => {
|
|
185
|
+
if (!active || !(refs.host.current instanceof HTMLElement))
|
|
186
|
+
return;
|
|
187
|
+
refs.monaco.current = monaco;
|
|
188
|
+
refs.editor.current = createReadonlyDiffEditor(monaco, refs.host.current);
|
|
189
|
+
installThemeChange(refs.host.current, monaco);
|
|
190
|
+
void applyReadonlyDiffModels(refs, props);
|
|
191
|
+
})
|
|
192
|
+
.catch((error) => {
|
|
193
|
+
if (active)
|
|
194
|
+
showMonacoError(refs.host.current, error, "Diff editor failed to load.");
|
|
195
|
+
});
|
|
196
|
+
return () => {
|
|
197
|
+
active = false;
|
|
198
|
+
cleanupReadonlyDiffRefs(refs);
|
|
199
|
+
};
|
|
200
|
+
}, []);
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
void applyReadonlyDiffModels(refs, props).catch(() => { });
|
|
203
|
+
}, [
|
|
204
|
+
props.languageName,
|
|
205
|
+
props.modifiedContent,
|
|
206
|
+
props.modifiedPath,
|
|
207
|
+
props.originalContent,
|
|
208
|
+
props.originalPath,
|
|
209
|
+
props.path,
|
|
210
|
+
]);
|
|
211
|
+
return _jsx(MonacoHost, { hostRef: refs.host, minHeight: props.minHeight });
|
|
212
|
+
}
|
|
213
|
+
function MonacoHost(props) {
|
|
214
|
+
return (_jsx("div", { ref: props.hostRef, className: "width-max", style: {
|
|
215
|
+
height: "100%",
|
|
216
|
+
minHeight: Number.isFinite(props.minHeight) ? Number(props.minHeight) : 520,
|
|
217
|
+
} }));
|
|
218
|
+
}
|
|
219
|
+
export { ReadonlyMonacoDiffPane, ReadonlyMonacoPane };
|
|
220
|
+
//# sourceMappingURL=monaco.js.map
|
|
@@ -0,0 +1 @@
|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AAK,CAAC;YACf,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,EAAE;QACD,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,eAAe;QACrB,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,eAAe;QACrB,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,IAAI;KACX,CAAC,CAAC;IACH,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CAAC;AACxE,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,CACL,cACE,GAAG,EAAE,KAAK,CAAC,OAAO,EAClB,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE;YACL,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;SAC5E,GACD,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function EmptyEditorMessage(props: any): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode>> | import("react").JSX.Element;
|
|
2
|
+
declare function ReadonlyEditorContentApp(props: any): import("react").JSX.Element;
|
|
3
|
+
declare function ReadonlyEditorDiffApp(props: any): import("react").JSX.Element;
|
|
4
|
+
export { EmptyEditorMessage, ReadonlyEditorContentApp, ReadonlyEditorDiffApp };
|
|
5
|
+
//# sourceMappingURL=readonly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly.d.ts","sourceRoot":"","sources":["../../../../src/editor/viewer/readonly.tsx"],"names":[],"mappings":"AAIA,iBAAS,kBAAkB,CAAC,KAAK,EAAE,GAAG,yTAWrC;AAED,iBAAS,wBAAwB,CAAC,KAAK,EAAE,GAAG,+BAsB3C;AAED,iBAAS,qBAAqB,CAAC,KAAK,EAAE,GAAG,+BAmCxC;AAED,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { card } from "../../primitives/components/index.js";
|
|
3
|
+
import { normalizePath, text } from "./shared.js";
|
|
4
|
+
import { ReadonlyMonacoDiffPane, ReadonlyMonacoPane } from "./monaco.js";
|
|
5
|
+
function EmptyEditorMessage(props) {
|
|
6
|
+
return card({
|
|
7
|
+
style: { minHeight: props.minHeight },
|
|
8
|
+
className: "column gap-sm center ver-center height-max",
|
|
9
|
+
children: (_jsxs(_Fragment, { children: [_jsx("strong", { children: props.title }), _jsx("span", { className: "text-muted text-small", children: props.copy })] })),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function ReadonlyEditorContentApp(props) {
|
|
13
|
+
const path = normalizePath(props.path || "diff.patch");
|
|
14
|
+
const content = String(props.content == null ? "" : props.content);
|
|
15
|
+
const languageName = text(props.languageName);
|
|
16
|
+
const minHeight = Number.isFinite(props.minHeight) ? Number(props.minHeight) : 560;
|
|
17
|
+
if (!content.trim()) {
|
|
18
|
+
return (_jsx(EmptyEditorMessage, { copy: "No content is available for this file.", minHeight: minHeight, title: "No content" }));
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(ReadonlyMonacoPane, { content: content, languageName: languageName, minHeight: minHeight, path: path }));
|
|
21
|
+
}
|
|
22
|
+
function ReadonlyEditorDiffApp(props) {
|
|
23
|
+
const originalContent = String(props.originalContent == null ? "" : props.originalContent);
|
|
24
|
+
const modifiedContent = String(props.modifiedContent == null ? "" : props.modifiedContent);
|
|
25
|
+
const minHeight = Number.isFinite(props.minHeight) ? Number(props.minHeight) : 560;
|
|
26
|
+
const languageName = text(props.languageName);
|
|
27
|
+
const diffPath = normalizePath(props.path || props.modifiedPath || props.originalPath || "diff.txt");
|
|
28
|
+
if (props.originalBinary === true || props.modifiedBinary === true) {
|
|
29
|
+
return (_jsx(EmptyEditorMessage, { copy: "Binary files cannot be displayed as text diffs.", minHeight: minHeight, title: "Diff unavailable" }));
|
|
30
|
+
}
|
|
31
|
+
if (!originalContent.trim() && !modifiedContent.trim()) {
|
|
32
|
+
return (_jsx(EmptyEditorMessage, { copy: "No diff content is available.", minHeight: minHeight, title: "No diff content" }));
|
|
33
|
+
}
|
|
34
|
+
return (_jsx(ReadonlyMonacoDiffPane, { languageName: languageName, minHeight: minHeight, modifiedContent: modifiedContent, modifiedPath: normalizePath(props.modifiedPath || props.path || "modified.txt"), originalContent: originalContent, originalPath: normalizePath(props.originalPath || props.path || "original.txt"), path: diffPath }));
|
|
35
|
+
}
|
|
36
|
+
export { EmptyEditorMessage, ReadonlyEditorContentApp, ReadonlyEditorDiffApp };
|
|
37
|
+
//# sourceMappingURL=readonly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["../../../../src/editor/viewer/readonly.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEzE,SAAS,kBAAkB,CAAC,KAAU;IACp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CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,IAAI,cAAc,CAAC,EAC/E,IAAI,EAAE,QAAQ,GACd,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { findFirstFilePath, findTreeNodeByPath, isImagePath, normalizePath, text } from "../../explorer/index.d.ts";
|
|
2
|
+
declare function getEditorViewerRoot(container: HTMLElement | null): import("react-dom/client").Root;
|
|
3
|
+
declare function deleteRoot(container: HTMLElement | null): void;
|
|
4
|
+
declare function buildFileApiUrl(baseUrlInput: unknown, pathInput: unknown): string;
|
|
5
|
+
declare function syncViewerPathInUrl(pathInput: unknown): void;
|
|
6
|
+
declare function readViewerPathFromUrl(): string;
|
|
7
|
+
declare function readFullscreenState(rootInput: HTMLDivElement | null): boolean;
|
|
8
|
+
declare function resolveViewerTreeHeight(isFullscreen: boolean, viewportHeight: number): number;
|
|
9
|
+
declare function nextEditorViewerModelInstanceId(): number;
|
|
10
|
+
declare function upsertReadonlyModel(monacoRef: any, currentModel: any, uriText: string, languageId: string, content: string): any;
|
|
11
|
+
declare function activateEditorLanguage(monacoRef: any, path: unknown, languageName: unknown): Promise<string>;
|
|
12
|
+
export { activateEditorLanguage, buildFileApiUrl, deleteRoot, findFirstFilePath, findTreeNodeByPath, getEditorViewerRoot, isImagePath, normalizePath, readFullscreenState, readViewerPathFromUrl, resolveViewerTreeHeight, syncViewerPathInUrl, nextEditorViewerModelInstanceId, text, upsertReadonlyModel, };
|
|
13
|
+
//# sourceMappingURL=shared.d.ts.map
|