@lvce-editor/renderer-process 30.64.11 → 30.64.12
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/rendererProcessMain.js +33 -4
- package/package.json +1 -1
|
@@ -4641,6 +4641,9 @@ const addCssStyleSheet = (id, text) => {
|
|
|
4641
4641
|
if (existing) {
|
|
4642
4642
|
existing.replaceSync(text);
|
|
4643
4643
|
setText$1(id, text);
|
|
4644
|
+
if (id === 'ContributedColorTheme') {
|
|
4645
|
+
window.dispatchEvent(new Event('color-theme-changed'));
|
|
4646
|
+
}
|
|
4644
4647
|
return;
|
|
4645
4648
|
}
|
|
4646
4649
|
const sheet = new CSSStyleSheet({});
|
|
@@ -4648,6 +4651,9 @@ const addCssStyleSheet = (id, text) => {
|
|
|
4648
4651
|
setText$1(id, text);
|
|
4649
4652
|
sheet.replaceSync(text);
|
|
4650
4653
|
document.adoptedStyleSheets.push(sheet);
|
|
4654
|
+
if (id === 'ContributedColorTheme') {
|
|
4655
|
+
window.dispatchEvent(new Event('color-theme-changed'));
|
|
4656
|
+
}
|
|
4651
4657
|
};
|
|
4652
4658
|
const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
|
|
4653
4659
|
const sheet = get$5(id);
|
|
@@ -12329,6 +12335,24 @@ const ready = main();
|
|
|
12329
12335
|
|
|
12330
12336
|
const defaultColumns = 80;
|
|
12331
12337
|
const defaultRows = 24;
|
|
12338
|
+
const terminalAnsiColors = [['black', 'Black'], ['red', 'Red'], ['green', 'Green'], ['yellow', 'Yellow'], ['blue', 'Blue'], ['magenta', 'Magenta'], ['cyan', 'Cyan'], ['white', 'White'], ['brightBlack', 'BrightBlack'], ['brightRed', 'BrightRed'], ['brightGreen', 'BrightGreen'], ['brightYellow', 'BrightYellow'], ['brightBlue', 'BrightBlue'], ['brightMagenta', 'BrightMagenta'], ['brightCyan', 'BrightCyan'], ['brightWhite', 'BrightWhite']];
|
|
12339
|
+
const getTerminalTheme = () => {
|
|
12340
|
+
const getColor = key => getComputedStyle(document.documentElement).getPropertyValue(`--${key}`).trim();
|
|
12341
|
+
const theme = {
|
|
12342
|
+
background: 'rgba(0, 0, 0, 0)'
|
|
12343
|
+
};
|
|
12344
|
+
const foreground = getColor('TerminalForeground') || getColor('WorkbenchForeground');
|
|
12345
|
+
if (foreground) {
|
|
12346
|
+
theme.foreground = foreground;
|
|
12347
|
+
}
|
|
12348
|
+
for (const [xtermColor, themeColor] of terminalAnsiColors) {
|
|
12349
|
+
const color = getColor(`TerminalAnsi${themeColor}`);
|
|
12350
|
+
if (color) {
|
|
12351
|
+
theme[xtermColor] = color;
|
|
12352
|
+
}
|
|
12353
|
+
}
|
|
12354
|
+
return theme;
|
|
12355
|
+
};
|
|
12332
12356
|
const createTerminal = async uid => {
|
|
12333
12357
|
const [{
|
|
12334
12358
|
FitAddon
|
|
@@ -12344,9 +12368,7 @@ const createTerminal = async uid => {
|
|
|
12344
12368
|
convertEol: true,
|
|
12345
12369
|
cursorBlink: true,
|
|
12346
12370
|
rows: defaultRows,
|
|
12347
|
-
theme:
|
|
12348
|
-
background: 'rgba(0, 0, 0, 0)'
|
|
12349
|
-
}
|
|
12371
|
+
theme: getTerminalTheme()
|
|
12350
12372
|
});
|
|
12351
12373
|
const fitAddon = new FitAddon();
|
|
12352
12374
|
terminal.loadAddon(fitAddon);
|
|
@@ -12403,6 +12425,11 @@ const mountTerminal = async (state, uid) => {
|
|
|
12403
12425
|
rows
|
|
12404
12426
|
});
|
|
12405
12427
|
});
|
|
12428
|
+
const updateTheme = () => {
|
|
12429
|
+
terminal.options.theme = getTerminalTheme();
|
|
12430
|
+
};
|
|
12431
|
+
window.addEventListener('color-theme-changed', updateTheme);
|
|
12432
|
+
updateTheme();
|
|
12406
12433
|
terminal.open(state.$Viewlet);
|
|
12407
12434
|
const resizeObserver = new ResizeObserver(() => {
|
|
12408
12435
|
if (state.restoring) return;
|
|
@@ -12413,7 +12440,9 @@ const mountTerminal = async (state, uid) => {
|
|
|
12413
12440
|
state.fitAddon = fitAddon;
|
|
12414
12441
|
state.resizeObserver = resizeObserver;
|
|
12415
12442
|
state.terminal = terminal;
|
|
12416
|
-
state.disposables = [inputDisposable, resizeDisposable
|
|
12443
|
+
state.disposables = [inputDisposable, resizeDisposable, {
|
|
12444
|
+
dispose: () => window.removeEventListener('color-theme-changed', updateTheme)
|
|
12445
|
+
}];
|
|
12417
12446
|
fitAddon.fit();
|
|
12418
12447
|
flushPendingData(state);
|
|
12419
12448
|
focusIfConnected(state);
|