<commit_before>import * as React from 'react'

import { List, ClickSource, SelectionSource } from '../list'
import { IMenu, MenuItem } from '../../models/app-menu'
import { MenuListItem } from './menu-list-item'

interface IMenuPaneProps {
  readonly depth: number
  readonly menu: IMenu
  readonly onItemClicked: (item: MenuItem) => void
  readonly onItemKeyDown: (depth: number, item: MenuItem, event: React.KeyboardEvent<any>) => void
  readonly onSelectionChanged: (depth: number, item: MenuItem, source: SelectionSource) => void
  readonly onMouseEnter: (depth: number) => void
}

const RowHeight = 30

export class MenuPane extends React.Component<IMenuPaneProps, void> {

  private list: List

  private renderMenuItem = (row: number) => {
    const item = this.props.menu.items[row]

    return <MenuListItem item={item} />
  }

  private onRowClick = (row: number, source: ClickSource) => {
    const item = this.props.menu.items[row]
    this.props.onItemClicked(item)
  }

  private onSelectionChanged = (row: number, source: SelectionSource) => {
    const item = this.props.menu.items[row]
    this.props.onSelectionChanged(this.props.depth, item, source)
  }

  private onRowKeyDown = (row: number, event: React.KeyboardEvent<any>) => {
    const item = this.props.menu.items[row]
    this.props.onItemKeyDown(this.props.depth, item, event)
  }

  private canSelectRow = (row: number) => {
    const item = this.props.menu.items[row]

    if (item.type === 'separator') { return false }

    return item.enabled && item.visible
  }

  private onListRef = (list: List) => {
    this.list = list
  }

  private onMouseEnter = (event: React.MouseEvent<any>) => {
    this.props.onMouseEnter(this.props.depth)
  }

  public render(): JSX.Element {

    const selectedItem = this.props.menu.selectedItem
<commit_msg>:art: locality<commit_after>import * as React from 'react'

import { List, ClickSource, SelectionSource } from '../list'
import { IMenu, MenuItem } from '../../models/app-menu'
import { MenuListItem } from './menu-list-item'

interface IMenuPaneProps {
  readonly depth: number
  readonly menu: IMenu
  readonly onItemClicked: (item: MenuItem) => void
  readonly onItemKeyDown: (depth: number, item: MenuItem, event: React.KeyboardEvent<any>) => void
  readonly onSelectionChanged: (depth: number, item: MenuItem, source: SelectionSource) => void
  readonly onMouseEnter: (depth: number) => void
}

const RowHeight = 30

export class MenuPane extends React.Component<IMenuPaneProps, void> {

  private list: List

  private onRowClick = (row: number, source: ClickSource) => {
    const item = this.props.menu.items[row]
    this.props.onItemClicked(item)
  }

  private onSelectionChanged = (row: number, source: SelectionSource) => {
    const item = this.props.menu.items[row]
    this.props.onSelectionChanged(this.props.depth, item, source)
  }

  private onRowKeyDown = (row: number, event: React.KeyboardEvent<any>) => {
    const item = this.props.menu.items[row]
    this.props.onItemKeyDown(this.props.depth, item, event)
  }

  private canSelectRow = (row: number) => {
    const item = this.props.menu.items[row]

    if (item.type === 'separator') { return false }

    return item.enabled && item.visible
  }

  private onListRef = (list: List) => {
    this.list = list
  }

  private onMouseEnter = (event: React.MouseEvent<any>) => {
    this.props.onMouseEnter(this.props.depth)
  }

  private renderMenuItem = (row: number) => {
    const item = this.props.menu.items[row]

    return <MenuListItem item={item} />
  }

  public render(): JSX.Element {

    const selectedItem = this.props.menu.selectedItem

{'fraction_non_alphanumeric': 0.13037523966036701, 'fraction_numerical': 0.0010955902492467817, 'mean_word_length': 3.8693333333333335, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 35, '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': '105795', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1126, 'n_words': 289}