correction && add form && add slide && add masonry && css
This commit is contained in:
57
node_modules/unidragger/README.md
generated
vendored
Normal file
57
node_modules/unidragger/README.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# Unidragger
|
||||
|
||||
_Base draggable class_
|
||||
|
||||
Used in [Flickity](http://flickity.metafizzy.co) and [Draggabilly](http://draggabilly.desandro.com).
|
||||
|
||||
Unidragger handles all the event binding and handling to support a draggable library.
|
||||
|
||||
## Features
|
||||
|
||||
+ Touch device support: iOS, Android, Microsoft Surface
|
||||
+ Handles click events in `input` elements
|
||||
|
||||
## Install
|
||||
|
||||
Bower: `bower install unidragger --save`
|
||||
|
||||
npm: `npm install unidragger --save`
|
||||
|
||||
## Demo code
|
||||
|
||||
``` js
|
||||
// your draggable class
|
||||
function Dragger( elem ) {
|
||||
this.element = elem;
|
||||
}
|
||||
|
||||
// use Unidragger as a mixin
|
||||
extend( Dragger.prototype, Unidragger.prototype );
|
||||
|
||||
Dragger.prototype.create = function() {
|
||||
// set drag handles
|
||||
this.handles = [ this.element ];
|
||||
this.bindHandles();
|
||||
};
|
||||
|
||||
Dragger.prototype.dragStart = function( event, pointer ) {
|
||||
console.log('drag start');
|
||||
};
|
||||
|
||||
Dragger.prototype.dragMove = function( event, pointer, moveVector ) {
|
||||
var dragX = this.dragStartPoint.x + moveVector.x;
|
||||
var dragY = this.dragStartPoint.y + moveVector.y;
|
||||
this.element.style.left = dragX + 'px';
|
||||
this.element.style.top = dragY + 'px';
|
||||
};
|
||||
|
||||
Dragger.prototype.dragEnd = function( event, pointer ) {
|
||||
console.log('drag end');
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
MIT license
|
||||
|
||||
By [Metafizzy 🌈🐻](https://metafizzy.co)
|
30
node_modules/unidragger/bower.json
generated
vendored
Normal file
30
node_modules/unidragger/bower.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "unidragger",
|
||||
"main": "unidragger.js",
|
||||
"dependencies": {
|
||||
"unipointer": "^2.3.0"
|
||||
},
|
||||
"authors": [
|
||||
"David DeSandro <desandrocodes@gmail.com>"
|
||||
],
|
||||
"description": "Draggable base class",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"draggable",
|
||||
"flickity",
|
||||
"draggabilly"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"package.json"
|
||||
]
|
||||
}
|
57
node_modules/unidragger/package.json
generated
vendored
Normal file
57
node_modules/unidragger/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"_from": "unidragger@^2.3.0",
|
||||
"_id": "unidragger@2.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-u+IgG7AG0MXJTKcdzAIYxCm+W5FcnA9M28203Awl6jIcE3/+9OtEyUX4Wv64y7XNKEVRKPot52IV4V6x7FlF5Q==",
|
||||
"_location": "/unidragger",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "unidragger@^2.3.0",
|
||||
"name": "unidragger",
|
||||
"escapedName": "unidragger",
|
||||
"rawSpec": "^2.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/flickity"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unidragger/-/unidragger-2.3.1.tgz",
|
||||
"_shasum": "2e8c34feff61affa96dc895234ddfc1ea4ec7515",
|
||||
"_spec": "unidragger@^2.3.0",
|
||||
"_where": "/var/www/html/node_modules/flickity",
|
||||
"author": {
|
||||
"name": "David DeSandro"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/metafizzy/unidragger/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"unipointer": "^2.3.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Base draggable class",
|
||||
"devDependencies": {},
|
||||
"homepage": "https://github.com/metafizzy/unidragger",
|
||||
"keywords": [
|
||||
"draggable",
|
||||
"flickity",
|
||||
"draggabilly",
|
||||
"browser",
|
||||
"dom"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "unidragger.js",
|
||||
"name": "unidragger",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/metafizzy/unidragger.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "2.3.1"
|
||||
}
|
283
node_modules/unidragger/unidragger.js
generated
vendored
Normal file
283
node_modules/unidragger/unidragger.js
generated
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
/*!
|
||||
* Unidragger v2.3.1
|
||||
* Draggable base class
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
/*jshint browser: true, unused: true, undef: true, strict: true */
|
||||
|
||||
( function( window, factory ) {
|
||||
// universal module definition
|
||||
/*jshint strict: false */ /*globals define, module, require */
|
||||
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [
|
||||
'unipointer/unipointer'
|
||||
], function( Unipointer ) {
|
||||
return factory( window, Unipointer );
|
||||
});
|
||||
} else if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory(
|
||||
window,
|
||||
require('unipointer')
|
||||
);
|
||||
} else {
|
||||
// browser global
|
||||
window.Unidragger = factory(
|
||||
window,
|
||||
window.Unipointer
|
||||
);
|
||||
}
|
||||
|
||||
}( window, function factory( window, Unipointer ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// -------------------------- Unidragger -------------------------- //
|
||||
|
||||
function Unidragger() {}
|
||||
|
||||
// inherit Unipointer & EvEmitter
|
||||
var proto = Unidragger.prototype = Object.create( Unipointer.prototype );
|
||||
|
||||
// ----- bind start ----- //
|
||||
|
||||
proto.bindHandles = function() {
|
||||
this._bindHandles( true );
|
||||
};
|
||||
|
||||
proto.unbindHandles = function() {
|
||||
this._bindHandles( false );
|
||||
};
|
||||
|
||||
/**
|
||||
* Add or remove start event
|
||||
* @param {Boolean} isAdd
|
||||
*/
|
||||
proto._bindHandles = function( isAdd ) {
|
||||
// munge isAdd, default to true
|
||||
isAdd = isAdd === undefined ? true : isAdd;
|
||||
// bind each handle
|
||||
var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
|
||||
var touchAction = isAdd ? this._touchActionValue : '';
|
||||
for ( var i=0; i < this.handles.length; i++ ) {
|
||||
var handle = this.handles[i];
|
||||
this._bindStartEvent( handle, isAdd );
|
||||
handle[ bindMethod ]( 'click', this );
|
||||
// touch-action: none to override browser touch gestures. metafizzy/flickity#540
|
||||
if ( window.PointerEvent ) {
|
||||
handle.style.touchAction = touchAction;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// prototype so it can be overwriteable by Flickity
|
||||
proto._touchActionValue = 'none';
|
||||
|
||||
// ----- start event ----- //
|
||||
|
||||
/**
|
||||
* pointer start
|
||||
* @param {Event} event
|
||||
* @param {Event or Touch} pointer
|
||||
*/
|
||||
proto.pointerDown = function( event, pointer ) {
|
||||
var isOkay = this.okayPointerDown( event );
|
||||
if ( !isOkay ) {
|
||||
return;
|
||||
}
|
||||
// track start event position
|
||||
// Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842
|
||||
this.pointerDownPointer = {
|
||||
pageX: pointer.pageX,
|
||||
pageY: pointer.pageY,
|
||||
};
|
||||
|
||||
event.preventDefault();
|
||||
this.pointerDownBlur();
|
||||
// bind move and end events
|
||||
this._bindPostStartEvents( event );
|
||||
this.emitEvent( 'pointerDown', [ event, pointer ] );
|
||||
};
|
||||
|
||||
// nodes that have text fields
|
||||
var cursorNodes = {
|
||||
TEXTAREA: true,
|
||||
INPUT: true,
|
||||
SELECT: true,
|
||||
OPTION: true,
|
||||
};
|
||||
|
||||
// input types that do not have text fields
|
||||
var clickTypes = {
|
||||
radio: true,
|
||||
checkbox: true,
|
||||
button: true,
|
||||
submit: true,
|
||||
image: true,
|
||||
file: true,
|
||||
};
|
||||
|
||||
// dismiss inputs with text fields. flickity#403, flickity#404
|
||||
proto.okayPointerDown = function( event ) {
|
||||
var isCursorNode = cursorNodes[ event.target.nodeName ];
|
||||
var isClickType = clickTypes[ event.target.type ];
|
||||
var isOkay = !isCursorNode || isClickType;
|
||||
if ( !isOkay ) {
|
||||
this._pointerReset();
|
||||
}
|
||||
return isOkay;
|
||||
};
|
||||
|
||||
// kludge to blur previously focused input
|
||||
proto.pointerDownBlur = function() {
|
||||
var focused = document.activeElement;
|
||||
// do not blur body for IE10, metafizzy/flickity#117
|
||||
var canBlur = focused && focused.blur && focused != document.body;
|
||||
if ( canBlur ) {
|
||||
focused.blur();
|
||||
}
|
||||
};
|
||||
|
||||
// ----- move event ----- //
|
||||
|
||||
/**
|
||||
* drag move
|
||||
* @param {Event} event
|
||||
* @param {Event or Touch} pointer
|
||||
*/
|
||||
proto.pointerMove = function( event, pointer ) {
|
||||
var moveVector = this._dragPointerMove( event, pointer );
|
||||
this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );
|
||||
this._dragMove( event, pointer, moveVector );
|
||||
};
|
||||
|
||||
// base pointer move logic
|
||||
proto._dragPointerMove = function( event, pointer ) {
|
||||
var moveVector = {
|
||||
x: pointer.pageX - this.pointerDownPointer.pageX,
|
||||
y: pointer.pageY - this.pointerDownPointer.pageY
|
||||
};
|
||||
// start drag if pointer has moved far enough to start drag
|
||||
if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
|
||||
this._dragStart( event, pointer );
|
||||
}
|
||||
return moveVector;
|
||||
};
|
||||
|
||||
// condition if pointer has moved far enough to start drag
|
||||
proto.hasDragStarted = function( moveVector ) {
|
||||
return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;
|
||||
};
|
||||
|
||||
// ----- end event ----- //
|
||||
|
||||
/**
|
||||
* pointer up
|
||||
* @param {Event} event
|
||||
* @param {Event or Touch} pointer
|
||||
*/
|
||||
proto.pointerUp = function( event, pointer ) {
|
||||
this.emitEvent( 'pointerUp', [ event, pointer ] );
|
||||
this._dragPointerUp( event, pointer );
|
||||
};
|
||||
|
||||
proto._dragPointerUp = function( event, pointer ) {
|
||||
if ( this.isDragging ) {
|
||||
this._dragEnd( event, pointer );
|
||||
} else {
|
||||
// pointer didn't move enough for drag to start
|
||||
this._staticClick( event, pointer );
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------- drag -------------------------- //
|
||||
|
||||
// dragStart
|
||||
proto._dragStart = function( event, pointer ) {
|
||||
this.isDragging = true;
|
||||
// prevent clicks
|
||||
this.isPreventingClicks = true;
|
||||
this.dragStart( event, pointer );
|
||||
};
|
||||
|
||||
proto.dragStart = function( event, pointer ) {
|
||||
this.emitEvent( 'dragStart', [ event, pointer ] );
|
||||
};
|
||||
|
||||
// dragMove
|
||||
proto._dragMove = function( event, pointer, moveVector ) {
|
||||
// do not drag if not dragging yet
|
||||
if ( !this.isDragging ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dragMove( event, pointer, moveVector );
|
||||
};
|
||||
|
||||
proto.dragMove = function( event, pointer, moveVector ) {
|
||||
event.preventDefault();
|
||||
this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );
|
||||
};
|
||||
|
||||
// dragEnd
|
||||
proto._dragEnd = function( event, pointer ) {
|
||||
// set flags
|
||||
this.isDragging = false;
|
||||
// re-enable clicking async
|
||||
setTimeout( function() {
|
||||
delete this.isPreventingClicks;
|
||||
}.bind( this ) );
|
||||
|
||||
this.dragEnd( event, pointer );
|
||||
};
|
||||
|
||||
proto.dragEnd = function( event, pointer ) {
|
||||
this.emitEvent( 'dragEnd', [ event, pointer ] );
|
||||
};
|
||||
|
||||
// ----- onclick ----- //
|
||||
|
||||
// handle all clicks and prevent clicks when dragging
|
||||
proto.onclick = function( event ) {
|
||||
if ( this.isPreventingClicks ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
// ----- staticClick ----- //
|
||||
|
||||
// triggered after pointer down & up with no/tiny movement
|
||||
proto._staticClick = function( event, pointer ) {
|
||||
// ignore emulated mouse up clicks
|
||||
if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.staticClick( event, pointer );
|
||||
|
||||
// set flag for emulated clicks 300ms after touchend
|
||||
if ( event.type != 'mouseup' ) {
|
||||
this.isIgnoringMouseUp = true;
|
||||
// reset flag after 300ms
|
||||
setTimeout( function() {
|
||||
delete this.isIgnoringMouseUp;
|
||||
}.bind( this ), 400 );
|
||||
}
|
||||
};
|
||||
|
||||
proto.staticClick = function( event, pointer ) {
|
||||
this.emitEvent( 'staticClick', [ event, pointer ] );
|
||||
};
|
||||
|
||||
// ----- utils ----- //
|
||||
|
||||
Unidragger.getPointerPoint = Unipointer.getPointerPoint;
|
||||
|
||||
// ----- ----- //
|
||||
|
||||
return Unidragger;
|
||||
|
||||
}));
|
Reference in New Issue
Block a user