<commit_before>/*
 * React Intense v0.0.1
 * https://github.com/brycedorn/react-intense
 *
 * A port of the javascript library: https://github.com/tholman/intense-images
 *
 * Released under the MIT license
 * https://mit-license.org
 */

// https://gist.github.com/paulirish/1579671
(function() {
  var lastTime = 0;
  var vendors = ['webkit', 'moz'];
  for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
    window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
    window.cancelAnimationFrame =
      window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
  }

  if (!window.requestAnimationFrame)
    window.requestAnimationFrame = function(callback, element) {
      var currTime = new Date().getTime();
      var timeToCall = Math.max(0, 16 - (currTime - lastTime));
      var id = window.setTimeout(function() { callback(currTime + timeToCall); },
        timeToCall);
      lastTime = currTime + timeToCall;
      return id;
    };

  if (!window.cancelAnimationFrame)
    window.cancelAnimationFrame = function(id) {
      clearTimeout(id);
    };
}());

import React from 'react'

export default class ReactIntense extends React.Component {
  static propTypes = {
    caption: React.PropTypes.string,
    classes: React.PropTypes.string,
    src: React.PropTypes.string.isRequired,
    thumbnailSrc: React.PropTypes.string,
    title: React.PropTypes.string,
  }

  defaultProps = {
    invert: true,
    thumbnailSrc: this.props.src,
    vertical: false,
  }

  state = {
    bindingsApplied: false,
    container: {
      width: window.innerWidth,
      height: window.innerHeight,
    },
    lastPosition: 0,
    loaded: false,
    mouseDest: {
      x: 0,
      y: 0,
    },
    mouseCurr: {
      x: window.innerWidth / 2,
      y: window.innerHeight / 2,
    },
    overflow: {
      x: 0,
      y: 0,
    },
    overflowValue: document.body.style.overflow,
    target: {
      width: 0,
      height: 0,
    },
    visible: false,
  }

  // Manually set height & width
  setDimensions (target) {
    const { offsetHeight, offsetWidth } = target
    const { innerHeight, innerWidth } = window
    const container = this.state.container

    this.setState({
      overflow: {
        x: this.state.container.width - offsetWidth,
        y: this.state.container.height - offsetHeight,
      },
    })
  }

  positionTarget () {
    const { mouseCurr, mouseDest } = this.state

    const newX = mouseCurr.x + (mouseDest.x - mouseCurr.x) * 0.05
    const newY = mouseCurr.y + (mouseDest.y - mouseCurr.y) * 0.05

    if(newX && newY) {
      this.setState({
        mouseCurr: {<commit_msg>bump version<commit_after>/*
 * React Intense v0.0.3
 * https://github.com/brycedorn/react-intense
 *
 * A port of the javascript library: https://github.com/tholman/intense-images
 *
 * Released under the MIT license
 * https://mit-license.org
 */

// https://gist.github.com/paulirish/1579671
(function() {
  var lastTime = 0;
  var vendors = ['webkit', 'moz'];
  for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
    window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
    window.cancelAnimationFrame =
      window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
  }

  if (!window.requestAnimationFrame)
    window.requestAnimationFrame = function(callback, element) {
      var currTime = new Date().getTime();
      var timeToCall = Math.max(0, 16 - (currTime - lastTime));
      var id = window.setTimeout(function() { callback(currTime + timeToCall); },
        timeToCall);
      lastTime = currTime + timeToCall;
      return id;
    };

  if (!window.cancelAnimationFrame)
    window.cancelAnimationFrame = function(id) {
      clearTimeout(id);
    };
}());

import React from 'react'

export default class ReactIntense extends React.Component {
  static propTypes = {
    caption: React.PropTypes.string,
    classes: React.PropTypes.string,
    src: React.PropTypes.string.isRequired,
    thumbnailSrc: React.PropTypes.string,
    title: React.PropTypes.string,
  }

  defaultProps = {
    invert: true,
    thumbnailSrc: this.props.src,
    vertical: false,
  }

  state = {
    bindingsApplied: false,
    container: {
      width: window.innerWidth,
      height: window.innerHeight,
    },
    lastPosition: 0,
    loaded: false,
    mouseDest: {
      x: 0,
      y: 0,
    },
    mouseCurr: {
      x: window.innerWidth / 2,
      y: window.innerHeight / 2,
    },
    overflow: {
      x: 0,
      y: 0,
    },
    overflowValue: document.body.style.overflow,
    target: {
      width: 0,
      height: 0,
    },
    visible: false,
  }

  // Manually set height & width
  setDimensions (target) {
    const { offsetHeight, offsetWidth } = target

    this.setState({
      overflow: {
        x: this.state.container.width - offsetWidth,
        y: this.state.container.height - offsetHeight,
      },
    })
  }

  positionTarget () {
    const { mouseCurr, mouseDest } = this.state

    const newX = mouseCurr.x + (mouseDest.x - mouseCurr.x) * 0.05
    const newY = mouseCurr.y + (mouseDest.y - mouseCurr.y) * 0.05

    if(newX && newY) {
      this.setState({
        mouseCurr: {
{'fraction_non_alphanumeric': 0.13046771444802122, 'fraction_numerical': 0.011361484567316796, 'mean_word_length': 2.7275935074100213, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '5659718', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1696, 'n_words': 360}