Compare commits

...

58 Commits

Author SHA1 Message Date
junghwan-park 4d72b5662b Deploy 2.2.6a 2017-02-01 10:14:01 +09:00
junghwan-park 13e96e0041 Merge branch 'master' of https://github.com/nhnent/raphael 2017-02-01 10:01:11 +09:00
Tomas Alabes 2f5c1a27e5 2.2.6 2016-10-02 15:52:05 -03:00
Tomas Alabes e6d07fc923 2.2.5 2016-10-02 15:48:47 -03:00
Tomas Alabes 07f3dd1d3c Using custom repo for eve as all other repos are outdated 2016-10-02 15:48:35 -03:00
Tomas Alabes 6fe6a270af Update history.md 2016-09-30 17:31:30 -03:00
Tomas Alabes a3fd679ea8 2.2.4 2016-09-30 17:27:43 -03:00
Tomas Alabes 1e81e1873f Fixing no-deps version 2016-09-30 17:26:49 -03:00
Tomas Alabes 056b2ca835 Update history.md 2016-09-29 22:47:43 -03:00
Tomas Alabes 55ee142b0f 2.2.3 2016-09-29 22:37:10 -03:00
Tomas Alabes c8de40446e 2.2.2 2016-09-29 22:36:27 -03:00
Tomas Alabes be2660dced Updating dependencies including eve 2016-09-29 22:35:05 -03:00
Tomas Alabes e8e8917898 New distributables after revert, not a release yet 2016-07-17 17:06:20 -07:00
Tomas Alabes b95d7324c5 Small mods, nothing new 2016-07-17 17:03:32 -07:00
Tomas Alabes eb43ba140f Merge pull request #1060 from gregbaker/master
Remove transform string reduction to prevent incorrect animations.
2016-07-17 17:02:43 -07:00
Greg Baker 38c4fa61d7 Remove transform string reduction to prevent incorrect animations. 2016-07-13 15:19:00 -07:00
Tomas Alabes b15a86d8f3 Improved element ids, suggested by @dpcouch 2016-07-02 21:41:35 -07:00
Tomas Alabes 5fec7097de updated package.json for npm module 2016-07-02 21:19:11 -07:00
Tomas Alabes d521c62835 v2.0.1 - small correction on amd build 2016-07-02 21:15:35 -07:00
Tomas Alabes 68cb2e3839 Merge pull request #1058 from kilida/patch-1
Repeated subexpression in raphael.vml.js
2016-07-02 20:35:25 -07:00
kilida e5cbea6f2b Repeated subexpression in raphael.vml.js
`params["stroke-width"] != null` is repeated
2016-06-24 14:10:33 -04:00
Tomas Alabes 427929f9e6 Merge pull request #1056 from artcups/master
Add css class to availableAttrs
2016-05-22 19:21:09 -07:00
Sebastian Lundh ecd13bcff3 Add css class to availableAttrs 2016-05-22 10:52:22 +02:00
Tomas Alabes bc0812175d Merge pull request #1053 from mortonfox/patch-1
Update the license link and the other Raphael link
2016-05-12 16:14:22 -07:00
Morton Fox 07d04a298d Update the license link and the other Raphael link 2016-05-12 01:06:52 -04:00
Tomas Alabes 8f74e736bd Fixed some typos 2016-04-24 11:41:43 -07:00
Tomas Alabes 5e868e42e7 Removed unnecesary banners 2016-04-23 11:58:18 -07:00
Tomas Alabes a5cd61ad78 Merge pull request #1044 from DmitryBaranovskiy/webpack
Webpack and v2.2.0
2016-04-12 19:46:54 -07:00
Tomas Alabes 44644e5ca3 updating package.json with v2.2.0 2016-04-12 19:46:33 -07:00
Tomas Alabes 3b0240d3fb pre-release v2.2.0 2016-04-12 19:42:33 -07:00
Tomas Alabes d7626c4650 eslint 2016-04-06 21:55:29 -07:00
Tomas Alabes db2b2f2b91 webpack ready, just eslint missing 2016-04-06 21:36:44 -07:00
Tomas Alabes 5bfc8a3197 webpack umd 2016-04-06 16:56:41 -07:00
Tomas Alabes cca8f941e4 Updating *.json definitions 2016-02-17 19:43:25 -08:00
Tomas Alabes 9cf2118d9a Small fixes 2016-02-17 19:33:09 -08:00
Tomas Alabes 9f04a78050 Merge branch 'add-tests' of https://github.com/TheCloudlessSky/raphael into TheCloudlessSky-add-tests 2016-02-17 19:21:16 -08:00
Tomas Alabes acfdc78c7f Small house cleaning 2016-02-17 19:02:07 -08:00
Tomas Alabes d9da47ddcf Updated website and added bower install to instructions 2016-02-17 18:53:07 -08:00
Tomas Alabes 9c672c8114 Merge pull request #1030 from ipetropolsky/gradient-location-origin
Fix oldschool browsers (incl. #998)
2016-02-15 23:39:28 -08:00
ipetropolsky 7e704f682f Build 2016-02-12 14:10:11 +03:00
ipetropolsky ffeb914945 Add gradient to global example 2016-02-12 14:10:10 +03:00
ipetropolsky 58a5c90f4d Fix version placeholder 2016-02-12 13:42:30 +03:00
ipetropolsky c89ffbe857 Fix ninja in IE8 2016-02-12 13:39:02 +03:00
ipetropolsky 48491c87c5 Fix #998: broken gradient in old Firefox and Opera 2016-02-11 22:24:11 +03:00
Tomas Alabes f803b084f3 Merge pull request #1025 from ipetropolsky/gradient-with-search
Fix #999: Gradient not filled when page's url contains "?" character
2016-02-08 18:57:37 -08:00
ipetropolsky 8abe20eedd Build after fixing #999 2016-02-08 21:22:00 +03:00
ipetropolsky f5d909be1b Fix #999: Add search string to gradient url 2016-02-08 21:18:33 +03:00
ipetropolsky 3fb83189ad Add gradient to test page 2016-02-08 21:16:47 +03:00
Tomas Alabes 98bfdf6c80 Added history of last commit 2016-02-05 17:30:52 -08:00
Tomas Alabes fdd4de43e7 Strict error on R.ninja method 2016-02-05 17:29:48 -08:00
Tomas Alabes 1290ef5e44 @benmaure - vml canvas check on path, analogous to svg check 2016-01-31 11:18:46 -08:00
Tomas Alabes 7685bb3e85 Merge pull request #1017 from Yenthe666/patch-1
Add meta content in HTML page
2016-01-31 11:13:06 -08:00
Tomas Alabes 6b10adf8d2 Merge pull request #1006 from byuksel/master
Fixed Issue #1005: Add bower requirement to the dev section of README.md
2016-01-31 11:08:52 -08:00
Tomas Alabes 793d51a38c @didiercrunch - fixed ie 9 10 gradient bug 2016-01-31 10:51:29 -08:00
Yenthe 3f222e5e61 Add meta content in HTML page
Add the meta content in the HTML page to prevent "The character encoding of the HTML document was not declared" which might be caused in some browsers.
2015-12-29 16:42:50 +01:00
by99 acd99e64ee Add bower requirement to the dev section of README.md 2015-11-12 12:40:03 -04:00
Adrian Phinney 921f6e2d1b Add SVG DOM manipulation tests. 2013-11-06 16:01:24 -04:00
Adrian Phinney af9bcf72b9 Add unit test suite structure. 2013-11-06 16:00:49 -04:00
32 changed files with 16890 additions and 19535 deletions

6
.eslintrc.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
"extends": "standard",
"plugins": [
"standard"
]
};

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
node_modules
/.idea
bower_components/
.idea
*.iml
npm-debug.log

