@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.
Files changed (121) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -2
  3. package/dist/components/CatalogDialog.css +401 -0
  4. package/dist/components/CatalogDialog.d.ts +16 -0
  5. package/dist/components/CatalogDialog.js +224 -0
  6. package/dist/components/CatalogDialog.js.map +1 -0
  7. package/dist/components/Codeview.css +127 -0
  8. package/dist/components/Codeview.d.ts +14 -0
  9. package/dist/components/Codeview.js +74 -0
  10. package/dist/components/Codeview.js.map +1 -0
  11. package/dist/components/ConfigurationSummary.d.ts +18 -0
  12. package/dist/components/ConfigurationSummary.js +44 -0
  13. package/dist/components/ConfigurationSummary.js.map +1 -0
  14. package/dist/components/ControlPanel.css +792 -0
  15. package/dist/components/ControlPanel.d.ts +48 -0
  16. package/dist/components/ControlPanel.js +218 -0
  17. package/dist/components/ControlPanel.js.map +1 -0
  18. package/dist/components/EditPreviewDialog.css +308 -0
  19. package/dist/components/EditPreviewDialog.d.ts +18 -0
  20. package/dist/components/EditPreviewDialog.js +46 -0
  21. package/dist/components/EditPreviewDialog.js.map +1 -0
  22. package/dist/components/Filetree.css +344 -0
  23. package/dist/components/Filetree.d.ts +22 -0
  24. package/dist/components/Filetree.js +250 -0
  25. package/dist/components/Filetree.js.map +1 -0
  26. package/dist/components/LogDialog.css +154 -0
  27. package/dist/components/LogDialog.d.ts +16 -0
  28. package/dist/components/LogDialog.js +42 -0
  29. package/dist/components/LogDialog.js.map +1 -0
  30. package/dist/components/LogPanel.css +106 -0
  31. package/dist/components/LogPanel.d.ts +10 -0
  32. package/dist/components/LogPanel.js +30 -0
  33. package/dist/components/LogPanel.js.map +1 -0
  34. package/dist/components/MetadataDialog.css +275 -0
  35. package/dist/components/MetadataDialog.d.ts +13 -0
  36. package/dist/components/MetadataDialog.js +67 -0
  37. package/dist/components/MetadataDialog.js.map +1 -0
  38. package/dist/components/NodeActionBar.css +163 -0
  39. package/dist/components/NodeActionBar.d.ts +19 -0
  40. package/dist/components/NodeActionBar.js +114 -0
  41. package/dist/components/NodeActionBar.js.map +1 -0
  42. package/dist/components/OperationsDialog.css +154 -0
  43. package/dist/components/OperationsDialog.d.ts +8 -0
  44. package/dist/components/OperationsDialog.js +27 -0
  45. package/dist/components/OperationsDialog.js.map +1 -0
  46. package/dist/components/PrepTeXWorkspace.css +224 -0
  47. package/dist/components/PrepTeXWorkspace.d.ts +125 -0
  48. package/dist/components/PrepTeXWorkspace.js +593 -0
  49. package/dist/components/PrepTeXWorkspace.js.map +1 -0
  50. package/dist/components/ProjectSetupDialog.css +292 -0
  51. package/dist/components/ProjectSetupDialog.d.ts +18 -0
  52. package/dist/components/ProjectSetupDialog.js +134 -0
  53. package/dist/components/ProjectSetupDialog.js.map +1 -0
  54. package/dist/components/WelcomeEmptyState.css +105 -0
  55. package/dist/components/WelcomeEmptyState.d.ts +9 -0
  56. package/dist/components/WelcomeEmptyState.js +28 -0
  57. package/dist/components/WelcomeEmptyState.js.map +1 -0
  58. package/dist/components/WorkspaceHeader.css +410 -0
  59. package/dist/components/WorkspaceHeader.d.ts +66 -0
  60. package/dist/components/WorkspaceHeader.js +297 -0
  61. package/dist/components/WorkspaceHeader.js.map +1 -0
  62. package/dist/components/astview/ASTview.css +690 -0
  63. package/dist/components/astview/ASTview.d.ts +27 -0
  64. package/dist/components/astview/ASTview.js +314 -0
  65. package/dist/components/astview/ASTview.js.map +1 -0
  66. package/dist/components/astview/TreeNode.d.ts +8 -0
  67. package/dist/components/astview/TreeNode.js +237 -0
  68. package/dist/components/astview/TreeNode.js.map +1 -0
  69. package/dist/components/astview/treebuilder.d.ts +13 -0
  70. package/dist/components/astview/treebuilder.js +292 -0
  71. package/dist/components/astview/treebuilder.js.map +1 -0
  72. package/dist/components/index.d.ts +18 -0
  73. package/dist/components/index.js +19 -0
  74. package/dist/components/index.js.map +1 -0
  75. package/dist/docs/architecture.md +46 -0
  76. package/dist/docs/integration.md +107 -0
  77. package/dist/index.d.ts +14 -0
  78. package/dist/index.js +12 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/model/useArtifacts.d.ts +14 -0
  81. package/dist/model/useArtifacts.js +32 -0
  82. package/dist/model/useArtifacts.js.map +1 -0
  83. package/dist/model/useControl.d.ts +15 -0
  84. package/dist/model/useControl.js +19 -0
  85. package/dist/model/useControl.js.map +1 -0
  86. package/dist/model/useFiles.d.ts +53 -0
  87. package/dist/model/useFiles.js +283 -0
  88. package/dist/model/useFiles.js.map +1 -0
  89. package/dist/model/useProjectConfiguration.d.ts +32 -0
  90. package/dist/model/useProjectConfiguration.js +151 -0
  91. package/dist/model/useProjectConfiguration.js.map +1 -0
  92. package/dist/model/useWorkspaceLayout.d.ts +26 -0
  93. package/dist/model/useWorkspaceLayout.js +55 -0
  94. package/dist/model/useWorkspaceLayout.js.map +1 -0
  95. package/dist/services/zip.d.ts +24 -0
  96. package/dist/services/zip.js +279 -0
  97. package/dist/services/zip.js.map +1 -0
  98. package/dist/styles/bundle.css +4652 -0
  99. package/dist/styles/tokens.css +77 -0
  100. package/dist/types/LayoutNode.d.ts +30 -0
  101. package/dist/types/LayoutNode.js +18 -0
  102. package/dist/types/LayoutNode.js.map +1 -0
  103. package/dist/types/artifacts.d.ts +9 -0
  104. package/dist/types/artifacts.js +2 -0
  105. package/dist/types/artifacts.js.map +1 -0
  106. package/dist/types/errors.d.ts +14 -0
  107. package/dist/types/errors.js +2 -0
  108. package/dist/types/errors.js.map +1 -0
  109. package/dist/types/files.d.ts +12 -0
  110. package/dist/types/files.js +2 -0
  111. package/dist/types/files.js.map +1 -0
  112. package/dist/utils/dropEntries.d.ts +6 -0
  113. package/dist/utils/dropEntries.js +58 -0
  114. package/dist/utils/dropEntries.js.map +1 -0
  115. package/dist/utils/fileFilter.d.ts +10 -0
  116. package/dist/utils/fileFilter.js +68 -0
  117. package/dist/utils/fileFilter.js.map +1 -0
  118. package/dist/utils/transformOutput.d.ts +24 -0
  119. package/dist/utils/transformOutput.js +83 -0
  120. package/dist/utils/transformOutput.js.map +1 -0
  121. package/package.json +103 -4
