angular-masonry
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -20,9 +20,10 @@ { | ||
"masonry": "~4.0.0", | ||
"angular": "^1.5.0", | ||
"angular": "^1.6.0", | ||
"jquery": "~2.1.0", | ||
"imagesloaded": "~4.1.0", | ||
"jquery-bridget": "~2.0.0" | ||
"jquery-bridget": "~2.0.0", | ||
"matches-selector": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"angular-mocks": "^1.5.0", | ||
"angular-mocks": "^1.6.0", | ||
"sinonjs": "~1.10.0", | ||
@@ -29,0 +30,0 @@ "jasmine-sinon": "~0.4.0" |
@@ -0,1 +1,13 @@ | ||
<a name="0.17.0"></a> | ||
# [0.17.0](https://github.com/passy/angular-masonry/compare/v0.16.0...v0.17.0) (2017-03-18) | ||
### Features | ||
* **app:** remove dependency on jQuery ([70e6855](https://github.com/passy/angular-masonry/commit/70e6855)) | ||
* **deps:** update AngularJS to 1.6 ([e53f7a9](https://github.com/passy/angular-masonry/commit/e53f7a9)) | ||
* **package:** Change entrypoint and add requires/exports for commonJS (like browserify) usage ([3da4a25](https://github.com/passy/angular-masonry/commit/3da4a25)) | ||
<a name="0.16.0"></a> | ||
@@ -2,0 +14,0 @@ # [0.16.0](https://github.com/passy/angular-masonry/compare/v0.15.0...v0.16.0) (2016-02-14) |
@@ -82,6 +82,12 @@ module.exports = function (grunt) { | ||
}, | ||
ngmin: { | ||
dist: { | ||
src: '<%= pkg.name %>.js', | ||
dest: '<%= pkg.name %>.js' | ||
ngAnnotate: { | ||
app: { | ||
options: { | ||
singleQuotes: true, | ||
}, | ||
files: [ | ||
{ | ||
'<%= pkg.name %>.js': ['<%= pkg.name %>.js'] | ||
} | ||
] | ||
} | ||
@@ -91,5 +97,5 @@ } | ||
grunt.registerTask('default', ['concat', 'ngmin', 'uglify']); | ||
grunt.registerTask('default', ['concat', 'ngAnnotate', 'uglify']); | ||
grunt.registerTask('server', ['default', 'connect:livereload', 'watch']); | ||
grunt.registerTask('test', ['karma:dist']); | ||
}; |
@@ -8,2 +8,3 @@ module.exports = function (config) { | ||
files: [ | ||
'bower_components/masonry/dist/masonry.pkgd.js', | ||
'bower_components/jquery/dist/jquery.js', | ||
@@ -15,4 +16,3 @@ 'bower_components/sinonjs/sinon.js', | ||
'src/angular-masonry.js', | ||
'test/mocks/**/*.js', | ||
'test/spec/**/*.coffee' | ||
'test/**/*.coffee' | ||
], | ||
@@ -19,0 +19,0 @@ preprocessors: { |
{ | ||
"name": "angular-masonry", | ||
"version": "0.16.0", | ||
"main": "angular-masonry.js", | ||
"version": "0.17.0", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"grunt": "^0.4.1", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-concat": "^0.5.1", | ||
"grunt-contrib-concat": "^1.0.0", | ||
"grunt-contrib-connect": "^0.11.2", | ||
"grunt-contrib-uglify": "^0.11.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-conventional-changelog": "^5.0.0", | ||
"grunt-conventional-changelog": "^6.1.0", | ||
"grunt-karma": "^0.12.0", | ||
"grunt-ngmin": "0.0.3", | ||
"grunt-ng-annotate": "^1.0.1", | ||
"jasmine-core": "^2.2.0", | ||
@@ -19,5 +19,6 @@ "karma": "^0.13.21", | ||
"karma-jasmine": "^0.3.5", | ||
"karma-phantomjs-launcher": "^0.2.1", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"load-grunt-tasks": "^3.1.0", | ||
"phantomjs": "^2.1.3" | ||
"phantomjs": "^2.1.3", | ||
"phantomjs-prebuilt": "^2.1.4" | ||
}, | ||
@@ -30,3 +31,3 @@ "repository": "https://github.com/passy/angular-masonry.git", | ||
"dependencies": { | ||
"angular": "^1.5.0", | ||
"angular": "^1.6.0", | ||
"imagesloaded": "^4.1.0", | ||
@@ -33,0 +34,0 @@ "jquery-bridget": "^2.0.0", |
@@ -1,2 +0,2 @@ | ||
# AngularJS Masonry Directive [![Build Status](https://travis-ci.org/passy/angular-masonry.png)](https://travis-ci.org/passy/angular-masonry) [![Dependency Status](https://gemnasium.com/passy/angular-masonry.png)](https://gemnasium.com/passy/angular-masonry) [![Code Climate](https://codeclimate.com/github/passy/angular-masonry.png)](https://codeclimate.com/github/passy/angular-masonry) | ||
# AngularJS Masonry Directive [![Build Status](https://travis-ci.org/passy/angular-masonry.svg?branch=master)](https://travis-ci.org/passy/angular-masonry)[![Dependency Status](https://gemnasium.com/passy/angular-masonry.svg)](https://gemnasium.com/passy/angular-masonry) [![Code Climate](https://codeclimate.com/github/passy/angular-masonry/badges/gpa.svg)](https://codeclimate.com/github/passy/angular-masonry) | ||
@@ -15,15 +15,18 @@ [Homepage](https://passy.github.io/angular-masonry) | ||
```html | ||
<script src="bower_components/jquery/dist/jquery.js"></script> | ||
<script src="bower_components/jquery-bridget/jquery-bridget.js"></script> | ||
<script src="bower_components/ev-emitter/ev-emitter.js"></script> | ||
<script src="bower_components/desandro-matches-selector/matches-selector.js"></script> | ||
<script src="bower_components/fizzy-ui-utils/utils.js"></script> | ||
<script src="bower_components/get-size/get-size.js"></script> | ||
<script src="bower_components/outlayer/item.js"></script> | ||
<script src="bower_components/outlayer/outlayer.js"></script> | ||
<script src="bower_components/masonry/masonry.js"></script> | ||
<!-- optional --> | ||
<script src="bower_components/imagesloaded/imagesloaded.js"></script> | ||
<!-- /optional --> | ||
<script src="bower_components/angular/angular.js"></script> | ||
<script src="bower_components/angular-masonry/angular-masonry.js"></script> | ||
``` | ||
4. Use the `masonry` directive. | ||
@@ -36,3 +39,3 @@ | ||
```html | ||
<div masonry> | ||
<div masonry load-images="true"> | ||
<div class="masonry-brick" ng-repeat="brick in bricks"> | ||
@@ -48,4 +51,4 @@ <img ng-src="{{ brick.src }}" alt="A masonry brick"> | ||
The directive uses [`imagesloaded`](https://github.com/desandro/imagesloaded) to | ||
determine when all images within the `masonry-brick` have been loaded and adds | ||
The directive optionally uses [`imagesloaded`](https://github.com/desandro/imagesloaded) | ||
to determine when all images within the `masonry-brick` have been loaded and adds | ||
the `loaded` CSS class to the element, so you can add custom styles and | ||
@@ -107,5 +110,3 @@ prevent ghosting effects. | ||
This attribute defaults to `true` and allows to disable the use of `imagesLoaded` | ||
altogether, so you don't have to include the dependency if your masonry layout | ||
doesn't actually make use of images. | ||
Allows usage of `imagesLoaded` plugin. Defaults to `false`. | ||
@@ -115,5 +116,5 @@ *Example:* | ||
```html | ||
<masonry load-images="false"> | ||
<div class="masonry-brick"><p>Only text.</p></div> | ||
<div class="masonry-brick"><p>And nothing but text.</p></div> | ||
<masonry load-images="true"> | ||
<div class="masonry-brick"><img src="/your/image_1.jpg" alt="image"/></div> | ||
<div class="masonry-brick"><img src="/your/image_2.jpg" alt="image"/></div> | ||
</masonry> | ||
@@ -125,4 +126,4 @@ ``` | ||
The `reload-on-show` attribute triggers a reload when the masonry element (or an | ||
ancestor element) is shown after being hidden, useful when using `ng-show` or | ||
`ng-hide`. Without this if the viewport is resized while the masonry element is | ||
ancestor element) is shown after being hidden, useful when using `ng-show` or | ||
`ng-hide`. Without this if the viewport is resized while the masonry element is | ||
hidden it may not render properly when shown again. | ||
@@ -145,4 +146,4 @@ | ||
The `reload-on-resize` attribute triggers a reload when the masonry element changes | ||
its width, useful when only the parent element is resized (and not the window) and | ||
you want the elements to be rearranged. Without this if the parent is resized then | ||
its width, useful when only the parent element is resized (and not the window) and | ||
you want the elements to be rearranged. Without this if the parent is resized then | ||
some blank space may be left on the sides. | ||
@@ -149,0 +150,0 @@ |
@@ -1,5 +0,8 @@ | ||
/*! | ||
* angular-masonry <%= pkg.version %> | ||
* Pascal Hartig, https://passy.me/ | ||
* License: MIT | ||
/** | ||
* angular-masonry | ||
* | ||
* @external 'angular.module' | ||
* @version <%= pkg.version %> | ||
* @author {@link https://passy.me/|Pascal Hartig} | ||
* @license: MIT | ||
*/ | ||
@@ -18,3 +21,3 @@ (function () { | ||
this.preserveOrder = false; | ||
this.loadImages = true; | ||
this.loadImages = false; | ||
@@ -46,3 +49,6 @@ this.scheduleMasonryOnce = function scheduleMasonryOnce() { | ||
schedule.forEach(function scheduleForEach(args) { | ||
$element.masonry.apply($element, args); | ||
var method = args[0]; | ||
args = args.slice(1); | ||
self.masonry[method].apply(self.masonry, args); | ||
}); | ||
@@ -64,3 +70,3 @@ schedule = []; | ||
if (Object.keys(bricks).length === 0) { | ||
$element.masonry('resize'); | ||
self.masonry.resize(); | ||
} | ||
@@ -71,3 +77,3 @@ if (bricks[id] === undefined) { | ||
defaultLoaded(element); | ||
$element.masonry(method, element, true); | ||
self.masonry[method](element, true); | ||
} | ||
@@ -89,5 +95,5 @@ } | ||
_add(); | ||
element.imagesLoaded(_layout); | ||
window.imagesLoaded(element, _layout); | ||
} else { | ||
element.imagesLoaded(function imagesLoaded() { | ||
window.imagesLoaded(element, function imagesLoaded() { | ||
_add(); | ||
@@ -105,3 +111,3 @@ _layout(); | ||
delete bricks[id]; | ||
$element.masonry('remove', element); | ||
self.masonry.remove(element); | ||
this.scheduleMasonryOnce('layout'); | ||
@@ -115,3 +121,3 @@ }; | ||
// Gently uninitialize if still present | ||
$element.masonry('destroy'); | ||
self.masonry.destroy(); | ||
} | ||
@@ -124,3 +130,3 @@ $scope.$emit('masonry.destroyed'); | ||
this.reload = function reload() { | ||
$element.masonry(); | ||
self.masonry.reload(); | ||
$scope.$emit('masonry.reloaded'); | ||
@@ -134,2 +140,3 @@ }; | ||
controller: 'MasonryCtrl', | ||
controllerAs: 'msnry', | ||
link: { | ||
@@ -142,9 +149,14 @@ pre: function preLink(scope, element, attrs, ctrl) { | ||
}, attrOptions || {}); | ||
element.masonry(options); | ||
scope.masonryContainer = element[0]; | ||
ctrl.masonry = new Masonry(scope.masonryContainer, options); | ||
var loadImages = scope.$eval(attrs.loadImages); | ||
ctrl.loadImages = loadImages !== false; | ||
ctrl.loadImages = !!loadImages; | ||
var preserveOrder = scope.$eval(attrs.preserveOrder); | ||
ctrl.preserveOrder = (preserveOrder !== false && attrs.preserveOrder !== undefined); | ||
ctrl.preserveOrder = (preserveOrder !== false && attrs.preserveOrder !== undefined); | ||
var reloadOnShow = scope.$eval(attrs.reloadOnShow); | ||
if (reloadOnShow !== false && attrs.reloadOnShow !== undefined) { | ||
@@ -159,6 +171,7 @@ scope.$watch(function () { | ||
} | ||
var reloadOnResize = scope.$eval(attrs.reloadOnResize); | ||
if (reloadOnResize !== false && attrs.reloadOnResize !== undefined) { | ||
scope.$watch('masonryContainer.offsetWidth', function (newWidth, oldWidth) { | ||
if (newWidth != oldWidth) { | ||
if (newWidth !== oldWidth) { | ||
ctrl.reload(); | ||
@@ -165,0 +178,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153234
19
533
205
17
Updatedangular@^1.6.0