<commit_before>import {Transition} from './transition';
import {Animation} from '../animations/animation';

const DURATION = 550;
const EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
const OPACITY = 'opacity';
const TRANSLATEX = 'translateX';
const OFF_RIGHT = '99.5%';
const OFF_LEFT = '-33%';
const CENTER = '0%'
const OFF_OPACITY = 0.8;
const SHOW_NAVBAR_CSS = 'show-navbar';
const SHOW_VIEW_CSS = 'show-view';
const SHOW_BACK_BTN_CSS = 'show-back-button';


class IOSTransition extends Animation {

  constructor(navCtrl, opts) {
    super(null, opts);

    this.duration(DURATION);
    this.easing(EASING);

    // what direction is the transition going
    let backDirection = (opts.direction === 'back');

    // get entering/leaving views
    let enteringView = navCtrl.getStagedEnteringView();
    let leavingView = navCtrl.getStagedLeavingView();

    // do they have navbars?
    let enteringHasNavbar = enteringView.hasNavbar();
    let leavingHasNavbar = leavingView && leavingView.hasNavbar();


    // entering content
    let enteringContent = new Animation(enteringView.contentRef());
    enteringContent
      .before.addClass(SHOW_VIEW_CSS)
      .before.setStyles({ zIndex: enteringView.index });
    this.add(enteringContent);

    if (backDirection) {
      // back direction
      enteringContent
        .fromTo(TRANSLATEX, OFF_LEFT, CENTER)
        .fromTo(OPACITY, OFF_OPACITY, 1);

    } else {
      // forward direction
      enteringContent
        .fromTo(TRANSLATEX, OFF_RIGHT, CENTER)
        .fromTo(OPACITY, 1, 1);
    }


    // entering navbar
    if (enteringHasNavbar) {
      let enteringNavBar = new Animation(enteringView.navbarRef());
      enteringNavBar.before.addClass(SHOW_NAVBAR_CSS);
      this.add(enteringNavBar);

      let enteringTitle = new Animation(enteringView.titleRef());
      let enteringNavbarItems = new Animation(enteringView.navbarItemRefs());
      let enteringNavbarBg = new Animation(enteringView.navbarBgRef());
      let enteringBackButton = new Animation(enteringView.backBtnRef());
      enteringNavBar
        .add(enteringTitle)
        .add(enteringNavbarItems)
        .add(enteringNavbarBg)
        .add(enteringBackButton);

      enteringTitle.fadeIn();
      enteringNavbarItems.fadeIn();

      // set properties depending on direction
      if (backDirection) {
        // back direction
        enteringTitle.fromTo(TRANSLATEX, OFF_LEFT, CENTER);
        enteringNavbarBg.fromTo(TRANSLATEX, OFF_LEFT, CENTER);

      } else {
        // forward direction
        enteringTitle.fromTo(TRANSLATEX, OFF_RIGHT, CENTER);
        enteringNavbarBg.fromTo(TRANSLATEX, OFF_RIGHT, CENTER);

        if (enteringView.enableBack()) {
          enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS);
          enteringBackButton.fadeIn();<commit_msg>fix(backbone): iOS back button fade in on back direction<commit_after>import {Transition} from './transition';
import {Animation} from '../animations/animation';

const DURATION = 550;
const EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
const OPACITY = 'opacity';
const TRANSLATEX = 'translateX';
const OFF_RIGHT = '99.5%';
const OFF_LEFT = '-33%';
const CENTER = '0%'
const OFF_OPACITY = 0.8;
const SHOW_NAVBAR_CSS = 'show-navbar';
const SHOW_VIEW_CSS = 'show-view';
const SHOW_BACK_BTN_CSS = 'show-back-button';


class IOSTransition extends Animation {

  constructor(navCtrl, opts) {
    super(null, opts);

    this.duration(DURATION);
    this.easing(EASING);

    // what direction is the transition going
    let backDirection = (opts.direction === 'back');

    // get entering/leaving views
    let enteringView = navCtrl.getStagedEnteringView();
    let leavingView = navCtrl.getStagedLeavingView();

    // do they have navbars?
    let enteringHasNavbar = enteringView.hasNavbar();
    let leavingHasNavbar = leavingView && leavingView.hasNavbar();


    // entering content
    let enteringContent = new Animation(enteringView.contentRef());
    enteringContent
      .before.addClass(SHOW_VIEW_CSS)
      .before.setStyles({ zIndex: enteringView.index });
    this.add(enteringContent);

    if (backDirection) {
      // back direction
      enteringContent
        .fromTo(TRANSLATEX, OFF_LEFT, CENTER)
        .fromTo(OPACITY, OFF_OPACITY, 1);

    } else {
      // forward direction
      enteringContent
        .fromTo(TRANSLATEX, OFF_RIGHT, CENTER)
        .fromTo(OPACITY, 1, 1);
    }


    // entering navbar
    if (enteringHasNavbar) {
      let enteringNavBar = new Animation(enteringView.navbarRef());
      enteringNavBar.before.addClass(SHOW_NAVBAR_CSS);
      this.add(enteringNavBar);

      let enteringTitle = new Animation(enteringView.titleRef());
      let enteringNavbarItems = new Animation(enteringView.navbarItemRefs());
      let enteringNavbarBg = new Animation(enteringView.navbarBgRef());
      let enteringBackButton = new Animation(enteringView.backBtnRef());
      enteringNavBar
        .add(enteringTitle)
        .add(enteringNavbarItems)
        .add(enteringNavbarBg)
        .add(enteringBackButton);

      enteringTitle.fadeIn();
      enteringNavbarItems.fadeIn();

      // set properties depending on direction
      if (backDirection) {
        // back direction
        enteringTitle.fromTo(TRANSLATEX, OFF_LEFT, CENTER);
        enteringNavbarBg.fromTo(TRANSLATEX, OFF_LEFT, CENTER);
        if (enteringView.enableBack()) {
          enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS);
          enteringBackButton.fadeIn();
        }

      } else {
        // forward direction
        enteringTitle.fromTo(TRANSLATEX, OFF_RIGHT, CENTER);
        enteringNavbarBg.fromTo(TRANSLATEX, OFF_RIGHT, CENTER);

        if (enteringView.enableBack()) {
          enteringBackButton.before.addClass(SHOW_BACK_BTN_CSS);
          enteringBackButton.fadeIn();
{'fraction_non_alphanumeric': 0.11025377229080932, 'fraction_numerical': 0.00823045267489712, 'mean_word_length': 3.2858192505510653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6796974', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1792, 'n_words': 361}