Skip to content

Commit

Permalink
release: 2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
linx4200 committed Jul 20, 2017
1 parent 5c752ab commit e6ed418
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 46 deletions.
111 changes: 70 additions & 41 deletions dist/vue-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ return /******/ (function(modules) { // webpackBootstrap
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var VueColor = {
version: '2.2.1',
version: '2.2.2',
Compact: _Compact2.default,
Material: _Material2.default,
Slider: _Slider2.default,
Expand Down Expand Up @@ -600,6 +600,16 @@ return /******/ (function(modules) { // webpackBootstrap
hsv.h = hsl.h = data.h || data.hsl && data.hsl.h || oldHue || 0;
}

if (hsv.v < 0.0164) {
hsv.h = data.h || data.hsv && data.hsv.h || 0;
hsv.s = data.s || data.hsv && data.hsv.s || 0;
}

if (hsl.l < 0.01) {
hsl.h = data.h || data.hsl && data.hsl.h || 0;
hsl.s = data.s || data.hsl && data.hsl.s || 0;
}

return {
hsl: hsl,
hex: color.toHexString().toUpperCase(),
Expand Down Expand Up @@ -714,7 +724,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this._r < 1) { this._r = mathRound(this._r); }
if (this._g < 1) { this._g = mathRound(this._g); }
if (this._b < 1) { this._b = mathRound(this._b); }

// console.log('====this===', this)
this._ok = rgb.ok;
this._tc_id = tinyCounter++;
}
Expand Down Expand Up @@ -987,6 +997,8 @@ return /******/ (function(modules) { // webpackBootstrap
color = stringInputToObject(color);
}

// console.log('==color===', color)

if (typeof color == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
Expand Down Expand Up @@ -1115,12 +1127,19 @@ return /******/ (function(modules) { // webpackBootstrap
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
// *Returns:* { h, s, v } in [0,1]
function rgbToHsv(r, g, b) {
// console.log('==rgbToHsv=1111==', r, g, b)

r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);


// console.log('==rgbToHsv=2222=', r, g, b)

var max = mathMax(r, g, b), min = mathMin(r, g, b);

// console.log('===max===', max)

var h, s, v = max;

var d = max - min;
Expand All @@ -1132,11 +1151,15 @@ return /******/ (function(modules) { // webpackBootstrap
else {
switch(max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case g:
h = (b - r) / d + 2;
// console.log('=====4=====', h);
break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
// console.log('===h====', h)
return { h: h, s: s, v: v };
}

Expand All @@ -1150,6 +1173,8 @@ return /******/ (function(modules) { // webpackBootstrap
s = bound01(s, 100);
v = bound01(v, 100);

// console.log('===3====', h, s, v)

var i = Math.floor(h),
f = h - i,
p = v * (1 - s),
Expand Down Expand Up @@ -1901,9 +1926,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-10", __vue_options__)
hotAPI.createRecord("data-v-9", __vue_options__)
} else {
hotAPI.reload("data-v-10", __vue_options__)
hotAPI.reload("data-v-9", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] EditableInput.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -1927,8 +1952,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-10!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./EditableInput.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-10!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./EditableInput.vue");
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-9!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./EditableInput.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-9!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./EditableInput.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -2067,7 +2092,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-10", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-9", module.exports)
}
}

Expand Down Expand Up @@ -2508,9 +2533,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-11", __vue_options__)
hotAPI.createRecord("data-v-12", __vue_options__)
} else {
hotAPI.reload("data-v-11", __vue_options__)
hotAPI.reload("data-v-12", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] Hue.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -2534,8 +2559,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-11!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Hue.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-11!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Hue.vue");
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-12!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Hue.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-12!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Hue.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -2579,12 +2604,18 @@ return /******/ (function(modules) { // webpackBootstrap
},
data: function data() {
return {
oldHue: ''
oldHue: 0,
pullDirection: ''
};
},

computed: {
colors: function colors() {
var h = this.value.hsl.h;
if (h !== 0 && h - this.oldHue > 0) this.pullDirection = 'right';
if (h !== 0 && h - this.oldHue < 0) this.pullDirection = 'left';
this.oldHue = h;

return this.value;
},
directionClass: function directionClass() {
Expand All @@ -2595,7 +2626,7 @@ return /******/ (function(modules) { // webpackBootstrap
},
pointerTop: function pointerTop() {
if (this.direction === 'vertical') {
if (this.colors.hsl.h === 0 && this.oldHue === 360) return 0;
if (this.colors.hsl.h === 0 && this.pullDirection === 'right') return 0;
return -(this.colors.hsl.h * 100 / 360) + 100 + '%';
} else {
return 0;
Expand All @@ -2605,7 +2636,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.direction === 'vertical') {
return 0;
} else {
if (this.colors.hsl.h === 0 && this.oldHue === 360) return '100%';
if (this.colors.hsl.h === 0 && this.pullDirection === 'right') return '100%';
return this.colors.hsl.h * 100 / 360 + '%';
}
}
Expand Down Expand Up @@ -2639,7 +2670,6 @@ return /******/ (function(modules) { // webpackBootstrap
}

if (this.colors.hsl.h !== h) {
this.oldHue = h;
this.$emit('change', {
h: h,
s: this.colors.hsl.s,
Expand All @@ -2659,7 +2689,6 @@ return /******/ (function(modules) { // webpackBootstrap
}

if (this.colors.hsl.h !== h) {
this.oldHue = h;
this.$emit('change', {
h: h,
s: this.colors.hsl.s,
Expand Down Expand Up @@ -2713,7 +2742,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-11", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-12", module.exports)
}
}

Expand Down Expand Up @@ -3198,9 +3227,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-12", __vue_options__)
hotAPI.createRecord("data-v-11", __vue_options__)
} else {
hotAPI.reload("data-v-12", __vue_options__)
hotAPI.reload("data-v-11", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] Saturation.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -3224,8 +3253,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-12!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Saturation.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-12!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Saturation.vue");
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-11!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Saturation.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-11!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Saturation.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -3274,7 +3303,7 @@ return /******/ (function(modules) { // webpackBootstrap
return this.value;
},
bgColor: function bgColor() {
return 'hsl(' + this.colors.hsl.h + ', 100%, 50%)';
return 'hsl(' + this.colors.hsv.h + ', 100%, 50%)';
},
pointerTop: function pointerTop() {
return -(this.colors.hsv.v * 100) + 1 + 100 + '%';
Expand Down Expand Up @@ -3320,10 +3349,10 @@ return /******/ (function(modules) { // webpackBootstrap
bright = bright > 1 ? 1 : bright;

this.throttle(this.onChange, {
h: this.colors.hsl.h,
h: this.colors.hsv.h,
s: saturation,
v: bright,
a: this.colors.hsl.a,
a: this.colors.hsv.a,
source: 'hsva'
});
},
Expand Down Expand Up @@ -3823,7 +3852,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-12", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-11", module.exports)
}
}

Expand Down Expand Up @@ -4026,9 +4055,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-9", __vue_options__)
hotAPI.createRecord("data-v-10", __vue_options__)
} else {
hotAPI.reload("data-v-9", __vue_options__)
hotAPI.reload("data-v-10", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] Checkboard.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -4052,8 +4081,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-9!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Checkboard.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-9!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Checkboard.vue");
module.hot.accept("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-10!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Checkboard.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js!../../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-10!../../../node_modules/stylus-loader/index.js!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Checkboard.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -4160,7 +4189,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-9", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-10", module.exports)
}
}

Expand Down Expand Up @@ -4429,9 +4458,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-7", __vue_options__)
hotAPI.createRecord("data-v-6", __vue_options__)
} else {
hotAPI.reload("data-v-7", __vue_options__)
hotAPI.reload("data-v-6", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] Sketch.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -4455,8 +4484,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Sketch.vue", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Sketch.vue");
module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-6!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Sketch.vue", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-6!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Sketch.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -4726,7 +4755,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-7", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-6", module.exports)
}
}

Expand Down Expand Up @@ -4765,9 +4794,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-6", __vue_options__)
hotAPI.createRecord("data-v-7", __vue_options__)
} else {
hotAPI.reload("data-v-6", __vue_options__)
hotAPI.reload("data-v-7", __vue_options__)
}
})()}
if (__vue_options__.functional) {console.error("[vue-loader] Chrome.vue: functional components are not supported and should be defined in plain js files using render functions.")}
Expand All @@ -4791,8 +4820,8 @@ return /******/ (function(modules) { // webpackBootstrap
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-6!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Chrome.vue", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-6!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Chrome.vue");
module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Chrome.vue", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7!../../node_modules/stylus-loader/index.js!../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Chrome.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
Expand Down Expand Up @@ -5187,7 +5216,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-6", module.exports)
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-7", module.exports)
}
}

Expand Down
6 changes: 3 additions & 3 deletions dist/vue-color.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-color",
"version": "2.2.1",
"version": "2.2.2",
"description": "Color of Vue Components",
"keywords": [
"color",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Saturation from './components/common/Saturation.vue'
import ColorMixin from './mixin/color.js'

const VueColor = {
version: '2.2.1',
version: '2.2.2',
Compact,
Material,
Slider,
Expand Down

0 comments on commit e6ed418

Please sign in to comment.