Skip to content

Commit 772c6ec

Browse files
committed
Bumping to v3.4.6
1 parent aa8f553 commit 772c6ec

12 files changed

+166
-29
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
dist
12
**/*{.,-}min.js

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This is a summary of the changes. For a full list of changes see https://github.com/ruhley/angular-color-picker/releases.
44

5+
## v3.4.6
6+
7+
#### Breaking Changes
8+
* None
9+
10+
#### New Features
11+
* None
12+
13+
#### Bug Fixes
14+
* Bug #170 - Internal model not updating when changed programmatically
15+
516
## v3.4.5
617

718
#### Breaking Changes

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-color-picker",
33
"description": "Color Picker Directive For AngularJS",
4-
"version": "3.4.5",
4+
"version": "3.4.6",
55
"homepage": "https://github.com/ruhley/angular-color-picker",
66
"repository": {
77
"type": "git",

dist/angularjs-color-picker.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v3.4.5
2+
* angularjs-color-picker v3.4.6
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2017 ruhley
66
*
7-
* 2017-09-19 08:53:33
7+
* 2017-09-22 11:38:16
88
*
99
*/
1010
.color-picker-wrapper {

dist/angularjs-color-picker.js

Lines changed: 128 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v3.4.5
2+
* angularjs-color-picker v3.4.6
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2017 ruhley
66
*
7-
* 2017-09-19 08:53:31
7+
* 2017-09-22 11:38:10
88
*
99
*/
1010

@@ -26,7 +26,118 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2626

2727

2828

29+
var asyncGenerator = function () {
30+
function AwaitValue(value) {
31+
this.value = value;
32+
}
33+
34+
function AsyncGenerator(gen) {
35+
var front, back;
36+
37+
function send(key, arg) {
38+
return new Promise(function (resolve, reject) {
39+
var request = {
40+
key: key,
41+
arg: arg,
42+
resolve: resolve,
43+
reject: reject,
44+
next: null
45+
};
46+
47+
if (back) {
48+
back = back.next = request;
49+
} else {
50+
front = back = request;
51+
resume(key, arg);
52+
}
53+
});
54+
}
55+
56+
function resume(key, arg) {
57+
try {
58+
var result = gen[key](arg);
59+
var value = result.value;
60+
61+
if (value instanceof AwaitValue) {
62+
Promise.resolve(value.value).then(function (arg) {
63+
resume("next", arg);
64+
}, function (arg) {
65+
resume("throw", arg);
66+
});
67+
} else {
68+
settle(result.done ? "return" : "normal", result.value);
69+
}
70+
} catch (err) {
71+
settle("throw", err);
72+
}
73+
}
74+
75+
function settle(type, value) {
76+
switch (type) {
77+
case "return":
78+
front.resolve({
79+
value: value,
80+
done: true
81+
});
82+
break;
83+
84+
case "throw":
85+
front.reject(value);
86+
break;
87+
88+
default:
89+
front.resolve({
90+
value: value,
91+
done: false
92+
});
93+
break;
94+
}
95+
96+
front = front.next;
97+
98+
if (front) {
99+
resume(front.key, front.arg);
100+
} else {
101+
back = null;
102+
}
103+
}
104+
105+
this._invoke = send;
106+
107+
if (typeof gen.return !== "function") {
108+
this.return = undefined;
109+
}
110+
}
111+
112+
if (typeof Symbol === "function" && Symbol.asyncIterator) {
113+
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
114+
return this;
115+
};
116+
}
117+
118+
AsyncGenerator.prototype.next = function (arg) {
119+
return this._invoke("next", arg);
120+
};
121+
122+
AsyncGenerator.prototype.throw = function (arg) {
123+
return this._invoke("throw", arg);
124+
};
125+
126+
AsyncGenerator.prototype.return = function (arg) {
127+
return this._invoke("return", arg);
128+
};
29129

130+
return {
131+
wrap: function (fn) {
132+
return function () {
133+
return new AsyncGenerator(fn.apply(this, arguments));
134+
};
135+
},
136+
await: function (value) {
137+
return new AwaitValue(value);
138+
}
139+
};
140+
}();
30141

31142

32143

@@ -94,8 +205,6 @@ var AngularColorPickerController = function () {
94205
this.ngModelOptions = this.$scope.control[0].$options.$$options;
95206
}
96207