View File

@ -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?

View File

@ -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
@ -57,8 +68,8 @@ Something like running `python -m SimpleHTTPServer` in the `raphael` directory a
## Copyright and license
Copyright © 2008-2013 Dmitry Baranovskiy (http://raphaeljs.com)
Copyright © 2008-2013 Dmitry Baranovskiy (http://dmitrybaranovskiy.github.io/raphael/)
Copyright © 2008-2013 Sencha Labs (http://sencha.com)
Licensed under the **MIT** (http://raphaeljs.com/license.html) license.
Licensed under the **MIT** (http://dmitrybaranovskiy.github.io/raphael/license.html) license.

View File

@ -1,10 +1,23 @@
{
"name": "raphael",
"main": "raphael.js",
"devDependencies": {
"requirejs": "~2.1.17",
"eve": "https://github.com/adobe-webplatform/eve.git#eef80ed"
"main": "raphael.min.js",
"description": "JavaScript Vector Library",
"dependencies": {
"eve-raphael": "0.5.0"
},
"devDependencies": {
"requirejs": "2.3.2"
},
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": ["svg", "vml", "javascript"],
"authors": [
"Dmitry Baranovskiy"
],
"license": "MIT",
"ignore": [
"**/.*",
"*.html",

View File

@ -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"
}
}

View File

@ -1,11 +0,0 @@
{
"curly": true,
"eqnull": true,
"eqeqeq": true,
"undef": true,
"indent": 4,
"unused": true,
"globals": {
"eve": true
}
}

View File

@ -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
});

8
dev/banner.txt Normal file
View File

@ -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.│ \\
// └───────────────────────────────────────────────────────────────────────────────────────────────────────┘ \\

View File

@ -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.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\

View File

@ -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 dont need to worry about z-index, but its 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 events 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;
}));

View File

@ -1,27 +1,5 @@
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ 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.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
define(["./raphael.core", "./raphael.svg", "./raphael.vml"], function(R) {
(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");
return R;
require("raphael.svg");
require("raphael.vml");
module.exports = factory(raphael);
} else {
glob.Raphael = factory(glob.Raphael);
}
}(this, function (Raphael) {
return Raphael.ninja();
}));
});

