initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

22
node_modules/event-target-shim/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Toru Nagashima
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

176
node_modules/event-target-shim/README.md generated vendored Normal file
View File

@@ -0,0 +1,176 @@
# event-target-shim
[![Build Status](https://travis-ci.org/mysticatea/event-target-shim.svg?branch=master)](https://travis-ci.org/mysticatea/event-target-shim)
[![Coverage Status](https://coveralls.io/repos/mysticatea/event-target-shim/badge.svg?branch=master&service=github)](https://coveralls.io/github/mysticatea/event-target-shim?branch=master)
[![Dependency Status](https://david-dm.org/mysticatea/event-target-shim.svg)](https://david-dm.org/mysticatea/event-target-shim)
[![devDependency Status](https://david-dm.org/mysticatea/event-target-shim/dev-status.svg)](https://david-dm.org/mysticatea/event-target-shim#info=devDependencies)<br>
[![npm version](https://img.shields.io/npm/v/event-target-shim.svg)](https://www.npmjs.com/package/event-target-shim)
[![Downloads/month](https://img.shields.io/npm/dm/event-target-shim.svg)](https://www.npmjs.com/package/event-target-shim)
An implementation of [W3C EventTarget interface](http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget), plus few extensions.
- This provides `EventTarget` constructor that can inherit for your custom object.
- This provides an utility that defines properties of attribute listeners (e.g. `obj.onclick`).
```js
// The prototype of this class has getters and setters of `onmessage` and `onerror`.
class Foo extends EventTarget("message", "error") {
//...
}
```
## Installation
```
npm install --save event-target-shim
```
Or download from `dist` directory.
## Usage
### Basic
```js
//-----------------------------------------------------------------------------
// import (with browserify, webpack, etc...).
const EventTarget = require("event-target-shim");
//-----------------------------------------------------------------------------
// define a custom type.
class Foo extends EventTarget {
}
//-----------------------------------------------------------------------------
// add event listeners.
let foo = new Foo();
foo.addEventListener("foo", event => {
console.log(event.hello);
});
foo.addEventListener("foo", event => {
if (event.hello !== "hello") {
// event implements Event interface.
event.preventDefault();
}
});
//-----------------------------------------------------------------------------
// dispatch an event.
let event = document.createEvent("CustomEvent");
event.initCustomEvent("foo", /*bubbles*/ false, /*cancelable*/ false, /*detail*/ null);
event.hello = "hello";
foo.dispatchEvent(event);
//-----------------------------------------------------------------------------
// dispatch an event simply (non standard).
foo.dispatchEvent({type: "foo", hello: "hello"});
//-----------------------------------------------------------------------------
// dispatch a cancelable event.
if (!foo.dispatchEvent({type: "foo", cancelable: true, hello: "hey"})) {
console.log("defaultPrevented");
}
//-----------------------------------------------------------------------------
// If `window.EventTarget` exists, `EventTarget` inherits from `window.EventTarget`.
if (foo instanceof window.EventTarget) {
console.log("yay!");
}
```
### The Extension for Attribute Listeners
```js
//-----------------------------------------------------------------------------
// import (with browserify, webpack, etc...).
const EventTarget = require("event-target-shim");
//-----------------------------------------------------------------------------
// define a custom type with attribute listeners.
class Foo extends EventTarget("message", "error") {
}
// or non-variadic
class Foo extends EventTarget(["message", "error"]) {
}
//-----------------------------------------------------------------------------
// add event listeners.
let foo = new Foo();
foo.onmessage = event => {
console.log(event.data);
};
foo.onerror = event => {
console.log(event.message);
};
foo.addEventListener("message", event => {
console.log(event.data);
});
//-----------------------------------------------------------------------------
// dispatch a event simply (non standard).
foo.dispatchEvent({type: "message", data: "hello"});
foo.dispatchEvent({type: "error", message: "an error"});
```
### Use in ES5
- Basic.
```js
function Foo() {
EventTarget.call(this);
}
Foo.prototype = Object.create(EventTarget.prototype, {
constructor: {
value: Foo,
configurable: true,
writable: true
},
//....
});
```
- With attribute listeners.
```js
function Foo() {
EventTarget.call(this);
}
Foo.prototype = Object.create(EventTarget("message", "error").prototype, {
// or
// Foo.prototype = Object.create(EventTarget(["message", "error"]).prototype, {
constructor: {
value: Foo,
configurable: true,
writable: true
},
//....
});
```
### Use with RequireJS
```js
require(["https://cdn.rawgit.com/mysticatea/event-target-shim/v1.1.0/dist/event-target-shim.min.js"], function(EventTarget) {
//...
});
```
## API
```ts
declare class EventTarget {
constructor();
addEventListener(type: string, listener?: (event: Event) => void, capture: boolean = false): void;
removeEventListener(type: string, listener?: (event: Event) => void, capture: boolean = false): void;
dispatchEvent(event: Event | {type: string, cancelable?: boolean}): void;
}
// Define EventTarget type with attribute listeners.
declare function EventTarget(...types: string[]): EventTarget;
declare function EventTarget(types: string[]): EventTarget;
```

View File

@@ -0,0 +1,531 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.eventTargetShim = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
/**
* Creates a unique key.
*
* @param {string} name - A name to create.
* @returns {symbol|string}
* @private
*/
var createUniqueKey = exports.createUniqueKey = (typeof Symbol !== "undefined" ?
Symbol :
function createUniqueKey(name) {
return "[[" + name + "_" + Math.random().toFixed(8).slice(2) + "]]";
});
/**
* The key of listeners.
*
* @type {symbol|string}
* @private
*/
exports.LISTENERS = createUniqueKey("listeners");
/**
* A value of kind for listeners which are registered in the capturing phase.
*
* @type {number}
* @private
*/
exports.CAPTURE = 1;
/**
* A value of kind for listeners which are registered in the bubbling phase.
*
* @type {number}
* @private
*/
exports.BUBBLE = 2;
/**
* A value of kind for listeners which are registered as an attribute.
*
* @type {number}
* @private
*/
exports.ATTRIBUTE = 3;
/**
* @typedef object ListenerNode
* @property {function} listener - A listener function.
* @property {number} kind - The kind of the listener.
* @property {ListenerNode|null} next - The next node.
* If this node is the last, this is `null`.
*/
/**
* Creates a node of singly linked list for a list of listeners.
*
* @param {function} listener - A listener function.
* @param {number} kind - The kind of the listener.
* @returns {ListenerNode} The created listener node.
*/
exports.newNode = function newNode(listener, kind) {
return {listener: listener, kind: kind, next: null};
};
},{}],2:[function(require,module,exports){
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var Commons = require("./commons");
var LISTENERS = Commons.LISTENERS;
var ATTRIBUTE = Commons.ATTRIBUTE;
var newNode = Commons.newNode;
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
/**
* Gets a specified attribute listener from a given EventTarget object.
*
* @param {EventTarget} eventTarget - An EventTarget object to get.
* @param {string} type - An event type to get.
* @returns {function|null} The found attribute listener.
*/
function getAttributeListener(eventTarget, type) {
var node = eventTarget[LISTENERS][type];
while (node != null) {
if (node.kind === ATTRIBUTE) {
return node.listener;
}
node = node.next;
}
return null;
}
/**
* Sets a specified attribute listener to a given EventTarget object.
*
* @param {EventTarget} eventTarget - An EventTarget object to set.
* @param {string} type - An event type to set.
* @param {function|null} listener - A listener to be set.
* @returns {void}
*/
function setAttributeListener(eventTarget, type, listener) {
if (typeof listener !== "function" && typeof listener !== "object") {
listener = null; // eslint-disable-line no-param-reassign
}
var prev = null;
var node = eventTarget[LISTENERS][type];
while (node != null) {
if (node.kind === ATTRIBUTE) {
// Remove old value.
if (prev == null) {
eventTarget[LISTENERS][type] = node.next;
}
else {
prev.next = node.next;
}
}
else {
prev = node;
}
node = node.next;
}
// Add new value.
if (listener != null) {
if (prev == null) {
eventTarget[LISTENERS][type] = newNode(listener, ATTRIBUTE);
}
else {
prev.next = newNode(listener, ATTRIBUTE);
}
}
}
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
/**
* Defines an `EventTarget` implementation which has `onfoobar` attributes.
*
* @param {EventTarget} EventTargetBase - A base implementation of EventTarget.
* @param {string[]} types - A list of event types which are defined as attribute listeners.
* @returns {EventTarget} The defined `EventTarget` implementation which has attribute listeners.
*/
exports.defineCustomEventTarget = function(EventTargetBase, types) {
function EventTarget() {
EventTargetBase.call(this);
}
var descripter = {
constructor: {
value: EventTarget,
configurable: true,
writable: true
}
};
types.forEach(function(type) {
descripter["on" + type] = {
get: function() { return getAttributeListener(this, type); },
set: function(listener) { setAttributeListener(this, type, listener); },
configurable: true,
enumerable: true
};
});
EventTarget.prototype = Object.create(EventTargetBase.prototype, descripter);
return EventTarget;
};
},{"./commons":1}],3:[function(require,module,exports){
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var Commons = require("./commons");
var CustomEventTarget = require("./custom-event-target");
var EventWrapper = require("./event-wrapper");
var LISTENERS = Commons.LISTENERS;
var CAPTURE = Commons.CAPTURE;
var BUBBLE = Commons.BUBBLE;
var ATTRIBUTE = Commons.ATTRIBUTE;
var newNode = Commons.newNode;
var defineCustomEventTarget = CustomEventTarget.defineCustomEventTarget;
var createEventWrapper = EventWrapper.createEventWrapper;
var STOP_IMMEDIATE_PROPAGATION_FLAG =
EventWrapper.STOP_IMMEDIATE_PROPAGATION_FLAG;
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
/**
* A flag which shows there is the native `EventTarget` interface object.
*
* @type {boolean}
* @private
*/
var HAS_EVENTTARGET_INTERFACE = (
typeof window !== "undefined" &&
typeof window.EventTarget !== "undefined"
);
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
/**
* An implementation for `EventTarget` interface.
*
* @constructor
* @public
*/
var EventTarget = module.exports = function EventTarget() {
if (this instanceof EventTarget) {
// this[LISTENERS] is a Map.
// Its key is event type.
// Its value is ListenerNode object or null.
//
// interface ListenerNode {
// var listener: Function
// var kind: CAPTURE|BUBBLE|ATTRIBUTE
// var next: ListenerNode|null
// }
Object.defineProperty(this, LISTENERS, {value: Object.create(null)});
}
else if (arguments.length === 1 && Array.isArray(arguments[0])) {
return defineCustomEventTarget(EventTarget, arguments[0]);
}
else if (arguments.length > 0) {
var types = Array(arguments.length);
for (var i = 0; i < arguments.length; ++i) {
types[i] = arguments[i];
}
// To use to extend with attribute listener properties.
// e.g.
// class MyCustomObject extends EventTarget("message", "error") {
// //...
// }
return defineCustomEventTarget(EventTarget, types);
}
else {
throw new TypeError("Cannot call a class as a function");
}
};
EventTarget.prototype = Object.create(
(HAS_EVENTTARGET_INTERFACE ? window.EventTarget : Object).prototype,
{
constructor: {
value: EventTarget,
writable: true,
configurable: true
},
addEventListener: {
value: function addEventListener(type, listener, capture) {
if (listener == null) {
return false;
}
if (typeof listener !== "function" && typeof listener !== "object") {
throw new TypeError("\"listener\" is not an object.");
}
var kind = (capture ? CAPTURE : BUBBLE);
var node = this[LISTENERS][type];
if (node == null) {
this[LISTENERS][type] = newNode(listener, kind);
return true;
}
var prev = null;
while (node != null) {
if (node.listener === listener && node.kind === kind) {
// Should ignore a duplicated listener.
return false;
}
prev = node;
node = node.next;
}
prev.next = newNode(listener, kind);
return true;
},
configurable: true,
writable: true
},
removeEventListener: {
value: function removeEventListener(type, listener, capture) {
if (listener == null) {
return false;
}
var kind = (capture ? CAPTURE : BUBBLE);
var prev = null;
var node = this[LISTENERS][type];
while (node != null) {
if (node.listener === listener && node.kind === kind) {
if (prev == null) {
this[LISTENERS][type] = node.next;
}
else {
prev.next = node.next;
}
return true;
}
prev = node;
node = node.next;
}
return false;
},
configurable: true,
writable: true
},
dispatchEvent: {
value: function dispatchEvent(event) {
// If listeners aren't registered, terminate.
var node = this[LISTENERS][event.type];
if (node == null) {
return true;
}
// Since we cannot rewrite several properties, so wrap object.
var wrapped = createEventWrapper(event, this);
// This doesn't process capturing phase and bubbling phase.
// This isn't participating in a tree.
while (node != null) {
if (typeof node.listener === "function") {
node.listener.call(this, wrapped);
}
else if (node.kind !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
node.listener.handleEvent(wrapped);
}
if (wrapped[STOP_IMMEDIATE_PROPAGATION_FLAG]) {
break;
}
node = node.next;
}
return !wrapped.defaultPrevented;
},
configurable: true,
writable: true
}
}
);
},{"./commons":1,"./custom-event-target":2,"./event-wrapper":4}],4:[function(require,module,exports){
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var createUniqueKey = require("./commons").createUniqueKey;
//-----------------------------------------------------------------------------
// Constsnts
//-----------------------------------------------------------------------------
/**
* The key of the flag which is turned on by `stopImmediatePropagation` method.
*
* @type {symbol|string}
* @private
*/
var STOP_IMMEDIATE_PROPAGATION_FLAG =
createUniqueKey("stop_immediate_propagation_flag");
/**
* The key of the flag which is turned on by `preventDefault` method.
*
* @type {symbol|string}
* @private
*/
var CANCELED_FLAG = createUniqueKey("canceled_flag");
/**
* The key of the original event object.
*
* @type {symbol|string}
* @private
*/
var ORIGINAL_EVENT = createUniqueKey("original_event");
/**
* Method definitions for the event wrapper.
*
* @type {object}
* @private
*/
var wrapperPrototypeDefinition = Object.freeze({
stopPropagation: Object.freeze({
value: function stopPropagation() {
var e = this[ORIGINAL_EVENT];
if (typeof e.stopPropagation === "function") {
e.stopPropagation();
}
},
writable: true,
configurable: true
}),
stopImmediatePropagation: Object.freeze({
value: function stopImmediatePropagation() {
this[STOP_IMMEDIATE_PROPAGATION_FLAG] = true;
var e = this[ORIGINAL_EVENT];
if (typeof e.stopImmediatePropagation === "function") {
e.stopImmediatePropagation();
}
},
writable: true,
configurable: true
}),
preventDefault: Object.freeze({
value: function preventDefault() {
if (this.cancelable === true) {
this[CANCELED_FLAG] = true;
}
var e = this[ORIGINAL_EVENT];
if (typeof e.preventDefault === "function") {
e.preventDefault();
}
},
writable: true,
configurable: true
}),
defaultPrevented: Object.freeze({
get: function defaultPrevented() { return this[CANCELED_FLAG]; },
enumerable: true,
configurable: true
})
});
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
exports.STOP_IMMEDIATE_PROPAGATION_FLAG = STOP_IMMEDIATE_PROPAGATION_FLAG;
/**
* Creates an event wrapper.
*
* We cannot modify several properties of `Event` object, so we need to create the wrapper.
* Plus, this wrapper supports non `Event` objects.
*
* @param {Event|{type: string}} event - An original event to create the wrapper.
* @param {EventTarget} eventTarget - The event target of the event.
* @returns {Event} The created wrapper. This object is implemented `Event` interface.
* @private
*/
exports.createEventWrapper = function createEventWrapper(event, eventTarget) {
var timeStamp = (
typeof event.timeStamp === "number" ? event.timeStamp : Date.now()
);
var propertyDefinition = {
type: {value: event.type, enumerable: true},
target: {value: eventTarget, enumerable: true},
currentTarget: {value: eventTarget, enumerable: true},
eventPhase: {value: 2, enumerable: true},
bubbles: {value: Boolean(event.bubbles), enumerable: true},
cancelable: {value: Boolean(event.cancelable), enumerable: true},
timeStamp: {value: timeStamp, enumerable: true},
isTrusted: {value: false, enumerable: true}
};
propertyDefinition[STOP_IMMEDIATE_PROPAGATION_FLAG] = {value: false, writable: true};
propertyDefinition[CANCELED_FLAG] = {value: false, writable: true};
propertyDefinition[ORIGINAL_EVENT] = {value: event};
// For CustomEvent.
if (typeof event.detail !== "undefined") {
propertyDefinition.detail = {value: event.detail, enumerable: true};
}
return Object.create(
Object.create(event, wrapperPrototypeDefinition),
propertyDefinition
);
};
},{"./commons":1}]},{},[3])(3)
});

View File

@@ -0,0 +1 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.eventTargetShim=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!u&&l)return l(i,!0);if(a)return a(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){"use strict";var r=n.createUniqueKey="undefined"!=typeof Symbol?Symbol:function(e){return"[["+e+"_"+Math.random().toFixed(8).slice(2)+"]]"};n.LISTENERS=r("listeners"),n.CAPTURE=1,n.BUBBLE=2,n.ATTRIBUTE=3,n.newNode=function(e,t){return{listener:e,kind:t,next:null}}},{}],2:[function(e,t,n){"use strict";function r(e,t){for(var n=e[i][t];null!=n;){if(n.kind===u)return n.listener;n=n.next}return null}function o(e,t,n){"function"!=typeof n&&"object"!=typeof n&&(n=null);for(var r=null,o=e[i][t];null!=o;)o.kind===u?null==r?e[i][t]=o.next:r.next=o.next:r=o,o=o.next;null!=n&&(null==r?e[i][t]=l(n,u):r.next=l(n,u))}var a=e("./commons"),i=a.LISTENERS,u=a.ATTRIBUTE,l=a.newNode;n.defineCustomEventTarget=function(e,t){function n(){e.call(this)}var a={constructor:{value:n,configurable:!0,writable:!0}};return t.forEach(function(e){a["on"+e]={get:function(){return r(this,e)},set:function(t){o(this,e,t)},configurable:!0,enumerable:!0}}),n.prototype=Object.create(e.prototype,a),n}},{"./commons":1}],3:[function(e,t,n){"use strict";var r=e("./commons"),o=e("./custom-event-target"),a=e("./event-wrapper"),i=r.LISTENERS,u=r.CAPTURE,l=r.BUBBLE,f=r.ATTRIBUTE,c=r.newNode,s=o.defineCustomEventTarget,p=a.createEventWrapper,v=a.STOP_IMMEDIATE_PROPAGATION_FLAG,d="undefined"!=typeof window&&"undefined"!=typeof window.EventTarget,b=t.exports=function m(){if(!(this instanceof m)){if(1===arguments.length&&Array.isArray(arguments[0]))return s(m,arguments[0]);if(arguments.length>0){for(var e=Array(arguments.length),t=0;t<arguments.length;++t)e[t]=arguments[t];return s(m,e)}throw new TypeError("Cannot call a class as a function")}Object.defineProperty(this,i,{value:Object.create(null)})};b.prototype=Object.create((d?window.EventTarget:Object).prototype,{constructor:{value:b,writable:!0,configurable:!0},addEventListener:{value:function(e,t,n){if(null==t)return!1;if("function"!=typeof t&&"object"!=typeof t)throw new TypeError('"listener" is not an object.');var r=n?u:l,o=this[i][e];if(null==o)return this[i][e]=c(t,r),!0;for(var a=null;null!=o;){if(o.listener===t&&o.kind===r)return!1;a=o,o=o.next}return a.next=c(t,r),!0},configurable:!0,writable:!0},removeEventListener:{value:function(e,t,n){if(null==t)return!1;for(var r=n?u:l,o=null,a=this[i][e];null!=a;){if(a.listener===t&&a.kind===r)return null==o?this[i][e]=a.next:o.next=a.next,!0;o=a,a=a.next}return!1},configurable:!0,writable:!0},dispatchEvent:{value:function(e){var t=this[i][e.type];if(null==t)return!0;for(var n=p(e,this);null!=t&&("function"==typeof t.listener?t.listener.call(this,n):t.kind!==f&&"function"==typeof t.listener.handleEvent&&t.listener.handleEvent(n),!n[v]);)t=t.next;return!n.defaultPrevented},configurable:!0,writable:!0}})},{"./commons":1,"./custom-event-target":2,"./event-wrapper":4}],4:[function(e,t,n){"use strict";var r=e("./commons").createUniqueKey,o=r("stop_immediate_propagation_flag"),a=r("canceled_flag"),i=r("original_event"),u=Object.freeze({stopPropagation:Object.freeze({value:function(){var e=this[i];"function"==typeof e.stopPropagation&&e.stopPropagation()},writable:!0,configurable:!0}),stopImmediatePropagation:Object.freeze({value:function(){this[o]=!0;var e=this[i];"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()},writable:!0,configurable:!0}),preventDefault:Object.freeze({value:function(){this.cancelable===!0&&(this[a]=!0);var e=this[i];"function"==typeof e.preventDefault&&e.preventDefault()},writable:!0,configurable:!0}),defaultPrevented:Object.freeze({get:function(){return this[a]},enumerable:!0,configurable:!0})});n.STOP_IMMEDIATE_PROPAGATION_FLAG=o,n.createEventWrapper=function(e,t){var n="number"==typeof e.timeStamp?e.timeStamp:Date.now(),r={type:{value:e.type,enumerable:!0},target:{value:t,enumerable:!0},currentTarget:{value:t,enumerable:!0},eventPhase:{value:2,enumerable:!0},bubbles:{value:Boolean(e.bubbles),enumerable:!0},cancelable:{value:Boolean(e.cancelable),enumerable:!0},timeStamp:{value:n,enumerable:!0},isTrusted:{value:!1,enumerable:!0}};return r[o]={value:!1,writable:!0},r[a]={value:!1,writable:!0},r[i]={value:e},"undefined"!=typeof e.detail&&(r.detail={value:e.detail,enumerable:!0}),Object.create(Object.create(e,u),r)}},{"./commons":1}]},{},[3])(3)});

71
node_modules/event-target-shim/lib/commons.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
/**
* Creates a unique key.
*
* @param {string} name - A name to create.
* @returns {symbol|string}
* @private
*/
var createUniqueKey = exports.createUniqueKey = (typeof Symbol !== "undefined" ?
Symbol :
function createUniqueKey(name) {
return "[[" + name + "_" + Math.random().toFixed(8).slice(2) + "]]";
});
/**
* The key of listeners.
*
* @type {symbol|string}
* @private
*/
exports.LISTENERS = createUniqueKey("listeners");
/**
* A value of kind for listeners which are registered in the capturing phase.
*
* @type {number}
* @private
*/
exports.CAPTURE = 1;
/**
* A value of kind for listeners which are registered in the bubbling phase.
*
* @type {number}
* @private
*/
exports.BUBBLE = 2;
/**
* A value of kind for listeners which are registered as an attribute.
*
* @type {number}
* @private
*/
exports.ATTRIBUTE = 3;
/**
* @typedef object ListenerNode
* @property {function} listener - A listener function.
* @property {number} kind - The kind of the listener.
* @property {ListenerNode|null} next - The next node.
* If this node is the last, this is `null`.
*/
/**
* Creates a node of singly linked list for a list of listeners.
*
* @param {function} listener - A listener function.
* @param {number} kind - The kind of the listener.
* @returns {ListenerNode} The created listener node.
*/
exports.newNode = function newNode(listener, kind) {
return {listener: listener, kind: kind, next: null};
};

View File

@@ -0,0 +1,119 @@
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var Commons = require("./commons");
var LISTENERS = Commons.LISTENERS;
var ATTRIBUTE = Commons.ATTRIBUTE;
var newNode = Commons.newNode;
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
/**
* Gets a specified attribute listener from a given EventTarget object.
*
* @param {EventTarget} eventTarget - An EventTarget object to get.
* @param {string} type - An event type to get.
* @returns {function|null} The found attribute listener.
*/
function getAttributeListener(eventTarget, type) {
var node = eventTarget[LISTENERS][type];
while (node != null) {
if (node.kind === ATTRIBUTE) {
return node.listener;
}
node = node.next;
}
return null;
}
/**
* Sets a specified attribute listener to a given EventTarget object.
*
* @param {EventTarget} eventTarget - An EventTarget object to set.
* @param {string} type - An event type to set.
* @param {function|null} listener - A listener to be set.
* @returns {void}
*/
function setAttributeListener(eventTarget, type, listener) {
if (typeof listener !== "function" && typeof listener !== "object") {
listener = null; // eslint-disable-line no-param-reassign
}
var prev = null;
var node = eventTarget[LISTENERS][type];
while (node != null) {
if (node.kind === ATTRIBUTE) {
// Remove old value.
if (prev == null) {
eventTarget[LISTENERS][type] = node.next;
}
else {
prev.next = node.next;
}
}
else {
prev = node;
}
node = node.next;
}
// Add new value.
if (listener != null) {
if (prev == null) {
eventTarget[LISTENERS][type] = newNode(listener, ATTRIBUTE);
}
else {
prev.next = newNode(listener, ATTRIBUTE);
}
}
}
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
/**
* Defines an `EventTarget` implementation which has `onfoobar` attributes.
*
* @param {EventTarget} EventTargetBase - A base implementation of EventTarget.
* @param {string[]} types - A list of event types which are defined as attribute listeners.
* @returns {EventTarget} The defined `EventTarget` implementation which has attribute listeners.
*/
exports.defineCustomEventTarget = function(EventTargetBase, types) {
function EventTarget() {
EventTargetBase.call(this);
}
var descripter = {
constructor: {
value: EventTarget,
configurable: true,
writable: true
}
};
types.forEach(function(type) {
descripter["on" + type] = {
get: function() { return getAttributeListener(this, type); },
set: function(listener) { setAttributeListener(this, type, listener); },
configurable: true,
enumerable: true
};
});
EventTarget.prototype = Object.create(EventTargetBase.prototype, descripter);
return EventTarget;
};

190
node_modules/event-target-shim/lib/event-target.js generated vendored Normal file
View File

@@ -0,0 +1,190 @@
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var Commons = require("./commons");
var CustomEventTarget = require("./custom-event-target");
var EventWrapper = require("./event-wrapper");
var LISTENERS = Commons.LISTENERS;
var CAPTURE = Commons.CAPTURE;
var BUBBLE = Commons.BUBBLE;
var ATTRIBUTE = Commons.ATTRIBUTE;
var newNode = Commons.newNode;
var defineCustomEventTarget = CustomEventTarget.defineCustomEventTarget;
var createEventWrapper = EventWrapper.createEventWrapper;
var STOP_IMMEDIATE_PROPAGATION_FLAG =
EventWrapper.STOP_IMMEDIATE_PROPAGATION_FLAG;
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
/**
* A flag which shows there is the native `EventTarget` interface object.
*
* @type {boolean}
* @private
*/
var HAS_EVENTTARGET_INTERFACE = (
typeof window !== "undefined" &&
typeof window.EventTarget !== "undefined"
);
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
/**
* An implementation for `EventTarget` interface.
*
* @constructor
* @public
*/
var EventTarget = module.exports = function EventTarget() {
if (this instanceof EventTarget) {
// this[LISTENERS] is a Map.
// Its key is event type.
// Its value is ListenerNode object or null.
//
// interface ListenerNode {
// var listener: Function
// var kind: CAPTURE|BUBBLE|ATTRIBUTE
// var next: ListenerNode|null
// }
Object.defineProperty(this, LISTENERS, {value: Object.create(null)});
}
else if (arguments.length === 1 && Array.isArray(arguments[0])) {
return defineCustomEventTarget(EventTarget, arguments[0]);
}
else if (arguments.length > 0) {
var types = Array(arguments.length);
for (var i = 0; i < arguments.length; ++i) {
types[i] = arguments[i];
}
// To use to extend with attribute listener properties.
// e.g.
// class MyCustomObject extends EventTarget("message", "error") {
// //...
// }
return defineCustomEventTarget(EventTarget, types);
}
else {
throw new TypeError("Cannot call a class as a function");
}
};
EventTarget.prototype = Object.create(
(HAS_EVENTTARGET_INTERFACE ? window.EventTarget : Object).prototype,
{
constructor: {
value: EventTarget,
writable: true,
configurable: true
},
addEventListener: {
value: function addEventListener(type, listener, capture) {
if (listener == null) {
return false;
}
if (typeof listener !== "function" && typeof listener !== "object") {
throw new TypeError("\"listener\" is not an object.");
}
var kind = (capture ? CAPTURE : BUBBLE);
var node = this[LISTENERS][type];
if (node == null) {
this[LISTENERS][type] = newNode(listener, kind);
return true;
}
var prev = null;
while (node != null) {
if (node.listener === listener && node.kind === kind) {
// Should ignore a duplicated listener.
return false;
}
prev = node;
node = node.next;
}
prev.next = newNode(listener, kind);
return true;
},
configurable: true,
writable: true
},
removeEventListener: {
value: function removeEventListener(type, listener, capture) {
if (listener == null) {
return false;
}
var kind = (capture ? CAPTURE : BUBBLE);
var prev = null;
var node = this[LISTENERS][type];
while (node != null) {
if (node.listener === listener && node.kind === kind) {
if (prev == null) {
this[LISTENERS][type] = node.next;
}
else {
prev.next = node.next;
}
return true;
}
prev = node;
node = node.next;
}
return false;
},
configurable: true,
writable: true
},
dispatchEvent: {
value: function dispatchEvent(event) {
// If listeners aren't registered, terminate.
var node = this[LISTENERS][event.type];
if (node == null) {
return true;
}
// Since we cannot rewrite several properties, so wrap object.
var wrapped = createEventWrapper(event, this);
// This doesn't process capturing phase and bubbling phase.
// This isn't participating in a tree.
while (node != null) {
if (typeof node.listener === "function") {
node.listener.call(this, wrapped);
}
else if (node.kind !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
node.listener.handleEvent(wrapped);
}
if (wrapped[STOP_IMMEDIATE_PROPAGATION_FLAG]) {
break;
}
node = node.next;
}
return !wrapped.defaultPrevented;
},
configurable: true,
writable: true
}
}
);

141
node_modules/event-target-shim/lib/event-wrapper.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
/**
* @author Toru Nagashima
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
var createUniqueKey = require("./commons").createUniqueKey;
//-----------------------------------------------------------------------------
// Constsnts
//-----------------------------------------------------------------------------
/**
* The key of the flag which is turned on by `stopImmediatePropagation` method.
*
* @type {symbol|string}
* @private
*/
var STOP_IMMEDIATE_PROPAGATION_FLAG =
createUniqueKey("stop_immediate_propagation_flag");
/**
* The key of the flag which is turned on by `preventDefault` method.
*
* @type {symbol|string}
* @private
*/
var CANCELED_FLAG = createUniqueKey("canceled_flag");
/**
* The key of the original event object.
*
* @type {symbol|string}
* @private
*/
var ORIGINAL_EVENT = createUniqueKey("original_event");
/**
* Method definitions for the event wrapper.
*
* @type {object}
* @private
*/
var wrapperPrototypeDefinition = Object.freeze({
stopPropagation: Object.freeze({
value: function stopPropagation() {
var e = this[ORIGINAL_EVENT];
if (typeof e.stopPropagation === "function") {
e.stopPropagation();
}
},
writable: true,
configurable: true
}),
stopImmediatePropagation: Object.freeze({
value: function stopImmediatePropagation() {
this[STOP_IMMEDIATE_PROPAGATION_FLAG] = true;
var e = this[ORIGINAL_EVENT];
if (typeof e.stopImmediatePropagation === "function") {
e.stopImmediatePropagation();
}
},
writable: true,
configurable: true
}),
preventDefault: Object.freeze({
value: function preventDefault() {
if (this.cancelable === true) {
this[CANCELED_FLAG] = true;
}
var e = this[ORIGINAL_EVENT];
if (typeof e.preventDefault === "function") {
e.preventDefault();
}
},
writable: true,
configurable: true
}),
defaultPrevented: Object.freeze({
get: function defaultPrevented() { return this[CANCELED_FLAG]; },
enumerable: true,
configurable: true
})
});
//-----------------------------------------------------------------------------
// Public Interface
//-----------------------------------------------------------------------------
exports.STOP_IMMEDIATE_PROPAGATION_FLAG = STOP_IMMEDIATE_PROPAGATION_FLAG;
/**
* Creates an event wrapper.
*
* We cannot modify several properties of `Event` object, so we need to create the wrapper.
* Plus, this wrapper supports non `Event` objects.
*
* @param {Event|{type: string}} event - An original event to create the wrapper.
* @param {EventTarget} eventTarget - The event target of the event.
* @returns {Event} The created wrapper. This object is implemented `Event` interface.
* @private
*/
exports.createEventWrapper = function createEventWrapper(event, eventTarget) {
var timeStamp = (
typeof event.timeStamp === "number" ? event.timeStamp : Date.now()
);
var propertyDefinition = {
type: {value: event.type, enumerable: true},
target: {value: eventTarget, enumerable: true},
currentTarget: {value: eventTarget, enumerable: true},
eventPhase: {value: 2, enumerable: true},
bubbles: {value: Boolean(event.bubbles), enumerable: true},
cancelable: {value: Boolean(event.cancelable), enumerable: true},
timeStamp: {value: timeStamp, enumerable: true},
isTrusted: {value: false, enumerable: true}
};
propertyDefinition[STOP_IMMEDIATE_PROPAGATION_FLAG] = {value: false, writable: true};
propertyDefinition[CANCELED_FLAG] = {value: false, writable: true};
propertyDefinition[ORIGINAL_EVENT] = {value: event};
// For CustomEvent.
if (typeof event.detail !== "undefined") {
propertyDefinition.detail = {value: event.detail, enumerable: true};
}
return Object.create(
Object.create(event, wrapperPrototypeDefinition),
propertyDefinition
);
};

118
node_modules/event-target-shim/package.json generated vendored Normal file
View File

@@ -0,0 +1,118 @@
{
"_args": [
[
"event-target-shim@^1.0.5",
"/home/bernhard/freifunk-app/node_modules/react-native"
]
],
"_from": "event-target-shim@>=1.0.5 <2.0.0",
"_id": "event-target-shim@1.1.1",
"_inCache": true,
"_installable": true,
"_location": "/event-target-shim",
"_nodeVersion": "4.2.3",
"_npmUser": {
"email": "star.ctor@gmail.com",
"name": "mysticatea"
},
"_npmVersion": "3.5.0",
"_phantomChildren": {},
"_requested": {
"name": "event-target-shim",
"raw": "event-target-shim@^1.0.5",
"rawSpec": "^1.0.5",
"scope": null,
"spec": ">=1.0.5 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/react-native"
],
"_resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-1.1.1.tgz",
"_shasum": "a86e5ee6bdaa16054475da797ccddf0c55698491",
"_shrinkwrap": null,
"_spec": "event-target-shim@^1.0.5",
"_where": "/home/bernhard/freifunk-app/node_modules/react-native",
"author": {
"name": "Toru Nagashima"
},
"bugs": {
"url": "https://github.com/mysticatea/event-target-shim/issues"
},
"dependencies": {},
"description": "An implementation of W3C EventTarget interface.",
"devDependencies": {
"browserify": "^12.0.1",
"browserify-istanbul": "^0.2.1",
"coveralls": "^2.11.4",
"eslint": "^1.10.2",
"eslint-config-mysticatea": "^1.9.0",
"eslint-plugin-mysticatea": "^1.0.3",
"eslint-plugin-node": "^0.2.0",
"espower-loader": "^1.0.0",
"espowerify": "^1.0.0",
"istanbul": "^0.4.1",
"karma": "^0.13.15",
"karma-browserify": "^4.2.1",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "^0.5.3",
"karma-firefox-launcher": "^0.1.6",
"karma-growl-reporter": "^0.1.1",
"karma-ie-launcher": "^0.2.0",
"karma-mocha": "^0.2.1",
"mkdirp": "^0.5.1",
"mocha": "^2.2.5",
"npm-run-all": "^1.2.5",
"power-assert": "^1.2.0",
"rimraf": "^2.3.4",
"spy": "^0.1.3",
"uglify-js": "^2.6.1"
},
"directories": {},
"dist": {
"shasum": "a86e5ee6bdaa16054475da797ccddf0c55698491",
"tarball": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-1.1.1.tgz"
},
"files": [
"dist",
"lib"
],
"gitHead": "a42f0a2b99fcea18856cbc64ab3b5f0aceaecb7b",
"homepage": "https://github.com/mysticatea/event-target-shim",
"keywords": [
"event",
"events",
"eventtarget",
"shim",
"w3c"
],
"license": "MIT",
"main": "lib/event-target.js",
"maintainers": [
{
"name": "mysticatea",
"email": "star.ctor@gmail.com"
}
],
"name": "event-target-shim",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/mysticatea/event-target-shim.git"
},
"scripts": {
"build": "npm-run-all clean lint test build:*",
"build:dist": "mkdirp dist && browserify lib/event-target.js --standalone event-target-shim > dist/event-target-shim.js",
"build:dist-min": "uglifyjs dist/event-target-shim.js --compress --mangle > dist/event-target-shim.min.js",
"clean": "rimraf coverage dist",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"lint": "eslint lib test",
"postversion": "git push && git push --tags",
"preversion": "npm run build",
"test": "npm-run-all clean lint && karma start karma.conf.js --single-run",
"travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- test/**/*.js --require scripts/power-assert",
"watch": "karma start karma.conf.js --watch"
},
"version": "1.1.1"
}