@@ -0,0 +1,314 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { isLayoutNodeKind, LAYOUT_NODE_KINDS } from '../../types/LayoutNode.js';
4
+ import TreeNode from './TreeNode.js';
5
+ import './ASTview.css';
6
+ const STORAGE_KEY = 'preptex.astview.options.v6';
7
+ const DEFAULT_NODE_KINDS = LAYOUT_NODE_KINDS;
8
+ const DEFAULT_VISIBLE_NODE_KINDS = [
9
+ 'root',
10
+ 'section',
11
+ ];
12
+ const DEFAULT_COMMANDS = ['title', 'author', 'input', 'label', 'ref', 'cite', 'includegraphics'];
13
+ const DEFAULT_VISIBLE_COMMANDS = ['title', 'author', 'input'];
14
+ const DEFAULT_ENVIRONMENTS = [
15
+ 'document',
16
+ 'abstract',
17
+ 'figure',
18
+ 'theorem',
19
+ 'lemma',
20
+ 'table',
21
+ 'tabular',
22
+ 'itemize',
23
+ 'enumerate',
24
+ 'equation',
25
+ 'align',
26
+ ];
27
+ const DEFAULT_VISIBLE_ENVIRONMENTS = ['document', 'abstract', 'figure', 'table', 'tabular', 'theorem'];
28
+ function normalizeOptionName(value) {
29
+ return value.trim().replace(/^\\+/, '').toLowerCase();
30
+ }
31
+ function unique(values) {
32
+ return Array.from(new Set(values.map(normalizeOptionName).filter(Boolean))).sort((a, b) => a.localeCompare(b));
33
+ }
34
+ function isRecord(value) {
35
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
36
+ }
37
+ function stringArray(value, fallback = []) {
38
+ return Array.isArray(value) && value.every((item) => typeof item === 'string')
39
+ ? value : fallback;
40
+ }
41
+ function loadOptions() {
42
+ const fallback = {
43
+ visibleKinds: DEFAULT_VISIBLE_NODE_KINDS,
44
+ commandCards: DEFAULT_COMMANDS,
45
+ selectedCommands: DEFAULT_VISIBLE_COMMANDS,
46
+ userCommands: [],
47
+ environmentCards: DEFAULT_ENVIRONMENTS,
48
+ selectedEnvironments: DEFAULT_VISIBLE_ENVIRONMENTS,
49
+ userEnvironments: [],
50
+ };
51
+ try {
52
+ const raw = window.localStorage.getItem(STORAGE_KEY);
53
+ if (!raw)
54
+ return fallback;
55
+ const parsed = JSON.parse(raw);
56
+ if (!isRecord(parsed))
57
+ return fallback;
58
+ const commandCards = unique([...stringArray(parsed.commandCards), ...DEFAULT_COMMANDS]);
59
+ const selectedCommands = unique(stringArray(parsed.selectedCommands, DEFAULT_VISIBLE_COMMANDS)).filter((name) => commandCards.includes(name));
60
+ const environmentCards = unique([
61
+ ...stringArray(parsed.environmentCards),
62
+ ...DEFAULT_ENVIRONMENTS,
63
+ ]);
64
+ const selectedEnvironments = unique(stringArray(parsed.selectedEnvironments, DEFAULT_VISIBLE_ENVIRONMENTS)).filter((name) => environmentCards.includes(name));
65
+ return {
66
+ visibleKinds: stringArray(parsed.visibleKinds, fallback.visibleKinds).filter(isLayoutNodeKind),
67
+ commandCards,
68
+ selectedCommands,
69
+ userCommands: unique(stringArray(parsed.userCommands)).filter((name) => commandCards.includes(name)),
70
+ environmentCards,
71
+ selectedEnvironments,
72
+ userEnvironments: unique(stringArray(parsed.userEnvironments)).filter((name) => environmentCards.includes(name)),
73
+ };
74
+ }
75
+ catch {
76
+ return fallback;
77
+ }
78
+ }
79
+ function filterTree(node, options, structureMode) {
80
+ if (structureMode === 'coarse') {
81
+ return node;
82
+ }
83
+ if (structureMode === 'source') {
84
+ if (node.kind === 'space' && !options.visibleKinds.includes('space')) {
85
+ return null;
86
+ }
87
+ const visibleChildren = node.children
88
+ .map((child) => filterTree(child, options, structureMode))
89
+ .filter((child) => Boolean(child));
90
+ return {
91
+ ...node,
92
+ children: visibleChildren,
93
+ };
94
+ }
95
+ const optionName = normalizeOptionName(node.data || node.label || '');
96
+ const allCommandsVisible = options.visibleKinds.includes('command');
97
+ const selectedCommandVisible = options.selectedCommands.includes(optionName);
98
+ const allEnvironmentsVisible = options.visibleKinds.includes('environment');
99
+ const selectedEnvironmentVisible = options.selectedEnvironments.includes(optionName);
100
+ const isVisibleCommand = node.kind !== 'command' || allCommandsVisible || selectedCommandVisible;
101
+ const isVisibleEnvironment = node.kind !== 'environment' || allEnvironmentsVisible || selectedEnvironmentVisible;
102
+ const isVisibleKind = node.kind === 'command'
103
+ ? allCommandsVisible || selectedCommandVisible
104
+ : node.kind === 'environment'
105
+ ? allEnvironmentsVisible || selectedEnvironmentVisible
106
+ : options.visibleKinds.includes(node.kind);
107
+ const shouldRender = isVisibleKind && isVisibleCommand && isVisibleEnvironment;
108
+ if (!shouldRender)
109
+ return null;
110
+ const visibleChildren = node.children
111
+ .map((child) => filterTree(child, options, structureMode))
112
+ .filter((child) => Boolean(child));
113
+ return {
114
+ ...node,
115
+ children: visibleChildren,
116
+ };
117
+ }
118
+ export default function ASTview({ root, onSelectNode, selectedNodeKey = null, collapsed, onToggleCollapsed, isSidePanel = true, structureMode = 'coarse', onChangeStructureMode, isConfiguredAvailable = true, viewIssue = null, inputMode = 'command', onChangeInputMode, inputWarnings = [], coarseOptions = {}, onChangeCoarseOptions, hasConditionals = false, conditionPolicy, detectedConditions = [], onConfigureConditions, splitEnabled, onToggleSplit, }) {
119
+ const [optionsOpen, setOptionsOpen] = useState(false);
120
+ const [phase0Open, setPhase0Open] = useState(false);
121
+ const [inlineMode, setInlineMode] = useState(conditionPolicy && conditionPolicy.mode !== 'ignore' ? conditionPolicy.mode : 'source');
122
+ const [inlineOverrides, setInlineOverrides] = useState({});
123
+ const [options, setOptions] = useState(() => loadOptions());
124
+ const [newCommand, setNewCommand] = useState('');
125
+ const [newEnvironment, setNewEnvironment] = useState('');
126
+ const optionsRef = useRef(null);
127
+ useEffect(() => {
128
+ try {
129
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(options));
130
+ }
131
+ catch {
132
+ // Filtering still works when browser storage is unavailable.
133
+ }
134
+ }, [options]);
135
+ useEffect(() => {
136
+ if (!optionsOpen)
137
+ return;
138
+ const closeOnOutsideClick = (event) => {
139
+ const target = event.target;
140
+ if (target instanceof Node && optionsRef.current?.contains(target))
141
+ return;
142
+ setOptionsOpen(false);
143
+ };
144
+ window.addEventListener('pointerdown', closeOnOutsideClick);
145
+ return () => window.removeEventListener('pointerdown', closeOnOutsideClick);
146
+ }, [optionsOpen]);
147
+ const filteredRoot = useMemo(() => (root ? filterTree(root, options, structureMode) : null), [root, options, structureMode]);
148
+ const toggleKind = (kind) => {
149
+ setOptions((current) => {
150
+ const visibleKinds = current.visibleKinds.includes(kind)
151
+ ? current.visibleKinds.filter((item) => item !== kind)
152
+ : [...current.visibleKinds, kind];
153
+ return { ...current, visibleKinds };
154
+ });
155
+ };
156
+ const toggleCommand = (command) => {
157
+ setOptions((current) => {
158
+ const selectedCommands = current.selectedCommands.includes(command)
159
+ ? current.selectedCommands.filter((item) => item !== command)
160
+ : [...current.selectedCommands, command];
161
+ return { ...current, selectedCommands: unique(selectedCommands) };
162
+ });
163
+ };
164
+ const toggleEnvironment = (environment) => {
165
+ setOptions((current) => {
166
+ const selectedEnvironments = current.selectedEnvironments.includes(environment)
167
+ ? current.selectedEnvironments.filter((item) => item !== environment)
168
+ : [...current.selectedEnvironments, environment];
169
+ return { ...current, selectedEnvironments: unique(selectedEnvironments) };
170
+ });
171
+ };
172
+ const deleteUserCommand = (event, command) => {
173
+ event.stopPropagation();
174
+ setOptions((current) => ({
175
+ ...current,
176
+ commandCards: current.commandCards.filter((item) => item !== command),
177
+ selectedCommands: current.selectedCommands.filter((item) => item !== command),
178
+ userCommands: current.userCommands.filter((item) => item !== command),
179
+ }));
180
+ };
181
+ const deleteUserEnvironment = (event, environment) => {
182
+ event.stopPropagation();
183
+ setOptions((current) => ({
184
+ ...current,
185
+ environmentCards: current.environmentCards.filter((item) => item !== environment),
186
+ selectedEnvironments: current.selectedEnvironments.filter((item) => item !== environment),
187
+ userEnvironments: current.userEnvironments.filter((item) => item !== environment),
188
+ }));
189
+ };
190
+ const addCommand = (event) => {
191
+ event.preventDefault();
192
+ const command = normalizeOptionName(newCommand);
193
+ if (!command)
194
+ return;
195
+ setOptions((current) => ({
196
+ ...current,
197
+ commandCards: unique([...current.commandCards, command]),
198
+ selectedCommands: unique([...current.selectedCommands, command]),
199
+ userCommands: unique([...current.userCommands, command]),
200
+ }));
201
+ setNewCommand('');
202
+ };
203
+ const addEnvironment = (event) => {
204
+ event.preventDefault();
205
+ const environment = normalizeOptionName(newEnvironment);
206
+ if (!environment)
207
+ return;
208
+ setOptions((current) => ({
209
+ ...current,
210
+ environmentCards: unique([...current.environmentCards, environment]),
211
+ selectedEnvironments: unique([...current.selectedEnvironments, environment]),
212
+ userEnvironments: unique([...current.userEnvironments, environment]),
213
+ }));
214
+ setNewEnvironment('');
215
+ };
216
+ const resetToDefault = () => {
217
+ setOptions((current) => ({
218
+ ...current,
219
+ visibleKinds: DEFAULT_VISIBLE_NODE_KINDS,
220
+ selectedCommands: DEFAULT_VISIBLE_COMMANDS,
221
+ selectedEnvironments: DEFAULT_VISIBLE_ENVIRONMENTS,
222
+ }));
223
+ };
224
+ return (_jsxs("section", { className: `AstTree ${collapsed ? 'AstTree--collapsed' : ''}`, "aria-label": "AST tree", children: [_jsxs("div", { className: "AstTreeHeader", children: [_jsx("h2", { children: "AST View" }), _jsxs("div", { className: "AstTreeActions", children: [!collapsed && onChangeInputMode ? (_jsxs("div", { className: "AstTreeModeToggle", role: "group", "aria-label": "Input handling mode", children: [_jsx("button", { type: "button", className: `AstTreeModeBtn ${inputMode === 'command' ? 'AstTreeModeBtn--active' : ''}`, onClick: () => onChangeInputMode('command'), title: "Handle \\\\input as a command in the entry file only", children: "Command" }), _jsx("button", { type: "button", className: `AstTreeModeBtn ${inputMode === 'recursive' ? 'AstTreeModeBtn--active' : ''}`, onClick: () => onChangeInputMode('recursive'), title: "Recursively parse and transform \\\\input targets", children: "Recursive" })] })) : null, !collapsed && onChangeStructureMode ? (_jsxs("div", { className: "AstTreeModeToggle", role: "group", "aria-label": "Tree view mode", children: [_jsx("button", { type: "button", className: `AstTreeModeBtn ${structureMode === 'coarse' ? 'AstTreeModeBtn--active' : ''}`, disabled: !isConfiguredAvailable, onClick: () => onChangeStructureMode('coarse'), title: isConfiguredAvailable
225
+ ? 'Readable coarse document outline (sections, environments, commands, arguments)'
226
+ : viewIssue
227
+ ? `${viewIssue.code}: ${viewIssue.message}`
228
+ : 'Configure an entry in Settings to enable coarse view', children: "Coarse" }), _jsx("button", { type: "button", className: `AstTreeModeBtn ${structureMode === 'configured' ? 'AstTreeModeBtn--active' : ''}`, disabled: !isConfiguredAvailable, onClick: () => onChangeStructureMode('configured'), title: isConfiguredAvailable
229
+ ? 'Detailed configured document AST'
230
+ : viewIssue
231
+ ? `${viewIssue.code}: ${viewIssue.message}`
232
+ : 'Configure an entry in Settings to enable structure view', children: "Structure" }), _jsx("button", { type: "button", className: `AstTreeModeBtn ${structureMode === 'source' ? 'AstTreeModeBtn--active' : ''}`, onClick: () => onChangeStructureMode('source'), title: "Raw source syntax and tokens", children: "Source" })] })) : null, !collapsed ? (_jsxs("div", { className: "AstTreeOptionsWrap", ref: optionsRef, children: [_jsx("button", { type: "button", className: `AstTreeToolButton ${optionsOpen ? 'AstTreeToolButton--active' : ''}`, onClick: () => setOptionsOpen((value) => !value), "aria-label": "AST view options", "aria-expanded": optionsOpen, title: "Options", children: "\u2699" }), optionsOpen ? (_jsx("div", { className: "AstTreeOptions", role: "dialog", "aria-label": "AST view options", children: structureMode === 'coarse' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "AstTreeOptionsHeader", children: [_jsx("div", { className: "AstTreeOptionsTitle", children: "Coarse Tree Options" }), onChangeCoarseOptions ? (_jsx("button", { type: "button", className: "AstTreeOptionsReset", onClick: () => onChangeCoarseOptions({}), children: "Reset" })) : null] }), _jsx("div", { className: "AstTreeOptionsSection", children: _jsx("div", { className: "AstTreeOptionCards", children: [
233
+ ['includeSections', 'Sections', true],
234
+ ['includeEnvironments', 'Environments', true],
235
+ ['includeInputs', 'Inputs', true],
236
+ ['includeCustomAndUndefinedCommands', 'Custom/Undefined cmds', true],
237
+ ['includeBuiltinCommands', 'Built-in cmds', false],
238
+ ['includeArguments', 'Arguments', true],
239
+ ['includeDisplayMath', 'Display math', false],
240
+ ['includeMath', 'All math', false],
241
+ ['includeGroups', 'Brace groups', false],
242
+ ['includeTextBlocks', 'Text blocks', false],
243
+ ].map(([key, label, fallback]) => {
244
+ const selected = coarseOptions[key] ?? fallback;
245
+ return (_jsx("button", { type: "button", className: `AstTreeOptionCard ${selected ? 'AstTreeOptionCard--selected' : ''}`, onClick: () => onChangeCoarseOptions?.({
246
+ ...coarseOptions,
247
+ [key]: !selected,
248
+ }), children: label }, key));
249
+ }) }) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "AstTreeOptionsHeader", children: [_jsx("div", { className: "AstTreeOptionsTitle", children: "Options" }), _jsx("button", { type: "button", className: "AstTreeOptionsReset", onClick: resetToDefault, children: "Reset" })] }), _jsxs("div", { className: "AstTreeOptionsSection", children: [_jsx("div", { className: "AstTreeOptionsTitle", children: "Node Types" }), _jsx("div", { className: "AstTreeOptionCards", children: DEFAULT_NODE_KINDS.map((kind) => {
250
+ const selected = options.visibleKinds.includes(kind);
251
+ return (_jsx("button", { type: "button", className: `AstTreeOptionCard ${selected ? 'AstTreeOptionCard--selected' : ''}`, onClick: () => toggleKind(kind), children: kind }, kind));
252
+ }) })] }), _jsxs("div", { className: "AstTreeOptionsSection", children: [_jsx("div", { className: "AstTreeOptionsTitle", children: "Environments" }), _jsx("div", { className: "AstTreeOptionCards", children: options.environmentCards.map((environment) => {
253
+ const selected = options.selectedEnvironments.includes(environment);
254
+ const userDefined = options.userEnvironments.includes(environment);
255
+ return (_jsxs("button", { type: "button", className: `AstTreeOptionCard AstTreeCommandCard ${selected ? 'AstTreeOptionCard--selected' : ''}`, onClick: () => toggleEnvironment(environment), children: [userDefined ? (_jsx("span", { className: "AstTreeCommandDelete", onClick: (event) => deleteUserEnvironment(event, environment), "aria-label": `Delete ${environment}`, children: "x" })) : null, _jsx("span", { children: environment })] }, environment));
256
+ }) }), _jsxs("form", { className: "AstTreeCommandForm", onSubmit: addEnvironment, children: [_jsx("input", { value: newEnvironment, onChange: (event) => setNewEnvironment(event.target.value), placeholder: "Add environment...", "aria-label": "Add environment" }), _jsx("button", { type: "submit", children: "Add" })] })] }), _jsxs("div", { className: "AstTreeOptionsSection", children: [_jsx("div", { className: "AstTreeOptionsTitle", children: "Commands" }), _jsx("div", { className: "AstTreeOptionCards", children: options.commandCards.map((command) => {
257
+ const selected = options.selectedCommands.includes(command);
258
+ const userDefined = options.userCommands.includes(command);
259
+ return (_jsxs("button", { type: "button", className: `AstTreeOptionCard AstTreeCommandCard ${selected ? 'AstTreeOptionCard--selected' : ''}`, onClick: () => toggleCommand(command), children: [userDefined ? (_jsx("span", { className: "AstTreeCommandDelete", onClick: (event) => deleteUserCommand(event, command), "aria-label": `Delete ${command}`, children: "x" })) : null, _jsxs("span", { children: ["\\", command] })] }, command));
260
+ }) }), _jsxs("form", { className: "AstTreeCommandForm", onSubmit: addCommand, children: [_jsx("input", { value: newCommand, onChange: (event) => setNewCommand(event.target.value), placeholder: "Add command...", "aria-label": "Add command" }), _jsx("button", { type: "submit", children: "Add" })] })] })] })) })) : null] })) : null, !collapsed && !isSidePanel && onToggleSplit ? (_jsxs("button", { type: "button", className: `AstTreeSplitBtn${splitEnabled ? ' AstTreeSplitBtn--active' : ''}`, onClick: onToggleSplit, title: "Toggle side-by-side Code view", children: [_jsx("span", { "aria-hidden": "true", children: "\u25EB" }), _jsx("span", { children: "Split" })] })) : null, isSidePanel && onToggleCollapsed ? (_jsx("button", { type: "button", className: "AstTreeToggle", onClick: onToggleCollapsed, "aria-label": collapsed ? 'Expand AST view' : 'Collapse AST view', title: collapsed ? 'Expand' : 'Collapse', children: collapsed ? '<' : '>' })) : null] })] }), !collapsed && inputWarnings.length > 0 ? (_jsxs("div", { className: "AstPhase0Prompt", role: "status", "aria-label": "Missing input warnings", children: [_jsx("div", { className: "AstPhase0PromptHeader", children: _jsx("strong", { children: inputWarnings.length === 1
261
+ ? 'Missing \\input warning'
262
+ : `${inputWarnings.length} missing \\input warnings` }) }), _jsx("p", { className: "AstPhase0Desc", children: inputWarnings.map((warning) => warning.message).join(' · ') })] })) : null, !collapsed && hasConditionals && onConfigureConditions ? (_jsxs("div", { className: "AstPhase0Region", children: [!isConfiguredAvailable && structureMode !== 'source' ? (_jsxs("div", { className: "AstPhase0Prompt", role: "region", "aria-label": "Condition configuration required", children: [_jsxs("div", { className: "AstPhase0PromptHeader", children: [_jsx("strong", { children: "Condition paths needed for branch AST" }), viewIssue ? _jsx("span", { className: "AstPhase0Issue", children: viewIssue.message }) : null] }), _jsx("p", { className: "AstPhase0Desc", children: "Cross-branch conditionals affect structural nesting here. Choose which branch to evaluate for AST inspection, or inspect Source mode." })] })) : (_jsxs("div", { className: "AstPhase0Banner", children: [_jsx("span", { children: conditionPolicy?.mode === 'ignore'
263
+ ? 'Viewing all conditional branches (ignore mode)'
264
+ : `Condition mode: ${conditionPolicy?.mode ?? 'source'}` }), _jsx("button", { type: "button", className: "AstPhase0ToggleBtn", onClick: () => setPhase0Open((v) => !v), children: phase0Open ? 'Hide Phase 0' : 'Configure Conditions' })] })), (phase0Open || (!isConfiguredAvailable && structureMode !== 'source')) ? (_jsxs("div", { className: "AstPhase0Card", children: [_jsx("div", { className: "AstPhase0Row", children: _jsxs("label", { className: "AstPhase0Field", children: [_jsx("span", { children: "Condition policy" }), _jsxs("select", { value: inlineMode, onChange: (e) => {
265
+ const val = e.target.value;
266
+ if (val === 'ignore' ||
267
+ val === 'source' ||
268
+ val === 'source-with-overrides' ||
269
+ val === 'manual' ||
270
+ val === 'none') {
271
+ setInlineMode(val);
272
+ }
273
+ }, children: [_jsx("option", { value: "ignore", children: "Ignore conditionals (all branches)" }), _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: "none", children: "Condition-free (none)" })] })] }) }), detectedConditions.length > 0 &&
274
+ (inlineMode === 'source-with-overrides' || inlineMode === 'manual') ? (_jsx("div", { className: "AstPhase0CondList", children: detectedConditions.map((cond) => {
275
+ const val = inlineOverrides[cond];
276
+ const choice = val === true ? 'true' : val === false ? 'false' : 'follow';
277
+ return (_jsxs("label", { className: "AstPhase0CondItem", children: [_jsxs("code", { children: ["\\if", cond] }), _jsxs("select", { value: choice, onChange: (e) => {
278
+ const v = e.target.value;
279
+ if (v === 'follow') {
280
+ const next = { ...inlineOverrides };
281
+ delete next[cond];
282
+ setInlineOverrides(next);
283
+ }
284
+ else {
285
+ setInlineOverrides({ ...inlineOverrides, [cond]: v === 'true' });
286
+ }
287
+ }, children: [inlineMode === 'source-with-overrides' ? (_jsx("option", { value: "follow", children: "Follow source" })) : null, inlineMode === 'manual' && val === undefined ? (_jsx("option", { value: "follow", children: "(Select\u2026)" })) : null, _jsx("option", { value: "true", children: "True" }), _jsx("option", { value: "false", children: "False" })] })] }, cond));
288
+ }) })) : null, _jsx("div", { className: "AstPhase0Actions", children: _jsx("button", { type: "button", className: "AstPhase0ApplyBtn", onClick: () => {
289
+ if (inlineMode === 'ignore') {
290
+ onConfigureConditions({ mode: 'ignore' });
291
+ }
292
+ else if (inlineMode === 'none') {
293
+ onConfigureConditions({ mode: 'none' });
294
+ }
295
+ else if (inlineMode === 'manual') {
296
+ onConfigureConditions({ mode: 'manual', values: inlineOverrides });
297
+ }
298
+ else if (inlineMode === 'source-with-overrides') {
299
+ onConfigureConditions({
300
+ mode: 'source-with-overrides',
301
+ overrides: inlineOverrides,
302
+ });
303
+ }
304
+ else {
305
+ onConfigureConditions({ mode: 'source' });
306
+ }
307
+ setPhase0Open(false);
308
+ }, children: "Apply Condition Setup" }) })] })) : null] })) : null, collapsed ? null : (_jsx("div", { className: "AstTreeList", role: "tree", children: filteredRoot ? (_jsx(TreeNode, { node: filteredRoot, onSelectNode: onSelectNode, selectedNodeKey: selectedNodeKey })) : (_jsx("div", { className: "AstTreeEmpty", children: root
309
+ ? 'No nodes match the current AST view options.'
310
+ : structureMode !== 'source' && viewIssue
311
+ ? `Structure unavailable (${viewIssue.code}): ${viewIssue.message}`
312
+ : 'Select a file to inspect its structure.' })) }))] }));
313
+ }
314
+ //# sourceMappingURL=ASTview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ASTview.js","sourceRoot":"","sources":["../../../src/components/astview/ASTview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAyB,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,eAAe,CAAC;AA4BvB,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAE7C,MAAM,0BAA0B,GAA8B;IAC5D,MAAM;IACN,SAAS;CACV,CAAC;AACF,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACjG,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9D,MAAM,oBAAoB,GAAG;IAC3B,UAAU;IACV,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;CACR,CAAC;AACF,MAAM,4BAA4B,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,S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I,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;yCACpE;6CAAM,IAAI,UAAU,KAAK,uBAAuB,EAAE;4CACjD,qBAAqB,CAAC;gDACpB,IAAI,EAAE,uBAAuB;gDAC7B,SAAS,EAAE,eAAe;6CAC3B,CAAC,CAAC;yCACJ;6CAAM;4CACL,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;yCAC3C;wCACD,aAAa,CAAC,KAAK,CAAC,CAAC;oCACvB,CAAC,sCAGM,GACL,IACF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,IAAI,EAEP,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAClB,cAAK,SAAS,EAAC,aAAa,EAAC,IAAI,EAAC,MAAM,YACrC,YAAY,CAAC,CAAC,CAAC,CACd,KAAC,QAAQ,IACP,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,cAAc,YAC1B,IAAI;wBACH,CAAC,CAAC,8CAA8C;wBAChD,CAAC,CAAC,aAAa,KAAK,QAAQ,IAAI,SAAS;4BACzC,CAAC,CAAC,0BAA0B,SAAS,CAAC,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;4BACnE,CAAC,CAAC,yCAAyC,GACzC,CACP,GACG,CACP,IACO,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { FormEvent, MouseEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport type { CoarseTreeOptions, ConditionPolicy, ProjectIssue, ViewInputMode } from '@preptex/core';\nimport { isLayoutNodeKind, LAYOUT_NODE_KINDS } from '../../types/LayoutNode';\nimport type { LayoutNode, LayoutNodeKind } from '../../types/LayoutNode';\nimport TreeNode from './TreeNode';\nimport './ASTview.css';\n\nexport type AstStructureMode = 'coarse' | 'configured' | 'source';\n\nexport interface ASTviewProps {\n root?: LayoutNode | null;\n onSelectNode?: (node: LayoutNode) => void;\n selectedNodeKey?: string | null;\n collapsed?: boolean;\n onToggleCollapsed?: () => void;\n isSidePanel?: boolean;\n structureMode?: AstStructureMode;\n onChangeStructureMode?: (mode: AstStructureMode) => void;\n isConfiguredAvailable?: boolean;\n viewIssue?: ProjectIssue | null;\n inputMode?: ViewInputMode;\n onChangeInputMode?: (mode: ViewInputMode) => void;\n inputWarnings?: readonly ProjectIssue[];\n coarseOptions?: CoarseTreeOptions;\n onChangeCoarseOptions?: (next: CoarseTreeOptions) => void;\n hasConditionals?: boolean;\n conditionPolicy?: ConditionPolicy;\n detectedConditions?: readonly string[];\n onConfigureConditions?: (policy: ConditionPolicy) => void;\n splitEnabled?: boolean;\n onToggleSplit?: () => void;\n}\n\nconst STORAGE_KEY = 'preptex.astview.options.v6';\n\nconst DEFAULT_NODE_KINDS = LAYOUT_NODE_KINDS;\n\nconst DEFAULT_VISIBLE_NODE_KINDS: readonly LayoutNodeKind[] = [\n 'root',\n 'section',\n];\nconst DEFAULT_COMMANDS = ['title', 'author', 'input', 'label', 'ref', 'cite', 'includegraphics'];\nconst DEFAULT_VISIBLE_COMMANDS = ['title', 'author', 'input'];\nconst DEFAULT_ENVIRONMENTS = [\n 'document',\n 'abstract',\n 'figure',\n 'theorem',\n 'lemma',\n 'table',\n 'tabular',\n 'itemize',\n 'enumerate',\n 'equation',\n 'align',\n];\nconst DEFAULT_VISIBLE_ENVIRONMENTS = ['document', 'abstract', 'figure', 'table', 'tabular', 'theorem'];\n\ntype AstViewOptions = {\n readonly visibleKinds: readonly LayoutNodeKind[];\n readonly commandCards: readonly string[];\n readonly selectedCommands: readonly string[];\n readonly userCommands: readonly string[];\n readonly environmentCards: readonly string[];\n readonly selectedEnvironments: readonly string[];\n readonly userEnvironments: readonly string[];\n};\n\nfunction normalizeOptionName(value: string): string {\n return value.trim().replace(/^\\\\+/, '').toLowerCase();\n}\n\nfunction unique(values: readonly string[]): string[] {\n return Array.from(new Set(values.map(normalizeOptionName).filter(Boolean))).sort((a, b) =>\n a.localeCompare(b),\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction stringArray(value: unknown, fallback: readonly string[] = []): readonly string[] {\n return Array.isArray(value) && value.every((item: unknown) => typeof item === 'string')\n ? value : fallback;\n}\n\nfunction loadOptions(): AstViewOptions {\n const fallback: AstViewOptions = {\n visibleKinds: DEFAULT_VISIBLE_NODE_KINDS,\n commandCards: DEFAULT_COMMANDS,\n selectedCommands: DEFAULT_VISIBLE_COMMANDS,\n userCommands: [],\n environmentCards: DEFAULT_ENVIRONMENTS,\n selectedEnvironments: DEFAULT_VISIBLE_ENVIRONMENTS,\n userEnvironments: [],\n };\n\n try {\n const raw = window.localStorage.getItem(STORAGE_KEY);\n if (!raw) return fallback;\n const parsed: unknown = JSON.parse(raw);\n if (!isRecord(parsed)) return fallback;\n const commandCards = unique([...stringArray(parsed.commandCards), ...DEFAULT_COMMANDS]);\n const selectedCommands = unique(stringArray(parsed.selectedCommands, DEFAULT_VISIBLE_COMMANDS)).filter(\n (name) => commandCards.includes(name),\n );\n const environmentCards = unique([\n ...stringArray(parsed.environmentCards),\n ...DEFAULT_ENVIRONMENTS,\n ]);\n const selectedEnvironments = unique(\n stringArray(parsed.selectedEnvironments, DEFAULT_VISIBLE_ENVIRONMENTS),\n ).filter((name) => environmentCards.includes(name));\n\n return {\n visibleKinds: stringArray(parsed.visibleKinds, fallback.visibleKinds).filter(isLayoutNodeKind),\n commandCards,\n selectedCommands,\n userCommands: unique(stringArray(parsed.userCommands)).filter((name) => commandCards.includes(name)),\n environmentCards,\n selectedEnvironments,\n userEnvironments: unique(stringArray(parsed.userEnvironments)).filter((name) =>\n environmentCards.includes(name),\n ),\n };\n } catch {\n return fallback;\n }\n}\n\nfunction filterTree(\n node: LayoutNode,\n options: AstViewOptions,\n structureMode: AstStructureMode,\n): LayoutNode | null {\n if (structureMode === 'coarse') {\n return node;\n }\n\n if (structureMode === 'source') {\n if (node.kind === 'space' && !options.visibleKinds.includes('space')) {\n return null;\n }\n const visibleChildren = node.children\n .map((child) => filterTree(child, options, structureMode))\n .filter((child): child is LayoutNode => Boolean(child));\n return {\n ...node,\n children: visibleChildren,\n };\n }\n\n const optionName = normalizeOptionName(node.data || node.label || '');\n const allCommandsVisible = options.visibleKinds.includes('command');\n const selectedCommandVisible = options.selectedCommands.includes(optionName);\n const allEnvironmentsVisible = options.visibleKinds.includes('environment');\n const selectedEnvironmentVisible = options.selectedEnvironments.includes(optionName);\n const isVisibleCommand =\n node.kind !== 'command' || allCommandsVisible || selectedCommandVisible;\n const isVisibleEnvironment =\n node.kind !== 'environment' || allEnvironmentsVisible || selectedEnvironmentVisible;\n const isVisibleKind =\n node.kind === 'command'\n ? allCommandsVisible || selectedCommandVisible\n : node.kind === 'environment'\n ? allEnvironmentsVisible || selectedEnvironmentVisible\n : options.visibleKinds.includes(node.kind);\n const shouldRender = isVisibleKind && isVisibleCommand && isVisibleEnvironment;\n\n if (!shouldRender) return null;\n\n const visibleChildren = node.children\n .map((child) => filterTree(child, options, structureMode))\n .filter((child): child is LayoutNode => Boolean(child));\n\n return {\n ...node,\n children: visibleChildren,\n };\n}\n\nexport default function ASTview({\n root,\n onSelectNode,\n selectedNodeKey = null,\n collapsed,\n onToggleCollapsed,\n isSidePanel = true,\n structureMode = 'coarse',\n onChangeStructureMode,\n isConfiguredAvailable = true,\n viewIssue = null,\n inputMode = 'command',\n onChangeInputMode,\n inputWarnings = [],\n coarseOptions = {},\n onChangeCoarseOptions,\n hasConditionals = false,\n conditionPolicy,\n detectedConditions = [],\n onConfigureConditions,\n splitEnabled,\n onToggleSplit,\n}: ASTviewProps) {\n const [optionsOpen, setOptionsOpen] = useState(false);\n const [phase0Open, setPhase0Open] = useState(false);\n const [inlineMode, setInlineMode] = useState<ConditionPolicy['mode']>(\n conditionPolicy && conditionPolicy.mode !== 'ignore' ? conditionPolicy.mode : 'source',\n );\n const [inlineOverrides, setInlineOverrides] = useState<Record<string, boolean>>({});\n const [options, setOptions] = useState<AstViewOptions>(() => loadOptions());\n const [newCommand, setNewCommand] = useState('');\n const [newEnvironment, setNewEnvironment] = useState('');\n const optionsRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n try {\n window.localStorage.setItem(STORAGE_KEY, JSON.stringify(options));\n } catch {\n // Filtering still works when browser storage is unavailable.\n }\n }, [options]);\n\n useEffect(() => {\n if (!optionsOpen) return;\n\n const closeOnOutsideClick = (event: PointerEvent) => {\n const target = event.target;\n if (target instanceof Node && optionsRef.current?.contains(target)) return;\n setOptionsOpen(false);\n };\n\n window.addEventListener('pointerdown', closeOnOutsideClick);\n return () => window.removeEventListener('pointerdown', closeOnOutsideClick);\n }, [optionsOpen]);\n\n const filteredRoot = useMemo(\n () => (root ? filterTree(root, options, structureMode) : null),\n [root, options, structureMode],\n );\n\n const toggleKind = (kind: LayoutNodeKind) => {\n setOptions((current) => {\n const visibleKinds = current.visibleKinds.includes(kind)\n ? current.visibleKinds.filter((item) => item !== kind)\n : [...current.visibleKinds, kind];\n return { ...current, visibleKinds };\n });\n };\n\n const toggleCommand = (command: string) => {\n setOptions((current) => {\n const selectedCommands = current.selectedCommands.includes(command)\n ? current.selectedCommands.filter((item) => item !== command)\n : [...current.selectedCommands, command];\n return { ...current, selectedCommands: unique(selectedCommands) };\n });\n };\n\n const toggleEnvironment = (environment: string) => {\n setOptions((current) => {\n const selectedEnvironments = current.selectedEnvironments.includes(environment)\n ? current.selectedEnvironments.filter((item) => item !== environment)\n : [...current.selectedEnvironments, environment];\n return { ...current, selectedEnvironments: unique(selectedEnvironments) };\n });\n };\n\n const deleteUserCommand = (event: MouseEvent<HTMLSpanElement>, command: string) => {\n event.stopPropagation();\n setOptions((current) => ({\n ...current,\n commandCards: current.commandCards.filter((item) => item !== command),\n selectedCommands: current.selectedCommands.filter((item) => item !== command),\n userCommands: current.userCommands.filter((item) => item !== command),\n }));\n };\n\n const deleteUserEnvironment = (event: MouseEvent<HTMLSpanElement>, environment: string) => {\n event.stopPropagation();\n setOptions((current) => ({\n ...current,\n environmentCards: current.environmentCards.filter((item) => item !== environment),\n selectedEnvironments: current.selectedEnvironments.filter((item) => item !== environment),\n userEnvironments: current.userEnvironments.filter((item) => item !== environment),\n }));\n };\n\n const addCommand = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const command = normalizeOptionName(newCommand);\n if (!command) return;\n setOptions((current) => ({\n ...current,\n commandCards: unique([...current.commandCards, command]),\n selectedCommands: unique([...current.selectedCommands, command]),\n userCommands: unique([...current.userCommands, command]),\n }));\n setNewCommand('');\n };\n\n const addEnvironment = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const environment = normalizeOptionName(newEnvironment);\n if (!environment) return;\n setOptions((current) => ({\n ...current,\n environmentCards: unique([...current.environmentCards, environment]),\n selectedEnvironments: unique([...current.selectedEnvironments, environment]),\n userEnvironments: unique([...current.userEnvironments, environment]),\n }));\n setNewEnvironment('');\n };\n\n const resetToDefault = () => {\n setOptions((current) => ({\n ...current,\n visibleKinds: DEFAULT_VISIBLE_NODE_KINDS,\n selectedCommands: DEFAULT_VISIBLE_COMMANDS,\n selectedEnvironments: DEFAULT_VISIBLE_ENVIRONMENTS,\n }));\n };\n\n return (\n <section className={`AstTree ${collapsed ? 'AstTree--collapsed' : ''}`} aria-label=\"AST tree\">\n <div className=\"AstTreeHeader\">\n <h2>AST View</h2>\n <div className=\"AstTreeActions\">\n {!collapsed && onChangeInputMode ? (\n <div className=\"AstTreeModeToggle\" role=\"group\" aria-label=\"Input handling mode\">\n <button\n type=\"button\"\n className={`AstTreeModeBtn ${inputMode === 'command' ? 'AstTreeModeBtn--active' : ''}`}\n onClick={() => onChangeInputMode('command')}\n title=\"Handle \\\\input as a command in the entry file only\"\n >\n Command\n </button>\n <button\n type=\"button\"\n className={`AstTreeModeBtn ${inputMode === 'recursive' ? 'AstTreeModeBtn--active' : ''}`}\n onClick={() => onChangeInputMode('recursive')}\n title=\"Recursively parse and transform \\\\input targets\"\n >\n Recursive\n </button>\n </div>\n ) : null}\n\n {!collapsed && onChangeStructureMode ? (\n <div className=\"AstTreeModeToggle\" role=\"group\" aria-label=\"Tree view mode\">\n <button\n type=\"button\"\n className={`AstTreeModeBtn ${structureMode === 'coarse' ? 'AstTreeModeBtn--active' : ''}`}\n disabled={!isConfiguredAvailable}\n onClick={() => onChangeStructureMode('coarse')}\n title={\n isConfiguredAvailable\n ? 'Readable coarse document outline (sections, environments, commands, arguments)'\n : viewIssue\n ? `${viewIssue.code}: ${viewIssue.message}`\n : 'Configure an entry in Settings to enable coarse view'\n }\n >\n Coarse\n </button>\n <button\n type=\"button\"\n className={`AstTreeModeBtn ${structureMode === 'configured' ? 'AstTreeModeBtn--active' : ''}`}\n disabled={!isConfiguredAvailable}\n onClick={() => onChangeStructureMode('configured')}\n title={\n isConfiguredAvailable\n ? 'Detailed configured document AST'\n : viewIssue\n ? `${viewIssue.code}: ${viewIssue.message}`\n : 'Configure an entry in Settings to enable structure view'\n }\n >\n Structure\n </button>\n <button\n type=\"button\"\n className={`AstTreeModeBtn ${structureMode === 'source' ? 'AstTreeModeBtn--active' : ''}`}\n onClick={() => onChangeStructureMode('source')}\n title=\"Raw source syntax and tokens\"\n >\n Source\n </button>\n </div>\n ) : null}\n\n {!collapsed ? (\n <div className=\"AstTreeOptionsWrap\" ref={optionsRef}>\n <button\n type=\"button\"\n className={`AstTreeToolButton ${optionsOpen ? 'AstTreeToolButton--active' : ''}`}\n onClick={() => setOptionsOpen((value) => !value)}\n aria-label=\"AST view options\"\n aria-expanded={optionsOpen}\n title=\"Options\"\n >\n &#9881;\n </button>\n\n {optionsOpen ? (\n <div className=\"AstTreeOptions\" role=\"dialog\" aria-label=\"AST view options\">\n {structureMode === 'coarse' ? (\n <>\n <div className=\"AstTreeOptionsHeader\">\n <div className=\"AstTreeOptionsTitle\">Coarse Tree Options</div>\n {onChangeCoarseOptions ? (\n <button\n type=\"button\"\n className=\"AstTreeOptionsReset\"\n onClick={() => onChangeCoarseOptions({})}\n >\n Reset\n </button>\n ) : null}\n </div>\n <div className=\"AstTreeOptionsSection\">\n <div className=\"AstTreeOptionCards\">\n {(\n [\n ['includeSections', 'Sections', true],\n ['includeEnvironments', 'Environments', true],\n ['includeInputs', 'Inputs', true],\n ['includeCustomAndUndefinedCommands', 'Custom/Undefined cmds', true],\n ['includeBuiltinCommands', 'Built-in cmds', false],\n ['includeArguments', 'Arguments', true],\n ['includeDisplayMath', 'Display math', false],\n ['includeMath', 'All math', false],\n ['includeGroups', 'Brace groups', false],\n ['includeTextBlocks', 'Text blocks', false],\n ] as const\n ).map(([key, label, fallback]) => {\n const selected = coarseOptions[key] ?? fallback;\n return (\n <button\n key={key}\n type=\"button\"\n className={`AstTreeOptionCard ${\n selected ? 'AstTreeOptionCard--selected' : ''\n }`}\n onClick={() =>\n onChangeCoarseOptions?.({\n ...coarseOptions,\n [key]: !selected,\n })\n }\n >\n {label}\n </button>\n );\n })}\n </div>\n </div>\n </>\n ) : (\n <>\n <div className=\"AstTreeOptionsHeader\">\n <div className=\"AstTreeOptionsTitle\">Options</div>\n <button\n type=\"button\"\n className=\"AstTreeOptionsReset\"\n onClick={resetToDefault}\n >\n Reset\n </button>\n </div>\n\n <div className=\"AstTreeOptionsSection\">\n <div className=\"AstTreeOptionsTitle\">Node Types</div>\n <div className=\"AstTreeOptionCards\">\n {DEFAULT_NODE_KINDS.map((kind) => {\n const selected = options.visibleKinds.includes(kind);\n return (\n <button\n key={kind}\n type=\"button\"\n className={`AstTreeOptionCard ${\n selected ? 'AstTreeOptionCard--selected' : ''\n }`}\n onClick={() => toggleKind(kind)}\n >\n {kind}\n </button>\n );\n })}\n </div>\n </div>\n\n <div className=\"AstTreeOptionsSection\">\n <div className=\"AstTreeOptionsTitle\">Environments</div>\n <div className=\"AstTreeOptionCards\">\n {options.environmentCards.map((environment) => {\n const selected = options.selectedEnvironments.includes(environment);\n const userDefined = options.userEnvironments.includes(environment);\n return (\n <button\n key={environment}\n type=\"button\"\n className={`AstTreeOptionCard AstTreeCommandCard ${\n selected ? 'AstTreeOptionCard--selected' : ''\n }`}\n onClick={() => toggleEnvironment(environment)}\n >\n {userDefined ? (\n <span\n className=\"AstTreeCommandDelete\"\n onClick={(event) => deleteUserEnvironment(event, environment)}\n aria-label={`Delete ${environment}`}\n >\n x\n </span>\n ) : null}\n <span>{environment}</span>\n </button>\n );\n })}\n </div>\n <form className=\"AstTreeCommandForm\" onSubmit={addEnvironment}>\n <input\n value={newEnvironment}\n onChange={(event) => setNewEnvironment(event.target.value)}\n placeholder=\"Add environment...\"\n aria-label=\"Add environment\"\n />\n <button type=\"submit\">Add</button>\n </form>\n </div>\n\n <div className=\"AstTreeOptionsSection\">\n <div className=\"AstTreeOptionsTitle\">Commands</div>\n <div className=\"AstTreeOptionCards\">\n {options.commandCards.map((command) => {\n const selected = options.selectedCommands.includes(command);\n const userDefined = options.userCommands.includes(command);\n return (\n <button\n key={command}\n type=\"button\"\n className={`AstTreeOptionCard AstTreeCommandCard ${\n selected ? 'AstTreeOptionCard--selected' : ''\n }`}\n onClick={() => toggleCommand(command)}\n >\n {userDefined ? (\n <span\n className=\"AstTreeCommandDelete\"\n onClick={(event) => deleteUserCommand(event, command)}\n aria-label={`Delete ${command}`}\n >\n x\n </span>\n ) : null}\n <span>\\{command}</span>\n </button>\n );\n })}\n </div>\n <form className=\"AstTreeCommandForm\" onSubmit={addCommand}>\n <input\n value={newCommand}\n onChange={(event) => setNewCommand(event.target.value)}\n placeholder=\"Add command...\"\n aria-label=\"Add command\"\n />\n <button type=\"submit\">Add</button>\n </form>\n </div>\n </>\n )}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {!collapsed && !isSidePanel && onToggleSplit ? (\n <button\n type=\"button\"\n className={`AstTreeSplitBtn${splitEnabled ? ' AstTreeSplitBtn--active' : ''}`}\n onClick={onToggleSplit}\n title=\"Toggle side-by-side Code view\"\n >\n <span aria-hidden=\"true\">◫</span>\n <span>Split</span>\n </button>\n ) : null}\n\n {isSidePanel && onToggleCollapsed ? (\n <button\n type=\"button\"\n className=\"AstTreeToggle\"\n onClick={onToggleCollapsed}\n aria-label={collapsed ? 'Expand AST view' : 'Collapse AST view'}\n title={collapsed ? 'Expand' : 'Collapse'}\n >\n {collapsed ? '<' : '>'}\n </button>\n ) : null}\n </div>\n </div>\n\n {!collapsed && inputWarnings.length > 0 ? (\n <div className=\"AstPhase0Prompt\" role=\"status\" aria-label=\"Missing input warnings\">\n <div className=\"AstPhase0PromptHeader\">\n <strong>\n {inputWarnings.length === 1\n ? 'Missing \\\\input warning'\n : `${inputWarnings.length} missing \\\\input warnings`}\n </strong>\n </div>\n <p className=\"AstPhase0Desc\">\n {inputWarnings.map((warning) => warning.message).join(' · ')}\n </p>\n </div>\n ) : null}\n\n {!collapsed && hasConditionals && onConfigureConditions ? (\n <div className=\"AstPhase0Region\">\n {!isConfiguredAvailable && structureMode !== 'source' ? (\n <div className=\"AstPhase0Prompt\" role=\"region\" aria-label=\"Condition configuration required\">\n <div className=\"AstPhase0PromptHeader\">\n <strong>Condition paths needed for branch AST</strong>\n {viewIssue ? <span className=\"AstPhase0Issue\">{viewIssue.message}</span> : null}\n </div>\n <p className=\"AstPhase0Desc\">\n Cross-branch conditionals affect structural nesting here. Choose which branch to evaluate for AST inspection, or inspect Source mode.\n </p>\n </div>\n ) : (\n <div className=\"AstPhase0Banner\">\n <span>\n {conditionPolicy?.mode === 'ignore'\n ? 'Viewing all conditional branches (ignore mode)'\n : `Condition mode: ${conditionPolicy?.mode ?? 'source'}`}\n </span>\n <button\n type=\"button\"\n className=\"AstPhase0ToggleBtn\"\n onClick={() => setPhase0Open((v) => !v)}\n >\n {phase0Open ? 'Hide Phase 0' : 'Configure Conditions'}\n </button>\n </div>\n )}\n\n {(phase0Open || (!isConfiguredAvailable && structureMode !== 'source')) ? (\n <div className=\"AstPhase0Card\">\n <div className=\"AstPhase0Row\">\n <label className=\"AstPhase0Field\">\n <span>Condition policy</span>\n <select\n value={inlineMode}\n onChange={(e) => {\n const val = e.target.value;\n if (\n val === 'ignore' ||\n val === 'source' ||\n val === 'source-with-overrides' ||\n val === 'manual' ||\n val === 'none'\n ) {\n setInlineMode(val);\n }\n }}\n >\n <option value=\"ignore\">Ignore conditionals (all branches)</option>\n <option value=\"source\">Follow source declarations &amp; 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=\"none\">Condition-free (none)</option>\n </select>\n </label>\n </div>\n\n {detectedConditions.length > 0 &&\n (inlineMode === 'source-with-overrides' || inlineMode === 'manual') ? (\n <div className=\"AstPhase0CondList\">\n {detectedConditions.map((cond) => {\n const val = inlineOverrides[cond];\n const choice = val === true ? 'true' : val === false ? 'false' : 'follow';\n return (\n <label key={cond} className=\"AstPhase0CondItem\">\n <code>\\if{cond}</code>\n <select\n value={choice}\n onChange={(e) => {\n const v = e.target.value;\n if (v === 'follow') {\n const next = { ...inlineOverrides };\n delete next[cond];\n setInlineOverrides(next);\n } else {\n setInlineOverrides({ ...inlineOverrides, [cond]: v === 'true' });\n }\n }}\n >\n {inlineMode === 'source-with-overrides' ? (\n <option value=\"follow\">Follow source</option>\n ) : null}\n {inlineMode === 'manual' && val === undefined ? (\n <option value=\"follow\">(Select…)</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\n <div className=\"AstPhase0Actions\">\n <button\n type=\"button\"\n className=\"AstPhase0ApplyBtn\"\n onClick={() => {\n if (inlineMode === 'ignore') {\n onConfigureConditions({ mode: 'ignore' });\n } else if (inlineMode === 'none') {\n onConfigureConditions({ mode: 'none' });\n } else if (inlineMode === 'manual') {\n onConfigureConditions({ mode: 'manual', values: inlineOverrides });\n } else if (inlineMode === 'source-with-overrides') {\n onConfigureConditions({\n mode: 'source-with-overrides',\n overrides: inlineOverrides,\n });\n } else {\n onConfigureConditions({ mode: 'source' });\n }\n setPhase0Open(false);\n }}\n >\n Apply Condition Setup\n </button>\n </div>\n </div>\n ) : null}\n </div>\n ) : null}\n\n {collapsed ? null : (\n <div className=\"AstTreeList\" role=\"tree\">\n {filteredRoot ? (\n <TreeNode\n node={filteredRoot}\n onSelectNode={onSelectNode}\n selectedNodeKey={selectedNodeKey}\n />\n ) : (\n <div className=\"AstTreeEmpty\">\n {root\n ? 'No nodes match the current AST view options.'\n : structureMode !== 'source' && viewIssue\n ? `Structure unavailable (${viewIssue.code}): ${viewIssue.message}`\n : 'Select a file to inspect its structure.'}\n </div>\n )}\n </div>\n )}\n </section>\n );\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { LayoutNode } from '../../types/LayoutNode.js';
3
+ export interface TreeNodeProps {
4
+ node: LayoutNode;
5
+ onSelectNode?: (node: LayoutNode) => void;
6
+ selectedNodeKey?: string | null;
7
+ }
8
+ export default function TreeNode({ node, onSelectNode, selectedNodeKey }: TreeNodeProps): import("react").JSX.Element;