View File

@ -1,22 +1,5 @@
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Core Module │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
define(["eve"], function(eve) {
(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) {
/*\
* Raphael
[ method ]
@ -84,7 +67,7 @@
}
}
}
R.version = "@@VERSION";
R.version = "2.2.0";
R.eve = eve;
var loaded,
separator = /[, ]+/,
@ -212,7 +195,8 @@
transform: "",
width: 0,
x: 0,
y: 0
y: 0,
class: ""
},
availableAnimAttrs = R._availableAnimAttrs = {
blur: nu,
@ -385,7 +369,6 @@
\*/
R.fn = paperproto = Paper.prototype = R.prototype;
R._id = 0;
R._oid = 0;
/*\
* Raphael.is
[ method ]
@ -2838,7 +2821,7 @@
* Raphael.el
[ property (object) ]
**
* You can add your own method to elements. This is usefull when you want to hack default functionality or
* You can add your own method to elements. This is useful when you want to hack default functionality or
* want to wrap some common transformation or attributes in one method. In difference to canvas methods,
* you can redefine element method at any time. Expending element methods wouldnt affect set.
> Usage
@ -3085,7 +3068,7 @@
* Element.data
[ method ]
**
* Adds or retrieves given value asociated with given key.
* Adds or retrieves given value associated with given key.
**
* See also @Element.removeData
> Parameters
@ -3194,7 +3177,7 @@
- mcontext (object) #optional context for moving handler
- scontext (object) #optional context for drag start handler
- econtext (object) #optional context for drag end handler
* Additionaly following `drag` events will be triggered: `drag.start.<id>` on start,
* Additionally following `drag` events will be triggered: `drag.start.<id>` on start,
* `drag.end.<id>` on end and `drag.move.<id>` on every move. When element will be dragged over another element
* `drag.over.<id>` will be fired as well.
*
@ -5366,7 +5349,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 +5402,4 @@
})(document, "DOMContentLoaded");
return R;
}));
});

View File

@ -1,24 +1,4 @@
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ SVG Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright (c) 2008-2011 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.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 +122,7 @@
}
}
$(o, {
fill: "url('" + (document.location.origin || '') + document.location.pathname + "#" + id + "')",
fill: fillurl(id),
opacity: 1,
"fill-opacity": 1
});
@ -151,6 +131,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 + ")"});
@ -617,7 +614,7 @@
el._.dirty = 1;
var bb = el._getBBox(),
dif = a.y - (bb.y + bb.height / 2);
dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
if (bb.height) dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
},
getRealNode = function (node) {
if (node.parentNode && node.parentNode.tagName.toLowerCase() === "a") {
@ -664,8 +661,17 @@
* Unique id of the element. Especially useful when you want to listen to events of the element,
* because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method.
\*/
this.id = R._oid++;
this.id = guid();
node.raphaelid = this.id;
/**
* Method that returns a 5 letter/digit id, enough for 36^5 = 60466176 elements
* @returns {string} id
*/
function guid() {
return ("0000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5);
}
this.matrix = R.matrix();
this.realPath = null;
/*\
@ -872,9 +878,6 @@
this.attr({"stroke-width": sw});
}
//Reduce transform string
_.transform = this.matrix.toTransformString();
return this;
};
/*\
@ -1352,7 +1355,7 @@
* Paper.renderfix
[ method ]
**
* Fixes the issue of Firefox and IE9 regarding subpixel rendering. If paper is dependant
* Fixes the issue of Firefox and IE9 regarding subpixel rendering. If paper is dependent
* on other elements after reflow it could shift half pixel which cause for lines to lost their crispness.
* This method fixes the issue.
**
@ -1421,4 +1424,4 @@
};
})(method);
}
}));
});

View File

@ -1,24 +1,4 @@
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright (c) 2008-2011 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.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;
}
@ -239,7 +219,6 @@
addArrow(res, params["arrow-end"], 1);
}
if (params.opacity != null ||
params["stroke-width"] != null ||
params.fill != null ||
params.src != null ||
params.stroke != null ||
@ -768,7 +747,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 +996,4 @@
};
})(method);
}
}));
});

View File

@ -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,27 @@
<!-- 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>
<!-- 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("container", 640, 720);
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>

31
dev/test/index.html Normal file
View File

@ -0,0 +1,31 @@
<!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="../../raphael.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>

317
dev/test/svg/dom.js Normal file
View File

@ -0,0 +1,317 @@
(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);
});
// Element#attrs
// -------------
// #x
// #y
// #rx
// #ry
// #transform
// #title
// #href
//keep adding and testing!
})();

5
dev/test/vml/dom.js Normal file
View File

@ -0,0 +1,5 @@
(function() {
module('DOM');
})();

View File

@ -1,6 +1,26 @@
2.2.0 • WIP
2.2.4
------------------
* Fixed no-deps version with eve.
2.2.3
------------------
* Changed eve dependencies avoiding short sha and github url
2.2.2
------------------
* Improved elements ids, so multiple raphael instances are more reliable
2.2.1
------------------
* Removed name of amd module
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.

View File

@ -1,37 +1,47 @@
{
"name": "raphael",
"version": "2.1.4b",
"version": "2.2.6",
"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": "0.5.0"
},
"devDependencies": {
"bower": "1.7.9",
"eslint": "3.6.1",
"eslint-config-standard": "6.2.0",
"eslint-loader": "1.5.0",
"eslint-plugin-promise": "2.0.1",
"eslint-plugin-standard": "2.0.1",
"qunitjs": "2.0.1",
"webpack": "1.13.2"
},
"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.4a",
"_from": "raphael@"
"keywords": [
"svg",
"vml",
"javascript"
],
"homepage": "http://dmitrybaranovskiy.github.io/raphael/",
"license": "MIT"
}

11
raphael-min.js vendored

File diff suppressed because one or more lines are too long

11
raphael-nodeps-min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -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();
}));

16626
raphael.js

File diff suppressed because it is too large Load Diff

3
raphael.min.js vendored Normal file

File diff suppressed because one or more lines are too long

7930
raphael.no-deps.js Normal file

File diff suppressed because it is too large Load Diff

3
raphael.no-deps.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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"));
});

64
webpack.config.js Normal file
View File

@ -0,0 +1,64 @@
"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"
},
externals: externals,
plugins: plugins,
loaders: [
{
test: /\.js$/,
loader: "eslint-loader",
include: "./dev/"
}
],
eslint: {
configFile: './.eslintrc'
},
resolve: {
modulesDirectories: ["bower_components"],
alias: {
"eve": "eve-raphael/eve"
}
}
};