Compare commits
34 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
78a6ed3ec2 | |
|
|
38d4ba69d2 | |
|
|
a8f10206c0 | |
|
|
a5cd61ad78 | |
|
|
44644e5ca3 | |
|
|
3b0240d3fb | |
|
|
d7626c4650 | |
|
|
db2b2f2b91 | |
|
|
5bfc8a3197 | |
|
|
cca8f941e4 | |
|
|
9cf2118d9a | |
|
|
9f04a78050 | |
|
|
acfdc78c7f | |
|
|
d9da47ddcf | |
|
|
9c672c8114 | |
|
|
7e704f682f | |
|
|
ffeb914945 | |
|
|
58a5c90f4d | |
|
|
c89ffbe857 | |
|
|
48491c87c5 | |
|
|
f803b084f3 | |
|
|
8abe20eedd | |
|
|
f5d909be1b | |
|
|
3fb83189ad | |
|
|
98bfdf6c80 | |
|
|
fdd4de43e7 | |
|
|
1290ef5e44 | |
|
|
7685bb3e85 | |
|
|
6b10adf8d2 | |
|
|
793d51a38c | |
|
|
3f222e5e61 | |
|
|
acd99e64ee | |
|
|
921f6e2d1b | |
|
|
af9bcf72b9 |
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
"extends": "standard",
|
||||
"plugins": [
|
||||
"standard"
|
||||
]
|
||||
};
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
node_modules
|
||||
/.idea
|
||||
bower_components/
|
||||
|
||||
.idea
|
||||
*.iml
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
## Want to contribute?
|
||||
|
||||
All changes in code must go to `raphael.core`, `raphael.svg` or `raphael.vml`.
|
||||
`raphael.js` and `raphael-min.js` are generated files, generated after running `grunt` in the `dev` directory.
|
||||
The rest are generated files, generated after running `npm run build`.
|
||||
|
||||
After changing the core/vml/svg files, execute `grunt` in the dev folder to generate the minified version, make a commit and you are ready to make a pull request!
|
||||
To run tests you need to open `dev/test/index.html` in your browser, there's no automated way right now.
|
||||
|
||||
After changing the core/vml/svg files, execute `npm run build` to generate all versions, make a commit and you are ready to make a pull request!
|
||||
Remember that if you want to add a functionality it must be present in the vml and svg versions, **no svg-only features will be accepted.**
|
||||
|
||||
## Found an issue?
|
||||
|
|
|
|||
27
README.md
27
README.md
|
|
@ -1,20 +1,30 @@
|
|||
# Raphaël: Cross-browser vector graphics the easy way.
|
||||
|
||||
Visit the library website for more information: [http://raphaeljs.com](http://raphaeljs.com/)
|
||||
Visit the library website for more information: ~~[http://raphaeljs.com](http://raphaeljs.com/)~~ [http://dmitrybaranovskiy.github.io/raphael/](http://dmitrybaranovskiy.github.io/raphael/)
|
||||
|
||||
## Quickstart guide
|
||||
|
||||
You need to have NPM installed to build the library.
|
||||
|
||||
* `git clone https://github.com/DmitryBaranovskiy/raphael.git`
|
||||
* `npm install && ./node_modules/grunt-cli/bin/grunt` or just `npm install && grunt` if you have grunt already installed
|
||||
* `npm run start`
|
||||
* `npm run build`
|
||||
|
||||
To run tests you need to open `dev/test/index.html` in your browser, there's no automated way right now.
|
||||
|
||||
## Dependencies
|
||||
* [eve](https://github.com/adobe-webplatform/eve)
|
||||
|
||||
You have the `raphael/raphael-min.js` files that has `eve` bundled inside, and `raphael-nodeps/raphael-nodeps-min.js`
|
||||
where `eve` must be loaded by you first (you can try with the one in the `dev/` folder).
|
||||
For AMD loading like Browserify, you can use raphael.amd.js.
|
||||
|
||||
## Distributable
|
||||
|
||||
All files are UMD compliant.
|
||||
|
||||
You can use:
|
||||
* `raphael.min.js` (includes `eve` and it's minified)
|
||||
* `raphael.js` (includes `eve` and it's not minified)
|
||||
* `raphael.no-deps.js` (doesn't include `eve` it's not minified)
|
||||
* `raphael.no-deps.min.js` (doesn't include `eve` it's minified)
|
||||
|
||||
## Where to start
|
||||
Check [Raphael-boilerplate](https://github.com/tomasAlabes/raphael-boilerplate) to see examples of loading.
|
||||
|
|
@ -29,11 +39,12 @@ define([ "path/to/raphael" ], function( Raphael ) {
|
|||
|
||||
## Development
|
||||
|
||||
Versions will be released as we gather and test new PRs. Each version should have a correspondent branch.
|
||||
As there are not automated tests, we will use the feedback from the users for the fixes.
|
||||
Versions will be released as we gather and test new PRs.
|
||||
As there are a lot of browsers being supported it might take a while to accept a PR, we will use the feedback from other users too.
|
||||
|
||||
|
||||
You can use the `raphaelTest.html` to try things, you need to start a server in the root dir to start testing things there.
|
||||
Something like running `python -m SimpleHTTPServer` in the `raphael` directory and hitting `http://localhost:8000/dev/raphaelTest.html` with the browser.
|
||||
Something like running `python -m SimpleHTTPServer` in the `raphael` directory and hitting `http://localhost:8000/dev/raphaelTest.html` with the browser. You should run `npm run start` before this can work.
|
||||
|
||||
|
||||
## Collaborators
|
||||
|
|
|
|||
13
bower.json
13
bower.json
|
|
@ -1,12 +1,23 @@
|
|||
{
|
||||
"name": "raphael",
|
||||
"main": "raphael.js",
|
||||
"main": "raphael.min.js",
|
||||
"description": "JavaScript Vector Library",
|
||||
"dependencies": {
|
||||
"eve": "https://github.com/adobe-webplatform/eve.git#eef80ed"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "~2.1.17"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": ["svg", "vml", "javascript"],
|
||||
"authors": [
|
||||
"Dmitry Baranovskiy"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.html",
|
||||
|
|
|
|||
23
cortex.json
23
cortex.json
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"name": "raphael",
|
||||
"version": "2.1.4",
|
||||
"description": "JavaScript Vector Library",
|
||||
"main": "raphael",
|
||||
"repository": "git://github.com/DmitryBaranovskiy/raphael.git",
|
||||
"keywords": [
|
||||
"vector",
|
||||
"canvas",
|
||||
"visualization"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Dmitry Baranovskiy"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/DmitryBaranovskiy/raphael/issues"
|
||||
},
|
||||
"homepage": "http://raphaeljs.com/",
|
||||
"dependencies" : {
|
||||
"eve":"^0.5.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"curly": true,
|
||||
"eqnull": true,
|
||||
"eqeqeq": true,
|
||||
"undef": true,
|
||||
"indent": 4,
|
||||
"unused": true,
|
||||
"globals": {
|
||||
"eve": true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
raphael: '../raphael'
|
||||
//you will need eve if you use the nodeps version
|
||||
/*eve: '../bower_components/eve/eve'*/
|
||||
}
|
||||
});
|
||||
|
||||
require(['raphael'], function(Raphael) {
|
||||
var paper = Raphael(0, 0, 640, 720, "container");
|
||||
paper.circle(100, 100, 100); //example
|
||||
|
||||
// Work here
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// ┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël 2.2.0 - JavaScript Vector Library │ \\
|
||||
// ├───────────────────────────────────────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Copyright © 2008-2016 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
|
||||
// │ Copyright © 2008-2016 Sencha Labs (http://sencha.com) │ \\
|
||||
// ├───────────────────────────────────────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Licensed under the MIT (https://github.com/DmitryBaranovskiy/raphael/blob/master/license.txt) license.│ \\
|
||||
// └───────────────────────────────────────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// ┌────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël @VERSION - JavaScript Vector Library │ \\
|
||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
|
||||
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
|
||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
||||
// └────────────────────────────────────────────────────────────────────┘ \\
|
||||
381
dev/eve.js
381
dev/eve.js
|
|
@ -1,381 +0,0 @@
|
|||
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the 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.4.2 - JavaScript Events Library │ \\
|
||||
// ├────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
|
||||
// └────────────────────────────────────────────────────────────┘ \\
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("eve", function() {
|
||||
return factory();
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
glob.eve = factory();
|
||||
}
|
||||
}(this, function(){
|
||||
var version = "0.4.2",
|
||||
has = "hasOwnProperty",
|
||||
separator = /[\.\/]/,
|
||||
wildcard = "*",
|
||||
fun = function () {},
|
||||
numsort = function (a, b) {
|
||||
return a - b;
|
||||
},
|
||||
current_event,
|
||||
stop,
|
||||
events = {n: {}},
|
||||
/*\
|
||||
* eve
|
||||
[ method ]
|
||||
|
||||
* Fires event with given `name`, given scope and other parameters.
|
||||
|
||||
> Arguments
|
||||
|
||||
- name (string) name of the *event*, dot (`.`) or slash (`/`) separated
|
||||
- scope (object) context for the event handlers
|
||||
- varargs (...) the rest of arguments will be sent to event handlers
|
||||
|
||||
= (object) array of returned values from the listeners
|
||||
\*/
|
||||
eve = function (name, scope) {
|
||||
name = String(name);
|
||||
var e = events,
|
||||
oldstop = stop,
|
||||
args = Array.prototype.slice.call(arguments, 2),
|
||||
listeners = eve.listeners(name),
|
||||
z = 0,
|
||||
f = false,
|
||||
l,
|
||||
indexed = [],
|
||||
queue = {},
|
||||
out = [],
|
||||
ce = current_event,
|
||||
errors = [];
|
||||
current_event = name;
|
||||
stop = 0;
|
||||
for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
|
||||
indexed.push(listeners[i].zIndex);
|
||||
if (listeners[i].zIndex < 0) {
|
||||
queue[listeners[i].zIndex] = listeners[i];
|
||||
}
|
||||
}
|
||||
indexed.sort(numsort);
|
||||
while (indexed[z] < 0) {
|
||||
l = queue[indexed[z++]];
|
||||
out.push(l.apply(scope, args));
|
||||
if (stop) {
|
||||
stop = oldstop;
|
||||
return out;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ii; i++) {
|
||||
l = listeners[i];
|
||||
if ("zIndex" in l) {
|
||||
if (l.zIndex == indexed[z]) {
|
||||
out.push(l.apply(scope, args));
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
do {
|
||||
z++;
|
||||
l = queue[indexed[z]];
|
||||
l && out.push(l.apply(scope, args));
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
} while (l)
|
||||
} else {
|
||||
queue[l.zIndex] = l;
|
||||
}
|
||||
} else {
|
||||
out.push(l.apply(scope, args));
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
stop = oldstop;
|
||||
current_event = ce;
|
||||
return out.length ? out : null;
|
||||
};
|
||||
// Undocumented. Debug only.
|
||||
eve._events = events;
|
||||
/*\
|
||||
* eve.listeners
|
||||
[ method ]
|
||||
|
||||
* Internal method which gives you array of all event handlers that will be triggered by the given `name`.
|
||||
|
||||
> Arguments
|
||||
|
||||
- name (string) name of the event, dot (`.`) or slash (`/`) separated
|
||||
|
||||
= (array) array of event handlers
|
||||
\*/
|
||||
eve.listeners = function (name) {
|
||||
var names = name.split(separator),
|
||||
e = events,
|
||||
item,
|
||||
items,
|
||||
k,
|
||||
i,
|
||||
ii,
|
||||
j,
|
||||
jj,
|
||||
nes,
|
||||
es = [e],
|
||||
out = [];
|
||||
for (i = 0, ii = names.length; i < ii; i++) {
|
||||
nes = [];
|
||||
for (j = 0, jj = es.length; j < jj; j++) {
|
||||
e = es[j].n;
|
||||
items = [e[names[i]], e[wildcard]];
|
||||
k = 2;
|
||||
while (k--) {
|
||||
item = items[k];
|
||||
if (item) {
|
||||
nes.push(item);
|
||||
out = out.concat(item.f || []);
|
||||
}
|
||||
}
|
||||
}
|
||||
es = nes;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
/*\
|
||||
* eve.on
|
||||
[ method ]
|
||||
**
|
||||
* Binds given event handler with a given name. You can use wildcards “`*`” for the names:
|
||||
| eve.on("*.under.*", f);
|
||||
| eve("mouse.under.floor"); // triggers f
|
||||
* 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) 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:
|
||||
| eve.on("mouse", eatIt)(2);
|
||||
| eve.on("mouse", scream);
|
||||
| eve.on("mouse", catchIt)(1);
|
||||
* This will ensure that `catchIt()` function will be called before `eatIt()`.
|
||||
*
|
||||
* 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”.
|
||||
\*/
|
||||
eve.on = function (name, f) {
|
||||
name = String(name);
|
||||
if (typeof f != "function") {
|
||||
return function () {};
|
||||
}
|
||||
var names = name.split(separator),
|
||||
e = events;
|
||||
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) {
|
||||
return fun;
|
||||
}
|
||||
e.f.push(f);
|
||||
return function (zIndex) {
|
||||
if (+zIndex == +zIndex) {
|
||||
f.zIndex = +zIndex;
|
||||
}
|
||||
};
|
||||
};
|
||||
/*\
|
||||
* 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
|
||||
[ method ]
|
||||
**
|
||||
* Could be used inside event handler to figure out actual name of the event.
|
||||
**
|
||||
> Arguments
|
||||
**
|
||||
- subname (string) #optional subname of the event
|
||||
**
|
||||
= (string) name of the event, if `subname` is not specified
|
||||
* or
|
||||
= (boolean) `true`, if current event’s name contains `subname`
|
||||
\*/
|
||||
eve.nt = function (subname) {
|
||||
if (subname) {
|
||||
return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
|
||||
}
|
||||
return current_event;
|
||||
};
|
||||
/*\
|
||||
* 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 current_event.split(separator);
|
||||
};
|
||||
/*\
|
||||
* eve.off
|
||||
[ method ]
|
||||
**
|
||||
* Removes given function from the list of event listeners assigned to given name.
|
||||
* If no arguments specified all the events will be cleared.
|
||||
**
|
||||
> Arguments
|
||||
**
|
||||
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
|
||||
- f (function) event handler function
|
||||
\*/
|
||||
/*\
|
||||
* eve.unbind
|
||||
[ method ]
|
||||
**
|
||||
* See @eve.off
|
||||
\*/
|
||||
eve.off = eve.unbind = function (name, f) {
|
||||
if (!name) {
|
||||
eve._events = events = {n: {}};
|
||||
return;
|
||||
}
|
||||
var names = name.split(separator),
|
||||
e,
|
||||
key,
|
||||
splice,
|
||||
i, ii, j, jj,
|
||||
cur = [events];
|
||||
for (i = 0, ii = names.length; i < ii; i++) {
|
||||
for (j = 0; j < cur.length; j += splice.length - 2) {
|
||||
splice = [j, 1];
|
||||
e = cur[j].n;
|
||||
if (names[i] != wildcard) {
|
||||
if (e[names[i]]) {
|
||||
splice.push(e[names[i]]);
|
||||
}
|
||||
} else {
|
||||
for (key in e) if (e[has](key)) {
|
||||
splice.push(e[key]);
|
||||
}
|
||||
}
|
||||
cur.splice.apply(cur, splice);
|
||||
}
|
||||
}
|
||||
for (i = 0, ii = cur.length; i < ii; i++) {
|
||||
e = cur[i];
|
||||
while (e.n) {
|
||||
if (f) {
|
||||
if (e.f) {
|
||||
for (j = 0, jj = e.f.length; j < jj; j++) if (e.f[j] == f) {
|
||||
e.f.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
!e.f.length && delete e.f;
|
||||
}
|
||||
for (key in e.n) if (e.n[has](key) && e.n[key].f) {
|
||||
var funcs = e.n[key].f;
|
||||
for (j = 0, jj = funcs.length; j < jj; j++) if (funcs[j] == f) {
|
||||
funcs.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
!funcs.length && delete e.n[key].f;
|
||||
}
|
||||
} else {
|
||||
delete e.f;
|
||||
for (key in e.n) if (e.n[has](key) && e.n[key].f) {
|
||||
delete e.n[key].f;
|
||||
}
|
||||
}
|
||||
e = e.n;
|
||||
}
|
||||
}
|
||||
};
|
||||
/*\
|
||||
* 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.unbind(name, f2);
|
||||
return f.apply(this, arguments);
|
||||
};
|
||||
return eve.on(name, f2);
|
||||
};
|
||||
/*\
|
||||
* eve.version
|
||||
[ property (string) ]
|
||||
**
|
||||
* Current version of the library.
|
||||
\*/
|
||||
eve.version = version;
|
||||
eve.toString = function () {
|
||||
return "You are running Eve " + version;
|
||||
};
|
||||
|
||||
return eve;
|
||||
}));
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// ┌────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël @VERSION - JavaScript Vector Library │ \\
|
||||
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
|
||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
|
||||
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
|
||||
|
|
@ -7,21 +7,8 @@
|
|||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
||||
// └────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("raphael", ["raphael.core", "raphael.svg", "raphael.vml"], function(Raphael) {
|
||||
return (glob.Raphael = factory(Raphael));
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
var raphael = require("raphael.core");
|
||||
define(["./raphael.core", "./raphael.svg", "./raphael.vml"], function(R) {
|
||||
|
||||
require("raphael.svg");
|
||||
require("raphael.vml");
|
||||
return R;
|
||||
|
||||
module.exports = factory(raphael);
|
||||
} else {
|
||||
glob.Raphael = factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (Raphael) {
|
||||
return Raphael.ninja();
|
||||
}));
|
||||
});
|
||||
|
|
@ -6,17 +6,8 @@
|
|||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
||||
// └────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("raphael.core", ["eve"], function(eve) {
|
||||
return factory(eve);
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
module.exports = factory(require("eve"));
|
||||
} else {
|
||||
glob.Raphael = factory(glob.eve);
|
||||
}
|
||||
}(this, function (eve) {
|
||||
define(["eve"], function(eve) {
|
||||
|
||||
/*\
|
||||
* Raphael
|
||||
[ method ]
|
||||
|
|
@ -5366,7 +5357,15 @@
|
|||
| })(Raphael.ninja());
|
||||
\*/
|
||||
R.ninja = function () {
|
||||
oldRaphael.was ? (g.win.Raphael = oldRaphael.is) : delete Raphael;
|
||||
if (oldRaphael.was) {
|
||||
g.win.Raphael = oldRaphael.is;
|
||||
} else {
|
||||
// IE8 raises an error when deleting window property
|
||||
window.Raphael = undefined;
|
||||
try {
|
||||
delete window.Raphael;
|
||||
} catch(e) {}
|
||||
}
|
||||
return R;
|
||||
};
|
||||
/*\
|
||||
|
|
@ -5411,4 +5410,4 @@
|
|||
})(document, "DOMContentLoaded");
|
||||
|
||||
return R;
|
||||
}));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,17 +8,7 @@
|
|||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("raphael.svg", ["raphael.core"], function(raphael) {
|
||||
return factory(raphael);
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
factory(require("./raphael.core"));
|
||||
} else {
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function(R) {
|
||||
define(["./raphael.core"], function(R) {
|
||||
if (R && !R.svg) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -142,7 +132,7 @@
|
|||
}
|
||||
}
|
||||
$(o, {
|
||||
fill: "url('" + document.location.origin + document.location.pathname + "#" + id + "')",
|
||||
fill: fillurl(id),
|
||||
opacity: 1,
|
||||
"fill-opacity": 1
|
||||
});
|
||||
|
|
@ -151,6 +141,23 @@
|
|||
s.fillOpacity = 1;
|
||||
return 1;
|
||||
},
|
||||
isIE9or10 = function () {
|
||||
var mode = document.documentMode;
|
||||
return mode && (mode === 9 || mode === 10);
|
||||
},
|
||||
fillurl = function (id) {
|
||||
if (isIE9or10()) {
|
||||
return "url('#" + id + "')";
|
||||
}
|
||||
var location = document.location;
|
||||
var locationString = (
|
||||
location.protocol + '//' +
|
||||
location.host +
|
||||
location.pathname +
|
||||
location.search
|
||||
);
|
||||
return "url('" + locationString + "#" + id + "')";
|
||||
},
|
||||
updatePosition = function (o) {
|
||||
var bbox = o.getBBox(1);
|
||||
$(o.pattern, {patternTransform: o.matrix.invert() + " translate(" + bbox.x + "," + bbox.y + ")"});
|
||||
|
|
@ -613,8 +620,8 @@
|
|||
$(node, {x: a.x, y: a.y});
|
||||
el._.dirty = 1;
|
||||
var bb = el._getBBox(),
|
||||
dif = a.y - (bb.y + bb.height / 2);
|
||||
dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
|
||||
dif = a.y - (bb.y + (bb.height / 2));
|
||||
if (bb.height) dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
|
||||
},
|
||||
getRealNode = function (node) {
|
||||
if (node.parentNode && node.parentNode.tagName.toLowerCase() === "a") {
|
||||
|
|
@ -1418,4 +1425,4 @@
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,17 +8,7 @@
|
|||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("raphael.vml", ["raphael.core"], function(raphael) {
|
||||
return factory(raphael);
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
factory(require("./raphael.core"));
|
||||
} else {
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function(R) {
|
||||
define(["./raphael.core"], function(R) {
|
||||
if (R && !R.vml) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -768,7 +758,7 @@
|
|||
p.path = [];
|
||||
p.Path = E;
|
||||
setFillAndStroke(p, attr);
|
||||
vml.canvas.appendChild(el);
|
||||
vml.canvas && vml.canvas.appendChild(el);
|
||||
var skew = createNode("skew");
|
||||
skew.on = true;
|
||||
el.appendChild(skew);
|
||||
|
|
@ -1017,4 +1007,4 @@
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
||||
<meta content="utf-8" http-equiv="encoding">
|
||||
<title>Raphael Dev testing html</title>
|
||||
|
||||
<!-- HTML to try new developments in Raphael -->
|
||||
|
|
@ -7,24 +9,28 @@
|
|||
<!-- Global use -->
|
||||
|
||||
<!-- To work with full version -->
|
||||
<!--<script type="text/javascript" src="../raphael.js"></script>-->
|
||||
<script type="text/javascript" src="../bower_components/requirejs/require.js"></script>
|
||||
<script type="text/javascript" src="../bower_components/eve/eve.js"></script>
|
||||
<script type="text/javascript" src="../raphael.js"></script>
|
||||
|
||||
<!-- To work with minified version -->
|
||||
<!--<script type="text/javascript" src="../raphael-min.js"></script>-->
|
||||
|
||||
<!-- Comment this script tag if you are testing with AMD -->
|
||||
<!--<script type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
// Initialize container when document is loaded
|
||||
window.onload = function () {
|
||||
paper = Raphael(0, 0, 640, 720, "container");
|
||||
paper.circle(100, 100, 100); //example
|
||||
require(['Raphael'], function(Raphael) {
|
||||
var paper = Raphael(0, 0, 640, 720, "container");
|
||||
paper.circle(100, 100, 100).attr({'fill':'270-#FAE56B:0-#E56B6B:100'}); //example
|
||||
});
|
||||
};
|
||||
//Work here, in a separate script file or via command line
|
||||
</script>-->
|
||||
</script>
|
||||
|
||||
<!-- Use amdDev.js to work with AMD and Raphael -->
|
||||
<!-- You need to do a 'bower install -D' first to get requirejs -->
|
||||
<script data-main="amdDev" src="../bower_components/requirejs/require.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Raphael Test Suite</title>
|
||||
<link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script type="text/javascript" src="../../bower_components/eve/eve.js"></script>
|
||||
<script type="text/javascript" src="../raphael.core.js"></script>
|
||||
<script type="text/javascript" src="../raphael.svg.js"></script>
|
||||
<script type="text/javascript" src="../raphael.vml.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var tests = [
|
||||
"dom"
|
||||
];
|
||||
var typeFolder = Raphael.type.toLowerCase();
|
||||
|
||||
for (var i = 0; i < tests.length; i++) {
|
||||
var s = document.createElement('script');
|
||||
s.type = "text/javascript";
|
||||
s.src = typeFolder + "/" + tests[i] + ".js";
|
||||
document.body.appendChild(s);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
(function() {
|
||||
|
||||
var paper,
|
||||
url = 'http://raphaeljs.com';
|
||||
|
||||
module('DOM', {
|
||||
setup: function() {
|
||||
paper = new Raphael(document.getElementById('qunit-fixture'), 1000, 1000);
|
||||
},
|
||||
teardown: function() {
|
||||
paper.remove();
|
||||
}
|
||||
});
|
||||
|
||||
var equalNodePosition = function(node, expectedParent, expectedPreviousSibling, expectedNextSibling) {
|
||||
equal(node.parentNode, expectedParent);
|
||||
equal(node.previousSibling, expectedPreviousSibling);
|
||||
equal(node.nextSibling, expectedNextSibling);
|
||||
};
|
||||
|
||||
var equalNodePositionWrapped = function(node, anchor, expectedParent, expectedPreviousSibling, expectedNextSibling) {
|
||||
equal(node.parentNode, anchor);
|
||||
equalNodePosition(anchor, expectedParent, expectedPreviousSibling, expectedNextSibling);
|
||||
};
|
||||
|
||||
// Element#insertBefore
|
||||
// --------------------
|
||||
|
||||
test('insertBefore: no element', function() {
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(null);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertBefore: first element', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, x.node);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertBefore: no element when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(null);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertBefore: first element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, x.node);
|
||||
});
|
||||
|
||||
test('insertBefore: first element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, xAnchor);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var y = paper.rect().attr('href', url),
|
||||
yAnchor = y.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, yAnchor);
|
||||
});
|
||||
|
||||
// TODO...
|
||||
// insertBefore: with set
|
||||
// insertBefore: with nested set.
|
||||
|
||||
// Element#insertAfter
|
||||
// -------------------
|
||||
|
||||
test('insertAfter: no element', function() {
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(null);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertAfter: no element when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(null);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, null);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var y = paper.rect().attr('href', url),
|
||||
yAnchor = y.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, yAnchor);
|
||||
});
|
||||
|
||||
// TODO...
|
||||
// insertAfter: with set
|
||||
// insertAfter: with nested set.
|
||||
|
||||
// Element#remove
|
||||
// --------------
|
||||
|
||||
test('remove: after added', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
node = el.node,
|
||||
anchor = node.parentNode;
|
||||
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, anchor);
|
||||
equal(anchor.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when already removed', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
el.remove();
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when the canvas is removed', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
paper.remove();
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
// Element#toFront
|
||||
// --------------
|
||||
|
||||
test('toFront: normal', function() {
|
||||
var el = paper.rect();
|
||||
var x = paper.rect();
|
||||
|
||||
el.toFront();
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('toFront: when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
var x = paper.rect();
|
||||
|
||||
el.toFront();
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
// Element#toBack
|
||||
// --------------
|
||||
|
||||
test('toBack: normal', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.toBack();
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, null, paper.desc);
|
||||
equalNodePosition(x.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('toBack: when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.toBack();
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, null, paper.desc);
|
||||
equalNodePosition(x.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(function() {
|
||||
|
||||
module('DOM');
|
||||
|
||||
})();
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
2.2.0 • WIP
|
||||
2.2.0
|
||||
------------------
|
||||
|
||||
* Webpack build
|
||||
* Added tests! (thanks @TheCloudlessSky)
|
||||
* Strict error on method R.ninja
|
||||
* Cross-browser gradient fixes
|
||||
* Reduce transform string to avoid long parsing times after several transformations
|
||||
* raphael.amd.js as main in package.json.
|
||||
* raphael.amd.js version to work with Browserify.
|
||||
|
|
|
|||
58
package.json
58
package.json
|
|
@ -1,37 +1,47 @@
|
|||
{
|
||||
"name": "raphael",
|
||||
"version": "2.1.4",
|
||||
"version": "2.2.0-c",
|
||||
"description": "JavaScript Vector Library",
|
||||
"main": "raphael.amd.js",
|
||||
"main": "raphael.min.js",
|
||||
"author": {
|
||||
"name": "Dmitry Baranovskiy"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tomas Alabes",
|
||||
"url": "https://github.com/tomasAlabes"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": "1.4.1",
|
||||
"eslint": "^2.7.0",
|
||||
"eslint-config-standard": "^5.1.0",
|
||||
"eslint-loader": "^1.3.0",
|
||||
"eslint-plugin-promise": "^1.1.0",
|
||||
"eslint-plugin-standard": "^1.3.2",
|
||||
"qunitjs": "1.21.0",
|
||||
"webpack": "^1.12.15"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"start": "npm install && bower install",
|
||||
"build": "webpack && webpack --min && webpack --no-deps && webpack --no-deps --min",
|
||||
"test": "echo \"Open dev/test/index.html with your browser\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/DmitryBaranovskiy/raphael.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dmitry Baranovskiy"
|
||||
},
|
||||
"license": "MIT",
|
||||
"readmeFilename": "README.markdown",
|
||||
"gitHead": "55151daed59ca2612001e493c37f2fa8407d6be6",
|
||||
"dependencies": {
|
||||
"eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "0.4.5",
|
||||
"grunt-cli": "0.1.13",
|
||||
"bower": "1.4.1",
|
||||
"grunt-contrib-concat": "^0.5.0",
|
||||
"grunt-contrib-uglify": "~0.2.0",
|
||||
"grunt-replace": "^0.8.0"
|
||||
},
|
||||
"readme": "# Raphaël: Cross-browser vector graphics the easy way. \n\nVisit the library website for more information: [http://raphaeljs.com](http://raphaeljs.com/)\n\n## Quickstart guide\n\n* `git clone https://github.com/DmitryBaranovskiy/raphael.git`\n* `git submodule init && git submodule update && npm install`\n(thank you [Wes Tood](https://github.com/wesleytodd))\n\n### Dependencies\n* [uglifyjs](https://github.com/mishoo/UglifyJS)\n* [eve](https://github.com/adobe-webplatform/eve)\n\n## Development\n\nAt the moment we have 4 milestones:\n\n### v2.1.1\nMilestone for bug fixes contributed by the community.\n### v2.2.0\nMilestone for enhancements from contributors pull requests.\n### v2.2.1\nMilestone with bug fixes added from issues created by community.\nThis fixes were not provided in the issues.\n### v2.3.0\nMilestone with enhancements suggested in issues but not provided by community at those issues.\n\nWe are organizing the current issues between this milestones, setting the grounds for people to contribute and start pushing code soon.\n\n## Want to contribute?\n\nAll changes in code must go to `raphael.core`, `raphael.svg` or `raphael.vml`. `raphael.js` is a generated file.\n\nAfter adding your changes, execute `./make`, the minified version will be created, commit and you are ready to make a pull request!\n\n## Found an issue?\n\nFirst search for similar issues to make sure you don't repeat an existing one.\n\nThen please create a fiddle ([boilerplate](http://jsfiddle.net/SSJJT/)) recreating the bug so we can find out what the problem is more easily (or be a hero and find it yourself and send a pull request!). You can also use the [raphael playground](http://raphaeljs.com/playground.html) to reproduce your issues.\n\nRemember to add all the info that can be useful such as\n\n* error details\n* steps to reproduce\n* browser and its version\n* any suggestion of what do you think the problem could be\n\n## Collaborators\n\n* [tomasAlabes](https://github.com/tomasAlabes)\n\n## Copyright and license\n\nCopyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) \n\nCopyright © 2008-2012 Sencha Labs (http://sencha.com) \n\nLicensed under the **MIT** (http://raphaeljs.com/license.html) license.",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DmitryBaranovskiy/raphael/issues"
|
||||
},
|
||||
"homepage": "https://github.com/DmitryBaranovskiy/raphael",
|
||||
"_id": "raphael@2.1.4",
|
||||
"_from": "raphael@"
|
||||
"keywords": [
|
||||
"svg",
|
||||
"vml",
|
||||
"javascript"
|
||||
],
|
||||
"homepage": "http://dmitrybaranovskiy.github.io/raphael/",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7885
raphael-nodeps.js
7885
raphael-nodeps.js
File diff suppressed because it is too large
Load Diff
|
|
@ -1,27 +0,0 @@
|
|||
// ┌────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
|
||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
|
||||
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
|
||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
||||
// └────────────────────────────────────────────────────────────────────┘ \\
|
||||
|
||||
(function (glob, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("raphael", ["dev/raphael.core.js", "raphael.svg", "raphael.vml"], function(Raphael) {
|
||||
return factory(Raphael);
|
||||
});
|
||||
} else if (typeof exports === "object") {
|
||||
var raphael = require("./dev/raphael.core");
|
||||
|
||||
require("./dev/raphael.svg");
|
||||
require("./dev/raphael.vml");
|
||||
|
||||
module.exports = factory(raphael);
|
||||
} else {
|
||||
glob.Raphael = factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (Raphael) {
|
||||
return Raphael.ninja();
|
||||
}));
|
||||
16597
raphael.js
16597
raphael.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2489
reference.html
2489
reference.html
File diff suppressed because one or more lines are too long
248
reference.js
248
reference.js
|
|
@ -1,248 +0,0 @@
|
|||
Raphael(function () {
|
||||
|
||||
// TOC
|
||||
(function (ol) {
|
||||
if (!ol) {
|
||||
return;
|
||||
}
|
||||
var li = document.createElement("li"),
|
||||
isABBR = function (str, abbr) {
|
||||
var letters = abbr.toUpperCase().split(""),
|
||||
first = letters.shift(),
|
||||
rg = new RegExp("^[" + first.toLowerCase() + first + "][a-z]*" + letters.join("[a-z]*") + "[a-z]*$");
|
||||
return !!String(str).match(rg);
|
||||
},
|
||||
score = function (me, search) {
|
||||
me = String(me);
|
||||
search = String(search);
|
||||
var score = 0,
|
||||
chunk;
|
||||
if (me == search) {
|
||||
return 1;
|
||||
}
|
||||
if (!me || !search) {
|
||||
return 0;
|
||||
}
|
||||
if (isABBR(me, search)) {
|
||||
return .9;
|
||||
}
|
||||
score = 0;
|
||||
chunk = me.toLowerCase();
|
||||
for (var j, i = 0, ii = search.length; i < ii; i++) {
|
||||
j = chunk.indexOf(search.charAt(i));
|
||||
if (~j) {
|
||||
chunk = chunk.substring(j + 1);
|
||||
score += 1 / (j + 1);
|
||||
}
|
||||
}
|
||||
score = Math.max(score / ii - Math.abs(me.length - ii) / me.length / 2, 0);
|
||||
return score;
|
||||
};
|
||||
li.innerHTML = '<input type="search" id="dr-filter" results="0">';
|
||||
var lis = ol.getElementsByTagName("span"),
|
||||
names = [],
|
||||
rgName = /[^\.\(]*(?=(\(\))?$)/;
|
||||
for (var i = 0, ii = lis.length; i < ii; i++) {
|
||||
names[i] = {
|
||||
li: lis[i].parentNode.parentNode,
|
||||
text: lis[i].innerHTML.match(rgName)[0]
|
||||
};
|
||||
}
|
||||
ol.insertBefore(li, ol.firstChild);
|
||||
var input = document.getElementById("dr-filter");
|
||||
input.style.width = "100%";
|
||||
input.style.marginTop = "10px";
|
||||
input.onclick = input.onchange = input.onkeydown = input.onkeyup = function () {
|
||||
var v = input.value,
|
||||
res = [];
|
||||
if (v.length > 1) {
|
||||
for (var i = 0, ii = names.length; i < ii; i++) {
|
||||
res[i] = {
|
||||
li: names[i].li,
|
||||
weight: score(names[i].text, v)
|
||||
};
|
||||
}
|
||||
res.sort(function (a, b) {
|
||||
return b.weight - a.weight;
|
||||
});
|
||||
for (i = 0, ii = res.length; i < ii; i++) {
|
||||
ol.appendChild(res[i].li);
|
||||
}
|
||||
} else {
|
||||
for (i = 0, ii = names.length; i < ii; i++) {
|
||||
ol.appendChild(names[i].li);
|
||||
}
|
||||
}
|
||||
};
|
||||
})(document.getElementById("dr-toc"));
|
||||
|
||||
function prepare(id) {
|
||||
var div = document.getElementById(id);
|
||||
div.style.cssText = "float:right;padding:10px;width:99px;height:99px;background:#2C53B0 url(http://raphaeljs.com/blueprint-min.png) no-repeat";
|
||||
return Raphael(div, 99, 99);
|
||||
}
|
||||
|
||||
var line = {
|
||||
stroke: "#fff",
|
||||
"stroke-width": 2,
|
||||
"stroke-linecap": "round",
|
||||
"stroke-linejoin": "round"
|
||||
},
|
||||
dots = {
|
||||
stroke: "#fff",
|
||||
"stroke-width": 2,
|
||||
"stroke-dasharray": "- ",
|
||||
"stroke-linecap": "round",
|
||||
"stroke-linejoin": "round"
|
||||
},
|
||||
fill = {
|
||||
stroke: "#fff",
|
||||
fill: "#fff",
|
||||
"fill-opacity": .5,
|
||||
"stroke-width": 2,
|
||||
"stroke-linecap": "round",
|
||||
"stroke-linejoin": "round"
|
||||
},
|
||||
none = {
|
||||
fill: "#000",
|
||||
opacity: 0
|
||||
};
|
||||
prepare("Paper.path-extra").path("M10,10R90,50 10,90").attr(line);
|
||||
|
||||
(function (r) {
|
||||
var there;
|
||||
r.circle(15, 15, 10).attr(fill).click(function () {
|
||||
var clr = Raphael.hsb(Math.random(), .6, 1);
|
||||
this.animate(there ? {
|
||||
cx: 15,
|
||||
cy: 15,
|
||||
r: 10,
|
||||
stroke: "#fff",
|
||||
fill: "#fff"
|
||||
} : {
|
||||
cx: 80,
|
||||
cy: 80,
|
||||
r: 15,
|
||||
stroke: clr,
|
||||
fill: clr
|
||||
}, 600, ["bounce", "<>", "elastic", ""][Math.round(Math.random() * 3)]);
|
||||
there = !there;
|
||||
});
|
||||
})(prepare("Element.animate-extra"));
|
||||
|
||||
(function (r) {
|
||||
var x, y;
|
||||
r.circle(15, 15, 10).attr(fill).drag(function (dx, dy) {
|
||||
this.attr({
|
||||
cx: Math.min(Math.max(x + dx, 15), 85),
|
||||
cy: Math.min(Math.max(y + dy, 15), 85)
|
||||
});
|
||||
}, function () {
|
||||
x = this.attr("cx");
|
||||
y = this.attr("cy");
|
||||
});
|
||||
|
||||
})(prepare("Element.drag-extra"));
|
||||
|
||||
(function (r) {
|
||||
var e = r.ellipse(50, 50, 40, 30).attr(fill).click(function () {
|
||||
this.animate({
|
||||
transform: "r180"
|
||||
}, 1000, function () {
|
||||
this.attr({
|
||||
transform: ""
|
||||
});
|
||||
});
|
||||
}),
|
||||
bb = r.rect().attr(e.getBBox()).attr(dots);
|
||||
eve.on("anim.frame." + e.id, function (anim) {
|
||||
bb.attr(e.getBBox());
|
||||
});
|
||||
})(prepare("Element.getBBox-extra"));
|
||||
|
||||
(function (r) {
|
||||
var e = r.path("M10,10R20,70 30,40 40,80 50,10 60,50 70,20 80,30 90,90").attr(line),
|
||||
l = e.getTotalLength(),
|
||||
to = 1;
|
||||
r.customAttributes.along = function (a) {
|
||||
var p = e.getPointAtLength(a * l);
|
||||
return {
|
||||
transform: "t" + [p.x, p.y] + "r" + p.alpha
|
||||
};
|
||||
};
|
||||
var c = r.ellipse(0, 0, 5, 2).attr({
|
||||
along: 0
|
||||
}).attr(line);
|
||||
r.rect(0, 0, 100, 100).attr(none).click(function () {
|
||||
c.stop().animate({
|
||||
along: to
|
||||
}, 5000);
|
||||
to = +!to;
|
||||
});
|
||||
})(prepare("Element.getPointAtLength-extra"));
|
||||
|
||||
(function (r) {
|
||||
var e = r.path("M10,10R20,70 30,40 40,80 50,10 60,50 70,20 80,30 90,90").attr(line),
|
||||
l = e.getTotalLength() - 10,
|
||||
to = 1;
|
||||
r.customAttributes.along = function (a) {
|
||||
return {
|
||||
path: e.getSubpath(a * l, a * l + 11)
|
||||
};
|
||||
};
|
||||
var c = r.path().attr(line).attr({
|
||||
along: 0,
|
||||
stroke: "#f00",
|
||||
"stroke-width": 3
|
||||
});
|
||||
r.rect(0, 0, 100, 100).attr(none).click(function () {
|
||||
c.stop().animate({
|
||||
along: to
|
||||
}, 5000);
|
||||
to = +!to;
|
||||
});
|
||||
})(prepare("Element.getSubpath-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.circle(50, 50, 40).attr(line).glow({color: "#fff"});
|
||||
})(prepare("Element.glow-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.rect(10, 10, 40, 30).attr(dots);
|
||||
r.rect(10, 10, 40, 30).attr(line).transform("r-30, 50, 10t10, 20s1.5");
|
||||
r.text(50, 90, "r-30, 50, 10\nt10, 20s1.5").attr({fill: "#fff"});
|
||||
})(prepare("Element.transform-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.circle(50, 50, 40).attr(line);
|
||||
})(prepare("Paper.circle-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.ellipse(50, 50, 40, 30).attr(line);
|
||||
})(prepare("Paper.ellipse-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.rect(10, 10, 50, 50).attr(line);
|
||||
r.rect(40, 40, 50, 50, 10).attr(line);
|
||||
})(prepare("Paper.rect-extra"));
|
||||
|
||||
(function (r) {
|
||||
var set = r.set(
|
||||
r.rect(10, 10, 50, 50).attr(fill),
|
||||
r.rect(40, 40, 50, 50, 10).attr(fill)
|
||||
).hover(function () {
|
||||
set.stop().animate({stroke: "#f00"}, 600, "<>");
|
||||
}, function () {
|
||||
set.stop().animate({stroke: "#fff"}, 600, "<>");
|
||||
});
|
||||
})(prepare("Paper.set-extra"));
|
||||
|
||||
(function (r) {
|
||||
r.text(50, 50, "Raphaël\nkicks\nbutt!").attr({
|
||||
fill: "#fff",
|
||||
font: "italic 20px Georgia",
|
||||
transform: "r-10"
|
||||
});
|
||||
})(prepare("Paper.text-extra"));
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
"use strict";
|
||||
|
||||
const webpack = require("webpack");
|
||||
const fs = require("fs");
|
||||
|
||||
const args = process.argv;
|
||||
|
||||
let plugins = [
|
||||
new webpack.BannerPlugin(fs.readFileSync('./dev/banner.txt', 'utf8'),{ raw: true, entryOnly: true })
|
||||
];
|
||||
let externals = [];
|
||||
let filename = "raphael";
|
||||
|
||||
|
||||
if(args.indexOf('--no-deps') !== -1){
|
||||
console.log('Building version without deps');
|
||||
externals.push("eve");
|
||||
filename += ".no-deps"
|
||||
}
|
||||
|
||||
if(args.indexOf('--min') !== -1){
|
||||
console.log('Building minified version');
|
||||
plugins.push(
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress:{
|
||||
dead_code: false,
|
||||
unused: false
|
||||
}
|
||||
})
|
||||
);
|
||||
filename += ".min"
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: './dev/raphael.amd.js',
|
||||
output: {
|
||||
filename: filename + ".js",
|
||||
libraryTarget: "umd",
|
||||
library: "Raphael",
|
||||
umdNamedDefine: true
|
||||
},
|
||||
|
||||
externals: externals,
|
||||
|
||||
plugins: plugins,
|
||||
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: "eslint-loader",
|
||||
include: "./dev/"
|
||||
}
|
||||
],
|
||||
|
||||
eslint: {
|
||||
configFile: './.eslintrc'
|
||||
},
|
||||
|
||||
resolve: {
|
||||
modulesDirectories: ["bower_components"]
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue