<commit_before>grabetha
========

## What

Grabetha is a fairly raw grab and drop library to help solve the grabbing and dropping of UI's that are based on data.

That said, a UI does not need to be data-driven for grabetha to work.

Usage:

    npm install grabetha.

Require grabetha:

```javascript
var grabetha = require('grabetha');
```

Create a grabbable set:

### grabetha.grabbable(element or selector)

```javascript
var grabbableStuff = grabetha.grabbable('.things .stuff');
```

Assign handlers to the set:

```javascript
grabbableStuff.on('grab', function(grab){
    // 'grab' gets raised once when a grabbable item is grabbed.

    // you can put stuff on the grabbableStuff object that is passed in,
    // as it lives throughout the lifecycle of the interaction.
    // the grabbableStuff object is also passed to any droppable instances
    // that it is hovered over or dropped onto.

    // Use the ghost helper to easily create
    // a ghost version of the thing you are grabbing.
    this.ghost = this.createGhost();

    // Listen to move events
    grab.on('move', function(){
        // a 'move' is raised every mousemove or touchmove

        //Do something
    });
})
// Listen to the drop
.on('drop', function(position){
    // a drop is raised on mouseup or touchend

    // Cleanup the ghost.
    this.ghost.destroy();
    this.ghost = null
});
```

Create a droppable set:

### grabetha.droppable(element or selector)

```javascript
var dropArea = grabetha.droppable('.majigger');
```

Assign handlers

```javascript
dropArea.on('hover', function(event){
    // the droppable element it is over
    event.taget;

    // the grabbale instance that is over it.
    event.grabbable;

    // the location of the grab
    event.position;
})
.on('drop', function(event){
    // the same stuff as above is accessable here.
    console.log(event);
});
```

Initialise the sets
```javascript
grabbableStuff.init();
dropArea.init();
```<commit_msg>remove init step from readme<commit_after>grabetha
========

## What

Grabetha is a fairly raw grab and drop library to help solve the grabbing and dropping of UI's that are based on data.

That said, a UI does not need to be data-driven for grabetha to work.

Usage:

    npm install grabetha.

Require grabetha:

```javascript
var grabetha = require('grabetha');
```

Create a grabbable set:

### grabetha.grabbable(element or selector)

```javascript
var grabbableStuff = grabetha.grabbable('.things .stuff');
```

Assign handlers to the set:

```javascript
grabbableStuff.on('grab', function(grab){
    // 'grab' gets raised once when a grabbable item is grabbed.

    // you can put stuff on the grabbableStuff object that is passed in,
    // as it lives throughout the lifecycle of the interaction.
    // the grabbableStuff object is also passed to any droppable instances
    // that it is hovered over or dropped onto.

    // Use the ghost helper to easily create
    // a ghost version of the thing you are grabbing.
    this.ghost = this.createGhost();

    // Listen to move events
    grab.on('move', function(){
        // a 'move' is raised every mousemove or touchmove

        //Do something
    });
})
// Listen to the drop
.on('drop', function(position){
    // a drop is raised on mouseup or touchend

    // Cleanup the ghost.
    this.ghost.destroy();
    this.ghost = null
});
```

Create a droppable set:

### grabetha.droppable(element or selector)

```javascript
var dropArea = grabetha.droppable('.majigger');
```

Assign handlers

```javascript
dropArea.on('hover', function(event){
    // the droppable element it is over
    event.taget;

    // the grabbale instance that is over it.
    event.grabbable;

    // the location of the grab
    event.position;
})
.on('drop', function(event){
    // the same stuff as above is accessable here.
    console.log(event);
});
```
{'fraction_non_alphanumeric': 0.11254517294785751, 'fraction_numerical': 0.0, 'mean_word_length': 3.180151024811219, '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': '392716', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1159, 'n_words': 450}