@industry-theme/file-editing-panels 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-Bet4c99j.js → index-14lgYlyv.js} +2 -2
- package/dist/{index-Bet4c99j.js.map → index-14lgYlyv.js.map} +1 -1
- package/dist/{index-DVQA1GI6.js → index-Be8sf6Yq.js} +2 -2
- package/dist/{index-DVQA1GI6.js.map → index-Be8sf6Yq.js.map} +1 -1
- package/dist/{index-CQtBr0UY.js → index-BfXsy0Ic.js} +2 -2
- package/dist/{index-CQtBr0UY.js.map → index-BfXsy0Ic.js.map} +1 -1
- package/dist/{index-BjkLI8D3.js → index-BgO3atCf.js} +2 -2
- package/dist/{index-BjkLI8D3.js.map → index-BgO3atCf.js.map} +1 -1
- package/dist/{index-DR6-tbJq.js → index-Bv-jaOT4.js} +2 -2
- package/dist/{index-DR6-tbJq.js.map → index-Bv-jaOT4.js.map} +1 -1
- package/dist/{index-BUkJBACP.js → index-BwQYP3Gr.js} +2 -2
- package/dist/{index-BUkJBACP.js.map → index-BwQYP3Gr.js.map} +1 -1
- package/dist/{index-ZhCVoili.js → index-Bz2hw5jD.js} +2 -2
- package/dist/{index-ZhCVoili.js.map → index-Bz2hw5jD.js.map} +1 -1
- package/dist/{index-Bg6SAM4G.js → index-C9AZ1bbc.js} +2 -2
- package/dist/{index-Bg6SAM4G.js.map → index-C9AZ1bbc.js.map} +1 -1
- package/dist/{index-CDkarLuR.js → index-CCKvgrZw.js} +2 -2
- package/dist/{index-CDkarLuR.js.map → index-CCKvgrZw.js.map} +1 -1
- package/dist/{index-TBMiP6Sa.js → index-CR9rs7ft.js} +2 -2
- package/dist/{index-TBMiP6Sa.js.map → index-CR9rs7ft.js.map} +1 -1
- package/dist/{index-ZGazVsqS.js → index-CTUvSkgO.js} +2 -2
- package/dist/{index-ZGazVsqS.js.map → index-CTUvSkgO.js.map} +1 -1
- package/dist/{index-u6DfL9YL.js → index-CVQuqypG.js} +2 -2
- package/dist/{index-u6DfL9YL.js.map → index-CVQuqypG.js.map} +1 -1
- package/dist/{index-BxXSPvaU.js → index-CZxNC5tF.js} +2 -2
- package/dist/{index-BxXSPvaU.js.map → index-CZxNC5tF.js.map} +1 -1
- package/dist/{index-CjyvtorY.js → index-CfSEVctn.js} +2 -2
- package/dist/{index-CjyvtorY.js.map → index-CfSEVctn.js.map} +1 -1
- package/dist/{index-Ds9lMu-c.js → index-Cw8rhvFp.js} +2 -2
- package/dist/{index-Ds9lMu-c.js.map → index-Cw8rhvFp.js.map} +1 -1
- package/dist/{index-BRiZ41Yj.js → index-DLyieo0R.js} +950 -567
- package/dist/index-DLyieo0R.js.map +1 -0
- package/dist/{index-D1BS_vz8.js → index-DYXlNXoN.js} +2 -2
- package/dist/{index-D1BS_vz8.js.map → index-DYXlNXoN.js.map} +1 -1
- package/dist/{index-CkLdyOmv.js → index-fTvnIXAZ.js} +2 -2
- package/dist/{index-CkLdyOmv.js.map → index-fTvnIXAZ.js.map} +1 -1
- package/dist/index.d.ts +24 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/mocks/panelContext.d.ts +27 -1
- package/dist/mocks/panelContext.d.ts.map +1 -1
- package/dist/panels/FileEditorPanel/FileEditorPanel.d.ts +11 -16
- package/dist/panels/FileEditorPanel/FileEditorPanel.d.ts.map +1 -1
- package/dist/panels/FileEditorPanel/FileEditorPanel.stories.d.ts +9 -8
- package/dist/panels/FileEditorPanel/FileEditorPanel.stories.d.ts.map +1 -1
- package/dist/panels/FileEditorPanel/index.d.ts +0 -1
- package/dist/panels/FileEditorPanel/index.d.ts.map +1 -1
- package/dist/panels/GitDiffPanel/GitDiffPanel.d.ts +10 -12
- package/dist/panels/GitDiffPanel/GitDiffPanel.d.ts.map +1 -1
- package/dist/panels/GitDiffPanel/GitDiffPanel.stories.d.ts +9 -5
- package/dist/panels/GitDiffPanel/GitDiffPanel.stories.d.ts.map +1 -1
- package/dist/panels/GitDiffPanel/index.d.ts +0 -1
- package/dist/panels/GitDiffPanel/index.d.ts.map +1 -1
- package/dist/panels/MDXEditorPanel/MDXEditorPanel.d.ts +11 -16
- package/dist/panels/MDXEditorPanel/MDXEditorPanel.d.ts.map +1 -1
- package/dist/panels/MDXEditorPanel/MDXEditorPanel.stories.d.ts +7 -8
- package/dist/panels/MDXEditorPanel/MDXEditorPanel.stories.d.ts.map +1 -1
- package/dist/panels/MDXEditorPanel/index.d.ts +0 -1
- package/dist/panels/MDXEditorPanel/index.d.ts.map +1 -1
- package/dist/panels.bundle.js +14 -6
- package/package.json +1 -1
- package/dist/index-BRiZ41Yj.js.map +0 -1
|
@@ -3,10 +3,162 @@ var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { e
|
|
|
3
3
|
var __publicField = (obj, key, value2) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value2);
|
|
4
4
|
import { jsx as jsx$1, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import * as React__default from "react";
|
|
6
|
-
import React__default__default, { createContext, useContext,
|
|
7
|
-
import {
|
|
6
|
+
import React__default__default, { createContext, useContext, useState, useEffect, forwardRef, createElement, useRef, useCallback, useMemo, useLayoutEffect, Suspense, useReducer, useImperativeHandle } from "react";
|
|
7
|
+
import { ThemedMonacoWithProvider, ThemedMonacoDiffEditor } from "@principal-ade/industry-themed-monaco-editor";
|
|
8
8
|
import * as ReactDOM from "react-dom";
|
|
9
9
|
import ReactDOM__default, { flushSync, createPortal } from "react-dom";
|
|
10
|
+
var terminalTheme = {
|
|
11
|
+
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
|
|
12
|
+
fonts: {
|
|
13
|
+
body: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
|
|
14
|
+
heading: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
|
|
15
|
+
monospace: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace'
|
|
16
|
+
},
|
|
17
|
+
fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],
|
|
18
|
+
fontScale: 1,
|
|
19
|
+
fontWeights: {
|
|
20
|
+
body: 400,
|
|
21
|
+
heading: 500,
|
|
22
|
+
bold: 600,
|
|
23
|
+
light: 300,
|
|
24
|
+
medium: 500,
|
|
25
|
+
semibold: 600
|
|
26
|
+
},
|
|
27
|
+
lineHeights: {
|
|
28
|
+
body: 1.6,
|
|
29
|
+
heading: 1.3,
|
|
30
|
+
tight: 1.4,
|
|
31
|
+
relaxed: 1.8
|
|
32
|
+
},
|
|
33
|
+
breakpoints: ["640px", "768px", "1024px", "1280px"],
|
|
34
|
+
sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],
|
|
35
|
+
radii: [0, 2, 4, 6, 8, 12, 16, 24],
|
|
36
|
+
shadows: [
|
|
37
|
+
"none",
|
|
38
|
+
"0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
39
|
+
"0 2px 4px 0 rgba(0, 0, 0, 0.06)",
|
|
40
|
+
"0 4px 6px 0 rgba(0, 0, 0, 0.07)",
|
|
41
|
+
"0 8px 12px 0 rgba(0, 0, 0, 0.08)",
|
|
42
|
+
"0 16px 24px 0 rgba(0, 0, 0, 0.10)"
|
|
43
|
+
],
|
|
44
|
+
zIndices: [0, 1, 10, 20, 30, 40, 50],
|
|
45
|
+
colors: {
|
|
46
|
+
text: "#e4e4e4",
|
|
47
|
+
background: "rgba(10, 10, 10, 0.85)",
|
|
48
|
+
primary: "#66b3ff",
|
|
49
|
+
secondary: "#80c4ff",
|
|
50
|
+
accent: "#66ff99",
|
|
51
|
+
highlight: "rgba(102, 179, 255, 0.15)",
|
|
52
|
+
muted: "rgba(26, 26, 26, 0.8)",
|
|
53
|
+
success: "#66ff99",
|
|
54
|
+
warning: "#ffcc66",
|
|
55
|
+
error: "#ff6666",
|
|
56
|
+
info: "#66b3ff",
|
|
57
|
+
border: "rgba(255, 255, 255, 0.1)",
|
|
58
|
+
backgroundSecondary: "rgba(15, 15, 15, 0.9)",
|
|
59
|
+
backgroundTertiary: "rgba(20, 20, 20, 0.9)",
|
|
60
|
+
backgroundLight: "rgba(255, 255, 255, 0.05)",
|
|
61
|
+
backgroundHover: "rgba(102, 179, 255, 0.08)",
|
|
62
|
+
surface: "rgba(15, 15, 15, 0.95)",
|
|
63
|
+
textSecondary: "rgba(255, 255, 255, 0.7)",
|
|
64
|
+
textTertiary: "rgba(255, 255, 255, 0.5)",
|
|
65
|
+
textMuted: "rgba(255, 255, 255, 0.4)",
|
|
66
|
+
highlightBg: "rgba(255, 235, 59, 0.25)",
|
|
67
|
+
highlightBorder: "rgba(255, 235, 59, 0.5)"
|
|
68
|
+
},
|
|
69
|
+
modes: {
|
|
70
|
+
light: {
|
|
71
|
+
text: "#1a1a1a",
|
|
72
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
73
|
+
primary: "#0066cc",
|
|
74
|
+
secondary: "#0052a3",
|
|
75
|
+
accent: "#00cc88",
|
|
76
|
+
highlight: "rgba(0, 102, 204, 0.08)",
|
|
77
|
+
muted: "rgba(245, 245, 245, 0.8)",
|
|
78
|
+
success: "#00cc88",
|
|
79
|
+
warning: "#ffaa00",
|
|
80
|
+
error: "#ff3333",
|
|
81
|
+
info: "#0066cc",
|
|
82
|
+
border: "rgba(0, 0, 0, 0.1)",
|
|
83
|
+
backgroundSecondary: "rgba(250, 250, 250, 0.9)",
|
|
84
|
+
backgroundTertiary: "rgba(245, 245, 245, 0.9)",
|
|
85
|
+
backgroundLight: "rgba(0, 0, 0, 0.02)",
|
|
86
|
+
backgroundHover: "rgba(0, 102, 204, 0.04)",
|
|
87
|
+
surface: "rgba(255, 255, 255, 0.95)",
|
|
88
|
+
textSecondary: "rgba(0, 0, 0, 0.6)",
|
|
89
|
+
textTertiary: "rgba(0, 0, 0, 0.4)",
|
|
90
|
+
textMuted: "rgba(0, 0, 0, 0.3)",
|
|
91
|
+
highlightBg: "rgba(255, 235, 59, 0.3)",
|
|
92
|
+
highlightBorder: "rgba(255, 235, 59, 0.6)"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
buttons: {
|
|
96
|
+
primary: {
|
|
97
|
+
color: "white",
|
|
98
|
+
bg: "primary",
|
|
99
|
+
borderWidth: 0,
|
|
100
|
+
"&:hover": {
|
|
101
|
+
bg: "secondary"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
secondary: {
|
|
105
|
+
color: "primary",
|
|
106
|
+
bg: "transparent",
|
|
107
|
+
borderWidth: 1,
|
|
108
|
+
borderStyle: "solid",
|
|
109
|
+
borderColor: "primary",
|
|
110
|
+
"&:hover": {
|
|
111
|
+
bg: "highlight"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
ghost: {
|
|
115
|
+
color: "text",
|
|
116
|
+
bg: "transparent",
|
|
117
|
+
"&:hover": {
|
|
118
|
+
bg: "backgroundHover"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
text: {
|
|
123
|
+
heading: {
|
|
124
|
+
fontFamily: "heading",
|
|
125
|
+
fontWeight: "heading",
|
|
126
|
+
lineHeight: "heading"
|
|
127
|
+
},
|
|
128
|
+
body: {
|
|
129
|
+
fontFamily: "body",
|
|
130
|
+
fontWeight: "body",
|
|
131
|
+
lineHeight: "body"
|
|
132
|
+
},
|
|
133
|
+
caption: {
|
|
134
|
+
fontSize: 1,
|
|
135
|
+
color: "textSecondary"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
cards: {
|
|
139
|
+
primary: {
|
|
140
|
+
bg: "surface",
|
|
141
|
+
border: "1px solid",
|
|
142
|
+
borderColor: "border",
|
|
143
|
+
borderRadius: 1
|
|
144
|
+
},
|
|
145
|
+
secondary: {
|
|
146
|
+
bg: "backgroundSecondary",
|
|
147
|
+
border: "1px solid",
|
|
148
|
+
borderColor: "border",
|
|
149
|
+
borderRadius: 1
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
function getMode(theme2, mode) {
|
|
154
|
+
if (!mode || !theme2.modes || !theme2.modes[mode]) {
|
|
155
|
+
return theme2.colors;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
...theme2.colors,
|
|
159
|
+
...theme2.modes[mode]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
10
162
|
var ThemeContext;
|
|
11
163
|
var getThemeContext = () => {
|
|
12
164
|
if (typeof window !== "undefined") {
|
|
@@ -30,6 +182,46 @@ var useTheme = () => {
|
|
|
30
182
|
}
|
|
31
183
|
return context;
|
|
32
184
|
};
|
|
185
|
+
var ThemeProvider = ({
|
|
186
|
+
children,
|
|
187
|
+
theme: customTheme = theme$1,
|
|
188
|
+
initialMode
|
|
189
|
+
}) => {
|
|
190
|
+
const [mode, setMode] = useState(initialMode);
|
|
191
|
+
const activeTheme = React__default__default.useMemo(() => {
|
|
192
|
+
if (!mode || !customTheme.modes || !customTheme.modes[mode]) {
|
|
193
|
+
return customTheme;
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
...customTheme,
|
|
197
|
+
colors: getMode(customTheme, mode)
|
|
198
|
+
};
|
|
199
|
+
}, [customTheme, mode]);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (!initialMode) {
|
|
202
|
+
const savedMode = localStorage.getItem("principlemd-theme-mode");
|
|
203
|
+
if (savedMode) {
|
|
204
|
+
setMode(savedMode);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, [initialMode]);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (mode) {
|
|
210
|
+
localStorage.setItem("principlemd-theme-mode", mode);
|
|
211
|
+
} else {
|
|
212
|
+
localStorage.removeItem("principlemd-theme-mode");
|
|
213
|
+
}
|
|
214
|
+
}, [mode]);
|
|
215
|
+
const value2 = {
|
|
216
|
+
theme: activeTheme,
|
|
217
|
+
mode,
|
|
218
|
+
setMode
|
|
219
|
+
};
|
|
220
|
+
return /* @__PURE__ */ React__default__default.createElement(ThemeContextSingleton.Provider, {
|
|
221
|
+
value: value2
|
|
222
|
+
}, children);
|
|
223
|
+
};
|
|
224
|
+
var theme$1 = terminalTheme;
|
|
33
225
|
/**
|
|
34
226
|
* @license lucide-react v0.552.0 - ISC
|
|
35
227
|
*
|
|
@@ -172,411 +364,6 @@ const __iconNode = [
|
|
|
172
364
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
173
365
|
];
|
|
174
366
|
const X$4 = createLucideIcon("x", __iconNode);
|
|
175
|
-
const statusMeta = {
|
|
176
|
-
staged: {
|
|
177
|
-
label: "Staged change",
|
|
178
|
-
description: "Comparing staged changes against the last commit"
|
|
179
|
-
},
|
|
180
|
-
unstaged: {
|
|
181
|
-
label: "Unstaged change",
|
|
182
|
-
description: "Comparing working tree changes against the last commit"
|
|
183
|
-
},
|
|
184
|
-
untracked: {
|
|
185
|
-
label: "Untracked file",
|
|
186
|
-
description: "New file compared against an empty baseline"
|
|
187
|
-
},
|
|
188
|
-
deleted: {
|
|
189
|
-
label: "Deleted file",
|
|
190
|
-
description: "Showing the last committed contents of the deleted file"
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
const languageFromPath = (filePath) => {
|
|
194
|
-
var _a2;
|
|
195
|
-
if (!filePath) {
|
|
196
|
-
return "plaintext";
|
|
197
|
-
}
|
|
198
|
-
const ext = ((_a2 = filePath.split(".").pop()) == null ? void 0 : _a2.toLowerCase()) ?? "";
|
|
199
|
-
const languageMap = {
|
|
200
|
-
js: "javascript",
|
|
201
|
-
jsx: "javascript",
|
|
202
|
-
ts: "typescript",
|
|
203
|
-
tsx: "typescript",
|
|
204
|
-
py: "python",
|
|
205
|
-
java: "java",
|
|
206
|
-
c: "c",
|
|
207
|
-
cpp: "cpp",
|
|
208
|
-
h: "c",
|
|
209
|
-
hpp: "cpp",
|
|
210
|
-
cs: "csharp",
|
|
211
|
-
go: "go",
|
|
212
|
-
rs: "rust",
|
|
213
|
-
php: "php",
|
|
214
|
-
rb: "ruby",
|
|
215
|
-
swift: "swift",
|
|
216
|
-
kt: "kotlin",
|
|
217
|
-
json: "json",
|
|
218
|
-
yaml: "yaml",
|
|
219
|
-
yml: "yaml",
|
|
220
|
-
toml: "toml",
|
|
221
|
-
ini: "ini",
|
|
222
|
-
cfg: "ini",
|
|
223
|
-
conf: "ini",
|
|
224
|
-
xml: "xml",
|
|
225
|
-
html: "html",
|
|
226
|
-
css: "css",
|
|
227
|
-
scss: "scss",
|
|
228
|
-
sass: "sass",
|
|
229
|
-
less: "less",
|
|
230
|
-
sh: "bash",
|
|
231
|
-
bash: "bash",
|
|
232
|
-
zsh: "bash",
|
|
233
|
-
md: "markdown",
|
|
234
|
-
mdx: "markdown",
|
|
235
|
-
sql: "sql"
|
|
236
|
-
};
|
|
237
|
-
return languageMap[ext] ?? "plaintext";
|
|
238
|
-
};
|
|
239
|
-
const GitDiffPanel = ({
|
|
240
|
-
filePath,
|
|
241
|
-
status = "unstaged",
|
|
242
|
-
diffProvider,
|
|
243
|
-
onClose
|
|
244
|
-
}) => {
|
|
245
|
-
const { theme: theme2 } = useTheme();
|
|
246
|
-
const [originalContent, setOriginalContent] = useState("");
|
|
247
|
-
const [modifiedContent, setModifiedContent] = useState("");
|
|
248
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
249
|
-
const [error, setError] = useState(null);
|
|
250
|
-
const language2 = useMemo(() => languageFromPath(filePath), [filePath]);
|
|
251
|
-
useEffect(() => {
|
|
252
|
-
let isActive = true;
|
|
253
|
-
const loadDiff = async () => {
|
|
254
|
-
if (!filePath) {
|
|
255
|
-
setOriginalContent("");
|
|
256
|
-
setModifiedContent("");
|
|
257
|
-
setIsLoading(false);
|
|
258
|
-
setError(null);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
setIsLoading(true);
|
|
262
|
-
setError(null);
|
|
263
|
-
try {
|
|
264
|
-
const [original, modified] = await Promise.all([
|
|
265
|
-
diffProvider.getOriginal(filePath, status),
|
|
266
|
-
diffProvider.getModified(filePath, status)
|
|
267
|
-
]);
|
|
268
|
-
if (!isActive) return;
|
|
269
|
-
setOriginalContent(original ?? "");
|
|
270
|
-
setModifiedContent(modified ?? "");
|
|
271
|
-
} catch (err) {
|
|
272
|
-
if (!isActive) return;
|
|
273
|
-
console.error("Failed to load git diff:", err);
|
|
274
|
-
setError(
|
|
275
|
-
err instanceof Error ? `Failed to load diff: ${err.message}` : "Failed to load diff"
|
|
276
|
-
);
|
|
277
|
-
setOriginalContent("");
|
|
278
|
-
setModifiedContent("");
|
|
279
|
-
} finally {
|
|
280
|
-
if (isActive) {
|
|
281
|
-
setIsLoading(false);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
void loadDiff();
|
|
286
|
-
return () => {
|
|
287
|
-
isActive = false;
|
|
288
|
-
};
|
|
289
|
-
}, [filePath, status, diffProvider]);
|
|
290
|
-
const statusInfo = status ? statusMeta[status] : null;
|
|
291
|
-
const statusColor = useMemo(() => {
|
|
292
|
-
if (!status) return theme2.colors.textSecondary;
|
|
293
|
-
switch (status) {
|
|
294
|
-
case "staged":
|
|
295
|
-
return theme2.colors.success || "#10b981";
|
|
296
|
-
case "unstaged":
|
|
297
|
-
return theme2.colors.warning || "#f59e0b";
|
|
298
|
-
case "untracked":
|
|
299
|
-
return theme2.colors.info || theme2.colors.primary || "#3b82f6";
|
|
300
|
-
case "deleted":
|
|
301
|
-
return theme2.colors.error || "#ef4444";
|
|
302
|
-
default:
|
|
303
|
-
return theme2.colors.textSecondary;
|
|
304
|
-
}
|
|
305
|
-
}, [status, theme2.colors]);
|
|
306
|
-
if (!filePath) {
|
|
307
|
-
return /* @__PURE__ */ jsx$1(
|
|
308
|
-
"div",
|
|
309
|
-
{
|
|
310
|
-
style: {
|
|
311
|
-
height: "100%",
|
|
312
|
-
display: "flex",
|
|
313
|
-
alignItems: "center",
|
|
314
|
-
justifyContent: "center",
|
|
315
|
-
color: theme2.colors.textSecondary,
|
|
316
|
-
backgroundColor: theme2.colors.backgroundSecondary
|
|
317
|
-
},
|
|
318
|
-
children: "Select a file from Git Changes to view its diff."
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
return /* @__PURE__ */ jsxs(
|
|
323
|
-
"div",
|
|
324
|
-
{
|
|
325
|
-
style: {
|
|
326
|
-
height: "100%",
|
|
327
|
-
display: "flex",
|
|
328
|
-
flexDirection: "column",
|
|
329
|
-
backgroundColor: theme2.colors.background
|
|
330
|
-
},
|
|
331
|
-
children: [
|
|
332
|
-
/* @__PURE__ */ jsxs(
|
|
333
|
-
"div",
|
|
334
|
-
{
|
|
335
|
-
style: {
|
|
336
|
-
padding: "12px 16px",
|
|
337
|
-
borderBottom: `1px solid ${theme2.colors.border}`,
|
|
338
|
-
display: "flex",
|
|
339
|
-
justifyContent: "space-between",
|
|
340
|
-
alignItems: "center",
|
|
341
|
-
backgroundColor: theme2.colors.backgroundSecondary
|
|
342
|
-
},
|
|
343
|
-
children: [
|
|
344
|
-
/* @__PURE__ */ jsx$1(
|
|
345
|
-
"div",
|
|
346
|
-
{
|
|
347
|
-
style: {
|
|
348
|
-
display: "flex",
|
|
349
|
-
alignItems: "center",
|
|
350
|
-
gap: "12px",
|
|
351
|
-
minWidth: 0
|
|
352
|
-
},
|
|
353
|
-
children: /* @__PURE__ */ jsxs(
|
|
354
|
-
"div",
|
|
355
|
-
{
|
|
356
|
-
style: {
|
|
357
|
-
display: "flex",
|
|
358
|
-
alignItems: "center",
|
|
359
|
-
gap: "8px",
|
|
360
|
-
minWidth: 0
|
|
361
|
-
},
|
|
362
|
-
children: [
|
|
363
|
-
/* @__PURE__ */ jsx$1(
|
|
364
|
-
"div",
|
|
365
|
-
{
|
|
366
|
-
style: {
|
|
367
|
-
width: "32px",
|
|
368
|
-
height: "32px",
|
|
369
|
-
borderRadius: "6px",
|
|
370
|
-
backgroundColor: theme2.colors.backgroundTertiary,
|
|
371
|
-
display: "flex",
|
|
372
|
-
alignItems: "center",
|
|
373
|
-
justifyContent: "center",
|
|
374
|
-
color: theme2.colors.text
|
|
375
|
-
},
|
|
376
|
-
children: /* @__PURE__ */ jsx$1(GitCommitHorizontal, { size: 18 })
|
|
377
|
-
}
|
|
378
|
-
),
|
|
379
|
-
/* @__PURE__ */ jsxs(
|
|
380
|
-
"div",
|
|
381
|
-
{
|
|
382
|
-
style: {
|
|
383
|
-
display: "flex",
|
|
384
|
-
flexDirection: "column",
|
|
385
|
-
gap: "4px",
|
|
386
|
-
minWidth: 0
|
|
387
|
-
},
|
|
388
|
-
children: [
|
|
389
|
-
/* @__PURE__ */ jsx$1(
|
|
390
|
-
"div",
|
|
391
|
-
{
|
|
392
|
-
style: {
|
|
393
|
-
fontSize: theme2.fontSizes[2],
|
|
394
|
-
fontWeight: 600,
|
|
395
|
-
color: theme2.colors.text,
|
|
396
|
-
overflow: "hidden",
|
|
397
|
-
textOverflow: "ellipsis"
|
|
398
|
-
},
|
|
399
|
-
title: filePath,
|
|
400
|
-
children: filePath
|
|
401
|
-
}
|
|
402
|
-
),
|
|
403
|
-
statusInfo && /* @__PURE__ */ jsxs(
|
|
404
|
-
"div",
|
|
405
|
-
{
|
|
406
|
-
style: {
|
|
407
|
-
display: "flex",
|
|
408
|
-
alignItems: "center",
|
|
409
|
-
gap: "8px"
|
|
410
|
-
},
|
|
411
|
-
children: [
|
|
412
|
-
/* @__PURE__ */ jsx$1(
|
|
413
|
-
"span",
|
|
414
|
-
{
|
|
415
|
-
style: {
|
|
416
|
-
display: "inline-flex",
|
|
417
|
-
alignItems: "center",
|
|
418
|
-
gap: "6px",
|
|
419
|
-
fontSize: theme2.fontSizes[0],
|
|
420
|
-
padding: "2px 8px",
|
|
421
|
-
borderRadius: "999px",
|
|
422
|
-
backgroundColor: `${statusColor}20`,
|
|
423
|
-
color: statusColor,
|
|
424
|
-
border: `1px solid ${statusColor}60`,
|
|
425
|
-
whiteSpace: "nowrap"
|
|
426
|
-
},
|
|
427
|
-
children: statusInfo.label
|
|
428
|
-
}
|
|
429
|
-
),
|
|
430
|
-
/* @__PURE__ */ jsx$1(
|
|
431
|
-
"span",
|
|
432
|
-
{
|
|
433
|
-
style: {
|
|
434
|
-
fontSize: theme2.fontSizes[0],
|
|
435
|
-
color: theme2.colors.textSecondary,
|
|
436
|
-
whiteSpace: "nowrap"
|
|
437
|
-
},
|
|
438
|
-
children: statusInfo.description
|
|
439
|
-
}
|
|
440
|
-
)
|
|
441
|
-
]
|
|
442
|
-
}
|
|
443
|
-
)
|
|
444
|
-
]
|
|
445
|
-
}
|
|
446
|
-
)
|
|
447
|
-
]
|
|
448
|
-
}
|
|
449
|
-
)
|
|
450
|
-
}
|
|
451
|
-
),
|
|
452
|
-
onClose && /* @__PURE__ */ jsx$1(
|
|
453
|
-
"button",
|
|
454
|
-
{
|
|
455
|
-
onClick: onClose,
|
|
456
|
-
style: {
|
|
457
|
-
background: "none",
|
|
458
|
-
border: "none",
|
|
459
|
-
padding: "4px",
|
|
460
|
-
cursor: "pointer",
|
|
461
|
-
color: theme2.colors.textSecondary,
|
|
462
|
-
display: "flex",
|
|
463
|
-
alignItems: "center",
|
|
464
|
-
justifyContent: "center",
|
|
465
|
-
borderRadius: "4px",
|
|
466
|
-
transition: "background-color 0.2s"
|
|
467
|
-
},
|
|
468
|
-
onMouseEnter: (e2) => {
|
|
469
|
-
e2.currentTarget.style.backgroundColor = theme2.colors.backgroundTertiary;
|
|
470
|
-
},
|
|
471
|
-
onMouseLeave: (e2) => {
|
|
472
|
-
e2.currentTarget.style.backgroundColor = "transparent";
|
|
473
|
-
},
|
|
474
|
-
children: /* @__PURE__ */ jsx$1(X$4, { size: 16 })
|
|
475
|
-
}
|
|
476
|
-
)
|
|
477
|
-
]
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
/* @__PURE__ */ jsx$1("div", { style: { flex: 1, minHeight: 0 }, children: isLoading ? /* @__PURE__ */ jsx$1(
|
|
481
|
-
"div",
|
|
482
|
-
{
|
|
483
|
-
style: {
|
|
484
|
-
height: "100%",
|
|
485
|
-
display: "flex",
|
|
486
|
-
alignItems: "center",
|
|
487
|
-
justifyContent: "center",
|
|
488
|
-
color: theme2.colors.textSecondary
|
|
489
|
-
},
|
|
490
|
-
children: "Loading diff..."
|
|
491
|
-
}
|
|
492
|
-
) : error ? /* @__PURE__ */ jsx$1(
|
|
493
|
-
"div",
|
|
494
|
-
{
|
|
495
|
-
style: {
|
|
496
|
-
height: "100%",
|
|
497
|
-
display: "flex",
|
|
498
|
-
alignItems: "center",
|
|
499
|
-
justifyContent: "center",
|
|
500
|
-
color: theme2.colors.error,
|
|
501
|
-
padding: "20px",
|
|
502
|
-
textAlign: "center"
|
|
503
|
-
},
|
|
504
|
-
children: error
|
|
505
|
-
}
|
|
506
|
-
) : /* @__PURE__ */ jsx$1(
|
|
507
|
-
ThemedMonacoDiffEditor,
|
|
508
|
-
{
|
|
509
|
-
theme: theme2,
|
|
510
|
-
original: originalContent,
|
|
511
|
-
modified: modifiedContent,
|
|
512
|
-
language: language2,
|
|
513
|
-
height: "100%",
|
|
514
|
-
options: {
|
|
515
|
-
renderSideBySide: true,
|
|
516
|
-
readOnly: true,
|
|
517
|
-
minimap: { enabled: false },
|
|
518
|
-
automaticLayout: true,
|
|
519
|
-
renderIndicators: true,
|
|
520
|
-
renderMarginRevertIcon: true,
|
|
521
|
-
ignoreTrimWhitespace: false,
|
|
522
|
-
diffAlgorithm: "advanced",
|
|
523
|
-
scrollbar: {
|
|
524
|
-
useShadows: false,
|
|
525
|
-
vertical: "auto",
|
|
526
|
-
horizontal: "auto"
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
loadingComponent: /* @__PURE__ */ jsx$1(
|
|
530
|
-
"div",
|
|
531
|
-
{
|
|
532
|
-
style: {
|
|
533
|
-
height: "100%",
|
|
534
|
-
display: "flex",
|
|
535
|
-
alignItems: "center",
|
|
536
|
-
justifyContent: "center",
|
|
537
|
-
color: theme2.colors.textSecondary
|
|
538
|
-
},
|
|
539
|
-
children: "Preparing diff editor..."
|
|
540
|
-
}
|
|
541
|
-
)
|
|
542
|
-
}
|
|
543
|
-
) })
|
|
544
|
-
]
|
|
545
|
-
}
|
|
546
|
-
);
|
|
547
|
-
};
|
|
548
|
-
const GitDiffPanelPreview = () => {
|
|
549
|
-
const { theme: theme2 } = useTheme();
|
|
550
|
-
return /* @__PURE__ */ jsxs(
|
|
551
|
-
"div",
|
|
552
|
-
{
|
|
553
|
-
style: {
|
|
554
|
-
padding: "12px",
|
|
555
|
-
fontSize: theme2.fontSizes[0],
|
|
556
|
-
color: theme2.colors.text,
|
|
557
|
-
display: "flex",
|
|
558
|
-
flexDirection: "column",
|
|
559
|
-
gap: "4px",
|
|
560
|
-
fontFamily: theme2.fonts.monospace
|
|
561
|
-
},
|
|
562
|
-
children: [
|
|
563
|
-
/* @__PURE__ */ jsx$1(
|
|
564
|
-
"div",
|
|
565
|
-
{
|
|
566
|
-
style: {
|
|
567
|
-
display: "flex",
|
|
568
|
-
gap: "8px"
|
|
569
|
-
},
|
|
570
|
-
children: /* @__PURE__ */ jsx$1("span", { style: { color: theme2.colors.textSecondary }, children: "@@ 12,5 @@" })
|
|
571
|
-
}
|
|
572
|
-
),
|
|
573
|
-
/* @__PURE__ */ jsx$1("div", { style: { color: "#ef4444" }, children: "- const count = oldValue;" }),
|
|
574
|
-
/* @__PURE__ */ jsx$1("div", { style: { color: "#22c55e" }, children: "+ const count = newValue;" }),
|
|
575
|
-
/* @__PURE__ */ jsx$1("div", { style: { color: theme2.colors.textSecondary }, children: " return count;" })
|
|
576
|
-
]
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
};
|
|
580
367
|
const getLanguage = (path) => {
|
|
581
368
|
var _a2;
|
|
582
369
|
const ext = ((_a2 = path.split(".").pop()) == null ? void 0 : _a2.toLowerCase()) || "";
|
|
@@ -618,15 +405,14 @@ const getLanguage = (path) => {
|
|
|
618
405
|
};
|
|
619
406
|
return languageMap[ext] || "plaintext";
|
|
620
407
|
};
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
onClose,
|
|
626
|
-
readOnly: forceReadOnly = false,
|
|
627
|
-
vimMode = false
|
|
408
|
+
const FileEditorPanelContent = ({
|
|
409
|
+
context,
|
|
410
|
+
actions: _actions,
|
|
411
|
+
events
|
|
628
412
|
}) => {
|
|
413
|
+
var _a2, _b, _c;
|
|
629
414
|
const { theme: theme2 } = useTheme();
|
|
415
|
+
const [filePath, setFilePath] = useState(null);
|
|
630
416
|
const [fileContent, setFileContent] = useState("");
|
|
631
417
|
const [editorContent, setEditorContent] = useState("");
|
|
632
418
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -637,6 +423,11 @@ const FileEditorPanel = ({
|
|
|
637
423
|
const latestFilePathRef = useRef(null);
|
|
638
424
|
const isSavingRef = useRef(false);
|
|
639
425
|
const isDirtyRef = useRef(false);
|
|
426
|
+
const fileSystem = (_a2 = context.adapters) == null ? void 0 : _a2.fileSystem;
|
|
427
|
+
const isEditable = Boolean(fileSystem == null ? void 0 : fileSystem.writeFile);
|
|
428
|
+
const activeFileSlice = context.getSlice("active-file");
|
|
429
|
+
const preferencesSlice = context.getSlice("preferences");
|
|
430
|
+
const vimMode = ((_b = preferencesSlice == null ? void 0 : preferencesSlice.data) == null ? void 0 : _b.vimMode) ?? false;
|
|
640
431
|
useEffect(() => {
|
|
641
432
|
isDirtyRef.current = isDirty;
|
|
642
433
|
}, [isDirty]);
|
|
@@ -647,10 +438,23 @@ const FileEditorPanel = ({
|
|
|
647
438
|
isSavingRef.current = false;
|
|
648
439
|
setSaveError(null);
|
|
649
440
|
}, [filePath]);
|
|
650
|
-
|
|
651
|
-
|
|
441
|
+
useEffect(() => {
|
|
442
|
+
var _a3;
|
|
443
|
+
if ((_a3 = activeFileSlice == null ? void 0 : activeFileSlice.data) == null ? void 0 : _a3.path) {
|
|
444
|
+
setFilePath(activeFileSlice.data.path);
|
|
445
|
+
}
|
|
446
|
+
}, [(_c = activeFileSlice == null ? void 0 : activeFileSlice.data) == null ? void 0 : _c.path]);
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
const unsubscribe = events.on("file:open", (event) => {
|
|
449
|
+
const payload = event.payload;
|
|
450
|
+
if (payload == null ? void 0 : payload.path) {
|
|
451
|
+
setFilePath(payload.path);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return unsubscribe;
|
|
455
|
+
}, [events]);
|
|
652
456
|
const loadFile = useCallback(async () => {
|
|
653
|
-
if (!filePath) {
|
|
457
|
+
if (!filePath || !(fileSystem == null ? void 0 : fileSystem.readFile)) {
|
|
654
458
|
latestFilePathRef.current = null;
|
|
655
459
|
setFileContent("");
|
|
656
460
|
setEditorContent("");
|
|
@@ -663,7 +467,7 @@ const FileEditorPanel = ({
|
|
|
663
467
|
setIsLoading(true);
|
|
664
468
|
setError(null);
|
|
665
469
|
try {
|
|
666
|
-
const content2 = await
|
|
470
|
+
const content2 = await fileSystem.readFile(filePath);
|
|
667
471
|
if (latestFilePathRef.current !== filePath) {
|
|
668
472
|
return;
|
|
669
473
|
}
|
|
@@ -688,21 +492,10 @@ const FileEditorPanel = ({
|
|
|
688
492
|
setIsLoading(false);
|
|
689
493
|
}
|
|
690
494
|
}
|
|
691
|
-
}, [filePath,
|
|
495
|
+
}, [filePath, fileSystem]);
|
|
692
496
|
useEffect(() => {
|
|
693
497
|
loadFile();
|
|
694
498
|
}, [loadFile]);
|
|
695
|
-
useEffect(() => {
|
|
696
|
-
if (!filePath || !isLocalFile || !contentProvider.watchFile) {
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
const unwatch = contentProvider.watchFile(filePath, () => {
|
|
700
|
-
if (!isSavingRef.current) {
|
|
701
|
-
loadFile();
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
return unwatch;
|
|
705
|
-
}, [filePath, isLocalFile, contentProvider, loadFile]);
|
|
706
499
|
const handleEditorChange = useCallback(
|
|
707
500
|
(value2) => {
|
|
708
501
|
const nextValue = value2 ?? "";
|
|
@@ -716,7 +509,7 @@ const FileEditorPanel = ({
|
|
|
716
509
|
);
|
|
717
510
|
const handleEditorSave = useCallback(
|
|
718
511
|
async (value2) => {
|
|
719
|
-
if (!filePath || !
|
|
512
|
+
if (!filePath || !(fileSystem == null ? void 0 : fileSystem.writeFile)) {
|
|
720
513
|
return;
|
|
721
514
|
}
|
|
722
515
|
const contentToSave = value2 ?? editorContent;
|
|
@@ -727,11 +520,17 @@ const FileEditorPanel = ({
|
|
|
727
520
|
setIsSaving(true);
|
|
728
521
|
setSaveError(null);
|
|
729
522
|
try {
|
|
730
|
-
await
|
|
523
|
+
await fileSystem.writeFile(filePath, contentToSave);
|
|
731
524
|
if (latestFilePathRef.current === filePath) {
|
|
732
525
|
setFileContent(contentToSave);
|
|
733
526
|
setEditorContent(contentToSave);
|
|
734
527
|
setIsDirty(false);
|
|
528
|
+
events.emit({
|
|
529
|
+
type: "file:save",
|
|
530
|
+
source: "industry-theme.file-editor",
|
|
531
|
+
timestamp: Date.now(),
|
|
532
|
+
payload: { path: filePath }
|
|
533
|
+
});
|
|
735
534
|
}
|
|
736
535
|
} catch (err) {
|
|
737
536
|
if (latestFilePathRef.current === filePath) {
|
|
@@ -746,8 +545,17 @@ const FileEditorPanel = ({
|
|
|
746
545
|
isSavingRef.current = false;
|
|
747
546
|
}
|
|
748
547
|
},
|
|
749
|
-
[editorContent, fileContent, filePath, isDirty,
|
|
548
|
+
[editorContent, fileContent, filePath, isDirty, fileSystem, events]
|
|
750
549
|
);
|
|
550
|
+
const handleClose2 = useCallback(() => {
|
|
551
|
+
events.emit({
|
|
552
|
+
type: "file:close",
|
|
553
|
+
source: "industry-theme.file-editor",
|
|
554
|
+
timestamp: Date.now(),
|
|
555
|
+
payload: { path: filePath }
|
|
556
|
+
});
|
|
557
|
+
setFilePath(null);
|
|
558
|
+
}, [events, filePath]);
|
|
751
559
|
const fileName = (filePath == null ? void 0 : filePath.split("/").pop()) || filePath || "";
|
|
752
560
|
const language2 = filePath ? getLanguage(filePath) : "plaintext";
|
|
753
561
|
if (!filePath) {
|
|
@@ -762,7 +570,8 @@ const FileEditorPanel = ({
|
|
|
762
570
|
flexDirection: "column",
|
|
763
571
|
color: theme2.colors.textSecondary,
|
|
764
572
|
padding: "20px",
|
|
765
|
-
textAlign: "center"
|
|
573
|
+
textAlign: "center",
|
|
574
|
+
fontFamily: theme2.fonts.body
|
|
766
575
|
},
|
|
767
576
|
children: [
|
|
768
577
|
/* @__PURE__ */ jsx$1(FileText, { size: 48, style: { marginBottom: "16px", opacity: 0.5 } }),
|
|
@@ -797,12 +606,16 @@ const FileEditorPanel = ({
|
|
|
797
606
|
"div",
|
|
798
607
|
{
|
|
799
608
|
style: {
|
|
800
|
-
|
|
609
|
+
height: "40px",
|
|
610
|
+
padding: "0 12px",
|
|
801
611
|
borderBottom: `1px solid ${theme2.colors.border}`,
|
|
802
612
|
display: "flex",
|
|
803
613
|
alignItems: "center",
|
|
804
614
|
justifyContent: "space-between",
|
|
805
|
-
backgroundColor: theme2.colors.backgroundSecondary
|
|
615
|
+
backgroundColor: theme2.colors.backgroundSecondary,
|
|
616
|
+
fontFamily: theme2.fonts.body,
|
|
617
|
+
flexShrink: 0,
|
|
618
|
+
boxSizing: "border-box"
|
|
806
619
|
},
|
|
807
620
|
children: [
|
|
808
621
|
/* @__PURE__ */ jsxs(
|
|
@@ -823,36 +636,21 @@ const FileEditorPanel = ({
|
|
|
823
636
|
style: { color: theme2.colors.primary, flexShrink: 0 }
|
|
824
637
|
}
|
|
825
638
|
),
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
{
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
/* @__PURE__ */ jsx$1(
|
|
842
|
-
"div",
|
|
843
|
-
{
|
|
844
|
-
style: {
|
|
845
|
-
fontSize: theme2.fontSizes[0],
|
|
846
|
-
color: theme2.colors.textSecondary,
|
|
847
|
-
whiteSpace: "nowrap",
|
|
848
|
-
overflow: "hidden",
|
|
849
|
-
textOverflow: "ellipsis"
|
|
850
|
-
},
|
|
851
|
-
title: filePath,
|
|
852
|
-
children: filePath
|
|
853
|
-
}
|
|
854
|
-
)
|
|
855
|
-
] })
|
|
639
|
+
/* @__PURE__ */ jsx$1(
|
|
640
|
+
"div",
|
|
641
|
+
{
|
|
642
|
+
style: {
|
|
643
|
+
fontSize: theme2.fontSizes[2],
|
|
644
|
+
fontWeight: 600,
|
|
645
|
+
color: theme2.colors.text,
|
|
646
|
+
whiteSpace: "nowrap",
|
|
647
|
+
overflow: "hidden",
|
|
648
|
+
textOverflow: "ellipsis"
|
|
649
|
+
},
|
|
650
|
+
title: filePath,
|
|
651
|
+
children: fileName
|
|
652
|
+
}
|
|
653
|
+
)
|
|
856
654
|
]
|
|
857
655
|
}
|
|
858
656
|
),
|
|
@@ -926,10 +724,10 @@ const FileEditorPanel = ({
|
|
|
926
724
|
}
|
|
927
725
|
)
|
|
928
726
|
] }),
|
|
929
|
-
|
|
727
|
+
filePath && /* @__PURE__ */ jsx$1(
|
|
930
728
|
"button",
|
|
931
729
|
{
|
|
932
|
-
onClick:
|
|
730
|
+
onClick: handleClose2,
|
|
933
731
|
style: {
|
|
934
732
|
background: "none",
|
|
935
733
|
border: "none",
|
|
@@ -965,7 +763,8 @@ const FileEditorPanel = ({
|
|
|
965
763
|
display: "flex",
|
|
966
764
|
alignItems: "center",
|
|
967
765
|
justifyContent: "center",
|
|
968
|
-
color: theme2.colors.textSecondary
|
|
766
|
+
color: theme2.colors.textSecondary,
|
|
767
|
+
fontFamily: theme2.fonts.body
|
|
969
768
|
},
|
|
970
769
|
children: "Loading file..."
|
|
971
770
|
}
|
|
@@ -979,7 +778,8 @@ const FileEditorPanel = ({
|
|
|
979
778
|
justifyContent: "center",
|
|
980
779
|
color: theme2.colors.error,
|
|
981
780
|
padding: "20px",
|
|
982
|
-
textAlign: "center"
|
|
781
|
+
textAlign: "center",
|
|
782
|
+
fontFamily: theme2.fonts.body
|
|
983
783
|
},
|
|
984
784
|
children: [
|
|
985
785
|
"Error: ",
|
|
@@ -1019,6 +819,9 @@ const FileEditorPanel = ({
|
|
|
1019
819
|
}
|
|
1020
820
|
);
|
|
1021
821
|
};
|
|
822
|
+
const FileEditorPanel = (props) => {
|
|
823
|
+
return /* @__PURE__ */ jsx$1(ThemeProvider, { children: /* @__PURE__ */ jsx$1(FileEditorPanelContent, { ...props }) });
|
|
824
|
+
};
|
|
1022
825
|
const FileEditorPanelPreview = () => {
|
|
1023
826
|
const { theme: theme2 } = useTheme();
|
|
1024
827
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1055,6 +858,398 @@ const FileEditorPanelPreview = () => {
|
|
|
1055
858
|
}
|
|
1056
859
|
);
|
|
1057
860
|
};
|
|
861
|
+
const statusMeta = {
|
|
862
|
+
staged: {
|
|
863
|
+
label: "Staged change",
|
|
864
|
+
description: "Comparing staged changes against the last commit"
|
|
865
|
+
},
|
|
866
|
+
unstaged: {
|
|
867
|
+
label: "Unstaged change",
|
|
868
|
+
description: "Comparing working tree changes against the last commit"
|
|
869
|
+
},
|
|
870
|
+
untracked: {
|
|
871
|
+
label: "Untracked file",
|
|
872
|
+
description: "New file compared against an empty baseline"
|
|
873
|
+
},
|
|
874
|
+
deleted: {
|
|
875
|
+
label: "Deleted file",
|
|
876
|
+
description: "Showing the last committed contents of the deleted file"
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
const languageFromPath = (filePath) => {
|
|
880
|
+
var _a2;
|
|
881
|
+
if (!filePath) {
|
|
882
|
+
return "plaintext";
|
|
883
|
+
}
|
|
884
|
+
const ext = ((_a2 = filePath.split(".").pop()) == null ? void 0 : _a2.toLowerCase()) ?? "";
|
|
885
|
+
const languageMap = {
|
|
886
|
+
js: "javascript",
|
|
887
|
+
jsx: "javascript",
|
|
888
|
+
ts: "typescript",
|
|
889
|
+
tsx: "typescript",
|
|
890
|
+
py: "python",
|
|
891
|
+
java: "java",
|
|
892
|
+
c: "c",
|
|
893
|
+
cpp: "cpp",
|
|
894
|
+
h: "c",
|
|
895
|
+
hpp: "cpp",
|
|
896
|
+
cs: "csharp",
|
|
897
|
+
go: "go",
|
|
898
|
+
rs: "rust",
|
|
899
|
+
php: "php",
|
|
900
|
+
rb: "ruby",
|
|
901
|
+
swift: "swift",
|
|
902
|
+
kt: "kotlin",
|
|
903
|
+
json: "json",
|
|
904
|
+
yaml: "yaml",
|
|
905
|
+
yml: "yaml",
|
|
906
|
+
toml: "toml",
|
|
907
|
+
ini: "ini",
|
|
908
|
+
cfg: "ini",
|
|
909
|
+
conf: "ini",
|
|
910
|
+
xml: "xml",
|
|
911
|
+
html: "html",
|
|
912
|
+
css: "css",
|
|
913
|
+
scss: "scss",
|
|
914
|
+
sass: "sass",
|
|
915
|
+
less: "less",
|
|
916
|
+
sh: "bash",
|
|
917
|
+
bash: "bash",
|
|
918
|
+
zsh: "bash",
|
|
919
|
+
md: "markdown",
|
|
920
|
+
mdx: "markdown",
|
|
921
|
+
sql: "sql"
|
|
922
|
+
};
|
|
923
|
+
return languageMap[ext] ?? "plaintext";
|
|
924
|
+
};
|
|
925
|
+
const GitDiffPanelContent = ({
|
|
926
|
+
context,
|
|
927
|
+
actions: _actions,
|
|
928
|
+
events
|
|
929
|
+
}) => {
|
|
930
|
+
var _a2;
|
|
931
|
+
const { theme: theme2 } = useTheme();
|
|
932
|
+
const [filePath, setFilePath] = useState(null);
|
|
933
|
+
const [status, setStatus2] = useState("unstaged");
|
|
934
|
+
const [originalContent, setOriginalContent] = useState("");
|
|
935
|
+
const [modifiedContent, setModifiedContent] = useState("");
|
|
936
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
937
|
+
const [error, setError] = useState(null);
|
|
938
|
+
const language2 = useMemo(() => languageFromPath(filePath), [filePath]);
|
|
939
|
+
const fileSystem = (_a2 = context.adapters) == null ? void 0 : _a2.fileSystem;
|
|
940
|
+
useEffect(() => {
|
|
941
|
+
const unsubscribe = events.on("git:diff", (event) => {
|
|
942
|
+
const payload = event.payload;
|
|
943
|
+
if (payload == null ? void 0 : payload.path) {
|
|
944
|
+
setFilePath(payload.path);
|
|
945
|
+
setStatus2(payload.status || "unstaged");
|
|
946
|
+
if (payload.original !== void 0 || payload.modified !== void 0) {
|
|
947
|
+
setOriginalContent(payload.original ?? "");
|
|
948
|
+
setModifiedContent(payload.modified ?? "");
|
|
949
|
+
setIsLoading(false);
|
|
950
|
+
setError(null);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
return unsubscribe;
|
|
955
|
+
}, [events]);
|
|
956
|
+
useEffect(() => {
|
|
957
|
+
let isActive = true;
|
|
958
|
+
const loadDiff = async () => {
|
|
959
|
+
if (!filePath) {
|
|
960
|
+
setOriginalContent("");
|
|
961
|
+
setModifiedContent("");
|
|
962
|
+
setIsLoading(false);
|
|
963
|
+
setError(null);
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
if (!(fileSystem == null ? void 0 : fileSystem.readFile)) {
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
setIsLoading(true);
|
|
970
|
+
setError(null);
|
|
971
|
+
try {
|
|
972
|
+
const modified = await fileSystem.readFile(filePath);
|
|
973
|
+
if (!isActive) return;
|
|
974
|
+
setModifiedContent(modified ?? "");
|
|
975
|
+
if (status === "untracked") {
|
|
976
|
+
setOriginalContent("");
|
|
977
|
+
}
|
|
978
|
+
} catch (err) {
|
|
979
|
+
if (!isActive) return;
|
|
980
|
+
console.error("Failed to load git diff:", err);
|
|
981
|
+
setError(
|
|
982
|
+
err instanceof Error ? `Failed to load diff: ${err.message}` : "Failed to load diff"
|
|
983
|
+
);
|
|
984
|
+
setOriginalContent("");
|
|
985
|
+
setModifiedContent("");
|
|
986
|
+
} finally {
|
|
987
|
+
if (isActive) {
|
|
988
|
+
setIsLoading(false);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
void loadDiff();
|
|
993
|
+
return () => {
|
|
994
|
+
isActive = false;
|
|
995
|
+
};
|
|
996
|
+
}, [filePath, status, fileSystem]);
|
|
997
|
+
const handleClose2 = () => {
|
|
998
|
+
events.emit({
|
|
999
|
+
type: "git:diff:close",
|
|
1000
|
+
source: "industry-theme.git-diff",
|
|
1001
|
+
timestamp: Date.now(),
|
|
1002
|
+
payload: { path: filePath }
|
|
1003
|
+
});
|
|
1004
|
+
setFilePath(null);
|
|
1005
|
+
};
|
|
1006
|
+
const statusInfo = status ? statusMeta[status] : null;
|
|
1007
|
+
const statusColor = useMemo(() => {
|
|
1008
|
+
if (!status) return theme2.colors.textSecondary;
|
|
1009
|
+
switch (status) {
|
|
1010
|
+
case "staged":
|
|
1011
|
+
return theme2.colors.success || "#10b981";
|
|
1012
|
+
case "unstaged":
|
|
1013
|
+
return theme2.colors.warning || "#f59e0b";
|
|
1014
|
+
case "untracked":
|
|
1015
|
+
return theme2.colors.info || theme2.colors.primary || "#3b82f6";
|
|
1016
|
+
case "deleted":
|
|
1017
|
+
return theme2.colors.error || "#ef4444";
|
|
1018
|
+
default:
|
|
1019
|
+
return theme2.colors.textSecondary;
|
|
1020
|
+
}
|
|
1021
|
+
}, [status, theme2.colors]);
|
|
1022
|
+
if (!filePath) {
|
|
1023
|
+
return /* @__PURE__ */ jsx$1(
|
|
1024
|
+
"div",
|
|
1025
|
+
{
|
|
1026
|
+
style: {
|
|
1027
|
+
height: "100%",
|
|
1028
|
+
display: "flex",
|
|
1029
|
+
alignItems: "center",
|
|
1030
|
+
justifyContent: "center",
|
|
1031
|
+
color: theme2.colors.textSecondary,
|
|
1032
|
+
backgroundColor: theme2.colors.backgroundSecondary,
|
|
1033
|
+
fontFamily: theme2.fonts.body
|
|
1034
|
+
},
|
|
1035
|
+
children: "Select a file from Git Changes to view its diff."
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
return /* @__PURE__ */ jsxs(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
style: {
|
|
1043
|
+
height: "100%",
|
|
1044
|
+
display: "flex",
|
|
1045
|
+
flexDirection: "column",
|
|
1046
|
+
backgroundColor: theme2.colors.background
|
|
1047
|
+
},
|
|
1048
|
+
children: [
|
|
1049
|
+
/* @__PURE__ */ jsxs(
|
|
1050
|
+
"div",
|
|
1051
|
+
{
|
|
1052
|
+
style: {
|
|
1053
|
+
height: "40px",
|
|
1054
|
+
padding: "0 12px",
|
|
1055
|
+
borderBottom: `1px solid ${theme2.colors.border}`,
|
|
1056
|
+
display: "flex",
|
|
1057
|
+
justifyContent: "space-between",
|
|
1058
|
+
alignItems: "center",
|
|
1059
|
+
backgroundColor: theme2.colors.backgroundSecondary,
|
|
1060
|
+
fontFamily: theme2.fonts.body,
|
|
1061
|
+
flexShrink: 0,
|
|
1062
|
+
boxSizing: "border-box"
|
|
1063
|
+
},
|
|
1064
|
+
children: [
|
|
1065
|
+
/* @__PURE__ */ jsxs(
|
|
1066
|
+
"div",
|
|
1067
|
+
{
|
|
1068
|
+
style: {
|
|
1069
|
+
display: "flex",
|
|
1070
|
+
alignItems: "center",
|
|
1071
|
+
gap: "8px",
|
|
1072
|
+
flex: 1,
|
|
1073
|
+
minWidth: 0
|
|
1074
|
+
},
|
|
1075
|
+
children: [
|
|
1076
|
+
/* @__PURE__ */ jsx$1(
|
|
1077
|
+
GitCommitHorizontal,
|
|
1078
|
+
{
|
|
1079
|
+
size: 16,
|
|
1080
|
+
style: { color: theme2.colors.primary, flexShrink: 0 }
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ jsx$1(
|
|
1084
|
+
"div",
|
|
1085
|
+
{
|
|
1086
|
+
style: {
|
|
1087
|
+
fontSize: theme2.fontSizes[2],
|
|
1088
|
+
fontWeight: 600,
|
|
1089
|
+
color: theme2.colors.text,
|
|
1090
|
+
whiteSpace: "nowrap",
|
|
1091
|
+
overflow: "hidden",
|
|
1092
|
+
textOverflow: "ellipsis"
|
|
1093
|
+
},
|
|
1094
|
+
title: filePath,
|
|
1095
|
+
children: (filePath == null ? void 0 : filePath.split("/").pop()) || filePath
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
statusInfo && /* @__PURE__ */ jsx$1(
|
|
1099
|
+
"span",
|
|
1100
|
+
{
|
|
1101
|
+
style: {
|
|
1102
|
+
display: "inline-flex",
|
|
1103
|
+
alignItems: "center",
|
|
1104
|
+
fontSize: theme2.fontSizes[0],
|
|
1105
|
+
padding: "2px 8px",
|
|
1106
|
+
borderRadius: "999px",
|
|
1107
|
+
backgroundColor: `${statusColor}20`,
|
|
1108
|
+
color: statusColor,
|
|
1109
|
+
border: `1px solid ${statusColor}60`,
|
|
1110
|
+
whiteSpace: "nowrap",
|
|
1111
|
+
flexShrink: 0
|
|
1112
|
+
},
|
|
1113
|
+
children: statusInfo.label
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
/* @__PURE__ */ jsx$1(
|
|
1120
|
+
"button",
|
|
1121
|
+
{
|
|
1122
|
+
onClick: handleClose2,
|
|
1123
|
+
style: {
|
|
1124
|
+
background: "none",
|
|
1125
|
+
border: "none",
|
|
1126
|
+
padding: "4px",
|
|
1127
|
+
cursor: "pointer",
|
|
1128
|
+
color: theme2.colors.textSecondary,
|
|
1129
|
+
display: "flex",
|
|
1130
|
+
alignItems: "center",
|
|
1131
|
+
justifyContent: "center",
|
|
1132
|
+
borderRadius: "4px",
|
|
1133
|
+
transition: "background-color 0.2s",
|
|
1134
|
+
flexShrink: 0
|
|
1135
|
+
},
|
|
1136
|
+
onMouseEnter: (e2) => {
|
|
1137
|
+
e2.currentTarget.style.backgroundColor = theme2.colors.backgroundTertiary;
|
|
1138
|
+
},
|
|
1139
|
+
onMouseLeave: (e2) => {
|
|
1140
|
+
e2.currentTarget.style.backgroundColor = "transparent";
|
|
1141
|
+
},
|
|
1142
|
+
children: /* @__PURE__ */ jsx$1(X$4, { size: 16 })
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ jsx$1("div", { style: { flex: 1, minHeight: 0 }, children: isLoading ? /* @__PURE__ */ jsx$1(
|
|
1149
|
+
"div",
|
|
1150
|
+
{
|
|
1151
|
+
style: {
|
|
1152
|
+
height: "100%",
|
|
1153
|
+
display: "flex",
|
|
1154
|
+
alignItems: "center",
|
|
1155
|
+
justifyContent: "center",
|
|
1156
|
+
color: theme2.colors.textSecondary,
|
|
1157
|
+
fontFamily: theme2.fonts.body
|
|
1158
|
+
},
|
|
1159
|
+
children: "Loading diff..."
|
|
1160
|
+
}
|
|
1161
|
+
) : error ? /* @__PURE__ */ jsx$1(
|
|
1162
|
+
"div",
|
|
1163
|
+
{
|
|
1164
|
+
style: {
|
|
1165
|
+
height: "100%",
|
|
1166
|
+
display: "flex",
|
|
1167
|
+
alignItems: "center",
|
|
1168
|
+
justifyContent: "center",
|
|
1169
|
+
color: theme2.colors.error,
|
|
1170
|
+
padding: "20px",
|
|
1171
|
+
textAlign: "center",
|
|
1172
|
+
fontFamily: theme2.fonts.body
|
|
1173
|
+
},
|
|
1174
|
+
children: error
|
|
1175
|
+
}
|
|
1176
|
+
) : /* @__PURE__ */ jsx$1(
|
|
1177
|
+
ThemedMonacoDiffEditor,
|
|
1178
|
+
{
|
|
1179
|
+
theme: theme2,
|
|
1180
|
+
original: originalContent,
|
|
1181
|
+
modified: modifiedContent,
|
|
1182
|
+
language: language2,
|
|
1183
|
+
height: "100%",
|
|
1184
|
+
options: {
|
|
1185
|
+
renderSideBySide: true,
|
|
1186
|
+
readOnly: true,
|
|
1187
|
+
minimap: { enabled: false },
|
|
1188
|
+
automaticLayout: true,
|
|
1189
|
+
renderIndicators: true,
|
|
1190
|
+
renderMarginRevertIcon: true,
|
|
1191
|
+
ignoreTrimWhitespace: false,
|
|
1192
|
+
diffAlgorithm: "advanced",
|
|
1193
|
+
scrollbar: {
|
|
1194
|
+
useShadows: false,
|
|
1195
|
+
vertical: "auto",
|
|
1196
|
+
horizontal: "auto"
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
loadingComponent: /* @__PURE__ */ jsx$1(
|
|
1200
|
+
"div",
|
|
1201
|
+
{
|
|
1202
|
+
style: {
|
|
1203
|
+
height: "100%",
|
|
1204
|
+
display: "flex",
|
|
1205
|
+
alignItems: "center",
|
|
1206
|
+
justifyContent: "center",
|
|
1207
|
+
color: theme2.colors.textSecondary
|
|
1208
|
+
},
|
|
1209
|
+
children: "Preparing diff editor..."
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
}
|
|
1213
|
+
) })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
);
|
|
1217
|
+
};
|
|
1218
|
+
const GitDiffPanel = (props) => {
|
|
1219
|
+
return /* @__PURE__ */ jsx$1(ThemeProvider, { children: /* @__PURE__ */ jsx$1(GitDiffPanelContent, { ...props }) });
|
|
1220
|
+
};
|
|
1221
|
+
const GitDiffPanelPreview = () => {
|
|
1222
|
+
const { theme: theme2 } = useTheme();
|
|
1223
|
+
return /* @__PURE__ */ jsxs(
|
|
1224
|
+
"div",
|
|
1225
|
+
{
|
|
1226
|
+
style: {
|
|
1227
|
+
padding: "12px",
|
|
1228
|
+
fontSize: theme2.fontSizes[0],
|
|
1229
|
+
color: theme2.colors.text,
|
|
1230
|
+
display: "flex",
|
|
1231
|
+
flexDirection: "column",
|
|
1232
|
+
gap: "4px",
|
|
1233
|
+
fontFamily: theme2.fonts.monospace
|
|
1234
|
+
},
|
|
1235
|
+
children: [
|
|
1236
|
+
/* @__PURE__ */ jsx$1(
|
|
1237
|
+
"div",
|
|
1238
|
+
{
|
|
1239
|
+
style: {
|
|
1240
|
+
display: "flex",
|
|
1241
|
+
gap: "8px"
|
|
1242
|
+
},
|
|
1243
|
+
children: /* @__PURE__ */ jsx$1("span", { style: { color: theme2.colors.textSecondary }, children: "@@ 12,5 @@" })
|
|
1244
|
+
}
|
|
1245
|
+
),
|
|
1246
|
+
/* @__PURE__ */ jsx$1("div", { style: { color: "#ef4444" }, children: "- const count = oldValue;" }),
|
|
1247
|
+
/* @__PURE__ */ jsx$1("div", { style: { color: "#22c55e" }, children: "+ const count = newValue;" }),
|
|
1248
|
+
/* @__PURE__ */ jsx$1("div", { style: { color: theme2.colors.textSecondary }, children: " return count;" })
|
|
1249
|
+
]
|
|
1250
|
+
}
|
|
1251
|
+
);
|
|
1252
|
+
};
|
|
1058
1253
|
var N$6 = Object.defineProperty;
|
|
1059
1254
|
var P$3 = (s2, t2, e2) => t2 in s2 ? N$6(s2, t2, { enumerable: true, configurable: true, writable: true, value: e2 }) : s2[t2] = e2;
|
|
1060
1255
|
var p$4 = (s2, t2, e2) => P$3(s2, typeof t2 != "symbol" ? t2 + "" : t2, e2);
|
|
@@ -49416,7 +49611,7 @@ const panelPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
49416
49611
|
let input = update.state.facet(showPanel);
|
|
49417
49612
|
if (input != this.input) {
|
|
49418
49613
|
let specs = input.filter((x2) => x2);
|
|
49419
|
-
let
|
|
49614
|
+
let panels2 = [], top2 = [], bottom = [], mount = [];
|
|
49420
49615
|
for (let spec of specs) {
|
|
49421
49616
|
let known = this.specs.indexOf(spec), panel;
|
|
49422
49617
|
if (known < 0) {
|
|
@@ -49427,11 +49622,11 @@ const panelPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
49427
49622
|
if (panel.update)
|
|
49428
49623
|
panel.update(update);
|
|
49429
49624
|
}
|
|
49430
|
-
|
|
49625
|
+
panels2.push(panel);
|
|
49431
49626
|
(panel.top ? top2 : bottom).push(panel);
|
|
49432
49627
|
}
|
|
49433
49628
|
this.specs = specs;
|
|
49434
|
-
this.panels =
|
|
49629
|
+
this.panels = panels2;
|
|
49435
49630
|
this.top.sync(top2);
|
|
49436
49631
|
this.bottom.sync(bottom);
|
|
49437
49632
|
for (let p2 of mount) {
|
|
@@ -49465,11 +49660,11 @@ class PanelGroup {
|
|
|
49465
49660
|
this.panels = [];
|
|
49466
49661
|
this.syncClasses();
|
|
49467
49662
|
}
|
|
49468
|
-
sync(
|
|
49663
|
+
sync(panels2) {
|
|
49469
49664
|
for (let p2 of this.panels)
|
|
49470
|
-
if (p2.destroy &&
|
|
49665
|
+
if (p2.destroy && panels2.indexOf(p2) < 0)
|
|
49471
49666
|
p2.destroy();
|
|
49472
|
-
this.panels =
|
|
49667
|
+
this.panels = panels2;
|
|
49473
49668
|
this.syncDOM();
|
|
49474
49669
|
}
|
|
49475
49670
|
syncDOM() {
|
|
@@ -62253,7 +62448,7 @@ function legacy(parser2) {
|
|
|
62253
62448
|
return new LanguageSupport(StreamLanguage.define(parser2));
|
|
62254
62449
|
}
|
|
62255
62450
|
function sql(dialectName) {
|
|
62256
|
-
return import("./index-
|
|
62451
|
+
return import("./index-Bv-jaOT4.js").then((m3) => m3.sql({ dialect: m3[dialectName] }));
|
|
62257
62452
|
}
|
|
62258
62453
|
const languages = [
|
|
62259
62454
|
// New-style language modes
|
|
@@ -62261,7 +62456,7 @@ const languages = [
|
|
|
62261
62456
|
name: "C",
|
|
62262
62457
|
extensions: ["c", "h", "ino"],
|
|
62263
62458
|
load() {
|
|
62264
|
-
return import("./index-
|
|
62459
|
+
return import("./index-Bz2hw5jD.js").then((m3) => m3.cpp());
|
|
62265
62460
|
}
|
|
62266
62461
|
}),
|
|
62267
62462
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62269,7 +62464,7 @@ const languages = [
|
|
|
62269
62464
|
alias: ["cpp"],
|
|
62270
62465
|
extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
|
|
62271
62466
|
load() {
|
|
62272
|
-
return import("./index-
|
|
62467
|
+
return import("./index-Bz2hw5jD.js").then((m3) => m3.cpp());
|
|
62273
62468
|
}
|
|
62274
62469
|
}),
|
|
62275
62470
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62291,7 +62486,7 @@ const languages = [
|
|
|
62291
62486
|
name: "Go",
|
|
62292
62487
|
extensions: ["go"],
|
|
62293
62488
|
load() {
|
|
62294
|
-
return import("./index-
|
|
62489
|
+
return import("./index-Cw8rhvFp.js").then((m3) => m3.go());
|
|
62295
62490
|
}
|
|
62296
62491
|
}),
|
|
62297
62492
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62306,7 +62501,7 @@ const languages = [
|
|
|
62306
62501
|
name: "Java",
|
|
62307
62502
|
extensions: ["java"],
|
|
62308
62503
|
load() {
|
|
62309
|
-
return import("./index-
|
|
62504
|
+
return import("./index-BfXsy0Ic.js").then((m3) => m3.java());
|
|
62310
62505
|
}
|
|
62311
62506
|
}),
|
|
62312
62507
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62321,7 +62516,7 @@ const languages = [
|
|
|
62321
62516
|
name: "Jinja",
|
|
62322
62517
|
extensions: ["j2", "jinja", "jinja2"],
|
|
62323
62518
|
load() {
|
|
62324
|
-
return import("./index-
|
|
62519
|
+
return import("./index-CfSEVctn.js").then((m3) => m3.jinja());
|
|
62325
62520
|
}
|
|
62326
62521
|
}),
|
|
62327
62522
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62329,7 +62524,7 @@ const languages = [
|
|
|
62329
62524
|
alias: ["json5"],
|
|
62330
62525
|
extensions: ["json", "map"],
|
|
62331
62526
|
load() {
|
|
62332
|
-
return import("./index-
|
|
62527
|
+
return import("./index-CZxNC5tF.js").then((m3) => m3.json());
|
|
62333
62528
|
}
|
|
62334
62529
|
}),
|
|
62335
62530
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62343,14 +62538,14 @@ const languages = [
|
|
|
62343
62538
|
name: "LESS",
|
|
62344
62539
|
extensions: ["less"],
|
|
62345
62540
|
load() {
|
|
62346
|
-
return import("./index-
|
|
62541
|
+
return import("./index-CR9rs7ft.js").then((m3) => m3.less());
|
|
62347
62542
|
}
|
|
62348
62543
|
}),
|
|
62349
62544
|
/* @__PURE__ */ LanguageDescription.of({
|
|
62350
62545
|
name: "Liquid",
|
|
62351
62546
|
extensions: ["liquid"],
|
|
62352
62547
|
load() {
|
|
62353
|
-
return import("./index-
|
|
62548
|
+
return import("./index-Be8sf6Yq.js").then((m3) => m3.liquid());
|
|
62354
62549
|
}
|
|
62355
62550
|
}),
|
|
62356
62551
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62382,7 +62577,7 @@ const languages = [
|
|
|
62382
62577
|
name: "PHP",
|
|
62383
62578
|
extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
|
|
62384
62579
|
load() {
|
|
62385
|
-
return import("./index-
|
|
62580
|
+
return import("./index-14lgYlyv.js").then((m3) => m3.php());
|
|
62386
62581
|
}
|
|
62387
62582
|
}),
|
|
62388
62583
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62403,28 +62598,28 @@ const languages = [
|
|
|
62403
62598
|
extensions: ["BUILD", "bzl", "py", "pyw"],
|
|
62404
62599
|
filename: /^(BUCK|BUILD)$/,
|
|
62405
62600
|
load() {
|
|
62406
|
-
return import("./index-
|
|
62601
|
+
return import("./index-CTUvSkgO.js").then((m3) => m3.python());
|
|
62407
62602
|
}
|
|
62408
62603
|
}),
|
|
62409
62604
|
/* @__PURE__ */ LanguageDescription.of({
|
|
62410
62605
|
name: "Rust",
|
|
62411
62606
|
extensions: ["rs"],
|
|
62412
62607
|
load() {
|
|
62413
|
-
return import("./index-
|
|
62608
|
+
return import("./index-fTvnIXAZ.js").then((m3) => m3.rust());
|
|
62414
62609
|
}
|
|
62415
62610
|
}),
|
|
62416
62611
|
/* @__PURE__ */ LanguageDescription.of({
|
|
62417
62612
|
name: "Sass",
|
|
62418
62613
|
extensions: ["sass"],
|
|
62419
62614
|
load() {
|
|
62420
|
-
return import("./index-
|
|
62615
|
+
return import("./index-DYXlNXoN.js").then((m3) => m3.sass({ indented: true }));
|
|
62421
62616
|
}
|
|
62422
62617
|
}),
|
|
62423
62618
|
/* @__PURE__ */ LanguageDescription.of({
|
|
62424
62619
|
name: "SCSS",
|
|
62425
62620
|
extensions: ["scss"],
|
|
62426
62621
|
load() {
|
|
62427
|
-
return import("./index-
|
|
62622
|
+
return import("./index-DYXlNXoN.js").then((m3) => m3.sass());
|
|
62428
62623
|
}
|
|
62429
62624
|
}),
|
|
62430
62625
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62459,7 +62654,7 @@ const languages = [
|
|
|
62459
62654
|
name: "WebAssembly",
|
|
62460
62655
|
extensions: ["wat", "wast"],
|
|
62461
62656
|
load() {
|
|
62462
|
-
return import("./index-
|
|
62657
|
+
return import("./index-BgO3atCf.js").then((m3) => m3.wast());
|
|
62463
62658
|
}
|
|
62464
62659
|
}),
|
|
62465
62660
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62467,7 +62662,7 @@ const languages = [
|
|
|
62467
62662
|
alias: ["rss", "wsdl", "xsd"],
|
|
62468
62663
|
extensions: ["xml", "xsl", "xsd", "svg"],
|
|
62469
62664
|
load() {
|
|
62470
|
-
return import("./index-
|
|
62665
|
+
return import("./index-BwQYP3Gr.js").then((m3) => m3.xml());
|
|
62471
62666
|
}
|
|
62472
62667
|
}),
|
|
62473
62668
|
/* @__PURE__ */ LanguageDescription.of({
|
|
@@ -62475,7 +62670,7 @@ const languages = [
|
|
|
62475
62670
|
alias: ["yml"],
|
|
62476
62671
|
extensions: ["yaml", "yml"],
|
|
62477
62672
|
load() {
|
|
62478
|
-
return import("./index-
|
|
62673
|
+
return import("./index-CCKvgrZw.js").then((m3) => m3.yaml());
|
|
62479
62674
|
}
|
|
62480
62675
|
}),
|
|
62481
62676
|
// Legacy modes ported from CodeMirror 5
|
|
@@ -63264,13 +63459,13 @@ const languages = [
|
|
|
63264
63459
|
name: "Vue",
|
|
63265
63460
|
extensions: ["vue"],
|
|
63266
63461
|
load() {
|
|
63267
|
-
return import("./index-
|
|
63462
|
+
return import("./index-CVQuqypG.js").then((m3) => m3.vue());
|
|
63268
63463
|
}
|
|
63269
63464
|
}),
|
|
63270
63465
|
/* @__PURE__ */ LanguageDescription.of({
|
|
63271
63466
|
name: "Angular Template",
|
|
63272
63467
|
load() {
|
|
63273
|
-
return import("./index-
|
|
63468
|
+
return import("./index-C9AZ1bbc.js").then((m3) => m3.angular());
|
|
63274
63469
|
}
|
|
63275
63470
|
})
|
|
63276
63471
|
];
|
|
@@ -75921,22 +76116,23 @@ var ThemedMDXEditorWithProvider = React__default__default.forwardRef((props, ref
|
|
|
75921
76116
|
return /* @__PURE__ */ jsx$1(ThemedMDXEditor, { ref, theme: theme2, ...props });
|
|
75922
76117
|
});
|
|
75923
76118
|
ThemedMDXEditorWithProvider.displayName = "ThemedMDXEditorWithProvider";
|
|
75924
|
-
const
|
|
75925
|
-
|
|
75926
|
-
|
|
75927
|
-
|
|
75928
|
-
onSave,
|
|
75929
|
-
readOnly: readOnly2 = false,
|
|
75930
|
-
onImageUpload
|
|
76119
|
+
const MDXEditorPanelContent = ({
|
|
76120
|
+
context,
|
|
76121
|
+
actions: _actions,
|
|
76122
|
+
events
|
|
75931
76123
|
}) => {
|
|
76124
|
+
var _a2, _b;
|
|
75932
76125
|
const { theme: theme2 } = useTheme();
|
|
75933
|
-
const [
|
|
76126
|
+
const [filePath, setFilePath] = useState(null);
|
|
76127
|
+
const [markdown2, setMarkdown] = useState("");
|
|
75934
76128
|
const [isMounted, setIsMounted] = useState(false);
|
|
75935
76129
|
const [isLoading, setIsLoading] = useState(false);
|
|
75936
76130
|
const [loadError, setLoadError] = useState(null);
|
|
75937
|
-
const [currentFilePath, setCurrentFilePath] = useState(null);
|
|
75938
76131
|
const [parseError, setParseError] = useState(null);
|
|
75939
|
-
const [
|
|
76132
|
+
const [_isDirty, setIsDirty] = useState(false);
|
|
76133
|
+
const fileSystem = (_a2 = context.adapters) == null ? void 0 : _a2.fileSystem;
|
|
76134
|
+
const isEditable = Boolean(fileSystem == null ? void 0 : fileSystem.writeFile);
|
|
76135
|
+
const activeFileSlice = context.getSlice("active-file");
|
|
75940
76136
|
const plugins = useMemo(
|
|
75941
76137
|
() => [
|
|
75942
76138
|
headingsPlugin(),
|
|
@@ -75947,10 +76143,10 @@ const MDXEditorPanel = ({
|
|
|
75947
76143
|
linkPlugin(),
|
|
75948
76144
|
linkDialogPlugin(),
|
|
75949
76145
|
imagePlugin({
|
|
75950
|
-
imageUploadHandler:
|
|
75951
|
-
console.
|
|
76146
|
+
imageUploadHandler: async (file) => {
|
|
76147
|
+
console.warn("Image upload not configured:", file.name);
|
|
75952
76148
|
return "/placeholder-image.png";
|
|
75953
|
-
}
|
|
76149
|
+
}
|
|
75954
76150
|
}),
|
|
75955
76151
|
tablePlugin(),
|
|
75956
76152
|
codeBlockPlugin({ defaultCodeBlockLanguage: "javascript" }),
|
|
@@ -75994,36 +76190,42 @@ const MDXEditorPanel = ({
|
|
|
75994
76190
|
] }) })
|
|
75995
76191
|
})
|
|
75996
76192
|
],
|
|
75997
|
-
[parseError
|
|
76193
|
+
[parseError]
|
|
75998
76194
|
);
|
|
75999
76195
|
useEffect(() => {
|
|
76000
76196
|
setIsMounted(true);
|
|
76001
76197
|
}, []);
|
|
76002
76198
|
useEffect(() => {
|
|
76003
|
-
|
|
76004
|
-
|
|
76005
|
-
|
|
76006
|
-
|
|
76007
|
-
|
|
76199
|
+
var _a3;
|
|
76200
|
+
const path = (_a3 = activeFileSlice == null ? void 0 : activeFileSlice.data) == null ? void 0 : _a3.path;
|
|
76201
|
+
if (path && (path.endsWith(".md") || path.endsWith(".mdx"))) {
|
|
76202
|
+
setFilePath(path);
|
|
76203
|
+
}
|
|
76204
|
+
}, [(_b = activeFileSlice == null ? void 0 : activeFileSlice.data) == null ? void 0 : _b.path]);
|
|
76205
|
+
useEffect(() => {
|
|
76206
|
+
const unsubscribe = events.on("file:open", (event) => {
|
|
76207
|
+
const payload = event.payload;
|
|
76208
|
+
if (payload == null ? void 0 : payload.path) {
|
|
76209
|
+
const path = payload.path;
|
|
76210
|
+
if (path.endsWith(".md") || path.endsWith(".mdx")) {
|
|
76211
|
+
setFilePath(path);
|
|
76212
|
+
}
|
|
76008
76213
|
}
|
|
76009
|
-
|
|
76214
|
+
});
|
|
76215
|
+
return unsubscribe;
|
|
76216
|
+
}, [events]);
|
|
76217
|
+
useEffect(() => {
|
|
76218
|
+
const loadFileContent = async () => {
|
|
76219
|
+
if (!filePath || !(fileSystem == null ? void 0 : fileSystem.readFile)) {
|
|
76220
|
+
setMarkdown("");
|
|
76010
76221
|
return;
|
|
76011
76222
|
}
|
|
76012
|
-
if (currentFilePath && isDirty && contentProvider.writeFile) {
|
|
76013
|
-
try {
|
|
76014
|
-
await contentProvider.writeFile(currentFilePath, markdown2);
|
|
76015
|
-
console.log("Auto-saved before loading new file:", currentFilePath);
|
|
76016
|
-
} catch (error) {
|
|
76017
|
-
console.error("Failed to auto-save before loading new file:", error);
|
|
76018
|
-
}
|
|
76019
|
-
}
|
|
76020
76223
|
setIsLoading(true);
|
|
76021
76224
|
setLoadError(null);
|
|
76022
76225
|
try {
|
|
76023
|
-
const content2 = await
|
|
76226
|
+
const content2 = await fileSystem.readFile(filePath);
|
|
76024
76227
|
if (content2 !== null) {
|
|
76025
76228
|
setMarkdown(content2);
|
|
76026
|
-
setCurrentFilePath(filePath);
|
|
76027
76229
|
setParseError(null);
|
|
76028
76230
|
setIsDirty(false);
|
|
76029
76231
|
} else {
|
|
@@ -76032,32 +76234,14 @@ const MDXEditorPanel = ({
|
|
|
76032
76234
|
} catch (error) {
|
|
76033
76235
|
console.error("Error loading file:", error);
|
|
76034
76236
|
setLoadError(`Failed to load file: ${filePath}`);
|
|
76035
|
-
setMarkdown(
|
|
76237
|
+
setMarkdown("");
|
|
76036
76238
|
setParseError(null);
|
|
76037
76239
|
} finally {
|
|
76038
76240
|
setIsLoading(false);
|
|
76039
76241
|
}
|
|
76040
76242
|
};
|
|
76041
76243
|
loadFileContent();
|
|
76042
|
-
}, [
|
|
76043
|
-
filePath,
|
|
76044
|
-
contentProvider,
|
|
76045
|
-
initialContent,
|
|
76046
|
-
currentFilePath,
|
|
76047
|
-
isDirty,
|
|
76048
|
-
markdown2
|
|
76049
|
-
]);
|
|
76050
|
-
useEffect(() => {
|
|
76051
|
-
return () => {
|
|
76052
|
-
if (currentFilePath && isDirty && (contentProvider == null ? void 0 : contentProvider.writeFile)) {
|
|
76053
|
-
contentProvider.writeFile(currentFilePath, markdown2).then(() => {
|
|
76054
|
-
console.log("Auto-saved on unmount:", currentFilePath);
|
|
76055
|
-
}).catch((error) => {
|
|
76056
|
-
console.error("Failed to auto-save on unmount:", error);
|
|
76057
|
-
});
|
|
76058
|
-
}
|
|
76059
|
-
};
|
|
76060
|
-
}, [currentFilePath, isDirty, markdown2, contentProvider]);
|
|
76244
|
+
}, [filePath, fileSystem]);
|
|
76061
76245
|
const handleChange = useCallback((value2) => {
|
|
76062
76246
|
setMarkdown(value2);
|
|
76063
76247
|
setParseError(null);
|
|
@@ -76065,20 +76249,22 @@ const MDXEditorPanel = ({
|
|
|
76065
76249
|
const handleSave = useCallback(
|
|
76066
76250
|
async (content2) => {
|
|
76067
76251
|
const contentToSave = content2 || markdown2;
|
|
76068
|
-
if (
|
|
76069
|
-
onSave(contentToSave);
|
|
76070
|
-
}
|
|
76071
|
-
if (currentFilePath && (contentProvider == null ? void 0 : contentProvider.writeFile)) {
|
|
76252
|
+
if (filePath && (fileSystem == null ? void 0 : fileSystem.writeFile)) {
|
|
76072
76253
|
try {
|
|
76073
|
-
await
|
|
76074
|
-
console.log("File saved successfully:", currentFilePath);
|
|
76254
|
+
await fileSystem.writeFile(filePath, contentToSave);
|
|
76075
76255
|
setIsDirty(false);
|
|
76256
|
+
events.emit({
|
|
76257
|
+
type: "file:save",
|
|
76258
|
+
source: "industry-theme.mdx-editor",
|
|
76259
|
+
timestamp: Date.now(),
|
|
76260
|
+
payload: { path: filePath }
|
|
76261
|
+
});
|
|
76076
76262
|
} catch (error) {
|
|
76077
76263
|
console.error("Error saving file:", error);
|
|
76078
76264
|
}
|
|
76079
76265
|
}
|
|
76080
76266
|
},
|
|
76081
|
-
[markdown2,
|
|
76267
|
+
[markdown2, filePath, fileSystem, events]
|
|
76082
76268
|
);
|
|
76083
76269
|
if (!isMounted) {
|
|
76084
76270
|
return /* @__PURE__ */ jsx$1(
|
|
@@ -76089,7 +76275,8 @@ const MDXEditorPanel = ({
|
|
|
76089
76275
|
alignItems: "center",
|
|
76090
76276
|
justifyContent: "center",
|
|
76091
76277
|
height: "100%",
|
|
76092
|
-
color: theme2.colors.text
|
|
76278
|
+
color: theme2.colors.text,
|
|
76279
|
+
fontFamily: theme2.fonts.body
|
|
76093
76280
|
},
|
|
76094
76281
|
children: "Loading editor..."
|
|
76095
76282
|
}
|
|
@@ -76104,7 +76291,8 @@ const MDXEditorPanel = ({
|
|
|
76104
76291
|
alignItems: "center",
|
|
76105
76292
|
justifyContent: "center",
|
|
76106
76293
|
height: "100%",
|
|
76107
|
-
color: theme2.colors.text
|
|
76294
|
+
color: theme2.colors.text,
|
|
76295
|
+
fontFamily: theme2.fonts.body
|
|
76108
76296
|
},
|
|
76109
76297
|
children: "Loading file..."
|
|
76110
76298
|
}
|
|
@@ -76122,7 +76310,8 @@ const MDXEditorPanel = ({
|
|
|
76122
76310
|
height: "100%",
|
|
76123
76311
|
color: theme2.colors.error,
|
|
76124
76312
|
padding: "20px",
|
|
76125
|
-
textAlign: "center"
|
|
76313
|
+
textAlign: "center",
|
|
76314
|
+
fontFamily: theme2.fonts.body
|
|
76126
76315
|
},
|
|
76127
76316
|
children: [
|
|
76128
76317
|
/* @__PURE__ */ jsx$1("div", { style: { marginBottom: "10px" }, children: "Warning" }),
|
|
@@ -76131,7 +76320,7 @@ const MDXEditorPanel = ({
|
|
|
76131
76320
|
}
|
|
76132
76321
|
);
|
|
76133
76322
|
}
|
|
76134
|
-
if (!filePath
|
|
76323
|
+
if (!filePath) {
|
|
76135
76324
|
return /* @__PURE__ */ jsxs(
|
|
76136
76325
|
"div",
|
|
76137
76326
|
{
|
|
@@ -76143,7 +76332,8 @@ const MDXEditorPanel = ({
|
|
|
76143
76332
|
height: "100%",
|
|
76144
76333
|
color: theme2.colors.textSecondary,
|
|
76145
76334
|
padding: "40px",
|
|
76146
|
-
textAlign: "center"
|
|
76335
|
+
textAlign: "center",
|
|
76336
|
+
fontFamily: theme2.fonts.body
|
|
76147
76337
|
},
|
|
76148
76338
|
children: [
|
|
76149
76339
|
/* @__PURE__ */ jsx$1(FileText, { size: 48, style: { marginBottom: "16px", opacity: 0.5 } }),
|
|
@@ -76191,9 +76381,9 @@ const MDXEditorPanel = ({
|
|
|
76191
76381
|
},
|
|
76192
76382
|
onChange: handleChange,
|
|
76193
76383
|
onDirtyChange: setIsDirty,
|
|
76194
|
-
readOnly:
|
|
76195
|
-
filePath:
|
|
76196
|
-
enableSaveShortcut:
|
|
76384
|
+
readOnly: !isEditable,
|
|
76385
|
+
filePath: filePath || void 0,
|
|
76386
|
+
enableSaveShortcut: isEditable,
|
|
76197
76387
|
hideStatusBar: false,
|
|
76198
76388
|
documentPadding: { left: 32, right: 32, top: 0, bottom: 32 },
|
|
76199
76389
|
onError: (error) => {
|
|
@@ -76208,7 +76398,7 @@ const MDXEditorPanel = ({
|
|
|
76208
76398
|
},
|
|
76209
76399
|
plugins
|
|
76210
76400
|
},
|
|
76211
|
-
|
|
76401
|
+
filePath || "default"
|
|
76212
76402
|
)
|
|
76213
76403
|
}
|
|
76214
76404
|
);
|
|
@@ -76250,6 +76440,9 @@ const MDXEditorPanel = ({
|
|
|
76250
76440
|
}
|
|
76251
76441
|
return editorContent;
|
|
76252
76442
|
};
|
|
76443
|
+
const MDXEditorPanel = (props) => {
|
|
76444
|
+
return /* @__PURE__ */ jsx$1(ThemeProvider, { children: /* @__PURE__ */ jsx$1(MDXEditorPanelContent, { ...props }) });
|
|
76445
|
+
};
|
|
76253
76446
|
const MDXEditorPanelPreview = () => {
|
|
76254
76447
|
const { theme: theme2 } = useTheme();
|
|
76255
76448
|
return /* @__PURE__ */ jsxs(
|
|
@@ -76295,15 +76488,204 @@ const MDXEditorPanelPreview = () => {
|
|
|
76295
76488
|
}
|
|
76296
76489
|
);
|
|
76297
76490
|
};
|
|
76491
|
+
const openFileTool = {
|
|
76492
|
+
name: "open_file",
|
|
76493
|
+
description: "Opens a file in the file editor panel",
|
|
76494
|
+
inputs: {
|
|
76495
|
+
type: "object",
|
|
76496
|
+
properties: {
|
|
76497
|
+
filePath: {
|
|
76498
|
+
type: "string",
|
|
76499
|
+
description: "Path to the file to open"
|
|
76500
|
+
},
|
|
76501
|
+
readOnly: {
|
|
76502
|
+
type: "boolean",
|
|
76503
|
+
description: "Whether to open the file in read-only mode"
|
|
76504
|
+
}
|
|
76505
|
+
},
|
|
76506
|
+
required: ["filePath"]
|
|
76507
|
+
},
|
|
76508
|
+
outputs: {
|
|
76509
|
+
type: "object",
|
|
76510
|
+
properties: {
|
|
76511
|
+
success: { type: "boolean" },
|
|
76512
|
+
filePath: { type: "string" }
|
|
76513
|
+
}
|
|
76514
|
+
},
|
|
76515
|
+
tags: ["file", "editor", "open"],
|
|
76516
|
+
tool_call_template: {
|
|
76517
|
+
call_template_type: "panel_event",
|
|
76518
|
+
event_type: "file-editing-panels:open-file"
|
|
76519
|
+
}
|
|
76520
|
+
};
|
|
76521
|
+
const viewDiffTool = {
|
|
76522
|
+
name: "view_diff",
|
|
76523
|
+
description: "Opens a file in the git diff panel to view changes",
|
|
76524
|
+
inputs: {
|
|
76525
|
+
type: "object",
|
|
76526
|
+
properties: {
|
|
76527
|
+
filePath: {
|
|
76528
|
+
type: "string",
|
|
76529
|
+
description: "Path to the file to diff"
|
|
76530
|
+
},
|
|
76531
|
+
status: {
|
|
76532
|
+
type: "string",
|
|
76533
|
+
enum: ["staged", "unstaged", "untracked", "deleted"],
|
|
76534
|
+
description: "The git status of the file"
|
|
76535
|
+
}
|
|
76536
|
+
},
|
|
76537
|
+
required: ["filePath"]
|
|
76538
|
+
},
|
|
76539
|
+
outputs: {
|
|
76540
|
+
type: "object",
|
|
76541
|
+
properties: {
|
|
76542
|
+
success: { type: "boolean" },
|
|
76543
|
+
filePath: { type: "string" }
|
|
76544
|
+
}
|
|
76545
|
+
},
|
|
76546
|
+
tags: ["git", "diff", "view"],
|
|
76547
|
+
tool_call_template: {
|
|
76548
|
+
call_template_type: "panel_event",
|
|
76549
|
+
event_type: "file-editing-panels:view-diff"
|
|
76550
|
+
}
|
|
76551
|
+
};
|
|
76552
|
+
const openMarkdownTool = {
|
|
76553
|
+
name: "open_markdown",
|
|
76554
|
+
description: "Opens a markdown file in the MDX editor panel",
|
|
76555
|
+
inputs: {
|
|
76556
|
+
type: "object",
|
|
76557
|
+
properties: {
|
|
76558
|
+
filePath: {
|
|
76559
|
+
type: "string",
|
|
76560
|
+
description: "Path to the markdown file to open"
|
|
76561
|
+
},
|
|
76562
|
+
readOnly: {
|
|
76563
|
+
type: "boolean",
|
|
76564
|
+
description: "Whether to open the file in read-only mode"
|
|
76565
|
+
}
|
|
76566
|
+
},
|
|
76567
|
+
required: ["filePath"]
|
|
76568
|
+
},
|
|
76569
|
+
outputs: {
|
|
76570
|
+
type: "object",
|
|
76571
|
+
properties: {
|
|
76572
|
+
success: { type: "boolean" },
|
|
76573
|
+
filePath: { type: "string" }
|
|
76574
|
+
}
|
|
76575
|
+
},
|
|
76576
|
+
tags: ["markdown", "mdx", "editor"],
|
|
76577
|
+
tool_call_template: {
|
|
76578
|
+
call_template_type: "panel_event",
|
|
76579
|
+
event_type: "file-editing-panels:open-markdown"
|
|
76580
|
+
}
|
|
76581
|
+
};
|
|
76582
|
+
const fileEditingPanelTools = [
|
|
76583
|
+
openFileTool,
|
|
76584
|
+
viewDiffTool,
|
|
76585
|
+
openMarkdownTool
|
|
76586
|
+
];
|
|
76587
|
+
const fileEditingPanelToolsMetadata = {
|
|
76588
|
+
id: "industry-theme.file-editing-panels",
|
|
76589
|
+
name: "File Editing Panels",
|
|
76590
|
+
description: "Tools for file editing, git diff viewing, and markdown editing",
|
|
76591
|
+
tools: fileEditingPanelTools
|
|
76592
|
+
};
|
|
76593
|
+
const panels = [
|
|
76594
|
+
{
|
|
76595
|
+
metadata: {
|
|
76596
|
+
id: "industry-theme.file-editor",
|
|
76597
|
+
name: "File Editor",
|
|
76598
|
+
icon: "📝",
|
|
76599
|
+
version: "0.1.0",
|
|
76600
|
+
author: "Industry Theme",
|
|
76601
|
+
description: "Monaco-based code editor with syntax highlighting",
|
|
76602
|
+
slices: ["active-file", "fileTree"],
|
|
76603
|
+
tools: [fileEditingPanelTools[0]]
|
|
76604
|
+
// openFileTool
|
|
76605
|
+
},
|
|
76606
|
+
component: FileEditorPanel,
|
|
76607
|
+
onMount: async (context) => {
|
|
76608
|
+
var _a2;
|
|
76609
|
+
console.log(
|
|
76610
|
+
"File Editor Panel mounted",
|
|
76611
|
+
(_a2 = context.currentScope.repository) == null ? void 0 : _a2.path
|
|
76612
|
+
);
|
|
76613
|
+
},
|
|
76614
|
+
onUnmount: async (_context) => {
|
|
76615
|
+
console.log("File Editor Panel unmounting");
|
|
76616
|
+
}
|
|
76617
|
+
},
|
|
76618
|
+
{
|
|
76619
|
+
metadata: {
|
|
76620
|
+
id: "industry-theme.git-diff",
|
|
76621
|
+
name: "Git Diff",
|
|
76622
|
+
icon: "🔀",
|
|
76623
|
+
version: "0.1.0",
|
|
76624
|
+
author: "Industry Theme",
|
|
76625
|
+
description: "Side-by-side git diff viewer",
|
|
76626
|
+
slices: ["git", "fileTree"],
|
|
76627
|
+
tools: [fileEditingPanelTools[1]]
|
|
76628
|
+
// viewDiffTool
|
|
76629
|
+
},
|
|
76630
|
+
component: GitDiffPanel,
|
|
76631
|
+
onMount: async (context) => {
|
|
76632
|
+
var _a2;
|
|
76633
|
+
console.log(
|
|
76634
|
+
"Git Diff Panel mounted",
|
|
76635
|
+
(_a2 = context.currentScope.repository) == null ? void 0 : _a2.path
|
|
76636
|
+
);
|
|
76637
|
+
},
|
|
76638
|
+
onUnmount: async (_context) => {
|
|
76639
|
+
console.log("Git Diff Panel unmounting");
|
|
76640
|
+
}
|
|
76641
|
+
},
|
|
76642
|
+
{
|
|
76643
|
+
metadata: {
|
|
76644
|
+
id: "industry-theme.mdx-editor",
|
|
76645
|
+
name: "MDX Editor",
|
|
76646
|
+
icon: "📄",
|
|
76647
|
+
version: "0.1.0",
|
|
76648
|
+
author: "Industry Theme",
|
|
76649
|
+
description: "Rich markdown/MDX editor with live preview",
|
|
76650
|
+
slices: ["active-file", "fileTree"],
|
|
76651
|
+
tools: [fileEditingPanelTools[2]]
|
|
76652
|
+
// openMarkdownTool
|
|
76653
|
+
},
|
|
76654
|
+
component: MDXEditorPanel,
|
|
76655
|
+
onMount: async (context) => {
|
|
76656
|
+
var _a2;
|
|
76657
|
+
console.log(
|
|
76658
|
+
"MDX Editor Panel mounted",
|
|
76659
|
+
(_a2 = context.currentScope.repository) == null ? void 0 : _a2.path
|
|
76660
|
+
);
|
|
76661
|
+
},
|
|
76662
|
+
onUnmount: async (_context) => {
|
|
76663
|
+
console.log("MDX Editor Panel unmounting");
|
|
76664
|
+
}
|
|
76665
|
+
}
|
|
76666
|
+
];
|
|
76667
|
+
const onPackageLoad = async () => {
|
|
76668
|
+
console.log("Panel package loaded - File Editing Panels");
|
|
76669
|
+
};
|
|
76670
|
+
const onPackageUnload = async () => {
|
|
76671
|
+
console.log("Panel package unloading - File Editing Panels");
|
|
76672
|
+
};
|
|
76298
76673
|
export {
|
|
76674
|
+
fileEditingPanelToolsMetadata as A,
|
|
76675
|
+
openFileTool as B,
|
|
76299
76676
|
ContextTracker as C,
|
|
76677
|
+
viewDiffTool as D,
|
|
76300
76678
|
ExternalTokenizer as E,
|
|
76301
|
-
|
|
76302
|
-
|
|
76679
|
+
openMarkdownTool as F,
|
|
76680
|
+
FileEditorPanel as G,
|
|
76681
|
+
FileEditorPanelPreview as H,
|
|
76303
76682
|
IterMode as I,
|
|
76683
|
+
GitDiffPanel as J,
|
|
76684
|
+
GitDiffPanelPreview as K,
|
|
76304
76685
|
LanguageSupport as L,
|
|
76305
76686
|
MDXEditorPanel as M,
|
|
76306
76687
|
NodeWeakMap as N,
|
|
76688
|
+
MDXEditorPanelPreview as O,
|
|
76307
76689
|
LRLanguage as a,
|
|
76308
76690
|
LRParser as b,
|
|
76309
76691
|
continuedIndent as c,
|
|
@@ -76326,8 +76708,9 @@ export {
|
|
|
76326
76708
|
tags$1 as t,
|
|
76327
76709
|
bracketMatchingHandle as u,
|
|
76328
76710
|
javascriptLanguage as v,
|
|
76329
|
-
|
|
76330
|
-
|
|
76331
|
-
|
|
76711
|
+
panels as w,
|
|
76712
|
+
onPackageLoad as x,
|
|
76713
|
+
onPackageUnload as y,
|
|
76714
|
+
fileEditingPanelTools as z
|
|
76332
76715
|
};
|
|
76333
|
-
//# sourceMappingURL=index-
|
|
76716
|
+
//# sourceMappingURL=index-DLyieo0R.js.map
|