97-
this.internalNgModel = this.ngModelOptions.getterSetter ? this.ngModel() : this.ngModel;
98-
99208
// browser variables
100209
this.chrome = Boolean(window.chrome);
101210
var _android_version = window.navigator.userAgent.match(/Android\s([0-9\.]*)/i);
@@ -163,7 +272,7 @@ var AngularColorPickerController = function () {
163272

164273
// ngModel
165274

166-
this.$scope.$watch('AngularColorPickerController.internalNgModel', this.watchNgModel.bind(this));
275+
this.$scope.$watch('AngularColorPickerController.internalNgModel', this.watchInternalNgModel.bind(this));
167276
this.$scope.$watch('AngularColorPickerController.ngModel', this.watchNgModel.bind(this));
168277

169278
// options
@@ -215,6 +324,17 @@ var AngularColorPickerController = function () {
215324
_this.valueUpdate('opacity');
216325
});
217326
}
327+
}, {
328+
key: 'watchInternalNgModel',
329+
value: function watchInternalNgModel(newValue, oldValue) {
330+
// the mouse is still moving so don't do anything yet
331+
if (this.colorMouse) {
332+
return;
333+
}
334+
335+
// calculate and set color values
336+
this.watchNgModelSet(newValue);
337+
}
218338

219339
/** Triggered on change to internal or external ngModel value */
220340

@@ -229,6 +349,9 @@ var AngularColorPickerController = function () {
229349
// sets the field to pristine or dirty for angular
230350
this.checkDirty(newValue);
231351

352+
// update the internal model from external model
353+
this.internalNgModel = this.ngModelOptions.getterSetter ? this.ngModel() : this.ngModel;
354+
232355
// the mouse is still moving so don't do anything yet
233356
if (this.colorMouse) {
234357
return;
@@ -974,7 +1097,6 @@ var AngularColorPickerController = function () {
9741097
var isValid = color.isValid();
9751098

9761099
if (isValid && this.options.restrictToFormat) {
977-
var format = this.options.format;
9781100
isValid = color.getFormat() === this.getTinyColorFormat();
9791101
}
9801102

dist/angularjs-color-picker.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angularjs-color-picker.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/themes/angularjs-color-picker-bootstrap.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v3.4.5
2+
* angularjs-color-picker v3.4.6
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2017 ruhley
66
*
7-
* 2017-09-19 08:53:33
7+
* 2017-09-22 11:38:16
88
*
99
*/
1010
.color-picker-wrapper .color-picker-input-wrapper {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* angularjs-color-picker v3.4.5
2+
* angularjs-color-picker v3.4.6
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2017 ruhley
66
*
7-
* 2017-09-19 08:53:33
7+
* 2017-09-22 11:38:16
88
*
99
*/.color-picker-wrapper .color-picker-input-wrapper{width:100%}.color-picker-wrapper .color-picker-swatch:not(.input-group-addon){height:28px}.color-picker-wrapper.color-picker-swatch-only .input-group .input-group-addon{border-radius:4px}

grunt/options/rollup.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var today = moment();
99

1010
module.exports = {
1111
options: {
12-
entry: 'src/scripts/module.js',
12+
input: 'src/scripts/module.js',
1313
plugins: [
1414
babel({
1515
exclude: 'node_modules/**',
@@ -18,7 +18,7 @@ module.exports = {
1818
]
1919
},
2020
options_min: {
21-
entry: 'src/scripts/module.js',
21+
input: 'src/scripts/module.js',
2222
plugins: [
2323
babel({
2424
exclude: 'node_modules/**',
@@ -39,11 +39,14 @@ module.exports = {
3939
]
4040
},
4141
writeOptions: {
42-
dest: 'dist/angularjs-color-picker.js',
42+
file: 'dist/angularjs-color-picker.js',
4343
format: 'umd',
44-
moduleName: 'AngularjsColorPicker',
45-
sourceMap: false,
46-
banner: '/*!\n * ' + pjson.name + ' v' + pjson.version + '\n * https://github.com/ruhley/angular-color-picker/\n *\n * Copyright ' + today.format('YYYY') + ' ruhley\n *\n * ' + today.format('YYYY-MM-DD HH:mm:ss') + '\n *\n */\n'
44+
name: 'AngularjsColorPicker',
45+
sourcemap: false,
46+
banner: '/*!\n * ' + pjson.name + ' v' + pjson.version + '\n * https://github.com/ruhley/angular-color-picker/\n *\n * Copyright ' + today.format('YYYY') + ' ruhley\n *\n * ' + today.format('YYYY-MM-DD HH:mm:ss') + '\n *\n */\n',
47+
globals: {
48+
tinycolor2: 'tinycolor',
49+
},
4750
},
4851
writeFile: function(writer, writeOptions) {
4952
try {

0 commit comments

Comments
 (0)