From f99ecd57a9be558789b6136d46d9ba585b839673 Mon Sep 17 00:00:00 2001 From: IjzerenHein Date: Tue, 7 Apr 2015 14:43:57 +0200 Subject: [PATCH] Updated docs, code checking & bump to v1.0.3 --- .eslintrc | 2 +- CONTRIBUTORS.md | 3 +- Gruntfile.js | 51 +++++----------------- bower.json | 8 +--- docs/BkImageSurface.md | 82 +++++++++++++++++++++-------------- examples/demo/index.html | 7 ++- examples/demo/main.js | 2 - examples/imagesurface/main.js | 6 +-- package.json | 13 ++---- 9 files changed, 74 insertions(+), 100 deletions(-) diff --git a/.eslintrc b/.eslintrc index e8acffa..86c55f5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,7 @@ }, "rules": { "valid-jsdoc": 0, - "curly": [1, "multi"], + "curly": [1, "all"], "brace-style": [1, "stroustrup"], "consistent-this": 2, "no-constant-condition": 1, diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ab69d2c..e585c78 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -3,5 +3,4 @@ The list is still small but I hope it will grow :) - Hein Rutjes (IjzerenHein) - - +- Pierre-Eric Marchandet (PEM) diff --git a/Gruntfile.js b/Gruntfile.js index 3ae3cf8..b971056 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,44 +3,17 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ - // Task configuration. - jshint: { + eslint: { + target: ['BkImageSurface.js'], options: { - curly: true, - eqeqeq: true, - immed: true, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - unused: true, - boss: true, - eqnull: true, - browser: true, - globals: { - jQuery: true - } - }, - gruntfile: { - src: 'Gruntfile.js' - }, - lib_test: { - src: ['*.js', 'examples/panToPosition/*.js', 'test/**/*.js'] + config: '.eslintrc' } }, - qunit: { - files: ['test/**/*.html'] - }, - watch: { - gruntfile: { - files: '<%= jshint.gruntfile.src %>', - tasks: ['jshint:gruntfile'] - }, - lib_test: { - files: '<%= jshint.lib_test.src %>', - tasks: ['jshint:lib_test', 'qunit'] - } + jscs: { + src: ['BkImageSurface.js'], + options: { + config: '.jscsrc' + } }, jsdoc2md: { separateOutputFilePerInput: { @@ -55,12 +28,10 @@ module.exports = function(grunt) { }); // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-qunit'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-eslint'); + grunt.loadNpmTasks('grunt-jscs'); grunt.loadNpmTasks('grunt-jsdoc-to-markdown'); // Default task. - grunt.registerTask('default', ['jshint', 'jsdoc2md', 'qunit']); - + grunt.registerTask('default', ['eslint', 'jscs', 'jsdoc2md']); }; diff --git a/bower.json b/bower.json index 9d6fba9..58e4d60 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "famous-bkimagesurface", - "version": "1.0.2", + "version": "1.0.3", "homepage": "https://github.com/IjzerenHein/famous-bkimagesurface", "repository": { "type": "git", @@ -29,9 +29,5 @@ "Gruntfile.js", "CONTRIBUTORS.md", "package.json" - ], - "devDependencies": { - "requirejs": "~2.1.11", - "famous": "~0.2.0" - } + ] } diff --git a/docs/BkImageSurface.md b/docs/BkImageSurface.md index 1fe87b3..d89f29d 100644 --- a/docs/BkImageSurface.md +++ b/docs/BkImageSurface.md @@ -6,38 +6,65 @@ It uses a 'div' with a background-image rather than a 'img' tag. Can be used as a drop-in replacement for ImageSurface, in case the the size of the div is not derived from the image. - + ##class: BkImageSurface ⏏ **Members** -* [new BkImageSurface(options)](#module_BkImageSurface) -* [bkImageSurface.setContent(imageUrl)](#module_BkImageSurface#setContent) -* [bkImageSurface.getContent()](#module_BkImageSurface#getContent) -* [bkImageSurface.setSizeMode(sizeMode)](#module_BkImageSurface#setSizeMode) -* [bkImageSurface.getSizeMode()](#module_BkImageSurface#getSizeMode) -* [bkImageSurface.setPositionMode(positionMode)](#module_BkImageSurface#setPositionMode) -* [bkImageSurface.getPositionMode()](#module_BkImageSurface#getPositionMode) -* [bkImageSurface.setRepeatMode(repeatMode)](#module_BkImageSurface#setRepeatMode) -* [bkImageSurface.getRepeatMode()](#module_BkImageSurface#getRepeatMode) -* [enum: BkImageSurface.SizeMode](#module_BkImageSurface.SizeMode) -* [enum: BkImageSurface.PositionMode](#module_BkImageSurface.PositionMode) -* [enum: BkImageSurface.RepeatMode](#module_BkImageSurface.RepeatMode) +* [class: BkImageSurface ⏏](#exp_module_BkImageSurface) + * [new BkImageSurface(options)](#exp_new_module_BkImageSurface) + * [enum: BkImageSurface.SizeMode](#module_BkImageSurface.SizeMode) + * [module:BkImageSurface.SizeMode.AUTO](#module_BkImageSurface.SizeMode.AUTO) + * [module:BkImageSurface.SizeMode.FILL](#module_BkImageSurface.SizeMode.FILL) + * [module:BkImageSurface.SizeMode.ASPECTFILL](#module_BkImageSurface.SizeMode.ASPECTFILL) + * [module:BkImageSurface.SizeMode.ASPECTFIT](#module_BkImageSurface.SizeMode.ASPECTFIT) + * [enum: BkImageSurface.PositionMode](#module_BkImageSurface.PositionMode) + * [module:BkImageSurface.PositionMode.CENTER](#module_BkImageSurface.PositionMode.CENTER) + * [module:BkImageSurface.PositionMode.LEFT](#module_BkImageSurface.PositionMode.LEFT) + * [module:BkImageSurface.PositionMode.RIGHT](#module_BkImageSurface.PositionMode.RIGHT) + * [module:BkImageSurface.PositionMode.TOP](#module_BkImageSurface.PositionMode.TOP) + * [module:BkImageSurface.PositionMode.BOTTOM](#module_BkImageSurface.PositionMode.BOTTOM) + * [module:BkImageSurface.PositionMode.TOPLEFT](#module_BkImageSurface.PositionMode.TOPLEFT) + * [module:BkImageSurface.PositionMode.TOPRIGHT](#module_BkImageSurface.PositionMode.TOPRIGHT) + * [module:BkImageSurface.PositionMode.BOTTOMLEFT](#module_BkImageSurface.PositionMode.BOTTOMLEFT) + * [module:BkImageSurface.PositionMode.BOTTOMRIGHT](#module_BkImageSurface.PositionMode.BOTTOMRIGHT) + * [enum: BkImageSurface.RepeatMode](#module_BkImageSurface.RepeatMode) + * [module:BkImageSurface.RepeatMode.NONE](#module_BkImageSurface.RepeatMode.NONE) + * [module:BkImageSurface.RepeatMode.VERTICAL](#module_BkImageSurface.RepeatMode.VERTICAL) + * [module:BkImageSurface.RepeatMode.HORIZONTAL](#module_BkImageSurface.RepeatMode.HORIZONTAL) + * [module:BkImageSurface.RepeatMode.BOTH](#module_BkImageSurface.RepeatMode.BOTH) + * [bkImageSurface.setContent(imageUrl)](#module_BkImageSurface#setContent) + * [bkImageSurface.getContent()](#module_BkImageSurface#getContent) + * [bkImageSurface.setSizeMode(sizeMode)](#module_BkImageSurface#setSizeMode) + * [bkImageSurface.getSizeMode()](#module_BkImageSurface#getSizeMode) + * [bkImageSurface.setPositionMode(positionMode)](#module_BkImageSurface#setPositionMode) + * [bkImageSurface.getPositionMode()](#module_BkImageSurface#getPositionMode) + * [bkImageSurface.setRepeatMode(repeatMode)](#module_BkImageSurface#setRepeatMode) + * [bkImageSurface.getRepeatMode()](#module_BkImageSurface#getRepeatMode) - + ###new BkImageSurface(options) **Params** -- options `Object` - Options. - - [content] `String` - Image-url. - - [sizeMode] `SizeMode` | `String` - Size-mode to use. - - [positionMode] `PositionMode` | `String` - Position-mode to use. - - [repeatMode] `RepeatMode` | `String` - Repeat-mode to use. +- options `Object` - Options. + - \[content\] `String` - Image-url. + - \[sizeMode\] `SizeMode` | `String` - Size-mode to use. + - \[positionMode\] `PositionMode` | `String` - Position-mode to use. + - \[repeatMode\] `RepeatMode` | `String` - Repeat-mode to use. + +###enum: BkImageSurface.SizeMode +**Properties**: `AUTO`, `FILL`, `ASPECTFILL`, `ASPECTFIT` + +###enum: BkImageSurface.PositionMode +**Properties**: `CENTER`, `LEFT`, `RIGHT`, `TOP`, `BOTTOM`, `TOPLEFT`, `TOPRIGHT`, `BOTTOMLEFT`, `BOTTOMRIGHT` + +###enum: BkImageSurface.RepeatMode +**Properties**: `NONE`, `VERTICAL`, `HORIZONTAL`, `BOTH` ###bkImageSurface.setContent(imageUrl) **Params** -- imageUrl `String` - Image-url, when set will cause re-rendering +- imageUrl `String` - Image-url, when set will cause re-rendering ###bkImageSurface.getContent() @@ -46,7 +73,7 @@ from the image. ###bkImageSurface.setSizeMode(sizeMode) **Params** -- sizeMode `SizeMode` | `String` - Sizing-mode, when set will cause re-rendering +- sizeMode `SizeMode` | `String` - Sizing-mode, when set will cause re-rendering ###bkImageSurface.getSizeMode() @@ -55,7 +82,7 @@ from the image. ###bkImageSurface.setPositionMode(positionMode) **Params** -- positionMode `PositionMode` | `String` - Position-mode, when set will cause re-rendering +- positionMode `PositionMode` | `String` - Position-mode, when set will cause re-rendering ###bkImageSurface.getPositionMode() @@ -64,17 +91,8 @@ from the image. ###bkImageSurface.setRepeatMode(repeatMode) **Params** -- repeatMode `RepeatMode` | `String` - Repeat-mode, when set will cause re-rendering +- repeatMode `RepeatMode` | `String` - Repeat-mode, when set will cause re-rendering ###bkImageSurface.getRepeatMode() **Returns**: `RepeatMode` | `String` - Repeat-mode - -###enum: BkImageSurface.SizeMode -**Properties**: `AUTO`, `FILL`, `ASPECTFILL`, `ASPECTFIT` - -###enum: BkImageSurface.PositionMode -**Properties**: `CENTER`, `LEFT`, `RIGHT`, `TOP`, `BOTTOM`, `TOPLEFT`, `TOPRIGHT`, `BOTTOMLEFT`, `BOTTOMRIGHT` - -###enum: BkImageSurface.RepeatMode -**Properties**: `NONE`, `VERTICAL`, `HORIZONTAL`, `BOTH` diff --git a/examples/demo/index.html b/examples/demo/index.html index a7d577a..c5129e0 100644 --- a/examples/demo/index.html +++ b/examples/demo/index.html @@ -6,12 +6,12 @@ - + - + @@ -25,12 +25,11 @@ require.config({ baseUrl: '', paths: { - 'famous-bkimagesurface': '../../BkImageSurface', + 'famous-bkimagesurface': '../../BkImageSurface' } }); require(['main']); - diff --git a/examples/demo/main.js b/examples/demo/main.js index 41132dd..c531f5b 100644 --- a/examples/demo/main.js +++ b/examples/demo/main.js @@ -8,8 +8,6 @@ * @copyright Gloey Apps, 2014 */ -/*global define*/ - define(function(require) { 'use strict'; diff --git a/examples/imagesurface/main.js b/examples/imagesurface/main.js index 7a7000e..11bd1a1 100644 --- a/examples/imagesurface/main.js +++ b/examples/imagesurface/main.js @@ -8,8 +8,6 @@ * @copyright Gloey Apps, 2014 */ -/*global define*/ - define(function(require) { 'use strict'; @@ -47,7 +45,7 @@ define(function(require) { } }); - var text = new Surface({ + var subText = new Surface({ content: 'size: ' + JSON.stringify(size) + '
desc: ' + text, properties: { color: 'white', @@ -63,7 +61,7 @@ define(function(require) { var renderNode = new RenderNode(modifier); renderNode.add(back); renderNode.add(image); - renderNode.add(text); + renderNode.add(subText); renderables.push(renderNode); } diff --git a/package.json b/package.json index 73cf335..517378a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "famous-bkimagesurface", - "version": "1.0.2", + "version": "1.0.3", "homepage": "https://github.com/IjzerenHein/famous-bkimagesurface", "repository": { "type": "git", @@ -8,9 +8,7 @@ }, "browserify": { "transform": [ - "deamdify", - "famousify", - "brfs" + "deamdify" ] }, "author": { @@ -38,14 +36,11 @@ "node": ">= 0.10.0" }, "devDependencies": { - "brfs": "latest", "browserify": "latest", "deamdify": "latest", - "famousify": "latest", "grunt": "latest", - "grunt-contrib-jshint": "latest", - "grunt-contrib-watch": "latest", - "grunt-contrib-qunit": "latest", + "grunt-eslint": "latest", + "grunt-jscs": "latest", "grunt-jsdoc-to-markdown": "latest" }, "files": [