@preptex/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +54 -2
- package/dist/components/CatalogDialog.css +401 -0
- package/dist/components/CatalogDialog.d.ts +16 -0
- package/dist/components/CatalogDialog.js +224 -0
- package/dist/components/CatalogDialog.js.map +1 -0
- package/dist/components/Codeview.css +127 -0
- package/dist/components/Codeview.d.ts +14 -0
- package/dist/components/Codeview.js +74 -0
- package/dist/components/Codeview.js.map +1 -0
- package/dist/components/ConfigurationSummary.d.ts +18 -0
- package/dist/components/ConfigurationSummary.js +44 -0
- package/dist/components/ConfigurationSummary.js.map +1 -0
- package/dist/components/ControlPanel.css +792 -0
- package/dist/components/ControlPanel.d.ts +48 -0
- package/dist/components/ControlPanel.js +218 -0
- package/dist/components/ControlPanel.js.map +1 -0
- package/dist/components/EditPreviewDialog.css +308 -0
- package/dist/components/EditPreviewDialog.d.ts +18 -0
- package/dist/components/EditPreviewDialog.js +46 -0
- package/dist/components/EditPreviewDialog.js.map +1 -0
- package/dist/components/Filetree.css +344 -0
- package/dist/components/Filetree.d.ts +22 -0
- package/dist/components/Filetree.js +250 -0
- package/dist/components/Filetree.js.map +1 -0
- package/dist/components/LogDialog.css +154 -0
- package/dist/components/LogDialog.d.ts +16 -0
- package/dist/components/LogDialog.js +42 -0
- package/dist/components/LogDialog.js.map +1 -0
- package/dist/components/LogPanel.css +106 -0
- package/dist/components/LogPanel.d.ts +10 -0
- package/dist/components/LogPanel.js +30 -0
- package/dist/components/LogPanel.js.map +1 -0
- package/dist/components/MetadataDialog.css +275 -0
- package/dist/components/MetadataDialog.d.ts +13 -0
- package/dist/components/MetadataDialog.js +67 -0
- package/dist/components/MetadataDialog.js.map +1 -0
- package/dist/components/NodeActionBar.css +163 -0
- package/dist/components/NodeActionBar.d.ts +19 -0
- package/dist/components/NodeActionBar.js +114 -0
- package/dist/components/NodeActionBar.js.map +1 -0
- package/dist/components/OperationsDialog.css +154 -0
- package/dist/components/OperationsDialog.d.ts +8 -0
- package/dist/components/OperationsDialog.js +27 -0
- package/dist/components/OperationsDialog.js.map +1 -0
- package/dist/components/PrepTeXWorkspace.css +224 -0
- package/dist/components/PrepTeXWorkspace.d.ts +125 -0
- package/dist/components/PrepTeXWorkspace.js +593 -0
- package/dist/components/PrepTeXWorkspace.js.map +1 -0
- package/dist/components/ProjectSetupDialog.css +292 -0
- package/dist/components/ProjectSetupDialog.d.ts +18 -0
- package/dist/components/ProjectSetupDialog.js +134 -0
- package/dist/components/ProjectSetupDialog.js.map +1 -0
- package/dist/components/WelcomeEmptyState.css +105 -0
- package/dist/components/WelcomeEmptyState.d.ts +9 -0
- package/dist/components/WelcomeEmptyState.js +28 -0
- package/dist/components/WelcomeEmptyState.js.map +1 -0
- package/dist/components/WorkspaceHeader.css +410 -0
- package/dist/components/WorkspaceHeader.d.ts +66 -0
- package/dist/components/WorkspaceHeader.js +297 -0
- package/dist/components/WorkspaceHeader.js.map +1 -0
- package/dist/components/astview/ASTview.css +690 -0
- package/dist/components/astview/ASTview.d.ts +27 -0
- package/dist/components/astview/ASTview.js +314 -0
- package/dist/components/astview/ASTview.js.map +1 -0
- package/dist/components/astview/TreeNode.d.ts +8 -0
- package/dist/components/astview/TreeNode.js +237 -0
- package/dist/components/astview/TreeNode.js.map +1 -0
- package/dist/components/astview/treebuilder.d.ts +13 -0
- package/dist/components/astview/treebuilder.js +292 -0
- package/dist/components/astview/treebuilder.js.map +1 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.js +19 -0
- package/dist/components/index.js.map +1 -0
- package/dist/docs/architecture.md +46 -0
- package/dist/docs/integration.md +107 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/model/useArtifacts.d.ts +14 -0
- package/dist/model/useArtifacts.js +32 -0
- package/dist/model/useArtifacts.js.map +1 -0
- package/dist/model/useControl.d.ts +15 -0
- package/dist/model/useControl.js +19 -0
- package/dist/model/useControl.js.map +1 -0
- package/dist/model/useFiles.d.ts +53 -0
- package/dist/model/useFiles.js +283 -0
- package/dist/model/useFiles.js.map +1 -0
- package/dist/model/useProjectConfiguration.d.ts +32 -0
- package/dist/model/useProjectConfiguration.js +151 -0
- package/dist/model/useProjectConfiguration.js.map +1 -0
- package/dist/model/useWorkspaceLayout.d.ts +26 -0
- package/dist/model/useWorkspaceLayout.js +55 -0
- package/dist/model/useWorkspaceLayout.js.map +1 -0
- package/dist/services/zip.d.ts +24 -0
- package/dist/services/zip.js +279 -0
- package/dist/services/zip.js.map +1 -0
- package/dist/styles/bundle.css +4652 -0
- package/dist/styles/tokens.css +77 -0
- package/dist/types/LayoutNode.d.ts +30 -0
- package/dist/types/LayoutNode.js +18 -0
- package/dist/types/LayoutNode.js.map +1 -0
- package/dist/types/artifacts.d.ts +9 -0
- package/dist/types/artifacts.js +2 -0
- package/dist/types/artifacts.js.map +1 -0
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/errors.js +2 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/files.d.ts +12 -0
- package/dist/types/files.js +2 -0
- package/dist/types/files.js.map +1 -0
- package/dist/utils/dropEntries.d.ts +6 -0
- package/dist/utils/dropEntries.js +58 -0
- package/dist/utils/dropEntries.js.map +1 -0
- package/dist/utils/fileFilter.d.ts +10 -0
- package/dist/utils/fileFilter.js +68 -0
- package/dist/utils/fileFilter.js.map +1 -0
- package/dist/utils/transformOutput.d.ts +24 -0
- package/dist/utils/transformOutput.js +83 -0
- package/dist/utils/transformOutput.js.map +1 -0
- package/package.json +103 -4
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import './PrepTeXWorkspace.css';
|
|
4
|
+
import ASTview from './astview/ASTview.js';
|
|
5
|
+
import { TreeLayoutBuilder } from './astview/treebuilder.js';
|
|
6
|
+
import CatalogDialog from './CatalogDialog.js';
|
|
7
|
+
import Codeview from './Codeview.js';
|
|
8
|
+
import { EditPreviewDialog } from './EditPreviewDialog.js';
|
|
9
|
+
import Filetree from './Filetree.js';
|
|
10
|
+
import LogDialog from './LogDialog.js';
|
|
11
|
+
import MetadataDialog from './MetadataDialog.js';
|
|
12
|
+
import { NodeActionBar } from './NodeActionBar.js';
|
|
13
|
+
import OperationsDialog from './OperationsDialog.js';
|
|
14
|
+
import { ProjectSetupDialog } from './ProjectSetupDialog.js';
|
|
15
|
+
import WelcomeEmptyState from './WelcomeEmptyState.js';
|
|
16
|
+
import WorkspaceHeader from './WorkspaceHeader.js';
|
|
17
|
+
import { useControl } from '../model/useControl.js';
|
|
18
|
+
import { useFiles } from '../model/useFiles.js';
|
|
19
|
+
import { recommendEntry, useProjectConfiguration } from '../model/useProjectConfiguration.js';
|
|
20
|
+
import { useWorkspaceLayout } from '../model/useWorkspaceLayout.js';
|
|
21
|
+
import { downloadBlob, downloadZipArchive } from '../services/zip.js';
|
|
22
|
+
export const DEFAULT_DEMO_PROJECT_FILES = {
|
|
23
|
+
'main.tex': `\\documentclass[11pt]{article}
|
|
24
|
+
\\usepackage{amsmath}
|
|
25
|
+
\\newcommand{\\highlight}[1]{\\textbf{#1}}
|
|
26
|
+
\\newenvironment{notebox}{\\begin{quote}}{\\end{quote}}
|
|
27
|
+
\\newif\\ifdraft
|
|
28
|
+
\\drafttrue
|
|
29
|
+
\\title[PrepTeX Demo]{PrepTeX Phase 3 Workspace Demo}
|
|
30
|
+
\\author{Narek Bojikian \\and Alex Researcher\\thanks{PrepTeX Lab}}
|
|
31
|
+
\\date{November 2026}
|
|
32
|
+
\\begin{document}
|
|
33
|
+
\\maketitle
|
|
34
|
+
\\begin{abstract}
|
|
35
|
+
A concise summary of the structural TeX workspace.
|
|
36
|
+
\\end{abstract}
|
|
37
|
+
|
|
38
|
+
% Main section
|
|
39
|
+
\\section{Introduction}\\label{sec:intro}
|
|
40
|
+
This is a \\highlight{sample} document demonstrating PrepTeX processing.
|
|
41
|
+
Undefined call with arguments: \\badge[new]{ready}.
|
|
42
|
+
See Section~\\ref{sec:methods} and work~\\cite{knuth84}.
|
|
43
|
+
|
|
44
|
+
\\input{intro/history.tex}
|
|
45
|
+
|
|
46
|
+
\\begin{notebox}
|
|
47
|
+
Editable custom environment content.
|
|
48
|
+
\\end{notebox}
|
|
49
|
+
|
|
50
|
+
\\ifdraft
|
|
51
|
+
% Draft notes:
|
|
52
|
+
Draft notice: work in progress.
|
|
53
|
+
\\else
|
|
54
|
+
Final published version.
|
|
55
|
+
\\fi
|
|
56
|
+
|
|
57
|
+
\\begin{comment}
|
|
58
|
+
Internal development comment to remove.
|
|
59
|
+
\\end{comment}
|
|
60
|
+
|
|
61
|
+
\\section{Methods}\\label{sec:methods}
|
|
62
|
+
Reference to \\ref{sec:missing}.
|
|
63
|
+
\\begin{enumerate}
|
|
64
|
+
\\item First item
|
|
65
|
+
\\item Second item
|
|
66
|
+
\\end{enumerate}
|
|
67
|
+
\\begin{thebibliography}{9}
|
|
68
|
+
\\bibitem{knuth84} Donald Knuth, The TeXbook.
|
|
69
|
+
\\end{thebibliography}
|
|
70
|
+
\\end{document}
|
|
71
|
+
`,
|
|
72
|
+
'intro/history.tex': `% Historical note in subfolder
|
|
73
|
+
\\subsection{Background}
|
|
74
|
+
Since 1984, \\highlight{TeX} has enabled structured mathematical typesetting across nested project files.
|
|
75
|
+
`,
|
|
76
|
+
};
|
|
77
|
+
export function applyProjectEditsToFilesMap(filesByName, edits) {
|
|
78
|
+
const editsByPath = new Map();
|
|
79
|
+
for (const edit of edits) {
|
|
80
|
+
const existing = editsByPath.get(edit.path) ?? [];
|
|
81
|
+
existing.push(edit);
|
|
82
|
+
editsByPath.set(edit.path, existing);
|
|
83
|
+
}
|
|
84
|
+
const nextFiles = { ...filesByName };
|
|
85
|
+
editsByPath.forEach((fileEdits, filePath) => {
|
|
86
|
+
const source = filesByName[filePath];
|
|
87
|
+
if (source === undefined || fileEdits.length === 0)
|
|
88
|
+
return;
|
|
89
|
+
let pos = 0;
|
|
90
|
+
const chunks = [];
|
|
91
|
+
for (const edit of fileEdits) {
|
|
92
|
+
const start = edit.kind === 'replace' ? edit.range.start : edit.offset;
|
|
93
|
+
const end = edit.kind === 'replace' ? edit.range.end + 1 : edit.offset;
|
|
94
|
+
const text = edit.kind === 'replace' ? edit.replacement : edit.text;
|
|
95
|
+
chunks.push(source.slice(pos, start), text);
|
|
96
|
+
pos = end;
|
|
97
|
+
}
|
|
98
|
+
chunks.push(source.slice(pos));
|
|
99
|
+
nextFiles[filePath] = chunks.join('');
|
|
100
|
+
});
|
|
101
|
+
return nextFiles;
|
|
102
|
+
}
|
|
103
|
+
function normalizeOutputName(raw) {
|
|
104
|
+
const trimmed = raw.trim();
|
|
105
|
+
if (!trimmed)
|
|
106
|
+
return '';
|
|
107
|
+
const hasExt = /\.[^./\\]+$/.test(trimmed);
|
|
108
|
+
return hasExt ? trimmed : `${trimmed}.processed.tex`;
|
|
109
|
+
}
|
|
110
|
+
export function getOperationHistoryLabel(operation, customLabels) {
|
|
111
|
+
if (operation && customLabels && customLabels[operation]) {
|
|
112
|
+
return customLabels[operation];
|
|
113
|
+
}
|
|
114
|
+
switch (operation) {
|
|
115
|
+
case 'realize-conditions':
|
|
116
|
+
return 'Condition realization';
|
|
117
|
+
case 'refactor-symbols':
|
|
118
|
+
return 'Symbol refactor';
|
|
119
|
+
case 'suppress-comments':
|
|
120
|
+
return 'Comment suppression';
|
|
121
|
+
case 'remove-environments':
|
|
122
|
+
return 'Remove environments';
|
|
123
|
+
case 'expand-inputs':
|
|
124
|
+
return 'Expand / flatten inputs';
|
|
125
|
+
case 'compose-transformations':
|
|
126
|
+
return 'Composed pipeline';
|
|
127
|
+
case 'edit-nodes':
|
|
128
|
+
return 'Node edit';
|
|
129
|
+
default:
|
|
130
|
+
return 'Transformation';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function findConfiguredNodeByKey(root, occurrenceKey) {
|
|
134
|
+
if (!root)
|
|
135
|
+
return null;
|
|
136
|
+
const stack = [root];
|
|
137
|
+
while (stack.length > 0) {
|
|
138
|
+
const current = stack.pop();
|
|
139
|
+
if (current.occurrenceKey === occurrenceKey)
|
|
140
|
+
return current;
|
|
141
|
+
if (current.kind !== 'token') {
|
|
142
|
+
for (let i = current.children.length - 1; i >= 0; i -= 1) {
|
|
143
|
+
const child = current.children[i];
|
|
144
|
+
if (child)
|
|
145
|
+
stack.push(child);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const WorkspaceSessionContext = createContext(null);
|
|
152
|
+
export function usePrepTeXWorkspace() {
|
|
153
|
+
const ctx = useContext(WorkspaceSessionContext);
|
|
154
|
+
if (!ctx) {
|
|
155
|
+
throw new Error('usePrepTeXWorkspace must be used inside a PrepTeXWorkspace.');
|
|
156
|
+
}
|
|
157
|
+
return ctx;
|
|
158
|
+
}
|
|
159
|
+
const EMPTY_MODEL = {};
|
|
160
|
+
const EMPTY_DIAGNOSTICS = [];
|
|
161
|
+
const EMPTY_FINDINGS = [];
|
|
162
|
+
const EMPTY_ARTIFACTS = [];
|
|
163
|
+
export function PrepTeXWorkspace({ files: externalFiles, projectConfig: externalProjectConfig, layout: externalLayout, control: externalControl, model = EMPTY_MODEL, actions, initialFiles, demoFiles = DEFAULT_DEMO_PROJECT_FILES, brandLabel, initialView = 'code', enableDemoQueryParams = true, extraViews, getExtraViews, getExtraMenus, getExtraFileMenuItems, getExtraEditMenuItems, renderHeaderRightSlot, renderAstNodeActions, renderDiagnosticsActions, renderOperationsExtraContent, renderEmptyStateActions, customOperationLabels, onFilesChange, }) {
|
|
164
|
+
const [jumpToLine, setJumpToLine] = useState(undefined);
|
|
165
|
+
const [jumpRange, setJumpRange] = useState(undefined);
|
|
166
|
+
const [jumpToken, setJumpToken] = useState(0);
|
|
167
|
+
const [structureMode, setStructureMode] = useState('coarse');
|
|
168
|
+
const hasAutoRecommendedEntryRef = useRef(false);
|
|
169
|
+
const [uploadFilesTrigger, setUploadFilesTrigger] = useState(0);
|
|
170
|
+
const [uploadFolderTrigger, setUploadFolderTrigger] = useState(0);
|
|
171
|
+
const [newFileTrigger, setNewFileTrigger] = useState(0);
|
|
172
|
+
const [selectedNode, setSelectedNode] = useState(null);
|
|
173
|
+
const [switchToConditionFree, setSwitchToConditionFree] = useState(true);
|
|
174
|
+
const [selectedArtifact, setSelectedArtifact] = useState(null);
|
|
175
|
+
const [localPendingPlan, setLocalPendingPlan] = useState(null);
|
|
176
|
+
const [localPendingMeta, setLocalPendingMeta] = useState(null);
|
|
177
|
+
const internalFiles = useFiles(initialFiles);
|
|
178
|
+
const filesState = externalFiles ?? internalFiles;
|
|
179
|
+
const { filesByName, fileNames, fileVersions, selectedFile, selectFile, uploadError, uploadNotice, clearUploadNotice, upsertFiles, upsertFileItems, upsertTextFiles, removeFile, resetFiles, sourceRevision, canGoBack, canGoForward, backLabel, forwardLabel, goBack, goForward, } = filesState;
|
|
180
|
+
const internalProjectConfig = useProjectConfiguration(filesByName, {
|
|
181
|
+
entryPath: selectedFile || null,
|
|
182
|
+
conditionPolicy: { mode: 'ignore' },
|
|
183
|
+
});
|
|
184
|
+
const projectConfig = externalProjectConfig ?? internalProjectConfig;
|
|
185
|
+
const internalLayout = useWorkspaceLayout(initialView);
|
|
186
|
+
const layout = externalLayout ?? internalLayout;
|
|
187
|
+
const internalControl = useControl();
|
|
188
|
+
const control = externalControl ?? internalControl;
|
|
189
|
+
const { options, setOptions } = control;
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
onFilesChange?.(filesByName, sourceRevision, fileVersions);
|
|
192
|
+
}, [filesByName, sourceRevision, fileVersions, onFilesChange]);
|
|
193
|
+
const loadDemoProject = useCallback(() => {
|
|
194
|
+
hasAutoRecommendedEntryRef.current = true;
|
|
195
|
+
upsertTextFiles(demoFiles);
|
|
196
|
+
const recommended = recommendEntry(demoFiles) ?? Object.keys(demoFiles)[0] ?? '';
|
|
197
|
+
if (recommended) {
|
|
198
|
+
selectFile(recommended);
|
|
199
|
+
}
|
|
200
|
+
projectConfig.commitConfiguration({
|
|
201
|
+
entryPath: recommended || null,
|
|
202
|
+
traversal: 'project',
|
|
203
|
+
inputs: 'command',
|
|
204
|
+
conditionPolicy: { mode: 'ignore' },
|
|
205
|
+
});
|
|
206
|
+
setSelectedArtifact(null);
|
|
207
|
+
setSelectedNode(null);
|
|
208
|
+
}, [demoFiles, projectConfig, selectFile, upsertTextFiles]);
|
|
209
|
+
// Auto-recommend an entry file quietly (without modal popup) when files enter an empty workspace
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (fileNames.length === 0) {
|
|
212
|
+
hasAutoRecommendedEntryRef.current = false;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!hasAutoRecommendedEntryRef.current) {
|
|
216
|
+
hasAutoRecommendedEntryRef.current = true;
|
|
217
|
+
if (!projectConfig.entryPath) {
|
|
218
|
+
const recommended = recommendEntry(filesByName);
|
|
219
|
+
if (recommended) {
|
|
220
|
+
projectConfig.setEntryPath(recommended);
|
|
221
|
+
selectFile(recommended);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}, [fileNames.length, filesByName, projectConfig, selectFile]);
|
|
226
|
+
// Demo / State URL parameter support
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
if (!enableDemoQueryParams || typeof window === 'undefined')
|
|
229
|
+
return;
|
|
230
|
+
const params = new URLSearchParams(window.location.search);
|
|
231
|
+
const demo = params.get('demo');
|
|
232
|
+
if (demo === 'sample' && fileNames.length === 0) {
|
|
233
|
+
loadDemoProject();
|
|
234
|
+
const state = params.get('state');
|
|
235
|
+
if (state === 'operations' || state === 'transformations') {
|
|
236
|
+
layout.selectView('transformations');
|
|
237
|
+
}
|
|
238
|
+
else if (state === 'ast') {
|
|
239
|
+
layout.selectView('ast');
|
|
240
|
+
}
|
|
241
|
+
else if (state === 'catalog') {
|
|
242
|
+
layout.selectView('catalog');
|
|
243
|
+
}
|
|
244
|
+
else if (state === 'metadata') {
|
|
245
|
+
layout.selectView('metadata');
|
|
246
|
+
}
|
|
247
|
+
else if (state === 'settings') {
|
|
248
|
+
layout.selectView('settings');
|
|
249
|
+
}
|
|
250
|
+
else if (state === 'log' || state === 'bottom-log' || state === 'diagnostics') {
|
|
251
|
+
layout.selectView('diagnostics');
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
actions?.onRunReferences?.();
|
|
254
|
+
}, 100);
|
|
255
|
+
}
|
|
256
|
+
else if (state && extraViews?.some((view) => view.id === state)) {
|
|
257
|
+
layout.selectView(state);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}, [actions, enableDemoQueryParams, extraViews, fileNames.length, layout, loadDemoProject]);
|
|
261
|
+
const code = filesByName[selectedFile] ?? '';
|
|
262
|
+
const displayedFilename = selectedArtifact ? selectedArtifact.path : selectedFile;
|
|
263
|
+
const displayedCode = selectedArtifact ? selectedArtifact.source : code;
|
|
264
|
+
const effectiveEntry = projectConfig.entryPath || selectedFile;
|
|
265
|
+
const rootNode = useMemo(() => {
|
|
266
|
+
if (structureMode === 'coarse') {
|
|
267
|
+
if (model.coarseTree) {
|
|
268
|
+
return new TreeLayoutBuilder().buildCoarse(model.coarseTree);
|
|
269
|
+
}
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
if (structureMode === 'configured') {
|
|
273
|
+
if (model.viewStatus === 'ready' && model.configuredRoot) {
|
|
274
|
+
return new TreeLayoutBuilder().buildConfigured(model.configuredRoot);
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
const tokens = model.sourceTokensByFile?.[selectedFile];
|
|
279
|
+
if (tokens && tokens.length > 0) {
|
|
280
|
+
return new TreeLayoutBuilder().buildSourceTokens(selectedFile, tokens);
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}, [
|
|
284
|
+
structureMode,
|
|
285
|
+
model.coarseTree,
|
|
286
|
+
model.viewStatus,
|
|
287
|
+
model.configuredRoot,
|
|
288
|
+
model.sourceTokensByFile,
|
|
289
|
+
selectedFile,
|
|
290
|
+
]);
|
|
291
|
+
const jumpToAnalysisLocation = useCallback((location) => {
|
|
292
|
+
if (filesByName[location.path]) {
|
|
293
|
+
setSelectedArtifact(null);
|
|
294
|
+
selectFile(location.path);
|
|
295
|
+
}
|
|
296
|
+
setJumpRange(location.range);
|
|
297
|
+
setJumpToLine(location.range.line);
|
|
298
|
+
setJumpToken((val) => val + 1);
|
|
299
|
+
if (!layout.splitEnabled) {
|
|
300
|
+
layout.selectView('code');
|
|
301
|
+
}
|
|
302
|
+
}, [filesByName, layout, selectFile]);
|
|
303
|
+
const stageEditPlan = useCallback((plan, metadata) => {
|
|
304
|
+
if (actions?.onStageEditPlan) {
|
|
305
|
+
actions.onStageEditPlan(plan, metadata);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
setLocalPendingPlan(plan);
|
|
309
|
+
setLocalPendingMeta(metadata ?? null);
|
|
310
|
+
}
|
|
311
|
+
if (metadata?.switchToDiff ?? true) {
|
|
312
|
+
layout.selectView('diff');
|
|
313
|
+
}
|
|
314
|
+
}, [actions, layout]);
|
|
315
|
+
const effectivePendingPlan = model.pendingEditPlan ?? localPendingPlan;
|
|
316
|
+
const effectivePendingMeta = model.pendingEditMetadata ?? localPendingMeta;
|
|
317
|
+
const effectiveArtifacts = model.artifacts ?? localPendingMeta?.artifacts ?? EMPTY_ARTIFACTS;
|
|
318
|
+
const effectiveDiagnostics = model.diagnostics ?? EMPTY_DIAGNOSTICS;
|
|
319
|
+
const effectiveFindings = model.findings ?? EMPTY_FINDINGS;
|
|
320
|
+
const workspaceContext = useMemo(() => ({
|
|
321
|
+
filesByName,
|
|
322
|
+
fileNames,
|
|
323
|
+
fileVersions,
|
|
324
|
+
sourceRevision,
|
|
325
|
+
selectedFile,
|
|
326
|
+
selectFile,
|
|
327
|
+
upsertTextFiles,
|
|
328
|
+
removeFile,
|
|
329
|
+
resetFiles,
|
|
330
|
+
projectConfig,
|
|
331
|
+
layout,
|
|
332
|
+
control,
|
|
333
|
+
model,
|
|
334
|
+
effectiveEntry,
|
|
335
|
+
selectedNode,
|
|
336
|
+
setSelectedNode,
|
|
337
|
+
selectedArtifact,
|
|
338
|
+
setSelectedArtifact,
|
|
339
|
+
jumpToLocation: jumpToAnalysisLocation,
|
|
340
|
+
stageEditPlan,
|
|
341
|
+
loadDemo: loadDemoProject,
|
|
342
|
+
}), [
|
|
343
|
+
control,
|
|
344
|
+
effectiveEntry,
|
|
345
|
+
fileNames,
|
|
346
|
+
fileVersions,
|
|
347
|
+
filesByName,
|
|
348
|
+
jumpToAnalysisLocation,
|
|
349
|
+
layout,
|
|
350
|
+
loadDemoProject,
|
|
351
|
+
model,
|
|
352
|
+
projectConfig,
|
|
353
|
+
removeFile,
|
|
354
|
+
resetFiles,
|
|
355
|
+
selectFile,
|
|
356
|
+
selectedArtifact,
|
|
357
|
+
selectedFile,
|
|
358
|
+
selectedNode,
|
|
359
|
+
sourceRevision,
|
|
360
|
+
stageEditPlan,
|
|
361
|
+
upsertTextFiles,
|
|
362
|
+
]);
|
|
363
|
+
const resolvedExtraViews = useMemo(() => (getExtraViews ? getExtraViews(workspaceContext) : extraViews ?? []), [extraViews, getExtraViews, workspaceContext]);
|
|
364
|
+
const resolvedExtraMenus = useMemo(() => (getExtraMenus ? getExtraMenus(workspaceContext) : []), [getExtraMenus, workspaceContext]);
|
|
365
|
+
const resolvedExtraFileMenuItems = useMemo(() => (getExtraFileMenuItems ? getExtraFileMenuItems(workspaceContext) : []), [getExtraFileMenuItems, workspaceContext]);
|
|
366
|
+
const resolvedExtraEditMenuItems = useMemo(() => (getExtraEditMenuItems ? getExtraEditMenuItems(workspaceContext) : []), [getExtraEditMenuItems, workspaceContext]);
|
|
367
|
+
const onDownload = (name) => {
|
|
368
|
+
const text = filesByName[name] ?? '';
|
|
369
|
+
const blob = new Blob([text], { type: 'text/plain;charset=utf-8' });
|
|
370
|
+
downloadBlob(blob, name);
|
|
371
|
+
};
|
|
372
|
+
const onSelectFile = (name) => {
|
|
373
|
+
setSelectedArtifact(null);
|
|
374
|
+
setJumpToLine(undefined);
|
|
375
|
+
setJumpRange(undefined);
|
|
376
|
+
selectFile(name);
|
|
377
|
+
if (layout.activeView === 'diff' || layout.activeView === 'settings') {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const handleCreateFile = (path) => {
|
|
382
|
+
const existed = Object.prototype.hasOwnProperty.call(filesByName, path);
|
|
383
|
+
if (!existed) {
|
|
384
|
+
upsertTextFiles({ [path]: '% New TeX file\n' }, { recordHistory: true, label: `Create ${path}` });
|
|
385
|
+
}
|
|
386
|
+
selectFile(path);
|
|
387
|
+
if (!layout.splitEnabled) {
|
|
388
|
+
layout.selectView('code');
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
const inputWarnings = useMemo(() => effectiveDiagnostics.filter((issue) => issue.code === 'missing-input'), [effectiveDiagnostics]);
|
|
392
|
+
const totalDiagnosticCount = effectiveDiagnostics.length +
|
|
393
|
+
effectiveFindings.length +
|
|
394
|
+
(model.error ? 1 : 0);
|
|
395
|
+
const handleSelectAstNode = useCallback((node) => {
|
|
396
|
+
if (node.path && node.path !== selectedFile && filesByName[node.path]) {
|
|
397
|
+
setSelectedArtifact(null);
|
|
398
|
+
selectFile(node.path);
|
|
399
|
+
}
|
|
400
|
+
if (node.range) {
|
|
401
|
+
setJumpRange(node.range);
|
|
402
|
+
}
|
|
403
|
+
if (typeof node.line === 'number' && Number.isFinite(node.line)) {
|
|
404
|
+
setJumpToLine(node.line);
|
|
405
|
+
setJumpToken((value) => value + 1);
|
|
406
|
+
}
|
|
407
|
+
if (model.viewStatus === 'ready' && node.occurrenceKey && model.configuredRoot) {
|
|
408
|
+
const found = findConfiguredNodeByKey(model.configuredRoot, node.occurrenceKey);
|
|
409
|
+
setSelectedNode(found);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
setSelectedNode(null);
|
|
413
|
+
}
|
|
414
|
+
}, [filesByName, model.configuredRoot, model.viewStatus, selectFile, selectedFile]);
|
|
415
|
+
const discardPending = useCallback(() => {
|
|
416
|
+
setLocalPendingPlan(null);
|
|
417
|
+
setLocalPendingMeta(null);
|
|
418
|
+
actions?.onDiscardPendingEdits?.();
|
|
419
|
+
}, [actions]);
|
|
420
|
+
const renderAstView = (isSplitCompanion = false) => (_jsxs("div", { className: "AstPaneComposite", children: [_jsx(NodeActionBar, { selectedNode: selectedNode, catalog: model.catalog ?? null, customCommands: projectConfig.customCommands, onRemoveNode: () => {
|
|
421
|
+
if (selectedNode) {
|
|
422
|
+
actions?.onRemoveNode?.(selectedNode);
|
|
423
|
+
}
|
|
424
|
+
}, onRenameEnvironment: (newName) => {
|
|
425
|
+
if (selectedNode) {
|
|
426
|
+
actions?.onRenameEnvironment?.(selectedNode, newName);
|
|
427
|
+
}
|
|
428
|
+
}, onRenameEnvironmentGlobally: (oldName, newName) => {
|
|
429
|
+
actions?.onRefactorSymbol?.({
|
|
430
|
+
kind: 'rename-environment-globally',
|
|
431
|
+
oldName,
|
|
432
|
+
newName,
|
|
433
|
+
});
|
|
434
|
+
}, onRenameCommand: (newName) => {
|
|
435
|
+
if (selectedNode) {
|
|
436
|
+
actions?.onRenameCommand?.(selectedNode, newName);
|
|
437
|
+
}
|
|
438
|
+
}, onRenameCommandGlobally: (oldName, newName) => {
|
|
439
|
+
actions?.onRefactorSymbol?.({
|
|
440
|
+
kind: 'rename-command-globally',
|
|
441
|
+
oldName,
|
|
442
|
+
newName,
|
|
443
|
+
});
|
|
444
|
+
}, onRenameSection: (sectionCommand, starred) => {
|
|
445
|
+
if (selectedNode) {
|
|
446
|
+
actions?.onRenameSection?.(selectedNode, sectionCommand, starred);
|
|
447
|
+
}
|
|
448
|
+
}, onUnwrapNode: () => {
|
|
449
|
+
if (selectedNode) {
|
|
450
|
+
actions?.onUnwrapNode?.(selectedNode);
|
|
451
|
+
}
|
|
452
|
+
}, onUpsertCustomCommand: projectConfig.upsertCustomCommand, onWrapNode: (wrapperName) => {
|
|
453
|
+
if (selectedNode) {
|
|
454
|
+
actions?.onWrapNode?.(selectedNode, wrapperName);
|
|
455
|
+
}
|
|
456
|
+
}, extraActions: selectedNode && renderAstNodeActions
|
|
457
|
+
? renderAstNodeActions(selectedNode, workspaceContext)
|
|
458
|
+
: undefined, onClearSelection: () => setSelectedNode(null) }), _jsx(ASTview, { root: rootNode, selectedNodeKey: selectedNode?.occurrenceKey ?? null, isSidePanel: false, structureMode: structureMode, onChangeStructureMode: setStructureMode, isConfiguredAvailable: model.viewStatus === 'ready', viewIssue: model.viewIssue ?? null, inputMode: projectConfig.inputs, onChangeInputMode: projectConfig.setInputMode, inputWarnings: inputWarnings, coarseOptions: projectConfig.coarseTreeOptions, onChangeCoarseOptions: projectConfig.setCoarseTreeOptions, hasConditionals: Boolean(model.hasConditionals), conditionPolicy: projectConfig.conditionPolicy, detectedConditions: model.detectedConditions ?? [], onConfigureConditions: projectConfig.setConditionPolicy, splitEnabled: layout.splitEnabled, onToggleSplit: isSplitCompanion ? undefined : layout.toggleSplit, onSelectNode: handleSelectAstNode }, `${selectedFile}:${model.viewId ?? ''}:${isSplitCompanion ? 'split' : 'main'}`)] }));
|
|
459
|
+
const renderPrimaryView = () => {
|
|
460
|
+
if (fileNames.length === 0) {
|
|
461
|
+
return (_jsx(WelcomeEmptyState, { onUploadFiles: () => setUploadFilesTrigger((c) => c + 1), onUploadFolder: () => setUploadFolderTrigger((c) => c + 1), onLoadDemo: loadDemoProject, onDropFiles: (items) => {
|
|
462
|
+
void upsertFileItems(items);
|
|
463
|
+
}, extraActions: renderEmptyStateActions?.(workspaceContext) }));
|
|
464
|
+
}
|
|
465
|
+
const customView = resolvedExtraViews.find((view) => view.id === layout.activeView);
|
|
466
|
+
if (customView) {
|
|
467
|
+
return customView.render(workspaceContext);
|
|
468
|
+
}
|
|
469
|
+
switch (layout.activeView) {
|
|
470
|
+
case 'code':
|
|
471
|
+
default:
|
|
472
|
+
return (_jsxs(_Fragment, { children: [selectedArtifact ? (_jsxs("div", { className: "ArtifactBanner", children: [_jsxs("span", { children: ["Viewing generated artifact: ", _jsx("code", { children: selectedArtifact.path })] }), _jsx("button", { type: "button", className: "ArtifactBannerBtn", onClick: () => setSelectedArtifact(null), children: "Return to source" })] })) : null, _jsx(Codeview, { filename: displayedFilename, code: displayedCode, jumpToLine: jumpToLine, jumpRange: jumpRange, jumpToken: jumpToken })] }));
|
|
473
|
+
case 'ast':
|
|
474
|
+
return renderAstView(false);
|
|
475
|
+
case 'transformations':
|
|
476
|
+
return (_jsx(OperationsDialog, { variant: "view", isOpen: true, onClose: () => layout.selectView('code'), options: options, onChange: setOptions, entryFile: effectiveEntry, conditionPolicy: projectConfig.conditionPolicy, hasConditionals: Boolean(model.hasConditionals), detectedConditions: model.detectedConditions ?? [], onConfigureConditions: projectConfig.setConditionPolicy, defaultTransformTarget: projectConfig.conditionPolicy.mode === 'ignore' ? 'source' : 'selected', canRunSourceTransformations: Boolean(model.canRunSourceTransformations), canRealizeConditions: Boolean(model.canRealizeConditions), realizeConditionsReason: model.realizeConditionsReason, conditionDecisions: model.conditionDecisions ?? [], canRunViewTransformations: Boolean(model.canRunViewTransformations), viewTransformationReason: model.viewTransformationReason, onApplyTransformations: actions?.onApplyTransformations, artifacts: effectiveArtifacts, onDownloadZip: () => {
|
|
477
|
+
if (effectiveArtifacts.length > 0) {
|
|
478
|
+
downloadZipArchive(effectiveArtifacts.map((a) => ({ path: a.path, content: a.source })), 'preptex-export.zip');
|
|
479
|
+
}
|
|
480
|
+
}, onDownloadArtifact: (art) => {
|
|
481
|
+
const overrideName = effectiveArtifacts.length === 1 ? normalizeOutputName(options.outputName) : '';
|
|
482
|
+
const blob = new Blob([art.source], { type: 'text/plain;charset=utf-8' });
|
|
483
|
+
downloadBlob(blob, overrideName || art.path);
|
|
484
|
+
}, onSelectArtifact: (art) => {
|
|
485
|
+
setSelectedArtifact(art);
|
|
486
|
+
layout.selectView('code');
|
|
487
|
+
}, extraContent: renderOperationsExtraContent?.(workspaceContext) }));
|
|
488
|
+
case 'catalog':
|
|
489
|
+
return (_jsx(CatalogDialog, { variant: "view", isOpen: true, onClose: () => layout.selectView('code'), catalog: model.catalog ?? null, customCommands: projectConfig.customCommands, onUpsertCustomCommand: projectConfig.upsertCustomCommand, onRemoveCustomCommand: projectConfig.removeCustomCommand, onRefactorSymbol: (action) => actions?.onRefactorSymbol?.(action), onSelectLocation: jumpToAnalysisLocation }));
|
|
490
|
+
case 'metadata':
|
|
491
|
+
return (_jsx(MetadataDialog, { variant: "view", isOpen: true, onClose: () => layout.selectView('code'), metadata: model.metadata ?? null, onEditMetadata: (action) => actions?.onRefactorSymbol?.(action), onSelectLocation: jumpToAnalysisLocation }));
|
|
492
|
+
case 'diagnostics':
|
|
493
|
+
return (_jsx(LogDialog, { variant: "view", isOpen: true, onClose: () => layout.selectView('code'), diagnostics: effectiveDiagnostics, error: model.error ?? null, findings: effectiveFindings, isStale: Boolean(model.isFindingsStale), onRunReferences: actions?.onRunReferences, canRunReferences: Boolean(model.canRunReferences), referencesReason: model.referencesReason, onRunCommandUsage: actions?.onRunCommandUsage, canRunCommandUsage: Boolean(model.canRunCommandUsage), commandUsageReason: model.commandUsageReason, isAnalyzing: Boolean(model.isAnalyzing), onSelectLocation: jumpToAnalysisLocation, extraHeaderActions: renderDiagnosticsActions?.(workspaceContext) }));
|
|
494
|
+
case 'diff':
|
|
495
|
+
return (_jsx(EditPreviewDialog, { variant: "view", isOpen: true, onClose: () => layout.returnFromDiff('code'), editPlan: effectivePendingPlan, isStale: Boolean(model.isEditPlanStale), error: model.error ?? null, switchToConditionFree: switchToConditionFree, onToggleSwitchToConditionFree: setSwitchToConditionFree, customTitle: effectivePendingMeta?.title, customSubtitle: effectivePendingMeta?.subtitle, onSelectLocation: (path, line) => {
|
|
496
|
+
if (filesByName[path]) {
|
|
497
|
+
setSelectedArtifact(null);
|
|
498
|
+
selectFile(path);
|
|
499
|
+
}
|
|
500
|
+
setJumpRange(undefined);
|
|
501
|
+
setJumpToLine(line);
|
|
502
|
+
setJumpToken((val) => val + 1);
|
|
503
|
+
if (!layout.splitEnabled) {
|
|
504
|
+
layout.selectView('code');
|
|
505
|
+
}
|
|
506
|
+
}, onDiscard: () => {
|
|
507
|
+
discardPending();
|
|
508
|
+
layout.returnFromDiff('code');
|
|
509
|
+
}, onApply: () => {
|
|
510
|
+
const plan = effectivePendingPlan;
|
|
511
|
+
if (!plan)
|
|
512
|
+
return;
|
|
513
|
+
const isConditionRealization = plan.provenance.request.operation === 'realize-conditions';
|
|
514
|
+
const historyLabel = effectivePendingMeta?.historyLabel ??
|
|
515
|
+
getOperationHistoryLabel(plan.provenance.request.operation, customOperationLabels);
|
|
516
|
+
if (actions?.onApplyPendingEdits) {
|
|
517
|
+
const applyResult = actions.onApplyPendingEdits({
|
|
518
|
+
switchToConditionFree,
|
|
519
|
+
historyLabel,
|
|
520
|
+
});
|
|
521
|
+
const clearIfApplied = (applied) => {
|
|
522
|
+
if (applied !== false) {
|
|
523
|
+
setSelectedNode(null);
|
|
524
|
+
setSelectedArtifact(null);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
if (typeof applyResult === 'boolean' || applyResult === undefined) {
|
|
528
|
+
clearIfApplied(applyResult);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
void applyResult.then(clearIfApplied);
|
|
532
|
+
}
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const updatedFiles = applyProjectEditsToFilesMap(filesByName, plan.edits);
|
|
536
|
+
upsertTextFiles(updatedFiles, { recordHistory: true, label: historyLabel });
|
|
537
|
+
setLocalPendingPlan(null);
|
|
538
|
+
setLocalPendingMeta(null);
|
|
539
|
+
setSelectedNode(null);
|
|
540
|
+
setSelectedArtifact(null);
|
|
541
|
+
if (isConditionRealization && switchToConditionFree) {
|
|
542
|
+
projectConfig.setConditionPolicy({ mode: 'none' });
|
|
543
|
+
}
|
|
544
|
+
layout.selectView('code');
|
|
545
|
+
} }));
|
|
546
|
+
case 'settings':
|
|
547
|
+
return (_jsx(ProjectSetupDialog, { variant: "view", isOpen: true, onClose: () => layout.selectView('code'), files: filesByName, configuration: projectConfig, onApply: (draft) => {
|
|
548
|
+
projectConfig.commitConfiguration(draft);
|
|
549
|
+
layout.selectView('code');
|
|
550
|
+
}, detectedConditions: model.detectedConditions ?? [], customCommands: projectConfig.customCommands, onRemoveCustomCommand: projectConfig.removeCustomCommand, splitEnabled: layout.splitEnabled, onToggleSplit: layout.toggleSplit }));
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
return (_jsx(WorkspaceSessionContext.Provider, { value: workspaceContext, children: _jsxs("div", { className: "AppShell", children: [_jsx(WorkspaceHeader, { brandLabel: brandLabel, activeView: layout.activeView, splitEnabled: layout.splitEnabled, sidebarCollapsed: layout.sidebarCollapsed, openMenu: layout.openMenu, onSelectView: layout.selectView, onToggleSplit: layout.toggleSplit, onToggleSidebar: layout.toggleSidebar, onToggleMenu: layout.toggleMenu, onCloseMenu: () => layout.setOpenMenu(null), canGoBack: canGoBack, canGoForward: canGoForward, backLabel: backLabel, forwardLabel: forwardLabel, onGoBack: () => {
|
|
554
|
+
discardPending();
|
|
555
|
+
setSelectedNode(null);
|
|
556
|
+
setSelectedArtifact(null);
|
|
557
|
+
goBack();
|
|
558
|
+
}, onGoForward: () => {
|
|
559
|
+
discardPending();
|
|
560
|
+
setSelectedNode(null);
|
|
561
|
+
setSelectedArtifact(null);
|
|
562
|
+
goForward();
|
|
563
|
+
}, entryPath: projectConfig.entryPath, selectedFile: selectedFile, fileCount: fileNames.length, conditionPolicy: projectConfig.conditionPolicy, hasConditionals: Boolean(model.hasConditionals), viewStatus: model.viewStatus ?? null, pendingDiffCount: effectivePendingPlan?.edits.length ?? 0, diagnosticCount: totalDiagnosticCount, artifactCount: effectiveArtifacts.length, onTriggerUploadFiles: () => setUploadFilesTrigger((c) => c + 1), onTriggerUploadFolder: () => setUploadFolderTrigger((c) => c + 1), onRequestNewFile: () => {
|
|
564
|
+
layout.setSidebarCollapsed(false);
|
|
565
|
+
setNewFileTrigger((c) => c + 1);
|
|
566
|
+
}, onLoadDemo: loadDemoProject, onDownloadProjectZip: () => {
|
|
567
|
+
const entries = Object.entries(filesByName).map(([path, content]) => ({
|
|
568
|
+
path,
|
|
569
|
+
content,
|
|
570
|
+
}));
|
|
571
|
+
if (entries.length > 0) {
|
|
572
|
+
downloadZipArchive(entries, 'preptex-project.zip');
|
|
573
|
+
}
|
|
574
|
+
}, onDownloadActiveFile: () => {
|
|
575
|
+
if (selectedFile) {
|
|
576
|
+
onDownload(selectedFile);
|
|
577
|
+
}
|
|
578
|
+
}, onResetWorkspace: () => {
|
|
579
|
+
resetFiles();
|
|
580
|
+
discardPending();
|
|
581
|
+
setSelectedNode(null);
|
|
582
|
+
setSelectedArtifact(null);
|
|
583
|
+
layout.selectView('code');
|
|
584
|
+
}, extraViews: resolvedExtraViews, extraMenus: resolvedExtraMenus, extraFileMenuItems: resolvedExtraFileMenuItems, extraEditMenuItems: resolvedExtraEditMenuItems, rightSlot: renderHeaderRightSlot?.(workspaceContext) }), _jsxs("div", { className: "WorkspaceMainRow", children: [layout.sidebarCollapsed ? (_jsx("div", { className: "WorkspaceCollapsedRail", children: _jsx("button", { type: "button", className: "WorkspaceCollapsedRailBtn", onClick: layout.toggleSidebar, "aria-label": "Show file explorer", title: "Show file explorer", children: "\u00BB" }) })) : null, _jsx("aside", { className: `WorkspaceSidebar${layout.sidebarCollapsed ? ' is-collapsed' : ''}`, "aria-hidden": layout.sidebarCollapsed, children: _jsx(Filetree, { files: fileNames, selected: selectedFile, entryPath: projectConfig.entryPath, onSelect: onSelectFile, onSetEntry: (path) => projectConfig.setEntryPath(path), onCreateFile: handleCreateFile, onDownload: onDownload, onRemove: (name) => removeFile(name), onUploadFiles: (fl) => {
|
|
585
|
+
void upsertFiles(fl);
|
|
586
|
+
}, onUploadFolder: (fl) => {
|
|
587
|
+
void upsertFiles(fl, { filterExtensions: true });
|
|
588
|
+
}, onDropFiles: (items) => {
|
|
589
|
+
void upsertFileItems(items);
|
|
590
|
+
}, uploadError: uploadError, uploadNotice: uploadNotice, onDismissUploadNotice: clearUploadNotice, uploadFilesTrigger: uploadFilesTrigger, uploadFolderTrigger: uploadFolderTrigger, newFileTrigger: newFileTrigger, onCollapseSidebar: layout.toggleSidebar }) }), _jsxs("main", { className: "WorkspaceViewport", children: [_jsx("div", { className: "WorkspacePrimaryPane", children: renderPrimaryView() }), layout.splitEnabled && fileNames.length > 0 ? (_jsx("div", { className: "WorkspaceSplitPane", "aria-label": "Split companion view", children: layout.activeView === 'code' ? (renderAstView(true)) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "SplitPaneHeader", children: [_jsx("span", { children: "Code Companion" }), _jsx("button", { type: "button", className: "AstPhase0ToggleBtn", onClick: () => layout.setSplitEnabled(false), children: "Close Split" })] }), _jsx(Codeview, { filename: displayedFilename, code: displayedCode, jumpToLine: jumpToLine, jumpRange: jumpRange, jumpToken: jumpToken })] })) })) : null] })] })] }) }));
|
|
591
|
+
}
|
|
592
|
+
export default PrepTeXWorkspace;
|
|
593
|
+
//# sourceMappingURL=PrepTeXWorkspace.js.map
|