@lvce-editor/renderer-process 30.64.10 → 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.
@@ -3487,18 +3487,20 @@ const render$2 = (element, eventMap, newEventMap) => {
3487
3487
 
3488
3488
  const renderInternal = ($Parent, elements, eventMap, newEventMap, renderElement = render$2) => {
3489
3489
  const max = elements.length - 1;
3490
- let stack = [];
3490
+ const stack = [];
3491
3491
  for (let i = max; i >= 0; i--) {
3492
3492
  const element = elements[i];
3493
3493
  const $Element = renderElement(element, eventMap, newEventMap);
3494
3494
  if (element.childCount > 0) {
3495
- // @ts-expect-error
3496
- $Element.append(...stack.slice(0, element.childCount));
3497
- stack = stack.slice(element.childCount);
3495
+ for (let child = 0; child < element.childCount; child++) {
3496
+ $Element.append(stack.pop());
3497
+ }
3498
3498
  }
3499
- stack.unshift($Element);
3499
+ stack.push($Element);
3500
+ }
3501
+ while (stack.length > 0) {
3502
+ $Parent.append(stack.pop());
3500
3503
  }
3501
- $Parent.append(...stack);
3502
3504
  };
3503
3505
 
3504
3506
  const renderInto$1 = ($Parent, dom, eventMap = {}) => {
@@ -4639,6 +4641,9 @@ const addCssStyleSheet = (id, text) => {
4639
4641
  if (existing) {
4640
4642
  existing.replaceSync(text);
4641
4643
  setText$1(id, text);
4644
+ if (id === 'ContributedColorTheme') {
4645
+ window.dispatchEvent(new Event('color-theme-changed'));
4646
+ }
4642
4647
  return;
4643
4648
  }
4644
4649
  const sheet = new CSSStyleSheet({});
@@ -4646,6 +4651,9 @@ const addCssStyleSheet = (id, text) => {
4646
4651
  setText$1(id, text);
4647
4652
  sheet.replaceSync(text);
4648
4653
  document.adoptedStyleSheets.push(sheet);
4654
+ if (id === 'ContributedColorTheme') {
4655
+ window.dispatchEvent(new Event('color-theme-changed'));
4656
+ }
4649
4657
  };
4650
4658
  const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
4651
4659
  const sheet = get$5(id);
@@ -12327,6 +12335,24 @@ const ready = main();
12327
12335
 
12328
12336
  const defaultColumns = 80;
12329
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
+ };
12330
12356
  const createTerminal = async uid => {
12331
12357
  const [{
12332
12358
  FitAddon
@@ -12342,9 +12368,7 @@ const createTerminal = async uid => {
12342
12368
  convertEol: true,
12343
12369
  cursorBlink: true,
12344
12370
  rows: defaultRows,
12345
- theme: {
12346
- background: 'rgba(0, 0, 0, 0)'
12347
- }
12371
+ theme: getTerminalTheme()
12348
12372
  });
12349
12373
  const fitAddon = new FitAddon();
12350
12374
  terminal.loadAddon(fitAddon);
@@ -12401,6 +12425,11 @@ const mountTerminal = async (state, uid) => {
12401
12425
  rows
12402
12426
  });
12403
12427
  });
12428
+ const updateTheme = () => {
12429
+ terminal.options.theme = getTerminalTheme();
12430
+ };
12431
+ window.addEventListener('color-theme-changed', updateTheme);
12432
+ updateTheme();
12404
12433
  terminal.open(state.$Viewlet);
12405
12434
  const resizeObserver = new ResizeObserver(() => {
12406
12435
  if (state.restoring) return;
@@ -12411,7 +12440,9 @@ const mountTerminal = async (state, uid) => {
12411
12440
  state.fitAddon = fitAddon;
12412
12441
  state.resizeObserver = resizeObserver;
12413
12442
  state.terminal = terminal;
12414
- state.disposables = [inputDisposable, resizeDisposable];
12443
+ state.disposables = [inputDisposable, resizeDisposable, {
12444
+ dispose: () => window.removeEventListener('color-theme-changed', updateTheme)
12445
+ }];
12415
12446
  fitAddon.fit();
12416
12447
  flushPendingData(state);
12417
12448
  focusIfConnected(state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.64.10",
3
+ "version": "30.64.12",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"