diff --git a/Gruntfile.js b/Gruntfile.js index 0cb3b18..aff14d1 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -76,7 +76,7 @@ module.exports = function (grunt) { '<%= grunt.template.today("yyyy-mm-dd") %> */' + '(function (root, factory) {' + 'if (typeof define === "function" && define.amd) {' + - 'define(["angular-tether"], factory);' + + 'define(["tether"], factory);' + '} else if (typeof exports === "object") {' + 'module.exports = factory(require("tether"));' + '} else {' + diff --git a/bower.json b/bower.json index d1ab7cc..d5f179a 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-tether", - "version": "0.1.1", + "version": "0.1.3", "main": "./dist/angular-tether.js", "repository": { "type": "git", @@ -9,7 +9,8 @@ "dependencies": { "angular": "~1.2.18", "tether": "~0.6.5", - "angular-animate": "~1.2.18" + "angular-animate": "~1.2.18", + "angular-ui-ace": "~0.1.1" }, "ignore": [ "node_modules", diff --git a/dist/angular-tether.js b/dist/angular-tether.js index 0490a6c..f280a30 100644 --- a/dist/angular-tether.js +++ b/dist/angular-tether.js @@ -1,4 +1,4 @@ -/*! angular-tether - v0.1.1 - 2014-06-23 */(function (root, factory) {if (typeof define === "function" && define.amd) {define(["angular-tether"], factory);} else if (typeof exports === "object") {module.exports = factory(require("tether"));} else {root.test = factory(root.Tether)};}(this, function(Tether) {angular.module('ngTetherPopover', ['ngTether']).directive('tetherPopover', [ +/*! angular-tether - v0.1.3 - 2014-07-01 */(function (root, factory) {if (typeof define === "function" && define.amd) {define(["tether"], factory);} else if (typeof exports === "object") {module.exports = factory(require("tether"));} else {root.test = factory(root.Tether)};}(this, function(Tether) {angular.module('ngTetherPopover', ['ngTether']).directive('tetherPopover', [ 'Tether', '$parse', 'Utils', @@ -79,16 +79,13 @@ angular.module('ngTether', []).factory('Utils', [ '$compile', function ($compile) { var Utils = {}; - Utils.extendDeep = function (destination, source) { - for (var property in source) { - if (source[property] && source[property].constructor && source[property].constructor === Object) { - destination[property] = destination[property] || {}; - arguments.callee(destination[property], source[property]); - } else { - destination[property] = source[property]; - } - } - return destination; + Utils.extendDeep = function deepExtend(target, source) { + for (var prop in source) + if (prop in target) + angular.extend(target[prop], source[prop]); + else + target[prop] = source[prop]; + return target; }; return Utils; } @@ -170,7 +167,7 @@ angular.module('ngTether', []).factory('Utils', [ if (element) { $timeout(function () { tether.destroy(); - $animate.leave(element); + element && $animate.leave(element); }); } } diff --git a/dist/angular-tether.min.js b/dist/angular-tether.min.js index 0959397..92ddf90 100644 --- a/dist/angular-tether.min.js +++ b/dist/angular-tether.min.js @@ -1 +1 @@ -/*! angular-tether - v0.1.1 - 2014-06-20 */!function(a,b){"function"==typeof define&&define.amd?define(["tether"],b):"object"==typeof exports?module.exports=b(require("tether")):a.test=b(a.jQuery,a.jade,a._)}(this,function(a){angular.module("ngTetherPopover",["ngTether"]).directive("tetherPopover",["Tether","$parse","Utils",function(a,b,c){return{restrict:"A",scope:{tetherPopover:"=",config:"="},link:function(b,d){b.tetherPopover=new a(c.extendDeep({parentScope:b.$parent,leaveOnBlur:!0,tether:{target:d[0],attachment:"top center",targetAttachment:"bottom center",constraints:[{to:"window",attachment:"together"}]}},b.config)),b.$watch("tetherPopover.config.targetAttachment",function(){b.tetherPopover.isActive()&&b.tetherPopover.position()},!0),b.$watch("tetherPopover.config.attachment",function(){b.tetherPopover.isActive()&&b.tetherPopover.position()},!0)}}}]),angular.module("ngTetherTooltip",["ngTether"]).directive("tetherTooltip",["Tether","Utils",function(a,b){return{scope:{content:"@tetherTooltip",config:"=config"},link:function(c,d){var e=new a(b.extendDeep({template:'
{{ content }}
',parentScope:c,tether:{target:d[0],attachment:"top center",targetAttachment:"bottom center",constraints:[{to:"window",attachment:"together",pin:!0}]}},c.config));d.on("mouseenter",function(){e.enter()}),d.on("mouseleave",function(){e.leave()}),c.$on("$destroy",function(){d.unbind("hover"),d.unbind("mouseleave")})}}}]),angular.module("ngTether",[]).factory("Utils",["$compile",function(){var a={};return a.extendDeep=function(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},arguments.callee(a[c],b[c])):a[c]=b[c];return a},a}]).factory("Tether",["$compile","$rootScope","$window","$animate","$controller","$timeout","$q","$http","$templateCache",function(b,c,d,e,f,g,h,i,j){return function(k){"use strict";function l(){v=new a(z({element:A[0]},k.tether))}function m(a,c){if(A=angular.element(a.trim()),t=y.$new(),c&&(t.$locals=c),k.controller)var d=f(w,{$scope:t});x&&(t[x]=d),b(A)(t),t.$on("$destroy",r),g(function(){e.enter(A,B),l(),v.position(),k.leaveOnBlur&&B.on("click",n)})}function n(a){var b=a.target;if(A&&b!==A[0]){for(;null!==b.parentElement;){if(b.parentElement==A[0])return;b=b.parentElement}return B.off("click",n),p()}}function o(a){u.then(function(b){m(b,a)})}function p(){A&&g(function(){v.destroy(),e.leave(A)})}function q(){A&&(e.move(A,B),l())}function r(){s()?e.leave(A,function(){A=null}):A=null}function s(){return v&&v.enabled}if(!(!k.template^!k.templateUrl))throw new Error("Expected one of either `template` or `templateUrl`");k.tether=k.tether||{};var t,u,v,w=k.controller||angular.noop,x=k.controllerAs,y=k.parentScope||c,z=angular.extend,A=null,B=angular.element(d.document.body);if(k.template){var C=h.defer();C.resolve(j.get(k.template)||k.template),u=C.promise}else u=i.get(k.templateUrl,{cache:j}).then(function(a){return a.data});return{enter:o,leave:p,position:q,isActive:s,tether:u,config:k.tether}}}])}); \ No newline at end of file +/*! angular-tether - v0.1.3 - 2014-07-01 */!function(a,b){"function"==typeof define&&define.amd?define(["tether"],b):"object"==typeof exports?module.exports=b(require("tether")):a.test=b(a.Tether)}(this,function(a){angular.module("ngTetherPopover",["ngTether"]).directive("tetherPopover",["Tether","$parse","Utils",function(a,b,c){return{restrict:"A",scope:{tetherPopover:"=",config:"="},link:function(b,d){b.tetherPopover=new a(c.extendDeep({parentScope:b.$parent,leaveOnBlur:!0,tether:{target:d[0],attachment:"top center",targetAttachment:"bottom center",constraints:[{to:"window",attachment:"together"}]}},b.config)),b.$watch("tetherPopover.config.targetAttachment",function(){b.tetherPopover.isActive()&&b.tetherPopover.position()},!0),b.$watch("tetherPopover.config.attachment",function(){b.tetherPopover.isActive()&&b.tetherPopover.position()},!0)}}}]),angular.module("ngTetherTooltip",["ngTether"]).directive("tetherTooltip",["Tether","Utils",function(a,b){return{scope:{content:"@tetherTooltip",config:"=config"},link:function(c,d){var e=new a(b.extendDeep({template:'
{{ content }}
',parentScope:c,tether:{target:d[0],attachment:"top center",targetAttachment:"bottom center",constraints:[{to:"window",attachment:"together",pin:!0}]}},c.config));d.on("mouseenter",function(){e.enter()}),d.on("mouseleave",function(){e.leave()}),c.$on("$destroy",function(){d.unbind("hover"),d.unbind("mouseleave")})}}}]),angular.module("ngTether",[]).factory("Utils",["$compile",function(){var a={};return a.extendDeep=function(a,b){for(var c in b)c in a?angular.extend(a[c],b[c]):a[c]=b[c];return a},a}]).factory("Tether",["$compile","$rootScope","$window","$animate","$controller","$timeout","$q","$http","$templateCache",function(b,c,d,e,f,g,h,i,j){return function(k){"use strict";function l(){v=new a(z({element:A[0]},k.tether))}function m(a,c){if(A=angular.element(a.trim()),t=y.$new(),c&&(t.$locals=c),k.controller)var d=f(w,{$scope:t});x&&(t[x]=d),b(A)(t),t.$on("$destroy",r),g(function(){e.enter(A,B),l(),v.position(),k.leaveOnBlur&&B.on("click",n)})}function n(a){var b=a.target;if(A&&b!==A[0]){for(;null!==b.parentElement;){if(b.parentElement==A[0])return;b=b.parentElement}return B.off("click",n),p()}}function o(a){u.then(function(b){m(b,a)})}function p(){A&&g(function(){v.destroy(),A&&e.leave(A)})}function q(){A&&(e.move(A,B),l())}function r(){s()?e.leave(A,function(){A=null}):A=null}function s(){return v&&v.enabled}if(!(!k.template^!k.templateUrl))throw new Error("Expected one of either `template` or `templateUrl`");k.tether=k.tether||{};var t,u,v,w=k.controller||angular.noop,x=k.controllerAs,y=k.parentScope||c,z=angular.extend,A=null,B=angular.element(d.document.body);if(k.template){var C=h.defer();C.resolve(j.get(k.template)||k.template),u=C.promise}else u=i.get(k.templateUrl,{cache:j}).then(function(a){return a.data});return{enter:o,leave:p,position:q,isActive:s,tether:u,config:k.tether}}}])}); \ No newline at end of file diff --git a/src/angular-tether.js b/src/angular-tether.js index 32b5d58..a6ac2a0 100644 --- a/src/angular-tether.js +++ b/src/angular-tether.js @@ -3,18 +3,13 @@ angular.module('ngTether', []) .factory('Utils', function($compile) { var Utils = {}; - - Utils.extendDeep = function(destination, source) { - for (var property in source) { - if (source[property] && source[property].constructor && - source[property].constructor === Object) { - destination[property] = destination[property] || {}; - arguments.callee(destination[property], source[property]); - } else { - destination[property] = source[property]; - } - } - return destination; + Utils.extendDeep = function deepExtend(target, source) { + for (var prop in source) + if (prop in target) + angular.extend(target[prop], source[prop]); + else + target[prop] = source[prop]; + return target; }; return Utils; @@ -113,7 +108,7 @@ angular.module('ngTether', []) if (element) { $timeout(function(){ tether.destroy(); - $animate.leave(element); + element && $animate.leave(element); }); } }