Regenrate things

master
Dmitry Baranovskiy 2017-01-18 11:42:08 +11:00
parent dd8b5a249e
commit c31fad6ef9
3 changed files with 83 additions and 36 deletions

File diff suppressed because one or more lines are too long

89
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// build: 2017-01-03 // build: 2017-01-18
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
@ -30,13 +30,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// ┌────────────────────────────────────────────────────────────┐ \\ // ┌────────────────────────────────────────────────────────────┐ \\
// │ Eve 0.4.2 - JavaScript Events Library │ \\ // │ Eve 0.5.0 - JavaScript Events Library │ \\
// ├────────────────────────────────────────────────────────────┤ \\ // ├────────────────────────────────────────────────────────────┤ \\
// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\ // │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
// └────────────────────────────────────────────────────────────┘ \\ // └────────────────────────────────────────────────────────────┘ \\
(function (glob) { (function (glob) {
var version = "0.4.2", var version = "0.5.0",
has = "hasOwnProperty", has = "hasOwnProperty",
separator = /[\.\/]/, separator = /[\.\/]/,
comaseparator = /\s*,\s*/, comaseparator = /\s*,\s*/,
@ -63,6 +63,11 @@
} }
} }
}, },
objtos = Object.prototype.toString,
Str = String,
isArray = Array.isArray || function (ar) {
return ar instanceof Array || objtos.call(ar) == "[object Array]";
};
/*\ /*\
* eve * eve
[ method ] [ method ]
@ -78,7 +83,6 @@
= (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value. = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.
\*/ \*/
eve = function (name, scope) { eve = function (name, scope) {
name = String(name);
var e = events, var e = events,
oldstop = stop, oldstop = stop,
args = Array.prototype.slice.call(arguments, 2), args = Array.prototype.slice.call(arguments, 2),
@ -155,7 +159,7 @@
= (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,
@ -185,7 +189,25 @@
} }
return out; return out;
}; };
/*\
* eve.separator
[ method ]
* If for some reasons you dont 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 ]
@ -195,11 +217,12 @@
| 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
** **
- name (array) if you dont 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. = (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", eatIt)(2); | eve.on("mouse", eatIt)(2);
@ -211,14 +234,13 @@
* Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case. * Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case.
\*/ \*/
eve.on = function (name, f) { eve.on = function (name, f) {
name = String(name);
if (typeof f != "function") { if (typeof f != "function") {
return function () {}; return function () {};
} }
var names = name.split(comaseparator); var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
for (var i = 0, ii = names.length; i < ii; i++) { for (var i = 0, ii = names.length; i < ii; i++) {
(function (name) { (function (name) {
var names = name.split(separator), var names = isArray(name) ? name : Str(name).split(separator),
e = events, e = events,
exist; exist;
for (var i = 0, ii = names.length; i < ii; i++) { for (var i = 0, ii = names.length; i < ii; i++) {
@ -285,10 +307,11 @@
= (boolean) `true`, if current events name contains `subname` = (boolean) `true`, if current events 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.nts * eve.nts
@ -300,7 +323,7 @@
= (array) names of the event = (array) names of the event
\*/ \*/
eve.nts = function () { eve.nts = function () {
return current_event.split(separator); return isArray(current_event) ? current_event : current_event.split(separator);
}; };
/*\ /*\
* eve.off * eve.off
@ -325,19 +348,20 @@
eve._events = events = {n: {}}; eve._events = events = {n: {}};
return; return;
} }
var names = name.split(comaseparator); var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
if (names.length > 1) { if (names.length > 1) {
for (var i = 0, ii = names.length; i < ii; i++) { for (var i = 0, ii = names.length; i < ii; i++) {
eve.off(names[i], f); eve.off(names[i], f);
} }
return; return;
} }
names = name.split(separator); names = isArray(name) ? name : Str(name).split(separator);
var e, var e,
key, key,
splice, splice,
i, ii, j, jj, i, ii, j, jj,
cur = [events]; cur = [events],
inodes = [];
for (i = 0, ii = names.length; i < ii; i++) { for (i = 0, ii = names.length; i < ii; i++) {
for (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];
@ -345,10 +369,18 @@
if (names[i] != wildcard) { if (names[i] != wildcard) {
if (e[names[i]]) { if (e[names[i]]) {
splice.push(e[names[i]]); splice.push(e[names[i]]);
inodes.unshift({
n: e,
name: names[i]
});
} }
} else { } else {
for (key in e) if (e[has](key)) { for (key in e) if (e[has](key)) {
splice.push(e[key]); splice.push(e[key]);
inodes.unshift({
n: e,
name: key
});
} }
} }
cur.splice.apply(cur, splice); cur.splice.apply(cur, splice);
@ -382,6 +414,20 @@
e = e.n; e = e.n;
} }
} }
// prune inner nodes in path
prune: for (i = 0, ii = inodes.length; i < ii; i++) {
e = inodes[i];
for (key in e.n[e.name].f) {
// not empty (has listeners)
continue prune;
}
for (key in e.n[e.name].n) {
// not empty (has children)
continue prune;
}
// is empty
delete e.n[e.name];
}
}; };
/*\ /*\
* eve.once * eve.once
@ -402,7 +448,7 @@
\*/ \*/
eve.once = function (name, f) { eve.once = function (name, f) {
var f2 = function () { var f2 = function () {
eve.unbind(name, f2); eve.off(name, f2);
return f.apply(this, arguments); return f.apply(this, arguments);
}; };
return eve.on(name, f2); return eve.on(name, f2);
@ -438,7 +484,7 @@
} }
}(window || this, function (window, eve) { }(window || this, function (window, eve) {
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2017 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -580,7 +626,7 @@ var mina = (function (eve) {
- a (number) start _slave_ number - a (number) start _slave_ number
- A (number) end _slave_ number - A (number) end _slave_ number
- b (number) start _master_ number (start time in general case) - b (number) start _master_ number (start time in general case)
- B (number) end _master_ number (end time in gereal case) - B (number) end _master_ number (end time in general case)
- get (function) getter of _master_ number (see @mina.time) - get (function) getter of _master_ number (see @mina.time)
- set (function) setter of _slave_ number - set (function) setter of _slave_ number
- easing (function) #optional easing function, default is @mina.linear - easing (function) #optional easing function, default is @mina.linear
@ -794,6 +840,7 @@ var mina = (function (eve) {
window.mina = mina; window.mina = mina;
return mina; return mina;
})(typeof eve == "undefined" ? function () {} : eve); })(typeof eve == "undefined" ? function () {} : eve);
// Copyright (c) 2013 - 2015 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 - 2015 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -879,7 +926,7 @@ var has = "hasOwnProperty",
hsrg = {hs: 1, rg: 1}, hsrg = {hs: 1, rg: 1},
pathCommand = /([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig, pathCommand = /([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
tCommand = /([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig, tCommand = /([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
pathValues = /(-?\d*\.?\d*(?:e[\-+]?\\d+)?)[\s]*,?[\s]*/ig, pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\s]*,?[\s]*/ig,
idgen = 0, idgen = 0,
idprefix = "S" + (+new Date).toString(36), idprefix = "S" + (+new Date).toString(36),
ID = function (el) { ID = function (el) {
@ -5192,7 +5239,7 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
offset: +offset + "%" offset: +offset + "%"
}; };
color = Snap.color(color); color = Snap.color(color);
attr["stop-color"] = color.hex; attr["stop-color"] = color.toString();
if (color.opacity < 1) { if (color.opacity < 1) {
attr["stop-opacity"] = color.opacity; attr["stop-opacity"] = color.opacity;
} }

View File

@ -9665,7 +9665,7 @@ the classs presence or the value of the <code>flag</code> argument.
<span class="dr-description">start <em>master</em> number (start time in general case)</span></li> <span class="dr-description">start <em>master</em> number (start time in general case)</span></li>
<li class="topcoat-list__item"><span class="dr-param">B</span> <li class="topcoat-list__item"><span class="dr-param">B</span>
<span class="dr-type"><em class="dr-type-number">number</em> </span> <span class="dr-type"><em class="dr-type-number">number</em> </span>
<span class="dr-description">end <em>master</em> number (end time in gereal case)</span></li> <span class="dr-description">end <em>master</em> number (end time in general case)</span></li>
<li class="topcoat-list__item"><span class="dr-param">get</span> <li class="topcoat-list__item"><span class="dr-param">get</span>
<span class="dr-type"><em class="dr-type-function">function</em> </span> <span class="dr-type"><em class="dr-type-function">function</em> </span>
<span class="dr-description">getter of <em>master</em> number (see <a href="#mina.time" class="dr-link">mina.time</a>)</span></li> <span class="dr-description">getter of <em>master</em> number (see <a href="#mina.time" class="dr-link">mina.time</a>)</span></li>