draggable-rails 0.1.1 → 1.0.0.pre.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +19 -10
 - data/lib/draggable/rails/version.rb +1 -1
 - data/vendor/assets/javascripts/draggable.js +5602 -383
 - metadata +4 -28
 - data/vendor/assets/javascripts/behaviour/collidable.js +0 -99
 - data/vendor/assets/javascripts/behaviour/snappable.js +0 -107
 - data/vendor/assets/javascripts/core/accessibility.js +0 -58
 - data/vendor/assets/javascripts/core/mirror.js +0 -129
 - data/vendor/assets/javascripts/droppable.js +0 -168
 - data/vendor/assets/javascripts/events/abstract-event.js +0 -45
 - data/vendor/assets/javascripts/events/collidable-event.js +0 -25
 - data/vendor/assets/javascripts/events/drag-event.js +0 -91
 - data/vendor/assets/javascripts/events/draggable-event.js +0 -17
 - data/vendor/assets/javascripts/events/droppable-event.js +0 -21
 - data/vendor/assets/javascripts/events/mirror-event.js +0 -43
 - data/vendor/assets/javascripts/events/sensor-event.js +0 -47
 - data/vendor/assets/javascripts/events/snappable-event.js +0 -15
 - data/vendor/assets/javascripts/events/sortable-event.js +0 -35
 - data/vendor/assets/javascripts/events/swappable-event.js +0 -23
 - data/vendor/assets/javascripts/index.js +0 -18
 - data/vendor/assets/javascripts/sensors/drag-sensor.js +0 -158
 - data/vendor/assets/javascripts/sensors/force-touch-sensor.js +0 -166
 - data/vendor/assets/javascripts/sensors/mouse-sensor.js +0 -110
 - data/vendor/assets/javascripts/sensors/sensor.js +0 -23
 - data/vendor/assets/javascripts/sensors/touch-sensor.js +0 -145
 - data/vendor/assets/javascripts/sortable.js +0 -161
 - data/vendor/assets/javascripts/swappable.js +0 -104
 - data/vendor/assets/javascripts/utils.js +0 -52
 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: draggable-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0.pre.beta
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mohammed Sadiq
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-09-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -73,31 +73,7 @@ files: 
     | 
|
| 
       73 
73 
     | 
    
         
             
            - lib/draggable/rails.rb
         
     | 
| 
       74 
74 
     | 
    
         
             
            - lib/draggable/rails/version.rb
         
     | 
| 
       75 
75 
     | 
    
         
             
            - vendor/assets/javascripts/.keep
         
     | 
| 
       76 
     | 
    
         
            -
            - vendor/assets/javascripts/behaviour/collidable.js
         
     | 
| 
       77 
     | 
    
         
            -
            - vendor/assets/javascripts/behaviour/snappable.js
         
     | 
| 
       78 
     | 
    
         
            -
            - vendor/assets/javascripts/core/accessibility.js
         
     | 
| 
       79 
     | 
    
         
            -
            - vendor/assets/javascripts/core/mirror.js
         
     | 
| 
       80 
76 
     | 
    
         
             
            - vendor/assets/javascripts/draggable.js
         
     | 
| 
       81 
     | 
    
         
            -
            - vendor/assets/javascripts/droppable.js
         
     | 
| 
       82 
     | 
    
         
            -
            - vendor/assets/javascripts/events/abstract-event.js
         
     | 
| 
       83 
     | 
    
         
            -
            - vendor/assets/javascripts/events/collidable-event.js
         
     | 
| 
       84 
     | 
    
         
            -
            - vendor/assets/javascripts/events/drag-event.js
         
     | 
| 
       85 
     | 
    
         
            -
            - vendor/assets/javascripts/events/draggable-event.js
         
     | 
| 
       86 
     | 
    
         
            -
            - vendor/assets/javascripts/events/droppable-event.js
         
     | 
| 
       87 
     | 
    
         
            -
            - vendor/assets/javascripts/events/mirror-event.js
         
     | 
