Commit 07f3dd1d by Tomas Alabes

Using custom repo for eve as all other repos are outdated

parent 6fe6a270
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"main": "raphael.min.js", "main": "raphael.min.js",
"description": "JavaScript Vector Library", "description": "JavaScript Vector Library",
"dependencies": { "dependencies": {
"eve": "adobe-webplatform/eve" "eve-raphael": "0.5.0"
}, },
"devDependencies": { "devDependencies": {
"requirejs": "2.3.2" "requirejs": "2.3.2"
......
...@@ -5482,46 +5482,77 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5482,46 +5482,77 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 2 */ /* 2 */
/***/ function(module, exports) { /***/ function(module, exports, __webpack_require__) {
/* var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
* Eve 0.2.4 - JavaScript Events Library //
* // Licensed under the Apache License, Version 2.0 (the "License");
* Copyright (c) 2011 Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) // you may not use this file except in compliance with the License.
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. // You may obtain a copy of the License at
*/ //
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ┌────────────────────────────────────────────────────────────┐ \\
// │ Eve 0.5.0 - JavaScript Events Library │ \\
// ├────────────────────────────────────────────────────────────┤ \\
// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
// └────────────────────────────────────────────────────────────┘ \\
(function (glob) { (function (glob) {
var version = "0.2.4", var version = "0.5.0",
has = "hasOwnProperty", has = "hasOwnProperty",
separator = /[\.\/]/, separator = /[\.\/]/,
comaseparator = /\s*,\s*/,
wildcard = "*", wildcard = "*",
fun = function () {}, fun = function () {},
numsort = function (a, b) { numsort = function (a, b) {
return a - b; return a - b;
}, },
current_event, current_event,
stop,
events = {n: {}}, events = {n: {}},
firstDefined = function () {
for (var i = 0, ii = this.length; i < ii; i++) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
lastDefined = function () {
var i = this.length;
while (--i) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
objtos = Object.prototype.toString,
Str = String,
isArray = Array.isArray || function (ar) {
return ar instanceof Array || objtos.call(ar) == "[object Array]";
};
/*\ /*\
* eve * eve
[ method ] [ method ]
**
* Fires event with given `name`, given scope and other parameters. * Fires event with given `name`, given scope and other parameters.
**
> Arguments > Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated - name (string) name of the *event*, dot (`.`) or slash (`/`) separated
- scope (object) context for the event handlers - scope (object) context for the event handlers
- varargs (...) the rest of arguments will be sent to event handlers - varargs (...) the rest of arguments will be sent to event handlers
**
= (array) array of errors, if any. Each element of the array is in format: = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.
o {
o error (string) error message
o func (function) handler that caused error
o }
\*/ \*/
eve = function (name, scope) { eve = function (name, scope) {
var e = events, var e = events,
oldstop = stop,
args = Array.prototype.slice.call(arguments, 2), args = Array.prototype.slice.call(arguments, 2),
listeners = eve.listeners(name), listeners = eve.listeners(name),
z = 0, z = 0,
...@@ -5529,8 +5560,13 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5529,8 +5560,13 @@ return /******/ (function(modules) { // webpackBootstrap
l, l,
indexed = [], indexed = [],
queue = {}, queue = {},
out = [],
ce = current_event,
errors = []; errors = [];
out.firstDefined = firstDefined;
out.lastDefined = lastDefined;
current_event = name; current_event = name;
stop = 0;
for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) { for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
indexed.push(listeners[i].zIndex); indexed.push(listeners[i].zIndex);
if (listeners[i].zIndex < 0) { if (listeners[i].zIndex < 0) {
...@@ -5540,48 +5576,58 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5540,48 +5576,58 @@ return /******/ (function(modules) { // webpackBootstrap
indexed.sort(numsort); indexed.sort(numsort);
while (indexed[z] < 0) { while (indexed[z] < 0) {
l = queue[indexed[z++]]; l = queue[indexed[z++]];
if (l.apply(scope, args) === f) { out.push(l.apply(scope, args));
return f; if (stop) {
stop = oldstop;
return out;
} }
} }
for (i = 0; i < ii; i++) { for (i = 0; i < ii; i++) {
l = listeners[i]; l = listeners[i];
if ("zIndex" in l) { if ("zIndex" in l) {
if (l.zIndex == indexed[z]) { if (l.zIndex == indexed[z]) {
if (l.apply(scope, args) === f) { out.push(l.apply(scope, args));
return f; if (stop) {
break;
} }
do { do {
z++; z++;
l = queue[indexed[z]]; l = queue[indexed[z]];
if (l && l.apply(scope, args) === f) { l && out.push(l.apply(scope, args));
return f; if (stop) {
break;
} }
} while (l) } while (l)
} else { } else {
queue[l.zIndex] = l; queue[l.zIndex] = l;
} }
} else { } else {
if (l.apply(scope, args) === f) { out.push(l.apply(scope, args));
return f; if (stop) {
break;
} }
} }
} }
stop = oldstop;
current_event = ce;
return out;
}; };
// Undocumented. Debug only.
eve._events = events;
/*\ /*\
* eve.listeners * eve.listeners
[ method ] [ method ]
**
* Internal method which gives you array of all event handlers that will be triggered by the given `name`. * Internal method which gives you array of all event handlers that will be triggered by the given `name`.
**
> Arguments > Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated - name (string) name of the event, dot (`.`) or slash (`/`) separated
**
= (array) array of event handlers = (array) array of event handlers
\*/ \*/
eve.listeners = function (name) { eve.listeners = function (name) {
var names = name.split(separator), var names = isArray(name) ? name : name.split(separator),
e = events, e = events,
item, item,
items, items,
...@@ -5611,7 +5657,25 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5611,7 +5657,25 @@ return /******/ (function(modules) { // webpackBootstrap
} }
return out; return out;
}; };
/*\
* eve.separator
[ method ]
* If for some reasons you don’t like default separators (`.` or `/`) you can specify yours
* here. Be aware that if you pass a string longer than one character it will be treated as
* a list of characters.
- separator (string) new separator. Empty string resets to default: `.` or `/`.
\*/
eve.separator = function (sep) {
if (sep) {
sep = Str(sep).replace(/(?=[\.\^\]\[\-])/g, "\\");
sep = "[" + sep + "]";
separator = new RegExp(sep);
} else {
separator = /[\.\/]/;
}
};
/*\ /*\
* eve.on * eve.on
[ method ] [ method ]
...@@ -5621,33 +5685,44 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5621,33 +5685,44 @@ return /******/ (function(modules) { // webpackBootstrap
| eve("mouse.under.floor"); // triggers f | eve("mouse.under.floor"); // triggers f
* Use @eve to trigger the listener. * Use @eve to trigger the listener.
** **
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function - f (function) event handler function
** **
= (function) returned function accept one number parameter that represents z-index of the handler. It is optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. - name (array) if you don’t want to use separators, you can use array of strings
- f (function) event handler function
**
= (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
> Example: > Example:
| eve.on("mouse", eat)(2); | eve.on("mouse", eatIt)(2);
| eve.on("mouse", scream); | eve.on("mouse", scream);
| eve.on("mouse", catch)(1); | eve.on("mouse", catchIt)(1);
* This will ensure that `catch` function will be called before `eat`. * This will ensure that `catchIt` function will be called before `eatIt`.
* If you want to put you hadler before not indexed handlers specify negative value. *
* If you want to put your handler before non-indexed handlers, specify a negative value.
* Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”. * Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.
\*/ \*/
eve.on = function (name, f) { eve.on = function (name, f) {
var names = name.split(separator), if (typeof f != "function") {
e = events; return function () {};
for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n;
!e[names[i]] && (e[names[i]] = {n: {}});
e = e[names[i]];
} }
e.f = e.f || []; var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) { for (var i = 0, ii = names.length; i < ii; i++) {
return fun; (function (name) {
var names = isArray(name) ? name : Str(name).split(separator),
e = events,
exist;
for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n;
e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}});
}
e.f = e.f || [];
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
exist = true;
break;
}
!exist && e.f.push(f);
}(names[i]));
} }
e.f.push(f);
return function (zIndex) { return function (zIndex) {
if (+zIndex == +zIndex) { if (+zIndex == +zIndex) {
f.zIndex = +zIndex; f.zIndex = +zIndex;
...@@ -5655,6 +5730,37 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5655,6 +5730,37 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
}; };
/*\ /*\
* eve.f
[ method ]
**
* Returns function that will fire given event with optional arguments.
* Arguments that will be passed to the result function will be also
* concated to the list of final arguments.
| el.onclick = eve.f("click", 1, 2);
| eve.on("click", function (a, b, c) {
| console.log(a, b, c); // 1, 2, [event object]
| });
> Arguments
- event (string) event name
- varargs (…) and any other arguments
= (function) possible event handler function
\*/
eve.f = function (event) {
var attrs = [].slice.call(arguments, 1);
return function () {
eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));
};
};
/*\
* eve.stop
[ method ]
**
* Is used inside an event handler to stop the event, preventing any subsequent listeners from firing.
\*/
eve.stop = function () {
stop = 1;
};
/*\
* eve.nt * eve.nt
[ method ] [ method ]
** **
...@@ -5669,30 +5775,62 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5669,30 +5775,62 @@ return /******/ (function(modules) { // webpackBootstrap
= (boolean) `true`, if current event’s name contains `subname` = (boolean) `true`, if current event’s name contains `subname`
\*/ \*/
eve.nt = function (subname) { eve.nt = function (subname) {
var cur = isArray(current_event) ? current_event.join(".") : current_event;
if (subname) { if (subname) {
return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event); return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(cur);
} }
return current_event; return cur;
}; };
/*\ /*\
* eve.unbind * eve.nts
[ method ]
**
* Could be used inside event handler to figure out actual name of the event.
**
**
= (array) names of the event
\*/
eve.nts = function () {
return isArray(current_event) ? current_event : current_event.split(separator);
};
/*\
* eve.off
[ method ] [ method ]
** **
* Removes given function from the list of event listeners assigned to given name. * Removes given function from the list of event listeners assigned to given name.
* If no arguments specified all the events will be cleared.
** **
> Arguments > Arguments
** **
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function - f (function) event handler function
\*/ \*/
eve.unbind = function (name, f) { /*\
var names = name.split(separator), * eve.unbind
e, [ method ]
**
* See @eve.off
\*/
eve.off = eve.unbind = function (name, f) {
if (!name) {
eve._events = events = {n: {}};
return;
}
var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
if (names.length > 1) {
for (var i = 0, ii = names.length; i < ii; i++) {
eve.off(names[i], f);
}
return;
}
names = isArray(name) ? name : Str(name).split(separator);
var e,
key, key,
splice, splice,
i, ii, j, jj,
cur = [events]; cur = [events];
for (var i = 0, ii = names.length; i < ii; i++) { for (i = 0, ii = names.length; i < ii; i++) {
for (var j = 0; j < cur.length; j += splice.length - 2) { for (j = 0; j < cur.length; j += splice.length - 2) {
splice = [j, 1]; splice = [j, 1];
e = cur[j].n; e = cur[j].n;
if (names[i] != wildcard) { if (names[i] != wildcard) {
...@@ -5712,16 +5850,16 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5712,16 +5850,16 @@ return /******/ (function(modules) { // webpackBootstrap
while (e.n) { while (e.n) {
if (f) { if (f) {
if (e.f) { if (e.f) {
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) { for (j = 0, jj = e.f.length; j < jj; j++) if (e.f[j] == f) {
e.f.splice(i, 1); e.f.splice(j, 1);
break; break;
} }
!e.f.length && delete e.f; !e.f.length && delete e.f;
} }
for (key in e.n) if (e.n[has](key) && e.n[key].f) { for (key in e.n) if (e.n[has](key) && e.n[key].f) {
var funcs = e.n[key].f; var funcs = e.n[key].f;
for (i = 0, ii = funcs.length; i < ii; i++) if (funcs[i] == f) { for (j = 0, jj = funcs.length; j < jj; j++) if (funcs[j] == f) {
funcs.splice(i, 1); funcs.splice(j, 1);
break; break;
} }
!funcs.length && delete e.n[key].f; !funcs.length && delete e.n[key].f;
...@@ -5737,6 +5875,30 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5737,6 +5875,30 @@ return /******/ (function(modules) { // webpackBootstrap
} }
}; };
/*\ /*\
* eve.once
[ method ]
**
* Binds given event handler with a given name to only run once then unbind itself.
| eve.once("login", f);
| eve("login"); // triggers f
| eve("login"); // no listeners
* Use @eve to trigger the listener.
**
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function
**
= (function) same return function as @eve.on
\*/
eve.once = function (name, f) {
var f2 = function () {
eve.off(name, f2);
return f.apply(this, arguments);
};
return eve.on(name, f2);
};
/*\
* eve.version * eve.version
[ property (string) ] [ property (string) ]
** **
...@@ -5746,9 +5908,10 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -5746,9 +5908,10 @@ return /******/ (function(modules) { // webpackBootstrap
eve.toString = function () { eve.toString = function () {
return "You are running Eve " + version; return "You are running Eve " + version;
}; };
(typeof module != "undefined" && module.exports) ? (module.exports = eve) : (glob.eve = eve); (typeof module != "undefined" && module.exports) ? (module.exports = eve) : ( true ? (!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { return eve; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))) : (glob.eve = eve));
})(this); })(this);
/***/ }, /***/ },
/* 3 */ /* 3 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -58,7 +58,7 @@ module.exports = { ...@@ -58,7 +58,7 @@ module.exports = {
resolve: { resolve: {
modulesDirectories: ["bower_components"], modulesDirectories: ["bower_components"],
alias: { alias: {
"eve": "eve/eve" "eve": "eve-raphael/eve"
} }
} }
}; };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment