gesture-helper
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -1,4 +0,68 @@ | ||
webpackJsonp([0],{ | ||
/***/ "V2lK": | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = "/"; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -11,11 +75,11 @@ | ||
var _eventemitter = __webpack_require__("JNfv"); | ||
var _eventemitter = __webpack_require__(1); | ||
var _eventemitter2 = _interopRequireDefault(_eventemitter); | ||
var _performanceNow = __webpack_require__("UGHC"); | ||
var _performanceNow = __webpack_require__(2); | ||
var _performanceNow2 = _interopRequireDefault(_performanceNow); | ||
var _inputdevicecapabilitiesPolyfill = __webpack_require__("OZEC"); | ||
var _inputdevicecapabilitiesPolyfill = __webpack_require__(3); | ||
@@ -255,4 +319,182 @@ var _inputdevicecapabilitiesPolyfill2 = _interopRequireDefault(_inputdevicecapabilitiesPolyfill); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports) { | ||
module.exports = eventemitter2; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports) { | ||
module.exports = performance-now; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
/* inputdevicecapabilities-polyfill.js - https://github.com/WICG/InputDeviceCapabilities | ||
* | ||
* Uses a (not perfectly accurate) heuristic to implement | ||
* UIEvent.sourceCapabilities and InputDeviceCapabilities.firesTouchEvents. | ||
* Assumptions: | ||
* - If sourceCapabilities is consulted on an event, it will be first read within | ||
* one second of the original event being dispatched. We could, instead, | ||
* determine the sourceCapabilities as soon as any UIEvent is dispatched (eg. | ||
* by hooking addEventListener) but that woudln't work for legacy onevent | ||
* style handlers. | ||
* - Touch and non-touch input devices aren't both being used within one | ||
* second of eachother. Eg. if you tap the screen then quickly move the | ||
* mouse, we may incorrectly attribute the mouse movement to the touch | ||
* device. | ||
* | ||
* Browser support: | ||
* - Verified working on: | ||
* - Chrome 43 (Windows, Linux and Android) | ||
* - IE 11 (Windows) | ||
* - Firefox 38 (Linux) | ||
* - Safari 8 (Mac and iOS) | ||
* - Event constructors aren't supported by IE at all. | ||
* - IE on Windows phone isn't supported properly (https://github.com/WICG/InputDeviceCapabilities/issues/13) | ||
* - Won't work in IE prior to version 9 (due to lack of Object.defineProperty) | ||
*/ | ||
function InputDeviceCapabilities(global) { | ||
'use strict'; | ||
if ('InputDeviceCapabilities' in global || 'sourceCapabilities' in UIEvent.prototype) return; | ||
function InputDeviceCapabilities(inputDeviceCapabilitiesInit) { | ||
Object.defineProperty(this, '__firesTouchEvents', { | ||
value: inputDeviceCapabilitiesInit && 'firesTouchEvents' in inputDeviceCapabilitiesInit ? inputDeviceCapabilitiesInit.firesTouchEvents : false, | ||
writable: false, | ||
enumerable: false | ||
}); | ||
}; | ||
// Put the attributes prototype as getter functions to match the IDL. | ||
InputDeviceCapabilities.prototype = { | ||
get firesTouchEvents() { | ||
return this.__firesTouchEvents; | ||
} | ||
}; | ||
global.InputDeviceCapabilities = InputDeviceCapabilities; | ||
var touchDevice = new InputDeviceCapabilities({ firesTouchEvents: true }); | ||
var nonTouchDevice = new InputDeviceCapabilities({ firesTouchEvents: false }); | ||
// Keep track of the last time we saw a touch event. Note that if you don't | ||
// already have touch handlers on your document, this can have unfortunate | ||
// consequences for scrolling performance. See https://plus.google.com/+RickByers/posts/cmzrtyBYPQc. | ||
var lastTouchTime; | ||
function touchHandler(event) { | ||
lastTouchTime = Date.now(); | ||
}; | ||
document.addEventListener('touchstart', touchHandler, true); | ||
document.addEventListener('touchmove', touchHandler, true); | ||
document.addEventListener('touchend', touchHandler, true); | ||
document.addEventListener('touchcancel', touchHandler, true); | ||
var specifiedSourceCapabilitiesName = '__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities'; | ||
// A few UIEvents aren't really input events and so should always have a null | ||
// source capabilities. Arguably we should have a list of opt-in event types instead, | ||
// but that probably depends on ultimately how we want to specify this behavior. | ||
var eventTypesWithNoSourceCapabilities = ['resize', 'error', 'load', 'unload', 'abort']; | ||
// We assume that any UI event that occurs within this many ms from a touch | ||
// event is caused by a touch device. This needs to be a little longer than | ||
// the maximum tap delay on various browsers (350ms in Safari) while remaining | ||
// as short as possible to reduce the risk of confusing other input that happens | ||
// to come shortly after touch input. | ||
var touchTimeConstant = 1000; | ||
Object.defineProperty(UIEvent.prototype, 'sourceCapabilities', { | ||
get: function get() { | ||
// Handle script-generated events and events which have already had their | ||
// sourceCapabilities read. | ||
if (specifiedSourceCapabilitiesName in this) return this[specifiedSourceCapabilitiesName]; | ||
// Handle non-input events. | ||
if (eventTypesWithNoSourceCapabilities.indexOf(this.type) >= 0) return null; | ||
// touch events may not be supported by this browser at all (eg. IE desktop). | ||
if (!('TouchEvent' in global)) return nonTouchDevice; | ||
// Touch events are always generated from devices that fire touch events. | ||
if (this instanceof TouchEvent) return touchDevice; | ||
// Pointer events are special - they may come before a touch event. | ||
if ('PointerEvent' in global && this instanceof PointerEvent) { | ||
if (this.pointerType == "touch") return touchDevice; | ||
return nonTouchDevice; | ||
} | ||
// Otherwise use recent touch events to decide if this event is likely due | ||
// to a touch device or not. | ||
var sourceCapabilities = Date.now() < lastTouchTime + touchTimeConstant ? touchDevice : nonTouchDevice; | ||
// Cache the value to ensure it can't change over the life of the event. | ||
Object.defineProperty(this, specifiedSourceCapabilitiesName, { | ||
value: sourceCapabilities, | ||
writable: false | ||
}); | ||
return sourceCapabilities; | ||
}, | ||
configurable: true, | ||
enumerable: true | ||
}); | ||
// Add support for supplying a sourceCapabilities from JS in all UIEvent constructors. | ||
function augmentEventConstructor(constructorName) { | ||
if (!(constructorName in global)) return; | ||
// IE doesn't support event constructors at all. | ||
// In Safari typeof constructor is 'object' while it's 'function' in other browsers. | ||
if (!('length' in global[constructorName]) || global[constructorName].length < 1) return; | ||
var origCtor = global[constructorName]; | ||
global[constructorName] = function (type, initDict) { | ||
var sourceCapabilities = initDict && initDict.sourceCapabilities ? initDict.sourceCapabilities : null; | ||
// Need to explicitly remove sourceCapabilities from the dictionary as it would cause | ||
// a type error in blink when InputDeviceCapabilities support is disabled. | ||
if (initDict) delete initDict.sourceCapabilities; | ||
var evt = new origCtor(type, initDict); | ||
// Stash the sourceCapabilities value away for use by the UIEvent.sourceCapabilities | ||
// getter. We could instead shadow the property on this instance, but | ||
// that would be subtly different than the specified API. | ||
Object.defineProperty(evt, specifiedSourceCapabilitiesName, { | ||
value: sourceCapabilities, | ||
writable: false | ||
}); | ||
return evt; | ||
}; | ||
global[constructorName].prototype = origCtor.prototype; | ||
}; | ||
// Note that SVGZoomEvent desn't yet have constructors defined. | ||
var uiEventConstructors = ['UIEvent', 'MouseEvent', 'TouchEvent', 'InputEvent', 'CompositionEvent', 'FocusEvent', 'KeyboardEvent', 'WheelEvent', 'PointerEvent']; | ||
for (var i = 0; i < uiEventConstructors.length; i++) { | ||
augmentEventConstructor(uiEventConstructors[i]); | ||
} // Ensure events created with document.createEvent always get a null sourceCapabilities | ||
var origCreateEvent = Document.prototype.createEvent; | ||
Document.prototype.createEvent = function (type) { | ||
var evt = origCreateEvent.call(this, type); | ||
if (evt instanceof UIEvent) { | ||
Object.defineProperty(evt, specifiedSourceCapabilitiesName, { | ||
value: null, | ||
writable: false | ||
}); | ||
return evt; | ||
} | ||
}; | ||
} | ||
exports.default = InputDeviceCapabilities; | ||
/***/ }) | ||
},["V2lK"]); | ||
/******/ ]); |
{ | ||
"name": "gesture-helper", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "a *tiny* touch & mouse library to help make tracking touch interactions more simple.", | ||
"unpkg": "dist/umd.js", | ||
"main": "dist/index.js", | ||
"unpkg": "dist/umd.js", | ||
"files": [ | ||
"dist/index.js", | ||
"dist/manifest.js", | ||
"src" | ||
], | ||
"repository": "https://github.com/glomotion/gesture-helper.git", | ||
@@ -22,3 +27,3 @@ "author": "Tim Paul <tim@glo.id.au>", | ||
"demo": "webpack-dev-server --config ./webpack.demo.config.js --colors --open", | ||
"build-split": "webpack --config ./webpack.split.config.js", | ||
"build-split": "webpack --config ./webpack.config.js", | ||
"build-umd": "webpack --config ./webpack.umd.config.js", | ||
@@ -25,0 +30,0 @@ "build": "yarn build-split; yarn build-umd", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37712
6
739
1