Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,6 @@ | ||
## [2.1.0] - 2016-10-20 | ||
## Added | ||
- `.lazy` modifier to mimic v1 behavior | ||
## [2.0.0] - 2016-10-20 | ||
@@ -51,1 +56,2 @@ | ||
[2.0.0]: https://github.com/simplesmiler/vue-focus/compare/2.0.0-rc2...2.0.0 | ||
[2.1.0]: https://github.com/simplesmiler/vue-focus/compare/2.0.0...2.1.0 |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var version = '2.0.0'; | ||
var version = '2.1.0'; | ||
@@ -21,2 +21,8 @@ var compatible = (/^2\./).test(Vue.version); | ||
componentUpdated: function(el, binding) { | ||
if (binding.modifiers.lazy) { | ||
if (Boolean(binding.value) === Boolean(binding.oldValue)) { | ||
return; | ||
} | ||
} | ||
if (binding.value) el.focus(); | ||
@@ -23,0 +29,0 @@ else el.blur(); |
@@ -5,3 +5,3 @@ (function (exports,Vue) { 'use strict'; | ||
var version = '2.0.0'; | ||
var version = '2.1.0'; | ||
@@ -20,2 +20,8 @@ var compatible = (/^2\./).test(Vue.version); | ||
componentUpdated: function(el, binding) { | ||
if (binding.modifiers.lazy) { | ||
if (Boolean(binding.value) === Boolean(binding.oldValue)) { | ||
return; | ||
} | ||
} | ||
if (binding.value) el.focus(); | ||
@@ -22,0 +28,0 @@ else el.blur(); |
@@ -1,1 +0,1 @@ | ||
!function(u,e){"use strict";e="default"in e?e.default:e;var o="2.0.0",s=/^2\./.test(e.version);s||e.util.warn("VueFocus "+o+" only supports Vue 2.x, and does not support Vue "+e.version);var n={inserted:function(u,e){e.value?u.focus():u.blur()},componentUpdated:function(u,e){e.value?u.focus():u.blur()}},t={directives:{focus:n}};u.version=o,u.focus=n,u.mixin=t}(this.VueFocus={},Vue); | ||
!function(e,u){"use strict";u="default"in u?u.default:u;var o="2.1.0",n=/^2\./.test(u.version);n||u.util.warn("VueFocus "+o+" only supports Vue 2.x, and does not support Vue "+u.version);var s={inserted:function(e,u){u.value?e.focus():e.blur()},componentUpdated:function(e,u){u.modifiers.lazy&&Boolean(u.value)===Boolean(u.oldValue)||(u.value?e.focus():e.blur())}},t={directives:{focus:s}};e.version=o,e.focus=s,e.mixin=t}(this.VueFocus={},Vue); |
import Vue from 'vue'; | ||
export var version = '2.0.0'; | ||
export var version = '2.1.0'; | ||
@@ -17,2 +17,8 @@ var compatible = (/^2\./).test(Vue.version); | ||
componentUpdated: function(el, binding) { | ||
if (binding.modifiers.lazy) { | ||
if (Boolean(binding.value) === Boolean(binding.oldValue)) { | ||
return; | ||
} | ||
} | ||
if (binding.value) el.focus(); | ||
@@ -19,0 +25,0 @@ else el.blur(); |
{ | ||
"name": "vue-focus", | ||
"description": "A set of reusable focus directives for reusable Vue.js components", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Denis Karabaza <denis.karabaza@gmail.com>", | ||
@@ -6,0 +6,0 @@ "browserify": { |
@@ -26,2 +26,4 @@ # vue-focus | ||
If you need a version for Vue 1, try `vue-focus@1.0`. | ||
## Install | ||
@@ -38,5 +40,5 @@ | ||
``` html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.0.0/vue-focus.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.1.0/vue-focus.js"></script> | ||
<!-- OR --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.0.0/vue-focus.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.1.0/vue-focus.min.js"></script> | ||
``` | ||
@@ -48,3 +50,3 @@ | ||
A directive that binds focus to the expression in a one-way manner, so that the element recieves focus when the expression becomes `truthy` and loses focus when the expression becomes `falsy`. | ||
A directive that binds focus to the expression in a one-way manner, so that the element receives focus when the expression is `truthy` and loses focus when the expression is `falsy`. | ||
@@ -65,2 +67,4 @@ ``` js | ||
> NOTE: As opposed to 1.x, in Vue 2.0, directives are updated every time the host component rerenders, not just when the directive expression chages. Somethimes this may be undesirable, especially for the "autofocus" use case. If you want to mimic the 1.x behavior, then add the `.lazy` modifier to the directive, e.g. `v-focus.lazy="true"`. | ||
### `mixin` | ||
@@ -90,3 +94,3 @@ | ||
Form elements are not the only elements that are able to receive focus. The list also includes links, element with `tabindex` attribute set and elements with `contentEditable` set to `true`. | ||
Form elements are not the only elements that are able to receive focus. The list also includes links, elements with `tabindex` attribute set and elements with `contentEditable` set to `true`. | ||
@@ -93,0 +97,0 @@ ## License |
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
9016
86
95