<commit_before>import { Directive, Input, TemplateRef, OnDestroy, ElementRef, NgZone, ChangeDetectorRef } from '@angular/core';
import { LyTheme2, LY_COMMON_STYLES, LyOverlay, OverlayFromTemplateRef, Platform, LyFocusState, ThemeVariables, WindowScrollService } from '@alyle/ui';
import { Subscription } from 'rxjs';

const STYLE_PRIORITY = -2;
const styles = ({
  root: {
    ...LY_COMMON_STYLES.fill
  }
});

@Directive({
  selector: '[lyTooltip]',
  exportAs: 'lyTooltip'
})
export class LyTooltip implements OnDestroy {
  readonly classes = this._theme.addStyleSheet(styles, STYLE_PRIORITY);
  private _tooltip: string | TemplateRef<any> | null;
  private _tooltipOverlay: OverlayFromTemplateRef;
  private _listeners = new Map<string, EventListenerOrEventListenerObject>();
  private _scrollSub: Subscription;
  // private _scrollVal = 0;
  private _showTimeoutId: number | null;
  private _hideTimeoutId: number | null;
  @Input('lyTooltip')
  set tooltip(val: string | TemplateRef<any>) {
    this._tooltip = val;
  }
  get tooltip() {
    return this._tooltip;
  }
  @Input() lyTooltipShowDelay: number = 0;
  @Input() lyTooltipHideDelay: number = 1000;
  constructor(
    private _theme: LyTheme2,
    private _overlay: LyOverlay,
    private _el: ElementRef,
    private _cd: ChangeDetectorRef,
    focusState: LyFocusState,
    ngZone: NgZone,
    scroll: WindowScrollService
  ) {
    if (Platform.isBrowser) {
      const element: HTMLElement = _el.nativeElement;
      if (!Platform.IOS && !Platform.ANDROID) {
        this._listeners
          .set('mouseenter', () => this.show())
          .set('mouseleave', () => this.hide());
      } else {
        this._listeners.set('touchstart', () => this.show());
      }

      this._listeners.forEach((listener, event) => element.addEventListener(event, listener));

      this._scrollSub = scroll.scroll$.subscribe(() => {
        if (this._tooltipOverlay) {
          // this._scrollVal++;
          // if (this._scrollVal > 10) {
            ngZone.run(() => this.hide(0));
            // this._scrollVal = 0;<commit_msg>chore(): change tooltip hide delay<commit_after>import { Directive, Input, TemplateRef, OnDestroy, ElementRef, NgZone, ChangeDetectorRef } from '@angular/core';
import { LyTheme2, LY_COMMON_STYLES, LyOverlay, OverlayFromTemplateRef, Platform, LyFocusState, ThemeVariables, WindowScrollService } from '@alyle/ui';
import { Subscription } from 'rxjs';

const STYLE_PRIORITY = -2;
const styles = ({
  root: {
    ...LY_COMMON_STYLES.fill
  }
});

@Directive({
  selector: '[lyTooltip]',
  exportAs: 'lyTooltip'
})
export class LyTooltip implements OnDestroy {
  readonly classes = this._theme.addStyleSheet(styles, STYLE_PRIORITY);
  private _tooltip: string | TemplateRef<any> | null;
  private _tooltipOverlay: OverlayFromTemplateRef;
  private _listeners = new Map<string, EventListenerOrEventListenerObject>();
  private _scrollSub: Subscription;
  // private _scrollVal = 0;
  private _showTimeoutId: number | null;
  private _hideTimeoutId: number | null;
  @Input('lyTooltip')
  set tooltip(val: string | TemplateRef<any>) {
    this._tooltip = val;
  }
  get tooltip() {
    return this._tooltip;
  }
  @Input() lyTooltipShowDelay: number = 0;
  @Input() lyTooltipHideDelay: number = 500;
  constructor(
    private _theme: LyTheme2,
    private _overlay: LyOverlay,
    private _el: ElementRef,
    private _cd: ChangeDetectorRef,
    focusState: LyFocusState,
    ngZone: NgZone,
    scroll: WindowScrollService
  ) {
    if (Platform.isBrowser) {
      const element: HTMLElement = _el.nativeElement;
      if (!Platform.IOS && !Platform.ANDROID) {
        this._listeners
          .set('mouseenter', () => this.show())
          .set('mouseleave', () => this.hide());
      } else {
        this._listeners.set('touchstart', () => this.show());
      }

      this._listeners.forEach((listener, event) => element.addEventListener(event, listener));

      this._scrollSub = scroll.scroll$.subscribe(() => {
        if (this._tooltipOverlay) {
          // this._scrollVal++;
          // if (this._scrollVal > 10) {
            ngZone.run(() => this.hide(0));
            // this._scrollVal = 0;
{'fraction_non_alphanumeric': 0.13007159904534607, 'fraction_numerical': 0.0059665871121718375, 'mean_word_length': 3.560391730141458, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '1432248', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1286, 'n_words': 291}