<commit_before>import app from '..';
import { ipcRenderer } from 'electron';
import {
  TABS_PADDING,
  TAB_ANIMATION_DURATION,
  TOOLBAR_HEIGHT,
} from '../constants';
import { closeWindow } from '../utils';
import { createElement } from 'ui';

let id = 0;

export class Tab {
  public root: HTMLElement;
  public title: HTMLElement;
  public rightBorder: HTMLElement;

  public tabGroupId = 0;
  public isClosing = false;
  public width = 0;
  public left = 0;
  public id = id++;

  constructor() {
    this.root = (
      <div className="tab" onMouseDown={this.onMouseDown}>
        <div className="tab-content">
          <div ref={r => (this.title = r)} className="tab-title">
            New tab
          </div>
        </div>
        <div
          className="tab-close"
          onClick={this.onCloseClick}
          onMouseDown={this.onCloseMouseDown}
        />
        <div className="tab-right-border" ref={r => (this.rightBorder = r)} />
      </div>
    ) as any;

    app.tabs.container.appendChild(this.root);

    ipcRenderer.send('browserview-create', this.id);

    requestAnimationFrame(this.tick);
  }

  public tick = () => {
    const { scrollLeft } = app.tabs.container;
    const { top, height } = this.root.getBoundingClientRect();

    if (
      app.mouse.x >= this.left - scrollLeft &&
      app.mouse.x <= this.left + this.width - scrollLeft &&
      app.mouse.y >= top &&
      app.mouse.y <= height + top - 1
    ) {
      this.onMouseEnter();
    } else {
      this.onMouseLeave();
    }

    if (!this.isClosing) {
      requestAnimationFrame(this.tick);
    }
  };

  public get selected() {
    return app.tabs.selectedTabId === this.id;
  }

  public get previousTab() {
    return app.tabs.list[app.tabs.list.indexOf(this) - 1];
  }

  public onMouseEnter = () => {
    this.root.classList.add('hover');

    const previousTab = this.previousTab;
    if (previousTab) {
      previousTab.rightBorder.style.display = 'none';
    }
  };

  public onMouseLeave = () => {<commit_msg>Small fix for tabs hover<commit_after>import app from '..';
import { ipcRenderer } from 'electron';
import {
  TABS_PADDING,
  TAB_ANIMATION_DURATION,
  TOOLBAR_HEIGHT,
} from '../constants';
import { closeWindow } from '../utils';
import { createElement } from 'ui';

let id = 0;

export class Tab {
  public root: HTMLElement;
  public title: HTMLElement;
  public rightBorder: HTMLElement;

  public tabGroupId = 0;
  public isClosing = false;
  public width = 0;
  public left = 0;
  public id = id++;

  constructor() {
    this.root = (
      <div className="tab" onMouseDown={this.onMouseDown}>
        <div className="tab-content">
          <div ref={r => (this.title = r)} className="tab-title">
            New tab
          </div>
        </div>
        <div
          className="tab-close"
          onClick={this.onCloseClick}
          onMouseDown={this.onCloseMouseDown}
        />
        <div className="tab-right-border" ref={r => (this.rightBorder = r)} />
      </div>
    ) as any;

    app.tabs.container.appendChild(this.root);

    ipcRenderer.send('browserview-create', this.id);

    requestAnimationFrame(this.tick);
  }

  public tick = () => {
    const { scrollLeft } = app.tabs.container;
    const { top, height, left, width } = this.root.getBoundingClientRect();

    if (
      app.mouse.x >= left - scrollLeft &&
      app.mouse.x <= left + width - scrollLeft &&
      app.mouse.y >= top &&
      app.mouse.y <= height + top - 1
    ) {
      this.onMouseEnter();
    } else {
      this.onMouseLeave();
    }

    if (!this.isClosing) {
      requestAnimationFrame(this.tick);
    }
  };

  public get selected() {
    return app.tabs.selectedTabId === this.id;
  }

  public get previousTab() {
    return app.tabs.list[app.tabs.list.indexOf(this) - 1];
  }

  public onMouseEnter = () => {
    this.root.classList.add('hover');

    const previousTab = this.previousTab;
    if (previousTab) {
      previousTab.rightBorder.style.display = 'none';
    }
  };

  public onMouseLeave = () => {
{'fraction_non_alphanumeric': 0.1463836089854357, 'fraction_numerical': 0.0029622315477659837, 'mean_word_length': 2.487091222030981, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1187453', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1302, 'n_words': 278}