Skip to content

Commit 9d70022

Browse files
committed
Release 2.0.0-rc1
1 parent 093e796 commit 9d70022

File tree

5 files changed

+24
-248
lines changed

5 files changed

+24
-248
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [2.0.0-rc1] - 2016-09-22
2+
3+
## Breaking changes
4+
- Vue 2.0 now required
5+
- `v-focus-model` and `v-focus-auto` are removed
6+
17
## [1.0.0] - 2016-09-22
28

39
## Changed
@@ -30,3 +36,4 @@ Initial release
3036
[0.1.1]: https://github.com/simplesmiler/vue-focus/compare/0.1.0...0.1.1
3137
[0.1.2]: https://github.com/simplesmiler/vue-focus/compare/0.1.1...0.1.2
3238
[1.0.0]: https://github.com/simplesmiler/vue-focus/compare/0.1.2...1.0.0
39+
[2.0.0-rc1]: https://github.com/simplesmiler/vue-focus/compare/1.0.0...2.0.0-rc1

dist/vue-focus.common.js

Lines changed: 6 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,22 @@
11
'use strict';
22

3-
var Vue = require('vue');
4-
var Vue__default = 'default' in Vue ? Vue['default'] : Vue;
5-
6-
// @NOTE: We have to use Vue.nextTick because the element might not be
7-
// present at the time model changes, but will be in the next batch.
8-
// But because we use Vue.nextTick, the directive may already be unbound
9-
// by the time the callback executes, so we have to make sure it was not.
10-
113
var focus = {
12-
priority: 1000,
13-
14-
bind: function() {
15-
var self = this;
16-
this.bound = true;
17-
18-
this.focus = function() {
19-
if (self.bound === true) {
20-
self.el.focus();
21-
}
22-
};
23-
24-
this.blur = function() {
25-
if (self.bound === true) {
26-
self.el.blur();
27-
}
28-
};
29-
},
30-
31-
update: function(value) {
32-
if (value) {
33-
Vue__default.nextTick(this.focus);
34-
} else {
35-
Vue__default.nextTick(this.blur);
36-
}
4+
inserted: function(el, binding) {
5+
if (binding.value) el.focus();
6+
else el.blur();
377
},
388

39-
unbind: function() {
40-
this.bound = false;
41-
},
42-
};
43-
44-
var focusModel = {
45-
twoWay: true,
46-
priority: 1000,
47-
48-
bind: function() {
49-
Vue.util.warn(
50-
this.name + '="' +
51-
this.expression + '" is deprecated, ' +
52-
'use v-focus="' + this.expression + '" @focus="' + this.expression + ' = true" @blur="' + this.expression + ' = false" instead'
53-
);
54-
55-
var self = this;
56-
this.bound = true;
57-
58-
this.focus = function() {
59-
if (self.bound === true) {
60-
self.el.focus();
61-
}
62-
};
63-
64-
this.blur = function() {
65-
if (self.bound === true) {
66-
self.el.blur();
67-
}
68-
};
69-
70-
this.focusHandler = function() {
71-
self.set(true);
72-
};
73-
74-
this.blurHandler = function() {
75-
self.set(false);
76-
};
77-
78-
Vue.util.on(this.el, 'focus', this.focusHandler);
79-
Vue.util.on(this.el, 'blur', this.blurHandler);
80-
},
81-
82-
update: function(value) {
83-
if (value === true) {
84-
Vue__default.nextTick(this.focus);
85-
} else if (value === false) {
86-
Vue__default.nextTick(this.blur);
87-
} else {
88-
if (process.env.NODE_ENV !== 'production') {
89-
Vue.util.warn(
90-
this.name + '="' +
91-
this.expression + '" expects a boolean value, ' +
92-
'got ' + JSON.stringify(value)
93-
);
94-
}
95-
}
96-
},
97-
98-
unbind: function() {
99-
Vue.util.off(this.el, 'focus', this.focusHandler);
100-
Vue.util.off(this.el, 'blur', this.blurHandler);
101-
this.bound = false;
102-
},
103-
};
104-
105-
var focusAuto = {
106-
priority: 100,
107-
bind: function() {
108-
Vue.util.warn(
109-
this.name + ' is deprecated, ' +
110-
'use v-focus="true" instead'
111-
);
112-
113-
var self = this;
114-
this.bound = true;
115-
116-
Vue__default.nextTick(function() {
117-
if (self.bound === true) {
118-
self.el.focus();
119-
}
120-
});
121-
},
122-
unbind: function(){
123-
this.bound = false;
9+
componentUpdated: function(el, binding) {
10+
if (binding.value) el.focus();
11+
else el.blur();
12412
},
12513
};
12614

12715
var mixin = {
12816
directives: {
12917
focus: focus,
130-
focusModel: focusModel,
131-
focusAuto: focusAuto,
13218
},
13319
};
13420

13521
exports.focus = focus;
136-
exports.focusModel = focusModel;
137-
exports.focusAuto = focusAuto;
13822
exports.mixin = mixin;

dist/vue-focus.js

Lines changed: 8 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,24 @@
1-
(function (exports,Vue) { 'use strict';
2-
3-
var Vue__default = 'default' in Vue ? Vue['default'] : Vue;
4-
5-
// @NOTE: We have to use Vue.nextTick because the element might not be
6-
// present at the time model changes, but will be in the next batch.
7-
// But because we use Vue.nextTick, the directive may already be unbound
8-
// by the time the callback executes, so we have to make sure it was not.
1+
(function (exports) { 'use strict';
92

103
var focus = {
11-
priority: 1000,
12-
13-
bind: function() {
14-
var self = this;
15-
this.bound = true;
16-
17-
this.focus = function() {
18-
if (self.bound === true) {
19-
self.el.focus();
20-
}
21-
};
22-
23-
this.blur = function() {
24-
if (self.bound === true) {
25-
self.el.blur();
26-
}
27-
};
28-
},
29-
30-
update: function(value) {
31-
if (value) {
32-
Vue__default.nextTick(this.focus);
33-
} else {
34-
Vue__default.nextTick(this.blur);
35-
}
4+
inserted: function(el, binding) {
5+
if (binding.value) el.focus();
6+
else el.blur();
367
},
378

38-
unbind: function() {
39-
this.bound = false;
40-
},
41-
};
42-
43-
var focusModel = {
44-
twoWay: true,
45-
priority: 1000,
46-
47-
bind: function() {
48-
Vue.util.warn(
49-
this.name + '="' +
50-
this.expression + '" is deprecated, ' +
51-
'use v-focus="' + this.expression + '" @focus="' + this.expression + ' = true" @blur="' + this.expression + ' = false" instead'
52-
);
53-
54-
var self = this;
55-
this.bound = true;
56-
57-
this.focus = function() {
58-
if (self.bound === true) {
59-
self.el.focus();
60-
}
61-
};
62-
63-
this.blur = function() {
64-
if (self.bound === true) {
65-
self.el.blur();
66-
}
67-
};
68-
69-
this.focusHandler = function() {
70-
self.set(true);
71-
};
72-
73-
this.blurHandler = function() {
74-
self.set(false);
75-
};
76-
77-
Vue.util.on(this.el, 'focus', this.focusHandler);
78-
Vue.util.on(this.el, 'blur', this.blurHandler);
79-
},
80-
81-
update: function(value) {
82-
if (value === true) {
83-
Vue__default.nextTick(this.focus);
84-
} else if (value === false) {
85-
Vue__default.nextTick(this.blur);
86-
} else {
87-
if ('development' !== 'production') {
88-
Vue.util.warn(
89-
this.name + '="' +
90-
this.expression + '" expects a boolean value, ' +
91-
'got ' + JSON.stringify(value)
92-
);
93-
}
94-
}
95-
},
96-
97-
unbind: function() {
98-
Vue.util.off(this.el, 'focus', this.focusHandler);
99-
Vue.util.off(this.el, 'blur', this.blurHandler);
100-
this.bound = false;
101-
},
102-
};
103-
104-
var focusAuto = {
105-
priority: 100,
106-
bind: function() {
107-
Vue.util.warn(
108-
this.name + ' is deprecated, ' +
109-
'use v-focus="true" instead'
110-
);
111-
112-
var self = this;
113-
this.bound = true;
114-
115-
Vue__default.nextTick(function() {
116-
if (self.bound === true) {
117-
self.el.focus();
118-
}
119-
});
120-
},
121-
unbind: function(){
122-
this.bound = false;
9+
componentUpdated: function(el, binding) {
10+
if (binding.value) el.focus();
11+
else el.blur();
12312
},
12413
};
12514

12615
var mixin = {
12716
directives: {
12817
focus: focus,
129-
focusModel: focusModel,
130-
focusAuto: focusAuto,
13118
},
13219
};
13320

13421
exports.focus = focus;
135-
exports.focusModel = focusModel;
136-
exports.focusAuto = focusAuto;
13722
exports.mixin = mixin;
13823

139-
})((this.VueFocus = {}),Vue);
24+
})((this.VueFocus = {}));

dist/vue-focus.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-focus",
33
"description": "A set of reusable focus directives for reusable Vue.js components",
4-
"version": "1.0.0",
4+
"version": "2.0.0-rc1",
55
"author": "Denis Karabaza <[email protected]>",
66
"browserify": {
77
"transform": [
@@ -36,7 +36,7 @@
3636
"license": "MIT",
3737
"main": "dist/vue-focus.common.js",
3838
"peerDependencies": {
39-
"vue": "^1.0.0"
39+
"vue": "^2.0.0"
4040
},
4141
"repository": {
4242
"type": "git",

0 commit comments

Comments
 (0)