| 
       88 
     | 
    
         
            -
            - vendor/assets/javascripts/events/sensor-event.js
         
     | 
| 
       89 
     | 
    
         
            -
            - vendor/assets/javascripts/events/snappable-event.js
         
     | 
| 
       90 
     | 
    
         
            -
            - vendor/assets/javascripts/events/sortable-event.js
         
     | 
| 
       91 
     | 
    
         
            -
            - vendor/assets/javascripts/events/swappable-event.js
         
     | 
| 
       92 
     | 
    
         
            -
            - vendor/assets/javascripts/index.js
         
     | 
| 
       93 
     | 
    
         
            -
            - vendor/assets/javascripts/sensors/drag-sensor.js
         
     | 
| 
       94 
     | 
    
         
            -
            - vendor/assets/javascripts/sensors/force-touch-sensor.js
         
     | 
| 
       95 
     | 
    
         
            -
            - vendor/assets/javascripts/sensors/mouse-sensor.js
         
     | 
| 
       96 
     | 
    
         
            -
            - vendor/assets/javascripts/sensors/sensor.js
         
     | 
| 
       97 
     | 
    
         
            -
            - vendor/assets/javascripts/sensors/touch-sensor.js
         
     | 
| 
       98 
     | 
    
         
            -
            - vendor/assets/javascripts/sortable.js
         
     | 
| 
       99 
     | 
    
         
            -
            - vendor/assets/javascripts/swappable.js
         
     | 
| 
       100 
     | 
    
         
            -
            - vendor/assets/javascripts/utils.js
         
     | 
| 
       101 
77 
     | 
    
         
             
            - vendor/assets/stylesheets/.keep
         
     | 
| 
       102 
78 
     | 
    
         
             
            homepage: https://github.com/sadiqmmm/draggable-rails
         
     | 
| 
       103 
79 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -114,9 +90,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       114 
90 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       115 
91 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       116 
92 
     | 
    
         
             
              requirements:
         
     | 
| 
       117 
     | 
    
         
            -
              - - " 
     | 
| 
      
 93 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       118 
94 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       119 
     | 
    
         
            -
                  version:  
     | 
| 
      
 95 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       120 
96 
     | 
    
         
             
            requirements: []
         
     | 
| 
       121 
97 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       122 
98 
     | 
    
         
             
            rubygems_version: 2.6.13
         
     | 
