From 5d1a78589afcf0eeddfe4fb4bb885232331b5d68 Mon Sep 17 00:00:00 2001 From: Eric Rowell Date: Sat, 1 Jun 2013 10:27:44 -0700 Subject: [PATCH] updated class config param doc include replacements with grunt --- Gruntfile.js | 7 ++-- doc-includes/ContainerParams.txt | 1 + doc-includes/NodeParams.txt | 20 +++++++++++ doc-includes/ShapeParams.txt | 61 ++++++++++++++++++++++++++++++++ package.json | 2 +- src/Global.js | 22 ++++++------ src/plugins/Label.js | 2 +- src/plugins/Path.js | 4 +-- src/plugins/RegularPolygon.js | 4 +-- src/plugins/Star.js | 4 +-- src/plugins/TextPath.js | 4 +-- src/shapes/Blob.js | 4 +-- src/shapes/Circle.js | 4 +-- src/shapes/Image.js | 4 +-- src/shapes/Line.js | 4 +-- src/shapes/Polygon.js | 4 +-- src/shapes/Rect.js | 4 +-- src/shapes/Spline.js | 4 +-- src/shapes/Sprite.js | 4 +-- src/shapes/Text.js | 4 +-- src/shapes/Wedge.js | 4 +-- 21 files changed, 128 insertions(+), 43 deletions(-) create mode 100644 doc-includes/ContainerParams.txt create mode 100644 doc-includes/NodeParams.txt create mode 100644 doc-includes/ShapeParams.txt diff --git a/Gruntfile.js b/Gruntfile.js index 63d02eab..59b8a33c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -56,8 +56,11 @@ module.exports = function(grunt) { dist: { options: { variables: { - 'version': '<%= pkg.version %>', - 'date': '<%= grunt.template.today("yyyy-mm-dd") %>' + version: '<%= pkg.version %>', + date: '<%= grunt.template.today("yyyy-mm-dd") %>', + nodeParams: '<%= grunt.file.read("doc-includes/NodeParams.txt") %>', + containerParams: '<%= grunt.file.read("doc-includes/ContainerParams.txt") %>', + shapeParams: '<%= grunt.file.read("doc-includes/ShapeParams.txt") %>' }, prefix: '@@' }, diff --git a/doc-includes/ContainerParams.txt b/doc-includes/ContainerParams.txt new file mode 100644 index 00000000..e9c619ea --- /dev/null +++ b/doc-includes/ContainerParams.txt @@ -0,0 +1 @@ +@param {Function} [config.clipFunc] clipping function diff --git a/doc-includes/NodeParams.txt b/doc-includes/NodeParams.txt new file mode 100644 index 00000000..649028ca --- /dev/null +++ b/doc-includes/NodeParams.txt @@ -0,0 +1,20 @@ +@param {Number} [config.x] + * @param {Number} [config.y] + * @param {Number} [config.width] + * @param {Number} [config.height] + * @param {Boolean} [config.visible] + * @param {Boolean} [config.listening] whether or not the node is listening for events + * @param {String} [config.id] unique id + * @param {String} [config.name] non-unique name + * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1 + * @param {Object} [config.scale] set scale + * @param {Number} [config.scaleX] set scale x + * @param {Number} [config.scaleY] set scale y + * @param {Number} [config.rotation] rotation in radians + * @param {Number} [config.rotationDeg] rotation in degrees + * @param {Object} [config.offset] offset from center point and rotation point + * @param {Number} [config.offsetX] set offset x + * @param {Number} [config.offsetY] set offset y + * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop + * the entire stage by dragging any portion of the stage + * @param {Function} [config.dragBoundFunc] \ No newline at end of file diff --git a/doc-includes/ShapeParams.txt b/doc-includes/ShapeParams.txt new file mode 100644 index 00000000..254b5ad2 --- /dev/null +++ b/doc-includes/ShapeParams.txt @@ -0,0 +1,61 @@ +@param {String} [config.fill] fill color + * @param {Object} [config.fillRGB] set fill color with an object literal containing an r, g, and b component + * @param {Integer} [config.fillR] set fill red component + * @param {Integer} [config.fillG] set fill green component + * @param {Integer} [config.fillB] set fill blue component + * @param {Image} [config.fillPatternImage] fill pattern image + * @param {Number} [config.fillPatternX] + * @param {Number} [config.fillPatternY] + * @param {Number|Array|Object} [config.fillPatternOffset] number, array with two elements, or object with x and y component + * @param {Number} [config.fillPatternOffsetX] + * @param {Number} [config.fillPatternOffsetY] + * @param {Number|Array|Object} [config.fillPatternScale] number, array with two elements, or object with x and y component + * @param {Number} [config.fillPatternScaleX] + * @param {Number} [config.fillPatternScaleY] + * @param {Number} [config.fillPatternRotation] + * @param {String} [config.fillPatternRepeat] can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'no-repeat' + * @param {Number|Array|Object} [config.fillLinearGradientStartPoint] number, array with two elements, or object with x and y component + * @param {Number} [config.fillLinearGradientStartPointX] + * @param {Number} [config.fillLinearGradientStartPointY] + * @param {Number|Array|Object} [config.fillLinearGradientEndPoint] number, array with two elements, or object with x and y component + * @param {Number|Array|Object} [config.fillLinearGradientEndPoint] number, array with two elements, or object with x and y component + * @param {Number} [config.fillLinearGradientEndPointX] + * @param {Number} [config.fillLinearGradientEndPointY] + * @param {Array} [config.fillLinearGradientColorStops] array of color stops + * @param {Number|Array|Object} [config.fillRadialGradientStartPoint] number, array with two elements, or object with x and y component + * @param {Number} [config.fillRadialGradientStartPointX] + * @param {Number} [config.fillRadialGradientStartPointY] + * @param {Number|Array|Object} [config.fillRadialGradientEndPoint] number, array with two elements, or object with x and y component + * @param {Number} [config.fillRadialGradientEndPointX] + * @param {Number} [config.fillRadialGradientEndPointY] + * @param {Number} [config.fillRadialGradientStartRadius] + * @param {Number} [config.fillRadialGradientEndRadius] + * @param {Array} [config.fillRadialGradientColorStops] array of color stops + * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true + * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration + * @param {String} [config.stroke] stroke color + * @param {Object} [config.strokeRGB] set stroke color with an object literal containing an r, g, and b component + * @param {Integer} [config.strokeR] set stroke red component + * @param {Integer} [config.strokeG] set stroke green component + * @param {Integer} [config.strokeB] set stroke blue component + * @param {Number} [config.strokeWidth] stroke width + * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true + * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true + * @param {String} [config.lineJoin] can be miter, round, or bevel. The default + * is miter + * @param {String} [config.lineCap] can be butt, round, or sqare. The default + * is butt + * @param {String} [config.shadowColor] + * @param {Object} [config.shadowColorRGB] set shadowColor color with an object literal containing an r, g, and b component + * @param {Integer} [config.shadowColorR] set shadowColor red component + * @param {Integer} [config.shadowColorG] set shadowColor green component + * @param {Integer} [config.shadowColorB] set shadowColor blue component + * @param {Number} [config.shadowBlur] + * @param {Object} [config.shadowOffset] + * @param {Number} [config.shadowOffsetX] + * @param {Number} [config.shadowOffsetY] + * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number + * between 0 and 1 + * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true + * @param {Array} [config.dashArray] + * @param {Boolean} [config.dashArrayEnabled] flag which enables or disables the dashArray. The default value is true \ No newline at end of file diff --git a/package.json b/package.json index ef0af5f7..03ef030c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "KineticJS", - "version": "4.5.4", + "version": "current", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.1.1", diff --git a/src/Global.js b/src/Global.js index c447373d..a2715907 100644 --- a/src/Global.js +++ b/src/Global.js @@ -45,7 +45,7 @@ var Kinetic = {}; * @memberof Kinetic * @abstract * @param {Object} config - * {{NodeParams}} + * @@nodeParams */ Kinetic.Node = function(config) { this._nodeInit(config); @@ -58,8 +58,8 @@ var Kinetic = {}; * @memberof Kinetic * @augments Kinetic.Node * @param {Object} config - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var customShape = new Kinetic.Shape({
* x: 5,
@@ -88,8 +88,8 @@ var Kinetic = {}; * @augments Kinetic.Node * @abstract * @param {Object} config - * {{NodeParams}} - * {{ContainerParams}} + * @@nodeParams + * @@containerParams */ Kinetic.Container = function(config) { this._containerInit(config); @@ -102,8 +102,8 @@ var Kinetic = {}; * @augments Kinetic.Container * @param {Object} config * @param {String|DomElement} config.container Container id or DOM element - * {{NodeParams}} - * {{ContainerParams}} + * @@nodeParams + * @@containerParams * @example * var stage = new Kinetic.Stage({
* width: 500,
@@ -124,8 +124,8 @@ var Kinetic = {}; * @param {Object} config * @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want * to clear the canvas before each layer draw. The default value is true. - * {{NodeParams}} - * {{ContainerParams}} + * @@nodeParams + * @@containerParams * @example * var layer = new Kinetic.Layer(); */ @@ -139,8 +139,8 @@ var Kinetic = {}; * @memberof Kinetic * @augments Kinetic.Container * @param {Object} config - * {{NodeParams}} - * {{ContainerParams}} + * @@nodeParams + * @@containerParams * @example * var group = new Kinetic.Group(); */ diff --git a/src/plugins/Label.js b/src/plugins/Label.js index 06893e2a..f43ad891 100644 --- a/src/plugins/Label.js +++ b/src/plugins/Label.js @@ -31,7 +31,7 @@ * @param {Number} [config.tag.pointerWidth] * @param {Number} [config.tag.pointerHeight] * @param {Number} [config.tag.cornerRadius] - * {{NodeParams}} + * @@nodeParams * @example * // create label * var label = new Kinetic.Label({
diff --git a/src/plugins/Path.js b/src/plugins/Path.js index 3b6fbff7..a5feb43d 100644 --- a/src/plugins/Path.js +++ b/src/plugins/Path.js @@ -7,8 +7,8 @@ * @augments Kinetic.Shape * @param {Object} config * @param {String} config.data SVG data string - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var path = new Kinetic.Path({
* x: 240,
diff --git a/src/plugins/RegularPolygon.js b/src/plugins/RegularPolygon.js index b0a72232..1954f725 100644 --- a/src/plugins/RegularPolygon.js +++ b/src/plugins/RegularPolygon.js @@ -7,8 +7,8 @@ * @param {Object} config * @param {Number} config.sides * @param {Number} config.radius - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var hexagon = new Kinetic.RegularPolygon({
* x: 100,
diff --git a/src/plugins/Star.js b/src/plugins/Star.js index 40c09a98..433c0628 100644 --- a/src/plugins/Star.js +++ b/src/plugins/Star.js @@ -8,8 +8,8 @@ * @param {Integer} config.numPoints * @param {Number} config.innerRadius * @param {Number} config.outerRadius - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var star = new Kinetic.Star({
* x: 100,
diff --git a/src/plugins/TextPath.js b/src/plugins/TextPath.js index 75e222b5..80d6da93 100644 --- a/src/plugins/TextPath.js +++ b/src/plugins/TextPath.js @@ -15,8 +15,8 @@ * @param {String} [config.fontStyle] can be normal, bold, or italic. Default is normal * @param {String} config.text * @param {String} config.data SVG data string - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var textpath = new Kinetic.TextPath({
* x: 100,
diff --git a/src/shapes/Blob.js b/src/shapes/Blob.js index 7b3bda17..d9d953b6 100644 --- a/src/shapes/Blob.js +++ b/src/shapes/Blob.js @@ -9,8 +9,8 @@ * @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects. * e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent * @param {Number} [config.tension] default value is 1. Higher values will result in a more curvy line. A value of 0 will result in no interpolation. - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var blob = new Kinetic.Blob({
* points: [73, 140, 340, 23, 500, 109, 300, 170],
diff --git a/src/shapes/Circle.js b/src/shapes/Circle.js index 005af604..20fb3286 100644 --- a/src/shapes/Circle.js +++ b/src/shapes/Circle.js @@ -6,8 +6,8 @@ * @augments Kinetic.Shape * @param {Object} config * @param {Number} config.radius - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * // create simple circle * var circle = new Kinetic.Circle({
diff --git a/src/shapes/Image.js b/src/shapes/Image.js index bb8fdb8a..d17ef485 100644 --- a/src/shapes/Image.js +++ b/src/shapes/Image.js @@ -12,8 +12,8 @@ * @param {Object} config * @param {ImageObject} config.image * @param {Object} [config.crop] - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var imageObj = new Image();
* imageObj.onload = function() {
diff --git a/src/shapes/Line.js b/src/shapes/Line.js index 99f4bb2c..38152ad3 100644 --- a/src/shapes/Line.js +++ b/src/shapes/Line.js @@ -7,8 +7,8 @@ * @param {Object} config * @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects. * e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * // simple line * var line = new Kinetic.Line({
diff --git a/src/shapes/Polygon.js b/src/shapes/Polygon.js index 9b7f3dd7..f067be65 100644 --- a/src/shapes/Polygon.js +++ b/src/shapes/Polygon.js @@ -7,8 +7,8 @@ * @param {Object} config * @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects. * e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var polygon = new Kinetic.Polygon({
* points: [73, 192, 73, 160, 340, 23, 500, 109, 499, 139, 342, 93],
diff --git a/src/shapes/Rect.js b/src/shapes/Rect.js index f6e2ecd9..1ea13f51 100644 --- a/src/shapes/Rect.js +++ b/src/shapes/Rect.js @@ -6,8 +6,8 @@ * @augments Kinetic.Shape * @param {Object} config * @param {Number} [config.cornerRadius] - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var rect = new Kinetic.Rect({
* width: 100,
diff --git a/src/shapes/Spline.js b/src/shapes/Spline.js index 6ca62565..69d868a9 100644 --- a/src/shapes/Spline.js +++ b/src/shapes/Spline.js @@ -9,8 +9,8 @@ * @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects. * e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent * @param {Number} [config.tension] default value is 1. Higher values will result in a more curvy line. A value of 0 will result in no interpolation. - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var spline = new Kinetic.Spline({
* x: 100,
diff --git a/src/shapes/Sprite.js b/src/shapes/Sprite.js index 5c8a5fca..0e7e76e6 100644 --- a/src/shapes/Sprite.js +++ b/src/shapes/Sprite.js @@ -9,8 +9,8 @@ * @param {Object} config.animations animation map * @param {Integer} [config.index] animation index * @param {Image} config.image image object - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var animations = {
* idle: [{
diff --git a/src/shapes/Text.js b/src/shapes/Text.js index dfcbc6e8..975d38f1 100644 --- a/src/shapes/Text.js +++ b/src/shapes/Text.js @@ -43,8 +43,8 @@ * @param {Number} [config.height] default is auto * @param {Number} [config.lineHeight] default is 1 * @param {String} [config.wrap] can be word, char, or none. Default is word - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * var text = new Kinetic.Text({
* x: stage.getWidth() / 2,
diff --git a/src/shapes/Wedge.js b/src/shapes/Wedge.js index b44e373b..64ee6912 100644 --- a/src/shapes/Wedge.js +++ b/src/shapes/Wedge.js @@ -8,8 +8,8 @@ * @param {Number} config.angleDeg angle in degrees * @param {Number} config.radius * @param {Boolean} [config.clockwise] - * {{ShapeParams}} - * {{NodeParams}} + * @@shapeParams + * @@nodeParams * @example * // draw a wedge that's pointing downwards
* var wedge = new Kinetic.Wedge({