Commit d9365a7c by Tomas Alabes

Merge branch 'mdreizin-master'

parents 75a5818a 4d8dc216
......@@ -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 %>",
src: "<%= concat.dist.dest %>",
dest: "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",
"dev/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"]);
};
......@@ -4,6 +4,9 @@
"dependencies": {
"eve": "https://github.com/adobe-webplatform/eve.git#eef80ed"
},
"devDependencies": {
"requirejs": "~2.1.17"
},
"ignore": [
"eve",
"**/.*",
......
{
"name": "raphael",
"version": "2.1.2",
"version": "2.1.4",
"description": "JavaScript Vector Library",
"main": "./dev",
"main": "raphael",
"repository": "git://github.com/DmitryBaranovskiy/raphael.git",
"keywords": [
"vector",
......
require(['../raphael'], function(Raphael){
'use strict';
require.config({
paths: {
raphael: '../raphael'/*,
eve: '../bower_components/eve/eve'*/
}
});
require(['raphael'], function(Raphael) {
var paper = Raphael(0, 0, 640, 720, "container");
//paper.circle(100, 100, 100); //example
paper.circle(100, 100, 100); //example
// Work here
});
This diff is collapsed. Click to expand it.
var core = require('./raphael.core');
if(core.svg){
require('./raphael.svg');
}
if(core.vml){
require('./raphael.vml');
}
module.exports = core;
\ No newline at end of file
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ 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 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 = /[, ]+/,
......@@ -5358,7 +5356,7 @@
[ method ]
**
* If you want to leave no trace of Raphaël (Well, Raphaël creates only one global variable `Raphael`, but anyway.) You can use `ninja` method.
* Beware, that in this case plugins could stop working, because they are depending on global variable existance.
* Beware, that in this case plugins could stop working, because they are depending on global variable existence.
**
= (object) Raphael object
> Usage
......@@ -5412,13 +5410,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) {
return 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,
......@@ -1401,4 +1415,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) {
return 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);
}));
......@@ -6,33 +6,32 @@
<!-- Global use -->
<!-- Remember to run to pull the eve submodule -->
<!-- To work with concatenated version -->
<!--<script type="text/javascript" src="../raphael.js"></script>-->
<!-- To work with full version -->
<script type="text/javascript" src="../raphael.js"></script>
<!-- To work with minified version -->
<!--<script type="text/javascript" src="../raphael-min.js"></script>-->
<!-- To work with dev versions -->
<!-- Comment this 4 script tags if you are testing with AMD -->
<script type="text/javascript" src="../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" src="../node_modules/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>-->
<!-- Comment this script tag if you are testing with AMD -->
<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
paper.circle(100, 100, 100); //example
};
//Work here, in a separate script file or via command line
</script>
<!-- AMD use -->
<!--<script data-main="amdDev" src="require.js"></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>
......
......@@ -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": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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