| 
         @@ -1,99 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import {closest} from './../utils';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            import {
         
     | 
| 
       4 
     | 
    
         
            -
              CollidableInEvent,
         
     | 
| 
       5 
     | 
    
         
            -
              CollidableOutEvent,
         
     | 
| 
       6 
     | 
    
         
            -
            } from './../events/collidable-event';
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            export default class Collidable {
         
     | 
| 
       9 
     | 
    
         
            -
              constructor(draggable) {
         
     | 
| 
       10 
     | 
    
         
            -
                this.draggable = draggable;
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                this._onDragMove = this._onDragMove.bind(this);
         
     | 
| 
       13 
     | 
    
         
            -
                this._onDragStop = this._onDragStop.bind(this);
         
     | 
| 
       14 
     | 
    
         
            -
                this._onRequestAnimationFrame = this._onRequestAnimationFrame.bind(this);
         
     | 
| 
       15 
     | 
    
         
            -
              }
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              attach() {
         
     | 
| 
       18 
     | 
    
         
            -
                this.draggable.on('drag:move', this._onDragMove);
         
     | 
| 
       19 
     | 
    
         
            -
                this.draggable.on('drag:stop', this._onDragStop);
         
     | 
| 
       20 
     | 
    
         
            -
              }
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              detach() {
         
     | 
| 
       23 
     | 
    
         
            -
                this.draggable.off('drag:move', this._onDragMove);
         
     | 
| 
       24 
     | 
    
         
            -
                this.draggable.off('drag:stop', this._onDragStop);
         
     | 
| 
       25 
     | 
    
         
            -
              }
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              _onDragMove(event) {
         
     | 
| 
       28 
     | 
    
         
            -
                const target = event.sensorEvent.target;
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                this.currentAnimationFrame = requestAnimationFrame(this._onRequestAnimationFrame(target));
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                if (this.currentlyCollidingElement) {
         
     | 
| 
       33 
     | 
    
         
            -
                  event.cancel();
         
     | 
| 
       34 
     | 
    
         
            -
                }
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                const collidableInEvent = new CollidableInEvent({
         
     | 
| 
       37 
     | 
    
         
            -
                  dragEvent: event,
         
     | 
| 
       38 
     | 
    
         
            -
                  collidingElement: this.currentlyCollidingElement,
         
     | 
| 
       39 
     | 
    
         
            -
                });
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                const collidableOutEvent = new CollidableOutEvent({
         
     | 
| 
       42 
     | 
    
         
            -
                  dragEvent: event,
         
     | 
| 
       43 
     | 
    
         
            -
                  collidingElement: this.lastCollidingElement,
         
     | 
| 
       44 
     | 
    
         
            -
                });
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                const enteringCollidable = Boolean(this.currentlyCollidingElement && this.lastCollidingElement !== this.currentlyCollidingElement);
         
     | 
| 
       47 
     | 
    
         
            -
                const leavingCollidable = Boolean(!this.currentlyCollidingElement && this.lastCollidingElement);
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                if (enteringCollidable) {
         
     | 
| 
       50 
     | 
    
         
            -
                  if (this.lastCollidingElement) {
         
     | 
| 
       51 
     | 
    
         
            -
                    this.draggable.triggerEvent(collidableOutEvent);
         
     | 
| 
       52 
     | 
    
         
            -
                  }
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                  this.draggable.triggerEvent(collidableInEvent);
         
     | 
| 
       55 
     | 
    
         
            -
                } else if (leavingCollidable) {
         
     | 
| 
       56 
     | 
    
         
            -
                  this.draggable.triggerEvent(collidableOutEvent);
         
     | 
| 
       57 
     | 
    
         
            -
                }
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                this.lastCollidingElement = this.currentlyCollidingElement;
         
     | 
| 
       60 
     | 
    
         
            -
              }
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
              _onDragStop(event) {
         
     | 
| 
       63 
     | 
    
         
            -
                const lastCollidingElement = this.currentlyCollidingElement || this.lastCollidingElement;
         
     | 
| 
       64 
     | 
    
         
            -
                const collidableOutEvent = new CollidableOutEvent({
         
     | 
| 
       65 
     | 
    
         
            -
                  dragEvent: event,
         
     | 
| 
       66 
     | 
    
         
            -
                  collidingElement: lastCollidingElement,
         
     | 
| 
       67 
     | 
    
         
            -
                });
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                if (lastCollidingElement) {
         
     | 
| 
       70 
     | 
    
         
            -
                  this.draggable.triggerEvent(collidableOutEvent);
         
     | 
| 
       71 
     | 
    
         
            -
                }
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                this.lastCollidingElement = null;
         
     | 
| 
       74 
     | 
    
         
            -
                this.currentlyCollidingElement = null;
         
     | 
| 
       75 
     | 
    
         
            -
              }
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
              _onRequestAnimationFrame(target) {
         
     | 
| 
       78 
     | 
    
         
            -
                return () => {
         
     | 
| 
       79 
     | 
    
         
            -
                  const collidables = this._getCollidables();
         
     | 
| 
       80 
     | 
    
         
            -
                  this.currentlyCollidingElement = closest(target, (element) => collidables.includes(element));
         
     | 
| 
       81 
     | 
    
         
            -
                };
         
     | 
| 
       82 
     | 
    
         
            -
              }
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
              _getCollidables() {
         
     | 
| 
       85 
     | 
    
         
            -
                const collidables = this.draggable.options.collidables;
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
                if (typeof collidables === 'string') {
         
     | 
| 
       88 
     | 
    
         
            -
                  return Array.prototype.slice.call(document.querySelectorAll(collidables));
         
     | 
| 
       89 
     | 
    
         
            -
                } else if (collidables instanceof NodeList || collidables instanceof Array) {
         
     | 
| 
       90 
     | 
    
         
            -
                  return Array.prototype.slice.call(collidables);
         
     | 
| 
       91 
     | 
    
         
            -
                } else if (collidables instanceof HTMLElement) {
         
     | 
| 
       92 
     | 
    
         
            -
                  return [collidables];
         
     | 
| 
       93 
     | 
    
         
            -
                } else if (typeof collidables === 'function') {
         
     | 
| 
       94 
     | 
    
         
            -
                  return collidables();
         
     | 
| 
       95 
     | 
    
         
            -
                } else {
         
     | 
| 
       96 
     | 
    
         
            -
                  return [];
         
     | 
| 
       97 
     | 
    
         
            -
                }
         
     | 
| 
       98 
     | 
    
         
            -
              }
         
     | 
| 
       99 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,107 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import {
         
     | 
| 
       2 
     | 
    
         
            -
              SnapInEvent,
         
     | 
| 
       3 
     | 
    
         
            -
              SnapOutEvent,
         
     | 
| 
       4 
     | 
    
         
            -
            } from './../events/snappable-event';
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            export default class Snappable {
         
     | 
| 
       7 
     | 
    
         
            -
              constructor(draggable) {
         
     | 
| 
       8 
     | 
    
         
            -
                this.draggable = draggable;
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                this._onDragStart = this._onDragStart.bind(this);
         
     | 
| 
       11 
     | 
    
         
            -
                this._onDragStop = this._onDragStop.bind(this);
         
     | 
| 
       12 
     | 
    
         
            -
                this._onDragOver = this._onDragOver.bind(this);
         
     | 
| 
       13 
     | 
    
         
            -
                this._onDragOut = this._onDragOut.bind(this);
         
     | 
| 
       14 
     | 
    
         
            -
              }
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              attach() {
         
     | 
| 
       17 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       18 
     | 
    
         
            -
                  .on('drag:start', this._onDragStart)
         
     | 
| 
       19 
     | 
    
         
            -
                  .on('drag:stop', this._onDragStop)
         
     | 
| 
       20 
     | 
    
         
            -
                  .on('drag:over', this._onDragOver)
         
     | 
| 
       21 
     | 
    
         
            -
                  .on('drag:out', this._onDragOut)
         
     | 
| 
       22 
     | 
    
         
            -
                  .on('droppable:over', this._onDragOver)
         
     | 
| 
       23 
     | 
    
         
            -
                  .on('droppable:out', this._onDragOut);
         
     | 
| 
       24 
     | 
    
         
            -
              }
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              detach() {
         
     | 
| 
       27 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       28 
     | 
    
         
            -
                  .off('drag:start', this._onDragStart)
         
     | 
| 
       29 
     | 
    
         
            -
                  .off('drag:stop', this._onDragStop)
         
     | 
| 
       30 
     | 
    
         
            -
                  .off('drag:over', this._onDragOver)
         
     | 
| 
       31 
     | 
    
         
            -
                  .off('drag:out', this._onDragOut)
         
     | 
| 
       32 
     | 
    
         
            -
                  .off('droppable:over', this._onDragOver)
         
     | 
| 
       33 
     | 
    
         
            -
                  .off('droppable:out', this._onDragOut);
         
     | 
| 
       34 
     | 
    
         
            -
              }
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              _onDragStart(event) {
         
     | 
| 
       37 
     | 
    
         
            -
                if (event.canceled()) {
         
     | 
| 
       38 
     | 
    
         
            -
                  return;
         
     | 
| 
       39 
     | 
    
         
            -
                }
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                this.firstSource = event.source;
         
     | 
| 
       42 
     | 
    
         
            -
              }
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
              _onDragStop() {
         
     | 
| 
       45 
     | 
    
         
            -
                this.firstSource = null;
         
     | 
| 
       46 
     | 
    
         
            -
              }
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
              _onDragOver(event) {
         
     | 
| 
       49 
     | 
    
         
            -
                if (event.canceled()) {
         
     | 
| 
       50 
     | 
    
         
            -
                  return;
         
     | 
| 
       51 
     | 
    
         
            -
                }
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                const source = event.source || event.dragEvent.source;
         
     | 
| 
       54 
     | 
    
         
            -
                const mirror = event.mirror || event.dragEvent.mirror;
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                if (source === this.firstSource) {
         
     | 
| 
       57 
     | 
    
         
            -
                  this.firstSource = null;
         
     | 
| 
       58 
     | 
    
         
            -
                  return;
         
     | 
| 
       59 
     | 
    
         
            -
                }
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                const snapInEvent = new SnapInEvent({
         
     | 
| 
       62 
     | 
    
         
            -
                  dragEvent: event,
         
     | 
| 
       63 
     | 
    
         
            -
                });
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                this.draggable.triggerEvent(snapInEvent);
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                if (snapInEvent.canceled()) {
         
     | 
| 
       68 
     | 
    
         
            -
                  return;
         
     | 
| 
       69 
     | 
    
         
            -
                }
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                if (mirror) {
         
     | 
| 
       72 
     | 
    
         
            -
                  mirror.style.display = 'none';
         
     | 
| 
       73 
     | 
    
         
            -
                }
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                source.classList.remove(this.draggable.getClassNameFor('source:dragging'));
         
     | 
| 
       76 
     | 
    
         
            -
                source.classList.add(this.draggable.getClassNameFor('source:placed'));
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                setTimeout(() => {
         
     | 
| 
       79 
     | 
    
         
            -
                  source.classList.remove(this.draggable.getClassNameFor('source:placed'));
         
     | 
| 
       80 
     | 
    
         
            -
                }, this.draggable.options.placedTimeout);
         
     | 
| 
       81 
     | 
    
         
            -
              }
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
              _onDragOut(event) {
         
     | 
| 
       84 
     | 
    
         
            -
                if (event.canceled()) {
         
     | 
| 
       85 
     | 
    
         
            -
                  return;
         
     | 
| 
       86 
     | 
    
         
            -
                }
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                const mirror = event.mirror || event.dragEvent.mirror;
         
     | 
| 
       89 
     | 
    
         
            -
                const source = event.source || event.dragEvent.source;
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
                const snapOutEvent = new SnapOutEvent({
         
     | 
| 
       92 
     | 
    
         
            -
                  dragEvent: event,
         
     | 
| 
       93 
     | 
    
         
            -
                });
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                this.draggable.triggerEvent(snapOutEvent);
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                if (snapOutEvent.canceled()) {
         
     | 
| 
       98 
     | 
    
         
            -
                  return;
         
     | 
| 
       99 
     | 
    
         
            -
                }
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                if (mirror) {
         
     | 
| 
       102 
     | 
    
         
            -
                  mirror.style.display = '';
         
     | 
| 
       103 
     | 
    
         
            -
                }
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                source.classList.add(this.draggable.getClassNameFor('source:dragging'));
         
     | 
| 
       106 
     | 
    
         
            -
              }
         
     | 
| 
       107 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,58 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            const ARIA_GRABBED = 'aria-grabbed';
         
     | 
| 
       2 
     | 
    
         
            -
            const ARIA_DROPEFFECT = 'aria-dropeffect';
         
     | 
| 
       3 
     | 
    
         
            -
            const TABINDEX = 'tabindex';
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            export default class Accessibility {
         
     | 
| 
       6 
     | 
    
         
            -
              constructor(draggable) {
         
     | 
| 
       7 
     | 
    
         
            -
                this.draggable = draggable;
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                this._onInit = this._onInit.bind(this);
         
     | 
| 
       10 
     | 
    
         
            -
                this._onDestroy = this._onDestroy.bind(this);
         
     | 
| 
       11 
     | 
    
         
            -
              }
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              attach() {
         
     | 
| 
       14 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       15 
     | 
    
         
            -
                  .on('init', this._onInit)
         
     | 
| 
       16 
     | 
    
         
            -
                  .on('destroy', this._onDestroy)
         
     | 
| 
       17 
     | 
    
         
            -
                  .on('drag:start', _onDragStart)
         
     | 
| 
       18 
     | 
    
         
            -
                  .on('drag:stop', _onDragStop);
         
     | 
| 
       19 
     | 
    
         
            -
              }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              detach() {
         
     | 
| 
       22 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       23 
     | 
    
         
            -
                  .off('init', this._onInit)
         
     | 
| 
       24 
     | 
    
         
            -
                  .off('destroy', this._onDestroy)
         
     | 
| 
       25 
     | 
    
         
            -
                  .off('drag:start', _onDragStart)
         
     | 
| 
       26 
     | 
    
         
            -
                  .off('drag:stop', _onDragStop);
         
     | 
| 
       27 
     | 
    
         
            -
              }
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              _onInit({containers}) {
         
     | 
| 
       30 
     | 
    
         
            -
                for (const container of containers) {
         
     | 
| 
       31 
     | 
    
         
            -
                  container.setAttribute(ARIA_DROPEFFECT, this.draggable.options.type);
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                  for (const element of container.querySelectorAll(this.draggable.options.draggable)) {
         
     | 
| 
       34 
     | 
    
         
            -
                    element.setAttribute(TABINDEX, 0);
         
     | 
| 
       35 
     | 
    
         
            -
                    element.setAttribute(ARIA_GRABBED, false);
         
     | 
| 
       36 
     | 
    
         
            -
                  }
         
     | 
| 
       37 
     | 
    
         
            -
                }
         
     | 
| 
       38 
     | 
    
         
            -
              }
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              _onDestroy({containers}) {
         
     | 
| 
       41 
     | 
    
         
            -
                for (const container of containers) {
         
     | 
| 
       42 
     | 
    
         
            -
                  container.removeAttribute(ARIA_DROPEFFECT);
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  for (const element of container.querySelectorAll(this.draggable.options.draggable)) {
         
     | 
| 
       45 
     | 
    
         
            -
                    element.removeAttribute(TABINDEX, 0);
         
     | 
| 
       46 
     | 
    
         
            -
                    element.removeAttribute(ARIA_GRABBED, false);
         
     | 
| 
       47 
     | 
    
         
            -
                  }
         
     | 
| 
       48 
     | 
    
         
            -
                }
         
     | 
| 
       49 
     | 
    
         
            -
              }
         
     | 
| 
       50 
     | 
    
         
            -
            }
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
            function _onDragStart({source}) {
         
     | 
| 
       53 
     | 
    
         
            -
              source.setAttribute(ARIA_GRABBED, true);
         
     | 
| 
       54 
     | 
    
         
            -
            }
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            function _onDragStop({source}) {
         
     | 
| 
       57 
     | 
    
         
            -
              source.setAttribute(ARIA_GRABBED, false);
         
     | 
| 
       58 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,129 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export default class Mirror {
         
     | 
| 
       2 
     | 
    
         
            -
              constructor(draggable) {
         
     | 
| 
       3 
     | 
    
         
            -
                this.draggable = draggable;
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                this._onMirrorCreated = this._onMirrorCreated.bind(this);
         
     | 
| 
       6 
     | 
    
         
            -
                this._onMirrorMove = this._onMirrorMove.bind(this);
         
     | 
| 
       7 
     | 
    
         
            -
              }
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              attach() {
         
     | 
| 
       10 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       11 
     | 
    
         
            -
                  .on('mirror:created', this._onMirrorCreated)
         
     | 
| 
       12 
     | 
    
         
            -
                  .on('mirror:created', onMirrorCreated)
         
     | 
| 
       13 
     | 
    
         
            -
                  .on('mirror:move', this._onMirrorMove);
         
     | 
| 
       14 
     | 
    
         
            -
              }
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              detach() {
         
     | 
| 
       17 
     | 
    
         
            -
                this.draggable
         
     | 
| 
       18 
     | 
    
         
            -
                  .off('mirror:created', this._onMirrorCreated)
         
     | 
| 
       19 
     | 
    
         
            -
                  .off('mirror:created', onMirrorCreated)
         
     | 
| 
       20 
     | 
    
         
            -
                  .off('mirror:move', this._onMirrorMove);
         
     | 
| 
       21 
     | 
    
         
            -
              }
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              _onMirrorCreated({mirror, source, sensorEvent}) {
         
     | 
| 
       24 
     | 
    
         
            -
                const mirrorClass = this.draggable.getClassNameFor('mirror');
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                const setState = (data) => {
         
     | 
| 
       27 
     | 
    
         
            -
                  this.mirrorOffset = data.mirrorOffset;
         
     | 
| 
       28 
     | 
    
         
            -
                  return data;
         
     | 
| 
       29 
     | 
    
         
            -
                };
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                Promise.resolve({mirror, source, sensorEvent, mirrorClass})
         
     | 
| 
       32 
     | 
    
         
            -
                  .then(computeMirrorDimensions)
         
     | 
| 
       33 
     | 
    
         
            -
                  .then(calculateMirrorOffset)
         
     | 
| 
       34 
     | 
    
         
            -
                  .then(addMirrorClasses)
         
     | 
| 
       35 
     | 
    
         
            -
                  .then(positionMirror())
         
     | 
| 
       36 
     | 
    
         
            -
                  .then(removeMirrorID)
         
     | 
| 
       37 
     | 
    
         
            -
                  .then(setState)
         
     | 
| 
       38 
     | 
    
         
            -
                  .catch();
         
     | 
| 
       39 
     | 
    
         
            -
              }
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
              _onMirrorMove({mirror, sensorEvent}) {
         
     | 
| 
       42 
     | 
    
         
            -
                Promise.resolve({mirror, sensorEvent, mirrorOffset: this.mirrorOffset})
         
     | 
| 
       43 
     | 
    
         
            -
                  .then(positionMirror({raf: true}))
         
     | 
| 
       44 
     | 
    
         
            -
                  .catch();
         
     | 
| 
       45 
     | 
    
         
            -
              }
         
     | 
| 
       46 
     | 
    
         
            -
            }
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            function onMirrorCreated({mirror, source}) {
         
     | 
| 
       49 
     | 
    
         
            -
              Promise.resolve({mirror, source})
         
     | 
| 
       50 
     | 
    
         
            -
                .then(resetMirror)
         
     | 
| 
       51 
     | 
    
         
            -
                .catch();
         
     | 
| 
       52 
     | 
    
         
            -
            }
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            function resetMirror(data) {
         
     | 
| 
       55 
     | 
    
         
            -
              return withPromise((resolve) => {
         
     | 
| 
       56 
     | 
    
         
            -
                const {mirror, source} = data;
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                mirror.style.position = 'fixed';
         
     | 
| 
       59 
     | 
    
         
            -
                mirror.style.pointerEvents = 'none';
         
     | 
| 
       60 
     | 
    
         
            -
                mirror.style.top = 0;
         
     | 
| 
       61 
     | 
    
         
            -
                mirror.style.left = 0;
         
     | 
| 
       62 
     | 
    
         
            -
                mirror.style.width = `${source.offsetWidth}px`;
         
     | 
| 
       63 
     | 
    
         
            -
                mirror.style.height = `${source.offsetHeight}px`;
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                resolve(data);
         
     | 
| 
       66 
     | 
    
         
            -
              });
         
     | 
| 
       67 
     | 
    
         
            -
            }
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
            function computeMirrorDimensions(data) {
         
     | 
| 
       70 
     | 
    
         
            -
              return withPromise((resolve) => {
         
     | 
| 
       71 
     | 
    
         
            -
                const {source} = data;
         
     | 
| 
       72 
     | 
    
         
            -
                const sourceRect = source.getBoundingClientRect();
         
     | 
| 
       73 
     | 
    
         
            -
                resolve({...data, sourceRect});
         
     | 
| 
       74 
     | 
    
         
            -
              });
         
     | 
| 
       75 
     | 
    
         
            -
            }
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
            function calculateMirrorOffset(data) {
         
     | 
| 
       78 
     | 
    
         
            -
              return withPromise((resolve) => {
         
     | 
| 
       79 
     | 
    
         
            -
                const {sensorEvent, sourceRect} = data;
         
     | 
| 
       80 
     | 
    
         
            -
                const mirrorOffset = {top: sensorEvent.clientY - sourceRect.top, left: sensorEvent.clientX - sourceRect.left};
         
     | 
| 
       81 
     | 
    
         
            -
                resolve({...data, mirrorOffset});
         
     | 
| 
       82 
     | 
    
         
            -
              });
         
     | 
| 
       83 
     | 
    
         
            -
            }
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            function addMirrorClasses(data) {
         
     | 
| 
       86 
     | 
    
         
            -
              return withPromise((resolve) => {
         
     | 
| 
       87 
     | 
    
         
            -
                const {mirror, mirrorClass} = data;
         
     | 
| 
       88 
     | 
    
         
            -
                mirror.classList.add(mirrorClass);
         
     | 
| 
       89 
     | 
    
         
            -
                resolve(data);
         
     | 
| 
       90 
     | 
    
         
            -
              });
         
     | 
| 
       91 
     | 
    
         
            -
            }
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
            function removeMirrorID(data) {
         
     | 
| 
       94 
     | 
    
         
            -
              return withPromise((resolve) => {
         
     | 
| 
       95 
     | 
    
         
            -
                const {mirror} = data;
         
     | 
| 
       96 
     | 
    
         
            -
                mirror.removeAttribute('id');
         
     | 
| 
       97 
     | 
    
         
            -
                delete mirror.id;
         
     | 
| 
       98 
     | 
    
         
            -
                resolve(data);
         
     | 
| 
       99 
     | 
    
         
            -
              });
         
     | 
| 
       100 
     | 
    
         
            -
            }
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
            function positionMirror({withFrame = false} = {}) {
         
     | 
| 
       103 
     | 
    
         
            -
              return (data) => {
         
     | 
| 
       104 
     | 
    
         
            -
                return withPromise((resolve) => {
         
     | 
| 
       105 
     | 
    
         
            -
                  const {mirror, sensorEvent, mirrorOffset} = data;
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                  if (mirrorOffset) {
         
     | 
| 
       108 
     | 
    
         
            -
                    const x = sensorEvent.clientX - mirrorOffset.left;
         
     | 
| 
       109 
     | 
    
         
            -
                    const y = sensorEvent.clientY - mirrorOffset.top;
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                    mirror.style.transform = `translate3d(${x}px, ${y}px, 0)`;
         
     | 
| 
       112 
     | 
    
         
            -
                  }
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                  resolve(data);
         
     | 
| 
       115 
     | 
    
         
            -
                }, {frame: withFrame});
         
     | 
| 
       116 
     | 
    
         
            -
              };
         
     | 
| 
       117 
     | 
    
         
            -
            }
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
            function withPromise(callback, {raf = false} = {}) {
         
     | 
| 
       120 
     | 
    
         
            -
              return new Promise((resolve, reject) => {
         
     | 
| 
       121 
     | 
    
         
            -
                if (raf) {
         
     | 
| 
       122 
     | 
    
         
            -
                  requestAnimationFrame(() => {
         
     | 
| 
       123 
     | 
    
         
            -
                    callback(resolve, reject);
         
     | 
| 
       124 
     | 
    
         
            -
                  });
         
     | 
| 
       125 
     | 
    
         
            -
                } else {
         
     | 
| 
       126 
     | 
    
         
            -
                  callback(resolve, reject);
         
     | 
| 
       127 
     | 
    
         
            -
                }
         
     | 
| 
       128 
     | 
    
         
            -
              });
         
     | 
| 
       129 
     | 
    
         
            -
            }
         
     |