<commit_before>import React from 'react'
import KeyStepper from './KeyStepper'
import ifit from './ifit'
import {getParentTimeline, getParentTrack} from './utils'

export default function createParamSettings(connect) {
  if (!connect.value || connect.value.type !== 'param') {
    return null
  }

  const param = connect.value
  const track = getParentTrack(connect)
  const timeline = getParentTimeline(connect)

  const input = {
    value: getParamValue,
    onChange: setParamValue
  }
  const settings = {
    selector: 'all',
    extraInputs: [input],
    buttons: [{
      getElement: connect => {
        return <KeyStepper
          keyHolderId = {param.id}
          timelineId = {timeline.id}
        />
      }
    }],
    contextMenu: {
      items: ['foo', 'bar', 'qux']
    }
  }

  ifit(connect.value.name)
    .is('x,y,z,transformOriginZ', () => {
      input.type = 'number'
      input.addonLabel = 'px'
      input.precision = 2
    })
    .is('scaleX,scaleY,scaleZ', () => {
      input.type = 'number'
      input.dragSpeed = 0.01
      input.precision = 2
    })
    .is('rotationX,rotationY,rotationZ', () => {
      input.addonLabel = 'deg'
      input.precision = 1
    })
    .is('transformOriginX,transformOriginY', () => {
      input.addonLabel = '%'
      input.dragSpeed = 0.01
      input.precision = 5
    })
    .is('xPercent,yPercent', () => {
      input.dragSpeed = 1
      input.precision = 1
    })
    .is('color,borderColorTop,borderColorRight,borderColorBottom,borderColorLeft,backgroundColor', () => {
      input.type = 'color'
    })<commit_msg>[timeline-tab] make params renamable in place<commit_after>import React from 'react'
import KeyStepper from './KeyStepper'
import ifit from './ifit'
import {getParentTimeline, getParentTrack} from './utils'

export default function createParamSettings(connect) {
  if (!connect.value || connect.value.type !== 'param') {
    return null
  }

  const param = connect.value
  const track = getParentTrack(connect)
  const timeline = getParentTimeline(connect)

  const input = {
    value: getParamValue,
    onChange: setParamValue
  }
  const nameInput = {
    value: connect => connect.value.name,
    mod: {kind: 'stamp'},
    onChange: (value, connect) => {
      const {setNameOfParam} = BETON.require('project-manager').actions
      setNameOfParam({name: value, paramId: connect.value.id})
    }
  }
  const settings = {
    selector: 'all',
    label: null,
    extraInputs: [nameInput, input],
    buttons: [{
      getElement: connect => {
        return <KeyStepper
          keyHolderId = {param.id}
          timelineId = {timeline.id}
        />
      }
    }]
  }

  ifit(connect.value.name)
    .is('x,y,z,transformOriginZ', () => {
      input.type = 'number'
      input.addonLabel = 'px'
      input.precision = 2
    })
    .is('scaleX,scaleY,scaleZ', () => {
      input.type = 'number'
      input.dragSpeed = 0.01
      input.precision = 2
    })
    .is('rotationX,rotationY,rotationZ', () => {
      input.addonLabel = 'deg'
      input.precision = 1
    })
    .is('transformOriginX,transformOriginY', () => {
      input.addonLabel = '%'
      input.dragSpeed = 0.01
      input.precision = 5
    })
    .is('xPercent,yPercent', () => {
      input.dragSpeed = 1
      input.precision = 1
    })
    .is('color,borderColorTop,borderColorRight,borderColorBottom,borderColorLeft,backgroundColor', () => {
      input.type = 'color'
    })
{'fraction_non_alphanumeric': 0.14418066010422698, 'fraction_numerical': 0.006948465547191662, 'mean_word_length': 2.675531914893617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '5932369', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1094, 'n_words': 213}