Commit d6b6f769 by Tomas Alabes

Merge branch 'master' of https://github.com/mdreizin/raphael into mdreizin-master

parents 9c7f5821 e361cc42
......@@ -10,90 +10,50 @@ module.exports = function(grunt) {
pkg: pkg,
banner: grunt.file.read("dev/copy.js").replace(/@VERSION/, pkg.version),
// Task configuration.
jshint: {
beforeconcat: ['dev/raphael.core.js', 'dev/raphael.svg.js', 'dev/raphael.vml.js'],
afterconcat: ['dist/raphael.js'],
"options": {
jshintrc: 'dev/.jshintrc'
}
},
uglify: {
options: {
banner: "<%= banner %>"
},
dist: {
src: "<%= build.dist.dest %>",
dest: "raphael-min.js"
src: "<%= concat.dist.dest %>",
dest: "dev/raphael-min.js"
}
},
build: {
options: {
banner: "<%= banner %>"
},
replace: {
dist: {
options: {
patterns: [{
match: "VERSION",
replacement: "<%= pkg.version %>"
}]
},
files: [{
expand: true,
flatten: true,
src: "<%= concat.dist.dest %>",
dest: "./"
}]
}
},
concat: {
dist: {
dest: "raphael.js",
dest: "<%= pkg.name %>.js",
src: [
"node_modules/eve/eve.js",
"../node_modules/eve/eve.js",
"dev/raphael.core.js",
"dev/raphael.svg.js",
"dev/raphael.vml.js"
"dev/raphael.vml.js",
"dev/raphael.amd.js"
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-jshint');
// Special concat/build task to handle Raphael's build requirements
grunt.registerMultiTask(
"build",
"Concatenate source, remove individual closures, embed version",
function() {
var data = this.data,
name = data.dest,
src = data.src,
options = this.options({
banner: ""
}),
// Start with banner
compiled = options.banner,
svgorvmlRegex = /\.(svg|vml)\.js/,
closureRegex = /window\.Raphael.*\(R\)\s*\{/,
closureEndRegex = /\}\(window\.Raphael\);\s*$/,
exposeRegex = /(\r?\n\s*\/\/\s*EXPOSE(?:\r|\n|.)*\}\)\);)/;
// Concatenate src
src.forEach(function(path) {
var source = grunt.file.read(path);
var match = svgorvmlRegex.exec(path);
// If either SVG or VML,
// remove the closure and add an early return if not required
if (match) {
source = "\n\n" +
source.replace(closureRegex,
"(function(){\n" +
" if (!R." + match[1] + ") {\n" +
" return;\n" +
" }"
)
.replace( closureEndRegex, "})();" );
// Add source before EXPOSE line
compiled = compiled.replace(exposeRegex, source + "$1");
} else {
compiled += source;
}
});
grunt.file.write( name, compiled );
grunt.log.ok("Built file " + name);
});
grunt.loadNpmTasks("grunt-replace");
// Default task.
grunt.registerTask("default", ["build", /*"jshint",*/ "uglify"]); //Removed jshint because of too many errors, improving little by little...
grunt.registerTask("default", ["concat", "replace", "uglify"]);
};
require(['../raphael'], function(Raphael){
'use strict';
require.config({
paths: {
raphael: '../raphael'
}
});
require(['raphael'], function(Raphael) {
var paper = Raphael(0, 0, 640, 720, "container");
//paper.circle(100, 100, 100); //example
......
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ 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", ["raphael.core", "raphael.svg", "raphael.vml"], function(Raphael) {
return (glob.Raphael = factory(Raphael));
});
} else if (typeof exports === "object") {
var raphael = require("raphael.core");
require("raphael.svg");
require("raphael.vml");
module.exports = factory(raphael);
} else {
glob.Raphael = factory(glob.Raphael);
}
}(this, function (Raphael) {
return Raphael.ninja();
}));
\ No newline at end of file
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ "Raphaël 2.1.2" - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ 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. │ \\
// └────────────────────────────────────────────────────────────────────┘ \\
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Core Module │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
(function (glob, factory) {
// AMD support
if (typeof define === "function" && define.amd) {
// Define as an anonymous module
define(["eve"], function( eve ) {
return factory(glob, eve);
define("raphael.core", ["eve"], function(eve) {
return factory(eve);
});
} else if (typeof exports === "object") {
module.exports = factory(require("eve"));
} else {
// Browser globals (glob is window)
// Raphael adds itself to window
factory(glob, glob.eve || (typeof require == "function" && require('eve')) );
glob.Raphael = factory(glob.eve);
}
}(this, function (window, eve) {
}(this, function (eve) {
/*\
* Raphael
[ method ]
......@@ -86,7 +84,7 @@
}
}
}
R.version = "2.1.2";
R.version = "@@VERSION";
R.eve = eve;
var loaded,
separator = /[, ]+/,
......@@ -5410,13 +5408,5 @@
isLoaded();
})(document, "DOMContentLoaded");
// EXPOSE
// SVG and VML are appended just before the EXPOSE line
// Even with AMD, Raphael should be defined globally
oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R);
if(typeof exports == "object"){
module.exports = R;
}
return R;
}));
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ SVG Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
......@@ -8,7 +8,21 @@
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\
window.Raphael && window.Raphael.svg && function(R) {
(function (glob, factory) {
if (typeof define === "function" && define.amd) {
define("raphael.svg", ["raphael.core"], function(raphael) {
factory(raphael);
});
} else if (typeof exports === "object") {
factory(require("raphael.core"));
} else {
factory(glob.Raphael);
}
}(this, function(R) {
if (R && !R.svg) {
return;
}
var has = "hasOwnProperty",
Str = String,
toFloat = parseFloat,
......@@ -643,7 +657,7 @@ window.Raphael && window.Raphael.svg && function(R) {
* Element.id
[ property (number) ]
**
* Unique id of the element. Especially useful when you want to listen to events of the element,
* Unique id of the element. Especially usesful 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++;
......@@ -1400,4 +1414,4 @@ window.Raphael && window.Raphael.svg && function(R) {
};
})(method);
}
}(window.Raphael);
}));
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
......@@ -8,7 +8,21 @@
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\
window.Raphael && window.Raphael.vml && function(R) {
(function (glob, factory) {
if (typeof define === "function" && define.amd) {
define("raphael.vml", ["raphael.core"], function(raphael) {
factory(raphael);
});
} else if (typeof exports === "object") {
factory(require("raphael"));
} else {
factory(glob.Raphael);
}
}(this, function(R) {
if (R && !R.vml) {
return;
}
var has = "hasOwnProperty",
Str = String,
toFloat = parseFloat,
......@@ -224,7 +238,7 @@ window.Raphael && window.Raphael.vml && function(R) {
if ("arrow-end" in params) {
addArrow(res, params["arrow-end"], 1);
}
if (params.opacity != null ||
if (params.opacity != null ||
params["stroke-width"] != null ||
params.fill != null ||
params.src != null ||
......@@ -303,7 +317,7 @@ window.Raphael && window.Raphael.vml && function(R) {
params["stroke-width"] && (stroke.weight = width);
width && width < 1 && (opacity *= width) && (stroke.weight = 1);
stroke.opacity = opacity;
params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
stroke.miterlimit = params["stroke-miterlimit"] || 8;
params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
......@@ -350,7 +364,7 @@ window.Raphael && window.Raphael.vml && function(R) {
res._.dirty = 1;
break;
}
// text-anchor emulation
switch (a["text-anchor"]) {
case "start":
......@@ -563,7 +577,7 @@ window.Raphael && window.Raphael.vml && function(R) {
}
cx = cx == null ? bbox.x + bbox.width / 2 : cx;
cy = cy == null ? bbox.y + bbox.height / 2 : cy;
this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
this._.dirtyT = 1;
return this;
......@@ -1003,4 +1017,4 @@ window.Raphael && window.Raphael.vml && function(R) {
};
})(method);
}
}(window.Raphael);
}));
......@@ -19,6 +19,7 @@
<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" src="raphael.amd.js"></script>
<!-- Comment this script tag if you are testing with AMD -->
<script type="text/javascript">
......
......@@ -23,9 +23,9 @@
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"bower": "1.4.1",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-uglify": "^0.9.1",
"uglify-js": "~2.2.3"
"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": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment