@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,48 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';import type { ConditionDecision, ConditionPolicy, GeneratedArtifact, ProjectFilePath } from '@preptex/core';
|
|
2
|
+
import type { CoreOptionsUI } from '../model/useControl.js';
|
|
3
|
+
export type TransformationScopeOption = 'source' | 'selected';
|
|
4
|
+
export type TransformDestination = 'inplace' | 'new-files';
|
|
5
|
+
export interface UnifiedTransformRequest {
|
|
6
|
+
readonly destination: TransformDestination;
|
|
7
|
+
readonly outputFolder: string;
|
|
8
|
+
readonly realizeConditions: boolean;
|
|
9
|
+
readonly stripDeclarationsAndSetters: boolean;
|
|
10
|
+
readonly suppressComments: {
|
|
11
|
+
readonly enabled: boolean;
|
|
12
|
+
readonly suppressCommentEnvironments: boolean;
|
|
13
|
+
readonly target: TransformationScopeOption;
|
|
14
|
+
};
|
|
15
|
+
readonly removeEnvironments: {
|
|
16
|
+
readonly enabled: boolean;
|
|
17
|
+
readonly names: readonly string[];
|
|
18
|
+
readonly target: TransformationScopeOption;
|
|
19
|
+
};
|
|
20
|
+
readonly expandInputs: {
|
|
21
|
+
readonly enabled: boolean;
|
|
22
|
+
readonly mode: 'single' | 'recursive';
|
|
23
|
+
readonly target: TransformationScopeOption;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type ControlPanelProps = {
|
|
27
|
+
options: CoreOptionsUI;
|
|
28
|
+
onChange: (next: CoreOptionsUI) => void;
|
|
29
|
+
entryFile?: ProjectFilePath;
|
|
30
|
+
conditionPolicy?: ConditionPolicy;
|
|
31
|
+
hasConditionals?: boolean;
|
|
32
|
+
detectedConditions?: readonly string[];
|
|
33
|
+
onConfigureConditions?: (policy: ConditionPolicy) => void;
|
|
34
|
+
defaultTransformTarget?: TransformationScopeOption;
|
|
35
|
+
canRunSourceTransformations?: boolean;
|
|
36
|
+
canRealizeConditions?: boolean;
|
|
37
|
+
realizeConditionsReason?: string;
|
|
38
|
+
conditionDecisions?: readonly ConditionDecision[];
|
|
39
|
+
canRunViewTransformations?: boolean;
|
|
40
|
+
viewTransformationReason?: string;
|
|
41
|
+
onApplyTransformations?: (request: UnifiedTransformRequest) => void;
|
|
42
|
+
artifacts?: readonly GeneratedArtifact[];
|
|
43
|
+
onDownloadZip?: () => void;
|
|
44
|
+
onDownloadArtifact?: (artifact: GeneratedArtifact) => void;
|
|
45
|
+
onSelectArtifact?: (artifact: GeneratedArtifact) => void;
|
|
46
|
+
extraContent?: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
export default function ControlPanel({ options, onChange, entryFile, conditionPolicy, hasConditionals, detectedConditions, onConfigureConditions, defaultTransformTarget, canRunSourceTransformations, canRealizeConditions, realizeConditionsReason, conditionDecisions, canRunViewTransformations, viewTransformationReason, onApplyTransformations, artifacts, onDownloadZip, onDownloadArtifact, onSelectArtifact, extraContent, }: ControlPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import './ControlPanel.css';
|
|
4
|
+
import { normalizeOutputFolder } from '../utils/transformOutput.js';
|
|
5
|
+
function buildConditionPolicy(mode, overrides) {
|
|
6
|
+
if (mode === 'ignore')
|
|
7
|
+
return { mode: 'ignore' };
|
|
8
|
+
if (mode === 'none')
|
|
9
|
+
return { mode: 'none' };
|
|
10
|
+
if (mode === 'manual')
|
|
11
|
+
return { mode: 'manual', values: overrides };
|
|
12
|
+
if (mode === 'source-with-overrides')
|
|
13
|
+
return { mode: 'source-with-overrides', overrides };
|
|
14
|
+
return { mode: 'source' };
|
|
15
|
+
}
|
|
16
|
+
export default function ControlPanel({ options, onChange, entryFile = '', conditionPolicy, hasConditionals = false, detectedConditions = [], onConfigureConditions, defaultTransformTarget = 'selected', canRunSourceTransformations, canRealizeConditions = false, realizeConditionsReason, conditionDecisions = [], canRunViewTransformations = false, viewTransformationReason, onApplyTransformations, artifacts = [], onDownloadZip, onDownloadArtifact, onSelectArtifact, extraContent, }) {
|
|
17
|
+
const [active, setActive] = useState({
|
|
18
|
+
realize: false,
|
|
19
|
+
comments: false,
|
|
20
|
+
environments: false,
|
|
21
|
+
expand: false,
|
|
22
|
+
});
|
|
23
|
+
const [expanded, setExpanded] = useState({
|
|
24
|
+
realize: false,
|
|
25
|
+
comments: false,
|
|
26
|
+
environments: false,
|
|
27
|
+
expand: false,
|
|
28
|
+
});
|
|
29
|
+
const [commentScope, setCommentScope] = useState(defaultTransformTarget);
|
|
30
|
+
const [envNamesText, setEnvNamesText] = useState('');
|
|
31
|
+
const [envScope, setEnvScope] = useState(defaultTransformTarget);
|
|
32
|
+
const [expandMode, setExpandMode] = useState('single');
|
|
33
|
+
const [expandScope, setExpandScope] = useState(defaultTransformTarget);
|
|
34
|
+
const [destination, setDestination] = useState('inplace');
|
|
35
|
+
const [outputFolder, setOutputFolder] = useState('');
|
|
36
|
+
const [inlinePolicyMode, setInlinePolicyMode] = useState(conditionPolicy && conditionPolicy.mode !== 'ignore' ? conditionPolicy.mode : 'source');
|
|
37
|
+
const [inlineOverrides, setInlineOverrides] = useState({});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setCommentScope(defaultTransformTarget);
|
|
40
|
+
setEnvScope(defaultTransformTarget);
|
|
41
|
+
setExpandScope(defaultTransformTarget);
|
|
42
|
+
}, [defaultTransformTarget]);
|
|
43
|
+
const parsedEnvNames = envNamesText
|
|
44
|
+
.split(',')
|
|
45
|
+
.map((s) => s.trim())
|
|
46
|
+
.filter(Boolean);
|
|
47
|
+
const effectiveCanRunSource = canRunSourceTransformations ?? canRunViewTransformations;
|
|
48
|
+
const commentsRunnable = !active.comments ||
|
|
49
|
+
(commentScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);
|
|
50
|
+
const envsRunnable = !active.environments ||
|
|
51
|
+
(envScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);
|
|
52
|
+
const expandRunnable = !active.expand ||
|
|
53
|
+
(expandScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);
|
|
54
|
+
const realizeRunnable = !active.realize || canRealizeConditions;
|
|
55
|
+
const activeNames = [];
|
|
56
|
+
if (active.realize)
|
|
57
|
+
activeNames.push('Realize Conditions');
|
|
58
|
+
if (active.comments)
|
|
59
|
+
activeNames.push('Suppress Comments');
|
|
60
|
+
if (active.environments)
|
|
61
|
+
activeNames.push('Remove Environments');
|
|
62
|
+
if (active.expand)
|
|
63
|
+
activeNames.push('Expand \\input');
|
|
64
|
+
const hasMissingEnvNames = active.environments && parsedEnvNames.length === 0;
|
|
65
|
+
const normalizedFolder = normalizeOutputFolder(outputFolder);
|
|
66
|
+
const hasInvalidFolder = destination === 'new-files' && normalizedFolder === null;
|
|
67
|
+
const canApply = Boolean(onApplyTransformations) &&
|
|
68
|
+
activeNames.length > 0 &&
|
|
69
|
+
!hasMissingEnvNames &&
|
|
70
|
+
!hasInvalidFolder &&
|
|
71
|
+
realizeRunnable &&
|
|
72
|
+
commentsRunnable &&
|
|
73
|
+
envsRunnable &&
|
|
74
|
+
expandRunnable;
|
|
75
|
+
let disabledHint;
|
|
76
|
+
if (activeNames.length === 0) {
|
|
77
|
+
disabledHint = 'Activate one or more transformation boxes above.';
|
|
78
|
+
}
|
|
79
|
+
else if (hasMissingEnvNames) {
|
|
80
|
+
disabledHint = 'Enter at least one environment name in Remove Environments.';
|
|
81
|
+
}
|
|
82
|
+
else if (hasInvalidFolder) {
|
|
83
|
+
disabledHint = 'Output folder path cannot contain "." or ".." segments.';
|
|
84
|
+
}
|
|
85
|
+
else if (!realizeRunnable) {
|
|
86
|
+
disabledHint = realizeConditionsReason || 'Source files are required to realize conditions.';
|
|
87
|
+
}
|
|
88
|
+
else if (!commentsRunnable || !envsRunnable || !expandRunnable) {
|
|
89
|
+
disabledHint =
|
|
90
|
+
viewTransformationReason || 'Configure a valid project view or switch scope to whole document.';
|
|
91
|
+
}
|
|
92
|
+
const allExpanded = expanded.realize && expanded.comments && expanded.environments && expanded.expand;
|
|
93
|
+
const toggleAllExpanded = () => {
|
|
94
|
+
const next = !allExpanded;
|
|
95
|
+
setExpanded({
|
|
96
|
+
realize: next,
|
|
97
|
+
comments: next,
|
|
98
|
+
environments: next,
|
|
99
|
+
expand: next,
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const toggleActiveBox = (key, autoExpandIfEmpty = false) => {
|
|
103
|
+
setActive((prev) => {
|
|
104
|
+
const nextActive = !prev[key];
|
|
105
|
+
if (nextActive && autoExpandIfEmpty) {
|
|
106
|
+
setExpanded((cur) => ({ ...cur, [key]: true }));
|
|
107
|
+
}
|
|
108
|
+
return { ...prev, [key]: nextActive };
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const updateInlinePolicy = (nextMode, nextOverrides) => {
|
|
112
|
+
setInlinePolicyMode(nextMode);
|
|
113
|
+
setInlineOverrides(nextOverrides);
|
|
114
|
+
onConfigureConditions?.(buildConditionPolicy(nextMode, nextOverrides));
|
|
115
|
+
};
|
|
116
|
+
const handleApply = () => {
|
|
117
|
+
if (!onApplyTransformations || !canApply)
|
|
118
|
+
return;
|
|
119
|
+
onApplyTransformations({
|
|
120
|
+
destination,
|
|
121
|
+
outputFolder,
|
|
122
|
+
realizeConditions: active.realize,
|
|
123
|
+
stripDeclarationsAndSetters: options.stripDeclarationsAndSetters,
|
|
124
|
+
suppressComments: {
|
|
125
|
+
enabled: active.comments,
|
|
126
|
+
suppressCommentEnvironments: options.suppressCommentEnvironments,
|
|
127
|
+
target: commentScope,
|
|
128
|
+
},
|
|
129
|
+
removeEnvironments: {
|
|
130
|
+
enabled: active.environments,
|
|
131
|
+
names: parsedEnvNames,
|
|
132
|
+
target: envScope,
|
|
133
|
+
},
|
|
134
|
+
expandInputs: {
|
|
135
|
+
enabled: active.expand,
|
|
136
|
+
mode: expandMode,
|
|
137
|
+
target: expandScope,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const previewSampleName = entryFile || 'main.tex';
|
|
142
|
+
const previewOutputPath = normalizedFolder && normalizedFolder.length > 0
|
|
143
|
+
? `${normalizedFolder}/${previewSampleName}`
|
|
144
|
+
: previewSampleName.replace(/(\.[^./\\]+)?$/, (ext) => `.transformed${ext || '.tex'}`);
|
|
145
|
+
return (_jsxs("section", { className: "ControlPanel", "aria-label": "Control panel", children: [_jsxs("div", { className: "TransformToolbar", children: [_jsx("span", { className: "TransformToolbarHint", children: "Activate the transformations you want to run, expand any box to adjust its options, and apply below." }), _jsx("button", { type: "button", className: "TransformExpandAllBtn", "aria-expanded": allExpanded, onClick: toggleAllExpanded, children: allExpanded ? 'Collapse all' : 'Expand all' })] }), _jsxs("div", { className: "TransformBoxes", children: [_jsxs("div", { className: `TransformBox ${active.realize ? 'TransformBox--active' : ''}`, children: [_jsxs("div", { className: "TransformBoxHeader", children: [_jsxs("label", { className: "TransformBoxToggle", children: [_jsx("input", { type: "checkbox", checked: active.realize, onChange: () => toggleActiveBox('realize') }), _jsx("span", { className: "TransformBoxTitle", children: "Realize Conditions" })] }), _jsx("span", { className: `TransformStatusPill ${active.realize ? 'is-active' : ''}`, children: active.realize ? 'Active' : 'Inactive' })] }), _jsxs("details", { className: "TransformDetails", open: expanded.realize, onToggle: (e) => {
|
|
146
|
+
const isOpen = e.currentTarget.open;
|
|
147
|
+
setExpanded((prev) => (prev.realize === isOpen ? prev : { ...prev, realize: isOpen }));
|
|
148
|
+
}, children: [_jsxs("summary", { className: "TransformSummary", children: [_jsx("span", { className: "TransformSummaryLabel", children: "Options" }), _jsxs("span", { className: "TransformSummaryHint", children: [options.stripDeclarationsAndSetters ? 'Strip \\newif/setters' : 'Keep declarations', conditionPolicy ? ` · ${conditionPolicy.mode}` : ''] })] }), _jsxs("div", { className: "TransformBoxBody", children: [_jsxs("p", { className: "ControlSubtitle", children: ["Evaluate and strip ", _jsx("code", { children: "\\if..." }), " directives and inactive branches without requiring balanced environments."] }), _jsxs("label", { className: "ControlCheck", children: [_jsx("input", { type: "checkbox", checked: options.stripDeclarationsAndSetters, onChange: () => onChange({
|
|
149
|
+
...options,
|
|
150
|
+
stripDeclarationsAndSetters: !options.stripDeclarationsAndSetters,
|
|
151
|
+
}) }), _jsxs("span", { children: ["Strip declarations & setters (", _jsx("code", { children: "\\newif" }), ", ", _jsx("code", { children: "\\Xtrue" }), ")"] })] }), hasConditionals && onConfigureConditions ? (_jsxs("div", { className: "ControlInlinePhase0", children: [_jsxs("div", { className: "ControlInlinePhase0Header", children: [_jsx("strong", { children: "Condition Paths" }), _jsxs("span", { className: "ControlInlinePhase0Mode", children: ["Active: ", conditionPolicy?.mode ?? 'ignore'] })] }), _jsxs("select", { className: "ControlInput", "aria-label": "Realization condition policy", value: inlinePolicyMode, onChange: (e) => {
|
|
152
|
+
const val = e.target.value;
|
|
153
|
+
if (val === 'source' ||
|
|
154
|
+
val === 'source-with-overrides' ||
|
|
155
|
+
val === 'manual' ||
|
|
156
|
+
val === 'none' ||
|
|
157
|
+
val === 'ignore') {
|
|
158
|
+
updateInlinePolicy(val, inlineOverrides);
|
|
159
|
+
}
|
|
160
|
+
}, children: [_jsx("option", { value: "source", children: "Follow source declarations & setters" }), _jsx("option", { value: "source-with-overrides", children: "Source with named overrides" }), _jsx("option", { value: "manual", children: "Force explicit boolean values" }), _jsx("option", { value: "ignore", children: "Ignore conditionals (all branches)" }), _jsx("option", { value: "none", children: "Condition-free (none)" })] }), detectedConditions.length > 0 &&
|
|
161
|
+
(inlinePolicyMode === 'source-with-overrides' ||
|
|
162
|
+
inlinePolicyMode === 'manual') ? (_jsx("div", { className: "ControlInlineConditionsGrid", children: detectedConditions.map((cond) => {
|
|
163
|
+
const current = inlineOverrides[cond];
|
|
164
|
+
const valueStr = current === true ? 'true' : current === false ? 'false' : 'follow';
|
|
165
|
+
return (_jsxs("label", { className: "ControlInlineCondRow", children: [_jsx("span", { children: _jsxs("code", { children: ["\\if", cond] }) }), _jsxs("select", { className: "ControlInput", value: valueStr, "aria-label": `Condition \\if${cond}`, onChange: (e) => {
|
|
166
|
+
const v = e.target.value;
|
|
167
|
+
const next = { ...inlineOverrides };
|
|
168
|
+
if (v === 'follow') {
|
|
169
|
+
delete next[cond];
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
next[cond] = v === 'true';
|
|
173
|
+
}
|
|
174
|
+
updateInlinePolicy(inlinePolicyMode, next);
|
|
175
|
+
}, children: [inlinePolicyMode === 'source-with-overrides' ? (_jsx("option", { value: "follow", children: "Follow source" })) : null, inlinePolicyMode === 'manual' && current === undefined ? (_jsx("option", { value: "follow", children: "(Choose...)" })) : null, _jsx("option", { value: "true", children: "True" }), _jsx("option", { value: "false", children: "False" })] })] }, cond));
|
|
176
|
+
}) })) : null] })) : null, conditionDecisions.length > 0 ? (_jsxs("div", { className: "ControlDecisions", "aria-label": "Evaluated condition decisions", children: [_jsxs("div", { className: "ControlDecisionsTitle", children: ["Condition Decisions (", conditionDecisions.length, ")"] }), _jsxs("ul", { className: "ControlDecisionsList", children: [conditionDecisions.slice(0, 8).map((decision, idx) => (_jsxs("li", { className: "ControlDecisionItem", children: [_jsxs("code", { children: ["\\", decision.command] }), _jsx("span", { className: `ControlDecisionOutcome ControlDecisionOutcome--${decision.outcome}`, children: decision.outcome })] }, `${decision.command}-${idx}`))), conditionDecisions.length > 8 ? (_jsxs("li", { className: "ControlDecisionMore", children: ["+", conditionDecisions.length - 8, " more decisions"] })) : null] })] })) : null] })] })] }), _jsxs("div", { className: `TransformBox ${active.comments ? 'TransformBox--active' : ''}`, children: [_jsxs("div", { className: "TransformBoxHeader", children: [_jsxs("label", { className: "TransformBoxToggle", children: [_jsx("input", { type: "checkbox", checked: active.comments, onChange: () => toggleActiveBox('comments') }), _jsx("span", { className: "TransformBoxTitle", children: "Suppress Comments" })] }), _jsx("span", { className: `TransformStatusPill ${active.comments ? 'is-active' : ''}`, children: active.comments ? 'Active' : 'Inactive' })] }), _jsxs("details", { className: "TransformDetails", open: expanded.comments, onToggle: (e) => {
|
|
177
|
+
const isOpen = e.currentTarget.open;
|
|
178
|
+
setExpanded((prev) => prev.comments === isOpen ? prev : { ...prev, comments: isOpen });
|
|
179
|
+
}, children: [_jsxs("summary", { className: "TransformSummary", children: [_jsx("span", { className: "TransformSummaryLabel", children: "Options" }), _jsxs("span", { className: "TransformSummaryHint", children: [options.suppressCommentEnvironments
|
|
180
|
+
? 'Line % + comment environments'
|
|
181
|
+
: 'Line % comments only', ' ', "\u00B7 ", commentScope === 'source' ? 'all branches' : 'configured branch'] })] }), _jsxs("div", { className: "TransformBoxBody", children: [_jsxs("p", { className: "ControlSubtitle", children: ["Strip TeX comments while keeping ", _jsx("code", { children: "verbatim" }), " blocks intact."] }), _jsxs("label", { className: "ControlCheck", children: [_jsx("input", { type: "checkbox", checked: options.suppressCommentEnvironments, onChange: () => onChange({
|
|
182
|
+
...options,
|
|
183
|
+
suppressCommentEnvironments: !options.suppressCommentEnvironments,
|
|
184
|
+
}) }), _jsx("span", { children: "Also suppress comment environments" })] }), _jsxs("label", { className: "ControlField", htmlFor: "commentScopeSelect", children: [_jsx("span", { children: "Scope" }), _jsxs("select", { id: "commentScopeSelect", className: "ControlInput", value: commentScope, onChange: (e) => {
|
|
185
|
+
const val = e.target.value;
|
|
186
|
+
if (val === 'source' || val === 'selected') {
|
|
187
|
+
setCommentScope(val);
|
|
188
|
+
}
|
|
189
|
+
}, children: [_jsx("option", { value: "source", children: "All branches / whole document" }), _jsx("option", { value: "selected", children: "Configured branch (selected)" })] })] })] })] })] }), _jsxs("div", { className: `TransformBox ${active.environments ? 'TransformBox--active' : ''}`, children: [_jsxs("div", { className: "TransformBoxHeader", children: [_jsxs("label", { className: "TransformBoxToggle", children: [_jsx("input", { type: "checkbox", checked: active.environments, onChange: () => toggleActiveBox('environments', parsedEnvNames.length === 0) }), _jsx("span", { className: "TransformBoxTitle", children: "Remove Environments" })] }), _jsx("span", { className: `TransformStatusPill ${active.environments ? 'is-active' : ''}`, children: active.environments ? 'Active' : 'Inactive' })] }), _jsxs("details", { className: "TransformDetails", open: expanded.environments, onToggle: (e) => {
|
|
190
|
+
const isOpen = e.currentTarget.open;
|
|
191
|
+
setExpanded((prev) => prev.environments === isOpen ? prev : { ...prev, environments: isOpen });
|
|
192
|
+
}, children: [_jsxs("summary", { className: "TransformSummary", children: [_jsx("span", { className: "TransformSummaryLabel", children: "Options" }), _jsx("span", { className: "TransformSummaryHint", children: parsedEnvNames.length > 0
|
|
193
|
+
? parsedEnvNames.join(', ')
|
|
194
|
+
: 'No environments specified' })] }), _jsxs("div", { className: "TransformBoxBody", children: [_jsxs("p", { className: "ControlSubtitle", children: ["Delete named ", _jsxs("code", { children: ["\\begin", '{name}', "...\\end", '{name}'] }), " blocks and their contents."] }), _jsxs("div", { className: "ControlFieldGrid ControlFieldGrid--two", children: [_jsxs("label", { className: "ControlField", htmlFor: "envNamesInput", children: [_jsx("span", { children: "Environment names (comma-separated)" }), _jsx("input", { id: "envNamesInput", type: "text", className: "ControlInput", placeholder: "e.g. comment, draftnote, todo", value: envNamesText, onChange: (e) => setEnvNamesText(e.target.value) })] }), _jsxs("label", { className: "ControlField", htmlFor: "envScopeSelect", children: [_jsx("span", { children: "Scope" }), _jsxs("select", { id: "envScopeSelect", className: "ControlInput", value: envScope, onChange: (e) => {
|
|
195
|
+
const val = e.target.value;
|
|
196
|
+
if (val === 'source' || val === 'selected') {
|
|
197
|
+
setEnvScope(val);
|
|
198
|
+
}
|
|
199
|
+
}, children: [_jsx("option", { value: "source", children: "All branches / whole document" }), _jsx("option", { value: "selected", children: "Configured branch (selected)" })] })] })] })] })] })] }), _jsxs("div", { className: `TransformBox ${active.expand ? 'TransformBox--active' : ''}`, children: [_jsxs("div", { className: "TransformBoxHeader", children: [_jsxs("label", { className: "TransformBoxToggle", children: [_jsx("input", { type: "checkbox", checked: active.expand, onChange: () => toggleActiveBox('expand') }), _jsx("span", { className: "TransformBoxTitle", children: "Expand / Flatten \\input Commands" })] }), _jsx("span", { className: `TransformStatusPill ${active.expand ? 'is-active' : ''}`, children: active.expand ? 'Active' : 'Inactive' })] }), _jsxs("details", { className: "TransformDetails", open: expanded.expand, onToggle: (e) => {
|
|
200
|
+
const isOpen = e.currentTarget.open;
|
|
201
|
+
setExpanded((prev) => (prev.expand === isOpen ? prev : { ...prev, expand: isOpen }));
|
|
202
|
+
}, children: [_jsxs("summary", { className: "TransformSummary", children: [_jsx("span", { className: "TransformSummaryLabel", children: "Options" }), _jsxs("span", { className: "TransformSummaryHint", children: [expandMode === 'recursive' ? 'Flatten all nested' : 'Single level', " \u00B7", ' ', expandScope === 'source' ? 'all branches' : 'configured branch'] })] }), _jsxs("div", { className: "TransformBoxBody", children: [_jsxs("p", { className: "ControlSubtitle", children: ["Replace active ", _jsx("code", { children: "\\input" }), " commands with target file contents (emits non-halting warnings if a file is missing)."] }), _jsxs("div", { className: "ControlFieldGrid ControlFieldGrid--two", children: [_jsxs("label", { className: "ControlField", htmlFor: "expandModeSelect", children: [_jsx("span", { children: "Expansion Mode" }), _jsxs("select", { id: "expandModeSelect", className: "ControlInput", value: expandMode, onChange: (e) => {
|
|
203
|
+
const val = e.target.value;
|
|
204
|
+
if (val === 'single' || val === 'recursive') {
|
|
205
|
+
setExpandMode(val);
|
|
206
|
+
}
|
|
207
|
+
}, children: [_jsx("option", { value: "single", children: "Expand one level (single pass)" }), _jsx("option", { value: "recursive", children: "Flatten all nested inputs (recursive)" })] })] }), _jsxs("label", { className: "ControlField", htmlFor: "expandScopeSelect", children: [_jsx("span", { children: "Scope" }), _jsxs("select", { id: "expandScopeSelect", className: "ControlInput", value: expandScope, onChange: (e) => {
|
|
208
|
+
const val = e.target.value;
|
|
209
|
+
if (val === 'source' || val === 'selected') {
|
|
210
|
+
setExpandScope(val);
|
|
211
|
+
}
|
|
212
|
+
}, children: [_jsx("option", { value: "source", children: "All branches / whole document" }), _jsx("option", { value: "selected", children: "Configured branch (selected)" })] })] })] })] })] })] })] }), _jsxs("div", { className: "TransformApplyPanel", role: "region", "aria-label": "Apply transformations", children: [_jsx("div", { className: "TransformApplyHeader", children: _jsxs("div", { children: [_jsx("h3", { children: "Apply Transformations" }), _jsx("p", { className: "ControlSubtitle", children: activeNames.length > 0
|
|
213
|
+
? `${activeNames.length} active: ${activeNames.join(' → ')}`
|
|
214
|
+
: 'Select one or more transformation boxes above' })] }) }), _jsxs("div", { className: "TransformDestGroup", role: "radiogroup", "aria-label": "Output destination", children: [_jsxs("label", { className: `TransformDestOption ${destination === 'inplace' ? 'TransformDestOption--selected' : ''}`, children: [_jsx("input", { type: "radio", name: "transformDestination", value: "inplace", checked: destination === 'inplace', onChange: () => setDestination('inplace') }), _jsxs("span", { className: "TransformDestCopy", children: [_jsx("strong", { children: "Modify in place" }), _jsx("span", { children: "Stage diff review before overwriting existing workspace files (undoable)" })] })] }), _jsxs("label", { className: `TransformDestOption ${destination === 'new-files' ? 'TransformDestOption--selected' : ''}`, children: [_jsx("input", { type: "radio", name: "transformDestination", value: "new-files", checked: destination === 'new-files', onChange: () => setDestination('new-files') }), _jsxs("span", { className: "TransformDestCopy", children: [_jsx("strong", { children: "Output new file(s)" }), _jsx("span", { children: "Write transformed output to a new folder or sibling file without altering originals" })] })] })] }), destination === 'new-files' ? (_jsxs("div", { className: "TransformOutputFolderRow", children: [_jsxs("label", { className: "ControlField", htmlFor: "transformOutputFolder", children: [_jsx("span", { children: "Output folder (optional)" }), _jsx("input", { id: "transformOutputFolder", type: "text", className: "ControlInput", placeholder: "e.g. out or build/clean (leave blank for *.transformed.tex)", value: outputFolder, onChange: (e) => setOutputFolder(e.target.value) })] }), _jsx("span", { className: `TransformOutputPreview ${hasInvalidFolder ? 'is-error' : ''}`, children: hasInvalidFolder
|
|
215
|
+
? 'Invalid folder path: avoid "." or ".." segments.'
|
|
216
|
+
: `Output path example: ${previewOutputPath}` })] })) : null, _jsxs("div", { className: "TransformApplyFooter", children: [disabledHint ? _jsx("span", { className: "TransformApplyHint", children: disabledHint }) : _jsx("span", {}), _jsx("button", { type: "button", className: "ControlButton ControlButton--primary", disabled: !canApply, title: disabledHint, onClick: handleApply, children: destination === 'new-files' ? 'Create New File(s)' : 'Preview & Apply in Place' })] })] }), artifacts.length > 0 ? (_jsxs("div", { className: "ControlCard ControlCard--artifacts", children: [_jsxs("div", { className: "ControlCardHeader", children: [_jsxs("div", { className: "ArtifactsHeaderRow", children: [_jsxs("h3", { children: ["Generated Artifacts (", artifacts.length, ")"] }), onDownloadZip ? (_jsx("button", { type: "button", className: "ControlButton ControlButton--primary", onClick: onDownloadZip, children: "Download ZIP" })) : null] }), _jsx("p", { className: "ControlSubtitle", children: "Review or download generated output files" })] }), _jsx("div", { className: "ArtifactsList", children: artifacts.map((art) => (_jsxs("div", { className: "ArtifactItem", children: [_jsx("span", { className: "ArtifactPath", title: art.path, children: art.path }), _jsx("span", { className: "ArtifactTopology", children: art.topology }), _jsxs("div", { className: "ArtifactActions", children: [onSelectArtifact ? (_jsx("button", { type: "button", className: "ArtifactBtn", onClick: () => onSelectArtifact(art), children: "View" })) : null, onDownloadArtifact ? (_jsx("button", { type: "button", className: "ArtifactBtn", onClick: () => onDownloadArtifact(art), children: "Download" })) : null] })] }, art.path))) })] })) : null, extraContent] }));
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=ControlPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlPanel.js","sourceRoot":"","sources":["../../src/components/ControlPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAqDjE,SAAS,oBAAoB,CAC3B,IAA6B,EAC7B,SAAkC;IAElC,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjD,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7C,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACpE,IAAI,IAAI,KAAK,uBAAuB;QAAE,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,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AC,iBAAiB,0DAA8C,IACxE,EACN,cAAK,SAAS,EAAC,eAAe,YAC3B,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACtB,eAAoB,SAAS,EAAC,cAAc,aAC1C,eAAM,SAAS,EAAC,cAAc,EAAC,KAAK,EAAE,GAAG,CAAC,IAAI,YAAG,GAAG,CAAC,IAAI,GAAQ,EACjE,eAAM,SAAS,EAAC,kBAAkB,YAAE,GAAG,CAAC,QAAQ,GAAQ,EACxD,eAAK,SAAS,EAAC,iBAAiB,aAC7B,gBAAgB,CAAC,CAAC,CAAC,CAClB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,aAAa,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,qBAG7B,CACV,CAAC,CAAC,CAAC,IAAI,EACP,kBAAkB,CAAC,CAAC,CAAC,CACpB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,aAAa,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,yBAG/B,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,KAtBE,GAAG,CAAC,IAAI,CAuBZ,CACP,CAAC,GACE,IACF,CACP,CAAC,CAAC,CAAC,IAAI,EACP,YAAY,IACL,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactNode, useEffect, useState } from 'react';\nimport './ControlPanel.css';\nimport type {\n ConditionDecision,\n ConditionPolicy,\n GeneratedArtifact,\n ProjectFilePath,\n} from '@preptex/core';\nimport type { CoreOptionsUI } from '../model/useControl';\nimport { normalizeOutputFolder } from '../utils/transformOutput';\n\nexport type TransformationScopeOption = 'source' | 'selected';\nexport type TransformDestination = 'inplace' | 'new-files';\n\nexport interface UnifiedTransformRequest {\n readonly destination: TransformDestination;\n readonly outputFolder: string;\n readonly realizeConditions: boolean;\n readonly stripDeclarationsAndSetters: boolean;\n readonly suppressComments: {\n readonly enabled: boolean;\n readonly suppressCommentEnvironments: boolean;\n readonly target: TransformationScopeOption;\n };\n readonly removeEnvironments: {\n readonly enabled: boolean;\n readonly names: readonly string[];\n readonly target: TransformationScopeOption;\n };\n readonly expandInputs: {\n readonly enabled: boolean;\n readonly mode: 'single' | 'recursive';\n readonly target: TransformationScopeOption;\n };\n}\n\nexport type ControlPanelProps = {\n options: CoreOptionsUI;\n onChange: (next: CoreOptionsUI) => void;\n entryFile?: ProjectFilePath;\n conditionPolicy?: ConditionPolicy;\n hasConditionals?: boolean;\n detectedConditions?: readonly string[];\n onConfigureConditions?: (policy: ConditionPolicy) => void;\n defaultTransformTarget?: TransformationScopeOption;\n canRunSourceTransformations?: boolean;\n canRealizeConditions?: boolean;\n realizeConditionsReason?: string;\n conditionDecisions?: readonly ConditionDecision[];\n canRunViewTransformations?: boolean;\n viewTransformationReason?: string;\n onApplyTransformations?: (request: UnifiedTransformRequest) => void;\n\n artifacts?: readonly GeneratedArtifact[];\n onDownloadZip?: () => void;\n onDownloadArtifact?: (artifact: GeneratedArtifact) => void;\n onSelectArtifact?: (artifact: GeneratedArtifact) => void;\n extraContent?: ReactNode;\n};\n\ntype BoxKey = 'realize' | 'comments' | 'environments' | 'expand';\n\nfunction buildConditionPolicy(\n mode: ConditionPolicy['mode'],\n overrides: Record<string, boolean>,\n): ConditionPolicy {\n if (mode === 'ignore') return { mode: 'ignore' };\n if (mode === 'none') return { mode: 'none' };\n if (mode === 'manual') return { mode: 'manual', values: overrides };\n if (mode === 'source-with-overrides') return { mode: 'source-with-overrides', overrides };\n return { mode: 'source' };\n}\n\nexport default function ControlPanel({\n options,\n onChange,\n entryFile = '',\n conditionPolicy,\n hasConditionals = false,\n detectedConditions = [],\n onConfigureConditions,\n defaultTransformTarget = 'selected',\n canRunSourceTransformations,\n canRealizeConditions = false,\n realizeConditionsReason,\n conditionDecisions = [],\n canRunViewTransformations = false,\n viewTransformationReason,\n onApplyTransformations,\n artifacts = [],\n onDownloadZip,\n onDownloadArtifact,\n onSelectArtifact,\n extraContent,\n}: ControlPanelProps) {\n const [active, setActive] = useState<Record<BoxKey, boolean>>({\n realize: false,\n comments: false,\n environments: false,\n expand: false,\n });\n const [expanded, setExpanded] = useState<Record<BoxKey, boolean>>({\n realize: false,\n comments: false,\n environments: false,\n expand: false,\n });\n\n const [commentScope, setCommentScope] = useState<TransformationScopeOption>(defaultTransformTarget);\n const [envNamesText, setEnvNamesText] = useState('');\n const [envScope, setEnvScope] = useState<TransformationScopeOption>(defaultTransformTarget);\n const [expandMode, setExpandMode] = useState<'single' | 'recursive'>('single');\n const [expandScope, setExpandScope] = useState<TransformationScopeOption>(defaultTransformTarget);\n\n const [destination, setDestination] = useState<TransformDestination>('inplace');\n const [outputFolder, setOutputFolder] = useState('');\n\n const [inlinePolicyMode, setInlinePolicyMode] = useState<ConditionPolicy['mode']>(\n conditionPolicy && conditionPolicy.mode !== 'ignore' ? conditionPolicy.mode : 'source',\n );\n const [inlineOverrides, setInlineOverrides] = useState<Record<string, boolean>>({});\n\n useEffect(() => {\n setCommentScope(defaultTransformTarget);\n setEnvScope(defaultTransformTarget);\n setExpandScope(defaultTransformTarget);\n }, [defaultTransformTarget]);\n\n const parsedEnvNames = envNamesText\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean);\n\n const effectiveCanRunSource = canRunSourceTransformations ?? canRunViewTransformations;\n const commentsRunnable =\n !active.comments ||\n (commentScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);\n const envsRunnable =\n !active.environments ||\n (envScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);\n const expandRunnable =\n !active.expand ||\n (expandScope === 'source' ? effectiveCanRunSource : canRunViewTransformations);\n const realizeRunnable = !active.realize || canRealizeConditions;\n\n const activeNames: string[] = [];\n if (active.realize) activeNames.push('Realize Conditions');\n if (active.comments) activeNames.push('Suppress Comments');\n if (active.environments) activeNames.push('Remove Environments');\n if (active.expand) activeNames.push('Expand \\\\input');\n\n const hasMissingEnvNames = active.environments && parsedEnvNames.length === 0;\n const normalizedFolder = normalizeOutputFolder(outputFolder);\n const hasInvalidFolder = destination === 'new-files' && normalizedFolder === null;\n\n const canApply =\n Boolean(onApplyTransformations) &&\n activeNames.length > 0 &&\n !hasMissingEnvNames &&\n !hasInvalidFolder &&\n realizeRunnable &&\n commentsRunnable &&\n envsRunnable &&\n expandRunnable;\n\n let disabledHint: string | undefined;\n if (activeNames.length === 0) {\n disabledHint = 'Activate one or more transformation boxes above.';\n } else if (hasMissingEnvNames) {\n disabledHint = 'Enter at least one environment name in Remove Environments.';\n } else if (hasInvalidFolder) {\n disabledHint = 'Output folder path cannot contain \".\" or \"..\" segments.';\n } else if (!realizeRunnable) {\n disabledHint = realizeConditionsReason || 'Source files are required to realize conditions.';\n } else if (!commentsRunnable || !envsRunnable || !expandRunnable) {\n disabledHint =\n viewTransformationReason || 'Configure a valid project view or switch scope to whole document.';\n }\n\n const allExpanded =\n expanded.realize && expanded.comments && expanded.environments && expanded.expand;\n\n const toggleAllExpanded = () => {\n const next = !allExpanded;\n setExpanded({\n realize: next,\n comments: next,\n environments: next,\n expand: next,\n });\n };\n\n const toggleActiveBox = (key: BoxKey, autoExpandIfEmpty = false) => {\n setActive((prev) => {\n const nextActive = !prev[key];\n if (nextActive && autoExpandIfEmpty) {\n setExpanded((cur) => ({ ...cur, [key]: true }));\n }\n return { ...prev, [key]: nextActive };\n });\n };\n\n const updateInlinePolicy = (\n nextMode: ConditionPolicy['mode'],\n nextOverrides: Record<string, boolean>,\n ) => {\n setInlinePolicyMode(nextMode);\n setInlineOverrides(nextOverrides);\n onConfigureConditions?.(buildConditionPolicy(nextMode, nextOverrides));\n };\n\n const handleApply = () => {\n if (!onApplyTransformations || !canApply) return;\n onApplyTransformations({\n destination,\n outputFolder,\n realizeConditions: active.realize,\n stripDeclarationsAndSetters: options.stripDeclarationsAndSetters,\n suppressComments: {\n enabled: active.comments,\n suppressCommentEnvironments: options.suppressCommentEnvironments,\n target: commentScope,\n },\n removeEnvironments: {\n enabled: active.environments,\n names: parsedEnvNames,\n target: envScope,\n },\n expandInputs: {\n enabled: active.expand,\n mode: expandMode,\n target: expandScope,\n },\n });\n };\n\n const previewSampleName = entryFile || 'main.tex';\n const previewOutputPath =\n normalizedFolder && normalizedFolder.length > 0\n ? `${normalizedFolder}/${previewSampleName}`\n : previewSampleName.replace(/(\\.[^./\\\\]+)?$/, (ext) => `.transformed${ext || '.tex'}`);\n\n return (\n <section className=\"ControlPanel\" aria-label=\"Control panel\">\n <div className=\"TransformToolbar\">\n <span className=\"TransformToolbarHint\">\n Activate the transformations you want to run, expand any box to adjust its options, and apply below.\n </span>\n <button\n type=\"button\"\n className=\"TransformExpandAllBtn\"\n aria-expanded={allExpanded}\n onClick={toggleAllExpanded}\n >\n {allExpanded ? 'Collapse all' : 'Expand all'}\n </button>\n </div>\n\n <div className=\"TransformBoxes\">\n {/* Box 1: Realize Conditions */}\n <div className={`TransformBox ${active.realize ? 'TransformBox--active' : ''}`}>\n <div className=\"TransformBoxHeader\">\n <label className=\"TransformBoxToggle\">\n <input\n type=\"checkbox\"\n checked={active.realize}\n onChange={() => toggleActiveBox('realize')}\n />\n <span className=\"TransformBoxTitle\">Realize Conditions</span>\n </label>\n <span className={`TransformStatusPill ${active.realize ? 'is-active' : ''}`}>\n {active.realize ? 'Active' : 'Inactive'}\n </span>\n </div>\n <details\n className=\"TransformDetails\"\n open={expanded.realize}\n onToggle={(e) => {\n const isOpen = e.currentTarget.open;\n setExpanded((prev) => (prev.realize === isOpen ? prev : { ...prev, realize: isOpen }));\n }}\n >\n <summary className=\"TransformSummary\">\n <span className=\"TransformSummaryLabel\">Options</span>\n <span className=\"TransformSummaryHint\">\n {options.stripDeclarationsAndSetters ? 'Strip \\\\newif/setters' : 'Keep declarations'}\n {conditionPolicy ? ` · ${conditionPolicy.mode}` : ''}\n </span>\n </summary>\n <div className=\"TransformBoxBody\">\n <p className=\"ControlSubtitle\">\n Evaluate and strip <code>\\if...</code> directives and inactive branches without requiring balanced environments.\n </p>\n <label className=\"ControlCheck\">\n <input\n type=\"checkbox\"\n checked={options.stripDeclarationsAndSetters}\n onChange={() =>\n onChange({\n ...options,\n stripDeclarationsAndSetters: !options.stripDeclarationsAndSetters,\n })\n }\n />\n <span>Strip declarations & setters (<code>\\newif</code>, <code>\\Xtrue</code>)</span>\n </label>\n\n {hasConditionals && onConfigureConditions ? (\n <div className=\"ControlInlinePhase0\">\n <div className=\"ControlInlinePhase0Header\">\n <strong>Condition Paths</strong>\n <span className=\"ControlInlinePhase0Mode\">\n Active: {conditionPolicy?.mode ?? 'ignore'}\n </span>\n </div>\n <select\n className=\"ControlInput\"\n aria-label=\"Realization condition policy\"\n value={inlinePolicyMode}\n onChange={(e) => {\n const val = e.target.value;\n if (\n val === 'source' ||\n val === 'source-with-overrides' ||\n val === 'manual' ||\n val === 'none' ||\n val === 'ignore'\n ) {\n updateInlinePolicy(val, inlineOverrides);\n }\n }}\n >\n <option value=\"source\">Follow source declarations & setters</option>\n <option value=\"source-with-overrides\">Source with named overrides</option>\n <option value=\"manual\">Force explicit boolean values</option>\n <option value=\"ignore\">Ignore conditionals (all branches)</option>\n <option value=\"none\">Condition-free (none)</option>\n </select>\n {detectedConditions.length > 0 &&\n (inlinePolicyMode === 'source-with-overrides' ||\n inlinePolicyMode === 'manual') ? (\n <div className=\"ControlInlineConditionsGrid\">\n {detectedConditions.map((cond) => {\n const current = inlineOverrides[cond];\n const valueStr =\n current === true ? 'true' : current === false ? 'false' : 'follow';\n return (\n <label key={cond} className=\"ControlInlineCondRow\">\n <span><code>\\if{cond}</code></span>\n <select\n className=\"ControlInput\"\n value={valueStr}\n aria-label={`Condition \\\\if${cond}`}\n onChange={(e) => {\n const v = e.target.value;\n const next = { ...inlineOverrides };\n if (v === 'follow') {\n delete next[cond];\n } else {\n next[cond] = v === 'true';\n }\n updateInlinePolicy(inlinePolicyMode, next);\n }}\n >\n {inlinePolicyMode === 'source-with-overrides' ? (\n <option value=\"follow\">Follow source</option>\n ) : null}\n {inlinePolicyMode === 'manual' && current === undefined ? (\n <option value=\"follow\">(Choose...)</option>\n ) : null}\n <option value=\"true\">True</option>\n <option value=\"false\">False</option>\n </select>\n </label>\n );\n })}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {conditionDecisions.length > 0 ? (\n <div className=\"ControlDecisions\" aria-label=\"Evaluated condition decisions\">\n <div className=\"ControlDecisionsTitle\">\n Condition Decisions ({conditionDecisions.length})\n </div>\n <ul className=\"ControlDecisionsList\">\n {conditionDecisions.slice(0, 8).map((decision, idx) => (\n <li key={`${decision.command}-${idx}`} className=\"ControlDecisionItem\">\n <code>\\{decision.command}</code>\n <span\n className={`ControlDecisionOutcome ControlDecisionOutcome--${decision.outcome}`}\n >\n {decision.outcome}\n </span>\n </li>\n ))}\n {conditionDecisions.length > 8 ? (\n <li className=\"ControlDecisionMore\">\n +{conditionDecisions.length - 8} more decisions\n </li>\n ) : null}\n </ul>\n </div>\n ) : null}\n </div>\n </details>\n </div>\n\n {/* Box 2: Suppress Comments */}\n <div className={`TransformBox ${active.comments ? 'TransformBox--active' : ''}`}>\n <div className=\"TransformBoxHeader\">\n <label className=\"TransformBoxToggle\">\n <input\n type=\"checkbox\"\n checked={active.comments}\n onChange={() => toggleActiveBox('comments')}\n />\n <span className=\"TransformBoxTitle\">Suppress Comments</span>\n </label>\n <span className={`TransformStatusPill ${active.comments ? 'is-active' : ''}`}>\n {active.comments ? 'Active' : 'Inactive'}\n </span>\n </div>\n <details\n className=\"TransformDetails\"\n open={expanded.comments}\n onToggle={(e) => {\n const isOpen = e.currentTarget.open;\n setExpanded((prev) =>\n prev.comments === isOpen ? prev : { ...prev, comments: isOpen },\n );\n }}\n >\n <summary className=\"TransformSummary\">\n <span className=\"TransformSummaryLabel\">Options</span>\n <span className=\"TransformSummaryHint\">\n {options.suppressCommentEnvironments\n ? 'Line % + comment environments'\n : 'Line % comments only'}{' '}\n · {commentScope === 'source' ? 'all branches' : 'configured branch'}\n </span>\n </summary>\n <div className=\"TransformBoxBody\">\n <p className=\"ControlSubtitle\">\n Strip TeX comments while keeping <code>verbatim</code> blocks intact.\n </p>\n <label className=\"ControlCheck\">\n <input\n type=\"checkbox\"\n checked={options.suppressCommentEnvironments}\n onChange={() =>\n onChange({\n ...options,\n suppressCommentEnvironments: !options.suppressCommentEnvironments,\n })\n }\n />\n <span>Also suppress comment environments</span>\n </label>\n <label className=\"ControlField\" htmlFor=\"commentScopeSelect\">\n <span>Scope</span>\n <select\n id=\"commentScopeSelect\"\n className=\"ControlInput\"\n value={commentScope}\n onChange={(e) => {\n const val = e.target.value;\n if (val === 'source' || val === 'selected') {\n setCommentScope(val);\n }\n }}\n >\n <option value=\"source\">All branches / whole document</option>\n <option value=\"selected\">Configured branch (selected)</option>\n </select>\n </label>\n </div>\n </details>\n </div>\n\n {/* Box 3: Remove Environments */}\n <div className={`TransformBox ${active.environments ? 'TransformBox--active' : ''}`}>\n <div className=\"TransformBoxHeader\">\n <label className=\"TransformBoxToggle\">\n <input\n type=\"checkbox\"\n checked={active.environments}\n onChange={() => toggleActiveBox('environments', parsedEnvNames.length === 0)}\n />\n <span className=\"TransformBoxTitle\">Remove Environments</span>\n </label>\n <span className={`TransformStatusPill ${active.environments ? 'is-active' : ''}`}>\n {active.environments ? 'Active' : 'Inactive'}\n </span>\n </div>\n <details\n className=\"TransformDetails\"\n open={expanded.environments}\n onToggle={(e) => {\n const isOpen = e.currentTarget.open;\n setExpanded((prev) =>\n prev.environments === isOpen ? prev : { ...prev, environments: isOpen },\n );\n }}\n >\n <summary className=\"TransformSummary\">\n <span className=\"TransformSummaryLabel\">Options</span>\n <span className=\"TransformSummaryHint\">\n {parsedEnvNames.length > 0\n ? parsedEnvNames.join(', ')\n : 'No environments specified'}\n </span>\n </summary>\n <div className=\"TransformBoxBody\">\n <p className=\"ControlSubtitle\">\n Delete named <code>\\begin{'{name}'}...\\end{'{name}'}</code> blocks and their contents.\n </p>\n <div className=\"ControlFieldGrid ControlFieldGrid--two\">\n <label className=\"ControlField\" htmlFor=\"envNamesInput\">\n <span>Environment names (comma-separated)</span>\n <input\n id=\"envNamesInput\"\n type=\"text\"\n className=\"ControlInput\"\n placeholder=\"e.g. comment, draftnote, todo\"\n value={envNamesText}\n onChange={(e) => setEnvNamesText(e.target.value)}\n />\n </label>\n <label className=\"ControlField\" htmlFor=\"envScopeSelect\">\n <span>Scope</span>\n <select\n id=\"envScopeSelect\"\n className=\"ControlInput\"\n value={envScope}\n onChange={(e) => {\n const val = e.target.value;\n if (val === 'source' || val === 'selected') {\n setEnvScope(val);\n }\n }}\n >\n <option value=\"source\">All branches / whole document</option>\n <option value=\"selected\">Configured branch (selected)</option>\n </select>\n </label>\n </div>\n </div>\n </details>\n </div>\n\n {/* Box 4: Expand / Flatten \\input Commands */}\n <div className={`TransformBox ${active.expand ? 'TransformBox--active' : ''}`}>\n <div className=\"TransformBoxHeader\">\n <label className=\"TransformBoxToggle\">\n <input\n type=\"checkbox\"\n checked={active.expand}\n onChange={() => toggleActiveBox('expand')}\n />\n <span className=\"TransformBoxTitle\">Expand / Flatten \\input Commands</span>\n </label>\n <span className={`TransformStatusPill ${active.expand ? 'is-active' : ''}`}>\n {active.expand ? 'Active' : 'Inactive'}\n </span>\n </div>\n <details\n className=\"TransformDetails\"\n open={expanded.expand}\n onToggle={(e) => {\n const isOpen = e.currentTarget.open;\n setExpanded((prev) => (prev.expand === isOpen ? prev : { ...prev, expand: isOpen }));\n }}\n >\n <summary className=\"TransformSummary\">\n <span className=\"TransformSummaryLabel\">Options</span>\n <span className=\"TransformSummaryHint\">\n {expandMode === 'recursive' ? 'Flatten all nested' : 'Single level'} ·{' '}\n {expandScope === 'source' ? 'all branches' : 'configured branch'}\n </span>\n </summary>\n <div className=\"TransformBoxBody\">\n <p className=\"ControlSubtitle\">\n Replace active <code>\\input</code> commands with target file contents (emits non-halting warnings if a file is missing).\n </p>\n <div className=\"ControlFieldGrid ControlFieldGrid--two\">\n <label className=\"ControlField\" htmlFor=\"expandModeSelect\">\n <span>Expansion Mode</span>\n <select\n id=\"expandModeSelect\"\n className=\"ControlInput\"\n value={expandMode}\n onChange={(e) => {\n const val = e.target.value;\n if (val === 'single' || val === 'recursive') {\n setExpandMode(val);\n }\n }}\n >\n <option value=\"single\">Expand one level (single pass)</option>\n <option value=\"recursive\">Flatten all nested inputs (recursive)</option>\n </select>\n </label>\n <label className=\"ControlField\" htmlFor=\"expandScopeSelect\">\n <span>Scope</span>\n <select\n id=\"expandScopeSelect\"\n className=\"ControlInput\"\n value={expandScope}\n onChange={(e) => {\n const val = e.target.value;\n if (val === 'source' || val === 'selected') {\n setExpandScope(val);\n }\n }}\n >\n <option value=\"source\">All branches / whole document</option>\n <option value=\"selected\">Configured branch (selected)</option>\n </select>\n </label>\n </div>\n </div>\n </details>\n </div>\n </div>\n\n {/* Unified Apply Panel */}\n <div className=\"TransformApplyPanel\" role=\"region\" aria-label=\"Apply transformations\">\n <div className=\"TransformApplyHeader\">\n <div>\n <h3>Apply Transformations</h3>\n <p className=\"ControlSubtitle\">\n {activeNames.length > 0\n ? `${activeNames.length} active: ${activeNames.join(' → ')}`\n : 'Select one or more transformation boxes above'}\n </p>\n </div>\n </div>\n\n <div\n className=\"TransformDestGroup\"\n role=\"radiogroup\"\n aria-label=\"Output destination\"\n >\n <label\n className={`TransformDestOption ${\n destination === 'inplace' ? 'TransformDestOption--selected' : ''\n }`}\n >\n <input\n type=\"radio\"\n name=\"transformDestination\"\n value=\"inplace\"\n checked={destination === 'inplace'}\n onChange={() => setDestination('inplace')}\n />\n <span className=\"TransformDestCopy\">\n <strong>Modify in place</strong>\n <span>Stage diff review before overwriting existing workspace files (undoable)</span>\n </span>\n </label>\n\n <label\n className={`TransformDestOption ${\n destination === 'new-files' ? 'TransformDestOption--selected' : ''\n }`}\n >\n <input\n type=\"radio\"\n name=\"transformDestination\"\n value=\"new-files\"\n checked={destination === 'new-files'}\n onChange={() => setDestination('new-files')}\n />\n <span className=\"TransformDestCopy\">\n <strong>Output new file(s)</strong>\n <span>Write transformed output to a new folder or sibling file without altering originals</span>\n </span>\n </label>\n </div>\n\n {destination === 'new-files' ? (\n <div className=\"TransformOutputFolderRow\">\n <label className=\"ControlField\" htmlFor=\"transformOutputFolder\">\n <span>Output folder (optional)</span>\n <input\n id=\"transformOutputFolder\"\n type=\"text\"\n className=\"ControlInput\"\n placeholder=\"e.g. out or build/clean (leave blank for *.transformed.tex)\"\n value={outputFolder}\n onChange={(e) => setOutputFolder(e.target.value)}\n />\n </label>\n <span className={`TransformOutputPreview ${hasInvalidFolder ? 'is-error' : ''}`}>\n {hasInvalidFolder\n ? 'Invalid folder path: avoid \".\" or \"..\" segments.'\n : `Output path example: ${previewOutputPath}`}\n </span>\n </div>\n ) : null}\n\n <div className=\"TransformApplyFooter\">\n {disabledHint ? <span className=\"TransformApplyHint\">{disabledHint}</span> : <span />}\n <button\n type=\"button\"\n className=\"ControlButton ControlButton--primary\"\n disabled={!canApply}\n title={disabledHint}\n onClick={handleApply}\n >\n {destination === 'new-files' ? 'Create New File(s)' : 'Preview & Apply in Place'}\n </button>\n </div>\n </div>\n\n {/* Generated Artifacts (available for ZIP / download inspection) */}\n {artifacts.length > 0 ? (\n <div className=\"ControlCard ControlCard--artifacts\">\n <div className=\"ControlCardHeader\">\n <div className=\"ArtifactsHeaderRow\">\n <h3>Generated Artifacts ({artifacts.length})</h3>\n {onDownloadZip ? (\n <button\n type=\"button\"\n className=\"ControlButton ControlButton--primary\"\n onClick={onDownloadZip}\n >\n Download ZIP\n </button>\n ) : null}\n </div>\n <p className=\"ControlSubtitle\">Review or download generated output files</p>\n </div>\n <div className=\"ArtifactsList\">\n {artifacts.map((art) => (\n <div key={art.path} className=\"ArtifactItem\">\n <span className=\"ArtifactPath\" title={art.path}>{art.path}</span>\n <span className=\"ArtifactTopology\">{art.topology}</span>\n <div className=\"ArtifactActions\">\n {onSelectArtifact ? (\n <button\n type=\"button\"\n className=\"ArtifactBtn\"\n onClick={() => onSelectArtifact(art)}\n >\n View\n </button>\n ) : null}\n {onDownloadArtifact ? (\n <button\n type=\"button\"\n className=\"ArtifactBtn\"\n onClick={() => onDownloadArtifact(art)}\n >\n Download\n </button>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n </div>\n ) : null}\n {extraContent}\n </section>\n );\n}\n"]}
|