├── .editorconfig ├── .gitignore ├── .npmignore ├── .postcssrc ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── demo.js ├── dist ├── demo.js ├── demo.js.map ├── index.css ├── index.esm.js ├── index.esm.js.map ├── index.js └── index.js.map ├── index.html ├── package-lock.json ├── package.json ├── rollup.config.js └── src ├── color-picker.css ├── color-picker.vue └── index.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | # Use 4 spaces for the Python files 13 | [*.py] 14 | indent_size = 4 15 | max_line_length = 80 16 | 17 | # The JSON files contain newlines inconsistently 18 | [*.json] 19 | insert_final_newline = ignore 20 | 21 | # Minified JavaScript files shouldn't be changed 22 | [**.min.js] 23 | indent_style = ignore 24 | insert_final_newline = ignore 25 | 26 | # Makefiles always use tabs for indentation 27 | [Makefile] 28 | indent_style = tab 29 | 30 | # Batch files use tabs for indentation 31 | [*.bat] 32 | indent_style = tab 33 | 34 | [*.md] 35 | trim_trailing_whitespace = false 36 | 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | .DS_Store -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | dist/demo.js 3 | dist/demo.js.map 4 | .gitignore 5 | .npmignore 6 | index.html 7 | rollup.config.js 8 | yarn.lock 9 | -------------------------------------------------------------------------------- /.postcssrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": { 3 | "postcss-cssnext" : true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 2, 3 | "eslint.enable": true 4 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 wemlion 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # v-color 2 | 3 | Chrome-flavored color picker in Vue.js 4 | 5 | ## Install 6 | 7 | ``` 8 | yarn add v-color 9 | 10 | # or 11 | npm install --save v-color 12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /demo.js: -------------------------------------------------------------------------------- 1 | import ColorPicker from './src/index' 2 | window.Vue.use(ColorPicker) 3 | 4 | window.vm = new window.Vue({ 5 | el: '#app', 6 | template: ` 7 | `, 8 | data () { 9 | return { 10 | color: '#f0f' 11 | } 12 | }, 13 | methods: { 14 | onChange (e) { 15 | console.log(e) 16 | } 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /dist/demo.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (factory()); 5 | }(this, (function () { 'use strict'; 6 | 7 | /** 8 | * The base implementation of `_.clamp` which doesn't coerce arguments. 9 | * 10 | * @private 11 | * @param {number} number The number to clamp. 12 | * @param {number} [lower] The lower bound. 13 | * @param {number} upper The upper bound. 14 | * @returns {number} Returns the clamped number. 15 | */ 16 | function baseClamp(number, lower, upper) { 17 | if (number === number) { 18 | if (upper !== undefined) { 19 | number = number <= upper ? number : upper; 20 | } 21 | if (lower !== undefined) { 22 | number = number >= lower ? number : lower; 23 | } 24 | } 25 | return number; 26 | } 27 | 28 | var _baseClamp = baseClamp; 29 | 30 | /** 31 | * Checks if `value` is the 32 | * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 33 | * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 34 | * 35 | * @static 36 | * @memberOf _ 37 | * @since 0.1.0 38 | * @category Lang 39 | * @param {*} value The value to check. 40 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. 41 | * @example 42 | * 43 | * _.isObject({}); 44 | * // => true 45 | * 46 | * _.isObject([1, 2, 3]); 47 | * // => true 48 | * 49 | * _.isObject(_.noop); 50 | * // => true 51 | * 52 | * _.isObject(null); 53 | * // => false 54 | */ 55 | function isObject(value) { 56 | var type = typeof value; 57 | return value != null && (type == 'object' || type == 'function'); 58 | } 59 | 60 | var isObject_1 = isObject; 61 | 62 | var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 63 | 64 | function createCommonjsModule(fn, module) { 65 | return module = { exports: {} }, fn(module, module.exports), module.exports; 66 | } 67 | 68 | /** Detect free variable `global` from Node.js. */ 69 | var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; 70 | 71 | var _freeGlobal = freeGlobal; 72 | 73 | var freeGlobal$1 = _freeGlobal; 74 | 75 | /** Detect free variable `self`. */ 76 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 77 | 78 | /** Used as a reference to the global object. */ 79 | var root = freeGlobal$1 || freeSelf || Function('return this')(); 80 | 81 | var _root = root; 82 | 83 | var root$1 = _root; 84 | 85 | /** Built-in value references. */ 86 | var Symbol = root$1.Symbol; 87 | 88 | var _Symbol = Symbol; 89 | 90 | var Symbol$1 = _Symbol; 91 | 92 | /** Used for built-in method references. */ 93 | var objectProto = Object.prototype; 94 | 95 | /** Used to check objects for own properties. */ 96 | var hasOwnProperty = objectProto.hasOwnProperty; 97 | 98 | /** 99 | * Used to resolve the 100 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 101 | * of values. 102 | */ 103 | var nativeObjectToString = objectProto.toString; 104 | 105 | /** Built-in value references. */ 106 | var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; 107 | 108 | /** 109 | * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 110 | * 111 | * @private 112 | * @param {*} value The value to query. 113 | * @returns {string} Returns the raw `toStringTag`. 114 | */ 115 | function getRawTag(value) { 116 | var isOwn = hasOwnProperty.call(value, symToStringTag), 117 | tag = value[symToStringTag]; 118 | 119 | try { 120 | value[symToStringTag] = undefined; 121 | } catch (e) {} 122 | 123 | var result = nativeObjectToString.call(value); 124 | { 125 | if (isOwn) { 126 | value[symToStringTag] = tag; 127 | } else { 128 | delete value[symToStringTag]; 129 | } 130 | } 131 | return result; 132 | } 133 | 134 | var _getRawTag = getRawTag; 135 | 136 | /** Used for built-in method references. */ 137 | var objectProto$1 = Object.prototype; 138 | 139 | /** 140 | * Used to resolve the 141 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 142 | * of values. 143 | */ 144 | var nativeObjectToString$1 = objectProto$1.toString; 145 | 146 | /** 147 | * Converts `value` to a string using `Object.prototype.toString`. 148 | * 149 | * @private 150 | * @param {*} value The value to convert. 151 | * @returns {string} Returns the converted string. 152 | */ 153 | function objectToString(value) { 154 | return nativeObjectToString$1.call(value); 155 | } 156 | 157 | var _objectToString = objectToString; 158 | 159 | var Symbol$2 = _Symbol, 160 | getRawTag$1 = _getRawTag, 161 | objectToString$1 = _objectToString; 162 | 163 | /** `Object#toString` result references. */ 164 | var nullTag = '[object Null]', 165 | undefinedTag = '[object Undefined]'; 166 | 167 | /** Built-in value references. */ 168 | var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined; 169 | 170 | /** 171 | * The base implementation of `getTag` without fallbacks for buggy environments. 172 | * 173 | * @private 174 | * @param {*} value The value to query. 175 | * @returns {string} Returns the `toStringTag`. 176 | */ 177 | function baseGetTag(value) { 178 | if (value == null) { 179 | return value === undefined ? undefinedTag : nullTag; 180 | } 181 | return (symToStringTag$1 && symToStringTag$1 in Object(value)) 182 | ? getRawTag$1(value) 183 | : objectToString$1(value); 184 | } 185 | 186 | var _baseGetTag = baseGetTag; 187 | 188 | /** 189 | * Checks if `value` is object-like. A value is object-like if it's not `null` 190 | * and has a `typeof` result of "object". 191 | * 192 | * @static 193 | * @memberOf _ 194 | * @since 4.0.0 195 | * @category Lang 196 | * @param {*} value The value to check. 197 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 198 | * @example 199 | * 200 | * _.isObjectLike({}); 201 | * // => true 202 | * 203 | * _.isObjectLike([1, 2, 3]); 204 | * // => true 205 | * 206 | * _.isObjectLike(_.noop); 207 | * // => false 208 | * 209 | * _.isObjectLike(null); 210 | * // => false 211 | */ 212 | function isObjectLike(value) { 213 | return value != null && typeof value == 'object'; 214 | } 215 | 216 | var isObjectLike_1 = isObjectLike; 217 | 218 | var baseGetTag$1 = _baseGetTag, 219 | isObjectLike$1 = isObjectLike_1; 220 | 221 | /** `Object#toString` result references. */ 222 | var symbolTag = '[object Symbol]'; 223 | 224 | /** 225 | * Checks if `value` is classified as a `Symbol` primitive or object. 226 | * 227 | * @static 228 | * @memberOf _ 229 | * @since 4.0.0 230 | * @category Lang 231 | * @param {*} value The value to check. 232 | * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 233 | * @example 234 | * 235 | * _.isSymbol(Symbol.iterator); 236 | * // => true 237 | * 238 | * _.isSymbol('abc'); 239 | * // => false 240 | */ 241 | function isSymbol(value) { 242 | return typeof value == 'symbol' || 243 | (isObjectLike$1(value) && baseGetTag$1(value) == symbolTag); 244 | } 245 | 246 | var isSymbol_1 = isSymbol; 247 | 248 | var isObject$1 = isObject_1, 249 | isSymbol$1 = isSymbol_1; 250 | 251 | /** Used as references for various `Number` constants. */ 252 | var NAN = 0 / 0; 253 | 254 | /** Used to match leading and trailing whitespace. */ 255 | var reTrim = /^\s+|\s+$/g; 256 | 257 | /** Used to detect bad signed hexadecimal string values. */ 258 | var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 259 | 260 | /** Used to detect binary string values. */ 261 | var reIsBinary = /^0b[01]+$/i; 262 | 263 | /** Used to detect octal string values. */ 264 | var reIsOctal = /^0o[0-7]+$/i; 265 | 266 | /** Built-in method references without a dependency on `root`. */ 267 | var freeParseInt = parseInt; 268 | 269 | /** 270 | * Converts `value` to a number. 271 | * 272 | * @static 273 | * @memberOf _ 274 | * @since 4.0.0 275 | * @category Lang 276 | * @param {*} value The value to process. 277 | * @returns {number} Returns the number. 278 | * @example 279 | * 280 | * _.toNumber(3.2); 281 | * // => 3.2 282 | * 283 | * _.toNumber(Number.MIN_VALUE); 284 | * // => 5e-324 285 | * 286 | * _.toNumber(Infinity); 287 | * // => Infinity 288 | * 289 | * _.toNumber('3.2'); 290 | * // => 3.2 291 | */ 292 | function toNumber(value) { 293 | if (typeof value == 'number') { 294 | return value; 295 | } 296 | if (isSymbol$1(value)) { 297 | return NAN; 298 | } 299 | if (isObject$1(value)) { 300 | var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 301 | value = isObject$1(other) ? (other + '') : other; 302 | } 303 | if (typeof value != 'string') { 304 | return value === 0 ? value : +value; 305 | } 306 | value = value.replace(reTrim, ''); 307 | var isBinary = reIsBinary.test(value); 308 | return (isBinary || reIsOctal.test(value)) 309 | ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 310 | : (reIsBadHex.test(value) ? NAN : +value); 311 | } 312 | 313 | var toNumber_1 = toNumber; 314 | 315 | var baseClamp$1 = _baseClamp, 316 | toNumber$1 = toNumber_1; 317 | 318 | /** 319 | * Clamps `number` within the inclusive `lower` and `upper` bounds. 320 | * 321 | * @static 322 | * @memberOf _ 323 | * @since 4.0.0 324 | * @category Number 325 | * @param {number} number The number to clamp. 326 | * @param {number} [lower] The lower bound. 327 | * @param {number} upper The upper bound. 328 | * @returns {number} Returns the clamped number. 329 | * @example 330 | * 331 | * _.clamp(-10, -5, 5); 332 | * // => -5 333 | * 334 | * _.clamp(10, -5, 5); 335 | * // => 5 336 | */ 337 | function clamp(number, lower, upper) { 338 | if (upper === undefined) { 339 | upper = lower; 340 | lower = undefined; 341 | } 342 | if (upper !== undefined) { 343 | upper = toNumber$1(upper); 344 | upper = upper === upper ? upper : 0; 345 | } 346 | if (lower !== undefined) { 347 | lower = toNumber$1(lower); 348 | lower = lower === lower ? lower : 0; 349 | } 350 | return baseClamp$1(toNumber$1(number), lower, upper); 351 | } 352 | 353 | var clamp_1 = clamp; 354 | 355 | var root$2 = _root; 356 | 357 | /** 358 | * Gets the timestamp of the number of milliseconds that have elapsed since 359 | * the Unix epoch (1 January 1970 00:00:00 UTC). 360 | * 361 | * @static 362 | * @memberOf _ 363 | * @since 2.4.0 364 | * @category Date 365 | * @returns {number} Returns the timestamp. 366 | * @example 367 | * 368 | * _.defer(function(stamp) { 369 | * console.log(_.now() - stamp); 370 | * }, _.now()); 371 | * // => Logs the number of milliseconds it took for the deferred invocation. 372 | */ 373 | var now = function() { 374 | return root$2.Date.now(); 375 | }; 376 | 377 | var now_1 = now; 378 | 379 | var isObject$2 = isObject_1, 380 | now$1 = now_1, 381 | toNumber$2 = toNumber_1; 382 | 383 | /** Error message constants. */ 384 | var FUNC_ERROR_TEXT = 'Expected a function'; 385 | 386 | /* Built-in method references for those with the same name as other `lodash` methods. */ 387 | var nativeMax = Math.max, 388 | nativeMin = Math.min; 389 | 390 | /** 391 | * Creates a debounced function that delays invoking `func` until after `wait` 392 | * milliseconds have elapsed since the last time the debounced function was 393 | * invoked. The debounced function comes with a `cancel` method to cancel 394 | * delayed `func` invocations and a `flush` method to immediately invoke them. 395 | * Provide `options` to indicate whether `func` should be invoked on the 396 | * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 397 | * with the last arguments provided to the debounced function. Subsequent 398 | * calls to the debounced function return the result of the last `func` 399 | * invocation. 400 | * 401 | * **Note:** If `leading` and `trailing` options are `true`, `func` is 402 | * invoked on the trailing edge of the timeout only if the debounced function 403 | * is invoked more than once during the `wait` timeout. 404 | * 405 | * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 406 | * until to the next tick, similar to `setTimeout` with a timeout of `0`. 407 | * 408 | * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 409 | * for details over the differences between `_.debounce` and `_.throttle`. 410 | * 411 | * @static 412 | * @memberOf _ 413 | * @since 0.1.0 414 | * @category Function 415 | * @param {Function} func The function to debounce. 416 | * @param {number} [wait=0] The number of milliseconds to delay. 417 | * @param {Object} [options={}] The options object. 418 | * @param {boolean} [options.leading=false] 419 | * Specify invoking on the leading edge of the timeout. 420 | * @param {number} [options.maxWait] 421 | * The maximum time `func` is allowed to be delayed before it's invoked. 422 | * @param {boolean} [options.trailing=true] 423 | * Specify invoking on the trailing edge of the timeout. 424 | * @returns {Function} Returns the new debounced function. 425 | * @example 426 | * 427 | * // Avoid costly calculations while the window size is in flux. 428 | * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 429 | * 430 | * // Invoke `sendMail` when clicked, debouncing subsequent calls. 431 | * jQuery(element).on('click', _.debounce(sendMail, 300, { 432 | * 'leading': true, 433 | * 'trailing': false 434 | * })); 435 | * 436 | * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 437 | * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 438 | * var source = new EventSource('/stream'); 439 | * jQuery(source).on('message', debounced); 440 | * 441 | * // Cancel the trailing debounced invocation. 442 | * jQuery(window).on('popstate', debounced.cancel); 443 | */ 444 | function debounce(func, wait, options) { 445 | var lastArgs, 446 | lastThis, 447 | maxWait, 448 | result, 449 | timerId, 450 | lastCallTime, 451 | lastInvokeTime = 0, 452 | leading = false, 453 | maxing = false, 454 | trailing = true; 455 | 456 | if (typeof func != 'function') { 457 | throw new TypeError(FUNC_ERROR_TEXT); 458 | } 459 | wait = toNumber$2(wait) || 0; 460 | if (isObject$2(options)) { 461 | leading = !!options.leading; 462 | maxing = 'maxWait' in options; 463 | maxWait = maxing ? nativeMax(toNumber$2(options.maxWait) || 0, wait) : maxWait; 464 | trailing = 'trailing' in options ? !!options.trailing : trailing; 465 | } 466 | 467 | function invokeFunc(time) { 468 | var args = lastArgs, 469 | thisArg = lastThis; 470 | 471 | lastArgs = lastThis = undefined; 472 | lastInvokeTime = time; 473 | result = func.apply(thisArg, args); 474 | return result; 475 | } 476 | 477 | function leadingEdge(time) { 478 | // Reset any `maxWait` timer. 479 | lastInvokeTime = time; 480 | // Start the timer for the trailing edge. 481 | timerId = setTimeout(timerExpired, wait); 482 | // Invoke the leading edge. 483 | return leading ? invokeFunc(time) : result; 484 | } 485 | 486 | function remainingWait(time) { 487 | var timeSinceLastCall = time - lastCallTime, 488 | timeSinceLastInvoke = time - lastInvokeTime, 489 | timeWaiting = wait - timeSinceLastCall; 490 | 491 | return maxing 492 | ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 493 | : timeWaiting; 494 | } 495 | 496 | function shouldInvoke(time) { 497 | var timeSinceLastCall = time - lastCallTime, 498 | timeSinceLastInvoke = time - lastInvokeTime; 499 | 500 | // Either this is the first call, activity has stopped and we're at the 501 | // trailing edge, the system time has gone backwards and we're treating 502 | // it as the trailing edge, or we've hit the `maxWait` limit. 503 | return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 504 | (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 505 | } 506 | 507 | function timerExpired() { 508 | var time = now$1(); 509 | if (shouldInvoke(time)) { 510 | return trailingEdge(time); 511 | } 512 | // Restart the timer. 513 | timerId = setTimeout(timerExpired, remainingWait(time)); 514 | } 515 | 516 | function trailingEdge(time) { 517 | timerId = undefined; 518 | 519 | // Only invoke if we have `lastArgs` which means `func` has been 520 | // debounced at least once. 521 | if (trailing && lastArgs) { 522 | return invokeFunc(time); 523 | } 524 | lastArgs = lastThis = undefined; 525 | return result; 526 | } 527 | 528 | function cancel() { 529 | if (timerId !== undefined) { 530 | clearTimeout(timerId); 531 | } 532 | lastInvokeTime = 0; 533 | lastArgs = lastCallTime = lastThis = timerId = undefined; 534 | } 535 | 536 | function flush() { 537 | return timerId === undefined ? result : trailingEdge(now$1()); 538 | } 539 | 540 | function debounced() { 541 | var time = now$1(), 542 | isInvoking = shouldInvoke(time); 543 | 544 | lastArgs = arguments; 545 | lastThis = this; 546 | lastCallTime = time; 547 | 548 | if (isInvoking) { 549 | if (timerId === undefined) { 550 | return leadingEdge(lastCallTime); 551 | } 552 | if (maxing) { 553 | // Handle invocations in a tight loop. 554 | timerId = setTimeout(timerExpired, wait); 555 | return invokeFunc(lastCallTime); 556 | } 557 | } 558 | if (timerId === undefined) { 559 | timerId = setTimeout(timerExpired, wait); 560 | } 561 | return result; 562 | } 563 | debounced.cancel = cancel; 564 | debounced.flush = flush; 565 | return debounced; 566 | } 567 | 568 | var debounce_1 = debounce; 569 | 570 | /** 571 | * Copyright (c) 2013-present, Facebook, Inc. 572 | * 573 | * This source code is licensed under the MIT license found in the 574 | * LICENSE file in the root directory of this source tree. 575 | */ 576 | 577 | /** 578 | * Use invariant() to assert state which your program assumes to be true. 579 | * 580 | * Provide sprintf-style format (only %s is supported) and arguments 581 | * to provide information about what broke and what you were 582 | * expecting. 583 | * 584 | * The invariant message will be stripped in production, but the invariant 585 | * will remain to ensure logic does not differ in production. 586 | */ 587 | 588 | var invariant = function(condition, format, a, b, c, d, e, f) { 589 | { 590 | if (format === undefined) { 591 | throw new Error('invariant requires an error message argument'); 592 | } 593 | } 594 | 595 | if (!condition) { 596 | var error; 597 | if (format === undefined) { 598 | error = new Error( 599 | 'Minified exception occurred; use the non-minified dev environment ' + 600 | 'for the full error message and additional helpful warnings.' 601 | ); 602 | } else { 603 | var args = [a, b, c, d, e, f]; 604 | var argIndex = 0; 605 | error = new Error( 606 | format.replace(/%s/g, function() { return args[argIndex++]; }) 607 | ); 608 | error.name = 'Invariant Violation'; 609 | } 610 | 611 | error.framesToPop = 1; // we don't care about invariant's own frame 612 | throw error; 613 | } 614 | }; 615 | 616 | var browser = invariant; 617 | 618 | /* 619 | object-assign 620 | (c) Sindre Sorhus 621 | @license MIT 622 | */ 623 | /* eslint-disable no-unused-vars */ 624 | var getOwnPropertySymbols = Object.getOwnPropertySymbols; 625 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty; 626 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; 627 | 628 | function toObject(val) { 629 | if (val === null || val === undefined) { 630 | throw new TypeError('Object.assign cannot be called with null or undefined'); 631 | } 632 | 633 | return Object(val); 634 | } 635 | 636 | function shouldUseNative() { 637 | try { 638 | if (!Object.assign) { 639 | return false; 640 | } 641 | 642 | // Detect buggy property enumeration order in older V8 versions. 643 | 644 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 645 | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 646 | test1[5] = 'de'; 647 | if (Object.getOwnPropertyNames(test1)[0] === '5') { 648 | return false; 649 | } 650 | 651 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 652 | var test2 = {}; 653 | for (var i = 0; i < 10; i++) { 654 | test2['_' + String.fromCharCode(i)] = i; 655 | } 656 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 657 | return test2[n]; 658 | }); 659 | if (order2.join('') !== '0123456789') { 660 | return false; 661 | } 662 | 663 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 664 | var test3 = {}; 665 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 666 | test3[letter] = letter; 667 | }); 668 | if (Object.keys(Object.assign({}, test3)).join('') !== 669 | 'abcdefghijklmnopqrst') { 670 | return false; 671 | } 672 | 673 | return true; 674 | } catch (err) { 675 | // We don't expect any of the above to throw, but better to be safe. 676 | return false; 677 | } 678 | } 679 | 680 | var index = shouldUseNative() ? Object.assign : function (target, source) { 681 | var arguments$1 = arguments; 682 | 683 | var from; 684 | var to = toObject(target); 685 | var symbols; 686 | 687 | for (var s = 1; s < arguments.length; s++) { 688 | from = Object(arguments$1[s]); 689 | 690 | for (var key in from) { 691 | if (hasOwnProperty$1.call(from, key)) { 692 | to[key] = from[key]; 693 | } 694 | } 695 | 696 | if (getOwnPropertySymbols) { 697 | symbols = getOwnPropertySymbols(from); 698 | for (var i = 0; i < symbols.length; i++) { 699 | if (propIsEnumerable.call(from, symbols[i])) { 700 | to[symbols[i]] = from[symbols[i]]; 701 | } 702 | } 703 | } 704 | } 705 | 706 | return to; 707 | }; 708 | 709 | var component = /-?\d+(\.\d+)?%?/g; 710 | function extractComponents(color) { 711 | return color.match(component); 712 | } 713 | 714 | var extractComponents_1 = extractComponents; 715 | 716 | function clamp$1(val, min, max) { 717 | return Math.min(Math.max(val, min), max); 718 | } 719 | 720 | var clamp_1$1 = clamp$1; 721 | 722 | var extractComponents$1 = extractComponents_1; 723 | var clamp$2 = clamp_1$1; 724 | 725 | function parseHslComponent(component, i) { 726 | component = parseFloat(component); 727 | 728 | switch(i) { 729 | case 0: 730 | return clamp$2(component, 0, 360); 731 | case 1: 732 | case 2: 733 | return clamp$2(component, 0, 100); 734 | case 3: 735 | return clamp$2(component, 0, 1); 736 | } 737 | } 738 | 739 | function hsl(color) { 740 | return extractComponents$1(color).map(parseHslComponent); 741 | } 742 | 743 | var hsl_1 = hsl; 744 | 745 | function expand(hex) { 746 | var result = "#"; 747 | 748 | for (var i = 1; i < hex.length; i++) { 749 | var val = hex.charAt(i); 750 | result += val + val; 751 | } 752 | 753 | return result; 754 | } 755 | 756 | function hex(hex) { 757 | // #RGB or #RGBA 758 | if(hex.length === 4 || hex.length === 5) { 759 | hex = expand(hex); 760 | } 761 | 762 | var rgb = [ 763 | parseInt(hex.substring(1,3), 16), 764 | parseInt(hex.substring(3,5), 16), 765 | parseInt(hex.substring(5,7), 16) 766 | ]; 767 | 768 | // #RRGGBBAA 769 | if (hex.length === 9) { 770 | var alpha = parseFloat((parseInt(hex.substring(7,9), 16) / 255).toFixed(2)); 771 | rgb.push(alpha); 772 | } 773 | 774 | return rgb; 775 | } 776 | 777 | var hex_1 = hex; 778 | 779 | var extractComponents$2 = extractComponents_1; 780 | var clamp$3 = clamp_1$1; 781 | 782 | function parseRgbComponent(component, i) { 783 | if (i < 3) { 784 | if (component.indexOf('%') != -1) { 785 | return Math.round(255 * clamp$3(parseInt(component, 10), 0, 100)/100); 786 | } else { 787 | return clamp$3(parseInt(component, 10), 0, 255); 788 | } 789 | } else { 790 | return clamp$3(parseFloat(component), 0, 1); 791 | } 792 | } 793 | 794 | function rgb(color) { 795 | return extractComponents$2(color).map(parseRgbComponent); 796 | } 797 | 798 | var rgb_1 = rgb; 799 | 800 | function hsl2rgb(hsl) { 801 | var h = hsl[0] / 360, 802 | s = hsl[1] / 100, 803 | l = hsl[2] / 100, 804 | t1, t2, t3, rgb, val; 805 | 806 | if (s == 0) { 807 | val = l * 255; 808 | return [val, val, val]; 809 | } 810 | 811 | if (l < 0.5) 812 | { t2 = l * (1 + s); } 813 | else 814 | { t2 = l + s - l * s; } 815 | t1 = 2 * l - t2; 816 | 817 | rgb = [0, 0, 0]; 818 | for (var i = 0; i < 3; i++) { 819 | t3 = h + 1 / 3 * - (i - 1); 820 | t3 < 0 && t3++; 821 | t3 > 1 && t3--; 822 | 823 | if (6 * t3 < 1) 824 | { val = t1 + (t2 - t1) * 6 * t3; } 825 | else if (2 * t3 < 1) 826 | { val = t2; } 827 | else if (3 * t3 < 2) 828 | { val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; } 829 | else 830 | { val = t1; } 831 | 832 | rgb[i] = val * 255; 833 | } 834 | 835 | return rgb; 836 | } 837 | 838 | var hsl2rgb_1 = hsl2rgb; 839 | 840 | var hsl$1 = hsl_1; 841 | var hex$1 = hex_1; 842 | var rgb$1 = rgb_1; 843 | var hsl2rgb$1 = hsl2rgb_1; 844 | 845 | function hsl2rgbParse(color) { 846 | var h = hsl$1(color); 847 | var r = hsl2rgb$1(h); 848 | 849 | // handle alpha since hsl2rgb doesn't know (or care!) about it 850 | if(h.length === 4) { 851 | r.push(h[3]); 852 | } 853 | 854 | return r; 855 | } 856 | 857 | var space2parser = { 858 | "#" : hex$1, 859 | "hsl" : hsl2rgbParse, 860 | "rgb" : rgb$1 861 | }; 862 | 863 | function parse(color) { 864 | for(var scheme in space2parser) { 865 | if(color.indexOf(scheme) === 0) { 866 | return space2parser[scheme](color); 867 | } 868 | } 869 | } 870 | 871 | parse.rgb = rgb$1; 872 | parse.hsl = hsl$1; 873 | parse.hex = hex$1; 874 | 875 | var index$1 = parse; 876 | 877 | function rgb2hsv(rgb) { 878 | var r = rgb[0], 879 | g = rgb[1], 880 | b = rgb[2], 881 | min = Math.min(r, g, b), 882 | max = Math.max(r, g, b), 883 | delta = max - min, 884 | h, s, v; 885 | 886 | if (max == 0) 887 | { s = 0; } 888 | else 889 | { s = (delta/max * 1000)/10; } 890 | 891 | if (max == min) 892 | { h = 0; } 893 | else if (r == max) 894 | { h = (g - b) / delta; } 895 | else if (g == max) 896 | { h = 2 + (b - r) / delta; } 897 | else if (b == max) 898 | { h = 4 + (r - g) / delta; } 899 | 900 | h = Math.min(h * 60, 360); 901 | 902 | if (h < 0) 903 | { h += 360; } 904 | 905 | v = ((max / 255) * 1000) / 10; 906 | 907 | return [h, s, v]; 908 | } 909 | 910 | var rgb2hsv_1 = rgb2hsv; 911 | 912 | var clamp$4 = clamp_1$1; 913 | 914 | function componentToHex(c) { 915 | var value = Math.round(clamp$4(c, 0, 255)); 916 | var hex = value.toString(16); 917 | 918 | return hex.length == 1 ? "0" + hex : hex; 919 | } 920 | 921 | function rgb2hex(rgb) { 922 | var alpha = rgb.length === 4 ? componentToHex(rgb[3] * 255) : ""; 923 | 924 | return "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]) + alpha; 925 | } 926 | 927 | var rgb2hex_1 = rgb2hex; 928 | 929 | function hsv2hsl(hsv) { 930 | var h = hsv[0], 931 | s = hsv[1] / 100, 932 | v = hsv[2] / 100, 933 | sl, l; 934 | 935 | l = (2 - s) * v; 936 | sl = s * v; 937 | sl /= (l <= 1) ? l : 2 - l; 938 | sl = sl || 0; 939 | l /= 2; 940 | return [h, sl * 100, l * 100]; 941 | } 942 | 943 | var hsv2hsl_1 = hsv2hsl; 944 | 945 | function hsv2rgb(hsv) { 946 | var h = hsv[0] / 60, 947 | s = hsv[1] / 100, 948 | v = hsv[2] / 100, 949 | hi = Math.floor(h) % 6; 950 | 951 | var f = h - Math.floor(h), 952 | p = 255 * v * (1 - s), 953 | q = 255 * v * (1 - (s * f)), 954 | t = 255 * v * (1 - (s * (1 - f))), 955 | v = 255 * v; 956 | 957 | switch(hi) { 958 | case 0: 959 | return [v, t, p]; 960 | case 1: 961 | return [q, v, p]; 962 | case 2: 963 | return [p, v, t]; 964 | case 3: 965 | return [p, q, v]; 966 | case 4: 967 | return [t, p, v]; 968 | case 5: 969 | return [v, p, q]; 970 | } 971 | } 972 | 973 | var hsv2rgb_1 = hsv2rgb; 974 | 975 | var debounce$1 = debounce_1, 976 | isObject$3 = isObject_1; 977 | 978 | /** Error message constants. */ 979 | var FUNC_ERROR_TEXT$1 = 'Expected a function'; 980 | 981 | /** 982 | * Creates a throttled function that only invokes `func` at most once per 983 | * every `wait` milliseconds. The throttled function comes with a `cancel` 984 | * method to cancel delayed `func` invocations and a `flush` method to 985 | * immediately invoke them. Provide `options` to indicate whether `func` 986 | * should be invoked on the leading and/or trailing edge of the `wait` 987 | * timeout. The `func` is invoked with the last arguments provided to the 988 | * throttled function. Subsequent calls to the throttled function return the 989 | * result of the last `func` invocation. 990 | * 991 | * **Note:** If `leading` and `trailing` options are `true`, `func` is 992 | * invoked on the trailing edge of the timeout only if the throttled function 993 | * is invoked more than once during the `wait` timeout. 994 | * 995 | * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 996 | * until to the next tick, similar to `setTimeout` with a timeout of `0`. 997 | * 998 | * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 999 | * for details over the differences between `_.throttle` and `_.debounce`. 1000 | * 1001 | * @static 1002 | * @memberOf _ 1003 | * @since 0.1.0 1004 | * @category Function 1005 | * @param {Function} func The function to throttle. 1006 | * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 1007 | * @param {Object} [options={}] The options object. 1008 | * @param {boolean} [options.leading=true] 1009 | * Specify invoking on the leading edge of the timeout. 1010 | * @param {boolean} [options.trailing=true] 1011 | * Specify invoking on the trailing edge of the timeout. 1012 | * @returns {Function} Returns the new throttled function. 1013 | * @example 1014 | * 1015 | * // Avoid excessively updating the position while scrolling. 1016 | * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 1017 | * 1018 | * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 1019 | * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 1020 | * jQuery(element).on('click', throttled); 1021 | * 1022 | * // Cancel the trailing throttled invocation. 1023 | * jQuery(window).on('popstate', throttled.cancel); 1024 | */ 1025 | function throttle(func, wait, options) { 1026 | var leading = true, 1027 | trailing = true; 1028 | 1029 | if (typeof func != 'function') { 1030 | throw new TypeError(FUNC_ERROR_TEXT$1); 1031 | } 1032 | if (isObject$3(options)) { 1033 | leading = 'leading' in options ? !!options.leading : leading; 1034 | trailing = 'trailing' in options ? !!options.trailing : trailing; 1035 | } 1036 | return debounce$1(func, wait, { 1037 | 'leading': leading, 1038 | 'maxWait': wait, 1039 | 'trailing': trailing 1040 | }); 1041 | } 1042 | 1043 | var throttle_1 = throttle; 1044 | 1045 | /** 1046 | * Removes all key-value entries from the list cache. 1047 | * 1048 | * @private 1049 | * @name clear 1050 | * @memberOf ListCache 1051 | */ 1052 | function listCacheClear() { 1053 | this.__data__ = []; 1054 | this.size = 0; 1055 | } 1056 | 1057 | var _listCacheClear = listCacheClear; 1058 | 1059 | /** 1060 | * Performs a 1061 | * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 1062 | * comparison between two values to determine if they are equivalent. 1063 | * 1064 | * @static 1065 | * @memberOf _ 1066 | * @since 4.0.0 1067 | * @category Lang 1068 | * @param {*} value The value to compare. 1069 | * @param {*} other The other value to compare. 1070 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 1071 | * @example 1072 | * 1073 | * var object = { 'a': 1 }; 1074 | * var other = { 'a': 1 }; 1075 | * 1076 | * _.eq(object, object); 1077 | * // => true 1078 | * 1079 | * _.eq(object, other); 1080 | * // => false 1081 | * 1082 | * _.eq('a', 'a'); 1083 | * // => true 1084 | * 1085 | * _.eq('a', Object('a')); 1086 | * // => false 1087 | * 1088 | * _.eq(NaN, NaN); 1089 | * // => true 1090 | */ 1091 | function eq(value, other) { 1092 | return value === other || (value !== value && other !== other); 1093 | } 1094 | 1095 | var eq_1 = eq; 1096 | 1097 | var eq$1 = eq_1; 1098 | 1099 | /** 1100 | * Gets the index at which the `key` is found in `array` of key-value pairs. 1101 | * 1102 | * @private 1103 | * @param {Array} array The array to inspect. 1104 | * @param {*} key The key to search for. 1105 | * @returns {number} Returns the index of the matched value, else `-1`. 1106 | */ 1107 | function assocIndexOf(array, key) { 1108 | var length = array.length; 1109 | while (length--) { 1110 | if (eq$1(array[length][0], key)) { 1111 | return length; 1112 | } 1113 | } 1114 | return -1; 1115 | } 1116 | 1117 | var _assocIndexOf = assocIndexOf; 1118 | 1119 | var assocIndexOf$1 = _assocIndexOf; 1120 | 1121 | /** Used for built-in method references. */ 1122 | var arrayProto = Array.prototype; 1123 | 1124 | /** Built-in value references. */ 1125 | var splice = arrayProto.splice; 1126 | 1127 | /** 1128 | * Removes `key` and its value from the list cache. 1129 | * 1130 | * @private 1131 | * @name delete 1132 | * @memberOf ListCache 1133 | * @param {string} key The key of the value to remove. 1134 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. 1135 | */ 1136 | function listCacheDelete(key) { 1137 | var data = this.__data__, 1138 | index = assocIndexOf$1(data, key); 1139 | 1140 | if (index < 0) { 1141 | return false; 1142 | } 1143 | var lastIndex = data.length - 1; 1144 | if (index == lastIndex) { 1145 | data.pop(); 1146 | } else { 1147 | splice.call(data, index, 1); 1148 | } 1149 | --this.size; 1150 | return true; 1151 | } 1152 | 1153 | var _listCacheDelete = listCacheDelete; 1154 | 1155 | var assocIndexOf$2 = _assocIndexOf; 1156 | 1157 | /** 1158 | * Gets the list cache value for `key`. 1159 | * 1160 | * @private 1161 | * @name get 1162 | * @memberOf ListCache 1163 | * @param {string} key The key of the value to get. 1164 | * @returns {*} Returns the entry value. 1165 | */ 1166 | function listCacheGet(key) { 1167 | var data = this.__data__, 1168 | index = assocIndexOf$2(data, key); 1169 | 1170 | return index < 0 ? undefined : data[index][1]; 1171 | } 1172 | 1173 | var _listCacheGet = listCacheGet; 1174 | 1175 | var assocIndexOf$3 = _assocIndexOf; 1176 | 1177 | /** 1178 | * Checks if a list cache value for `key` exists. 1179 | * 1180 | * @private 1181 | * @name has 1182 | * @memberOf ListCache 1183 | * @param {string} key The key of the entry to check. 1184 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 1185 | */ 1186 | function listCacheHas(key) { 1187 | return assocIndexOf$3(this.__data__, key) > -1; 1188 | } 1189 | 1190 | var _listCacheHas = listCacheHas; 1191 | 1192 | var assocIndexOf$4 = _assocIndexOf; 1193 | 1194 | /** 1195 | * Sets the list cache `key` to `value`. 1196 | * 1197 | * @private 1198 | * @name set 1199 | * @memberOf ListCache 1200 | * @param {string} key The key of the value to set. 1201 | * @param {*} value The value to set. 1202 | * @returns {Object} Returns the list cache instance. 1203 | */ 1204 | function listCacheSet(key, value) { 1205 | var data = this.__data__, 1206 | index = assocIndexOf$4(data, key); 1207 | 1208 | if (index < 0) { 1209 | ++this.size; 1210 | data.push([key, value]); 1211 | } else { 1212 | data[index][1] = value; 1213 | } 1214 | return this; 1215 | } 1216 | 1217 | var _listCacheSet = listCacheSet; 1218 | 1219 | var listCacheClear$1 = _listCacheClear, 1220 | listCacheDelete$1 = _listCacheDelete, 1221 | listCacheGet$1 = _listCacheGet, 1222 | listCacheHas$1 = _listCacheHas, 1223 | listCacheSet$1 = _listCacheSet; 1224 | 1225 | /** 1226 | * Creates an list cache object. 1227 | * 1228 | * @private 1229 | * @constructor 1230 | * @param {Array} [entries] The key-value pairs to cache. 1231 | */ 1232 | function ListCache(entries) { 1233 | var this$1 = this; 1234 | 1235 | var index = -1, 1236 | length = entries == null ? 0 : entries.length; 1237 | 1238 | this.clear(); 1239 | while (++index < length) { 1240 | var entry = entries[index]; 1241 | this$1.set(entry[0], entry[1]); 1242 | } 1243 | } 1244 | 1245 | // Add methods to `ListCache`. 1246 | ListCache.prototype.clear = listCacheClear$1; 1247 | ListCache.prototype['delete'] = listCacheDelete$1; 1248 | ListCache.prototype.get = listCacheGet$1; 1249 | ListCache.prototype.has = listCacheHas$1; 1250 | ListCache.prototype.set = listCacheSet$1; 1251 | 1252 | var _ListCache = ListCache; 1253 | 1254 | var ListCache$1 = _ListCache; 1255 | 1256 | /** 1257 | * Removes all key-value entries from the stack. 1258 | * 1259 | * @private 1260 | * @name clear 1261 | * @memberOf Stack 1262 | */ 1263 | function stackClear() { 1264 | this.__data__ = new ListCache$1; 1265 | this.size = 0; 1266 | } 1267 | 1268 | var _stackClear = stackClear; 1269 | 1270 | /** 1271 | * Removes `key` and its value from the stack. 1272 | * 1273 | * @private 1274 | * @name delete 1275 | * @memberOf Stack 1276 | * @param {string} key The key of the value to remove. 1277 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. 1278 | */ 1279 | function stackDelete(key) { 1280 | var data = this.__data__, 1281 | result = data['delete'](key); 1282 | 1283 | this.size = data.size; 1284 | return result; 1285 | } 1286 | 1287 | var _stackDelete = stackDelete; 1288 | 1289 | /** 1290 | * Gets the stack value for `key`. 1291 | * 1292 | * @private 1293 | * @name get 1294 | * @memberOf Stack 1295 | * @param {string} key The key of the value to get. 1296 | * @returns {*} Returns the entry value. 1297 | */ 1298 | function stackGet(key) { 1299 | return this.__data__.get(key); 1300 | } 1301 | 1302 | var _stackGet = stackGet; 1303 | 1304 | /** 1305 | * Checks if a stack value for `key` exists. 1306 | * 1307 | * @private 1308 | * @name has 1309 | * @memberOf Stack 1310 | * @param {string} key The key of the entry to check. 1311 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 1312 | */ 1313 | function stackHas(key) { 1314 | return this.__data__.has(key); 1315 | } 1316 | 1317 | var _stackHas = stackHas; 1318 | 1319 | var baseGetTag$2 = _baseGetTag, 1320 | isObject$4 = isObject_1; 1321 | 1322 | /** `Object#toString` result references. */ 1323 | var asyncTag = '[object AsyncFunction]', 1324 | funcTag = '[object Function]', 1325 | genTag = '[object GeneratorFunction]', 1326 | proxyTag = '[object Proxy]'; 1327 | 1328 | /** 1329 | * Checks if `value` is classified as a `Function` object. 1330 | * 1331 | * @static 1332 | * @memberOf _ 1333 | * @since 0.1.0 1334 | * @category Lang 1335 | * @param {*} value The value to check. 1336 | * @returns {boolean} Returns `true` if `value` is a function, else `false`. 1337 | * @example 1338 | * 1339 | * _.isFunction(_); 1340 | * // => true 1341 | * 1342 | * _.isFunction(/abc/); 1343 | * // => false 1344 | */ 1345 | function isFunction(value) { 1346 | if (!isObject$4(value)) { 1347 | return false; 1348 | } 1349 | // The use of `Object#toString` avoids issues with the `typeof` operator 1350 | // in Safari 9 which returns 'object' for typed arrays and other constructors. 1351 | var tag = baseGetTag$2(value); 1352 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 1353 | } 1354 | 1355 | var isFunction_1 = isFunction; 1356 | 1357 | var root$3 = _root; 1358 | 1359 | /** Used to detect overreaching core-js shims. */ 1360 | var coreJsData = root$3['__core-js_shared__']; 1361 | 1362 | var _coreJsData = coreJsData; 1363 | 1364 | var coreJsData$1 = _coreJsData; 1365 | 1366 | /** Used to detect methods masquerading as native. */ 1367 | var maskSrcKey = (function() { 1368 | var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || ''); 1369 | return uid ? ('Symbol(src)_1.' + uid) : ''; 1370 | }()); 1371 | 1372 | /** 1373 | * Checks if `func` has its source masked. 1374 | * 1375 | * @private 1376 | * @param {Function} func The function to check. 1377 | * @returns {boolean} Returns `true` if `func` is masked, else `false`. 1378 | */ 1379 | function isMasked(func) { 1380 | return !!maskSrcKey && (maskSrcKey in func); 1381 | } 1382 | 1383 | var _isMasked = isMasked; 1384 | 1385 | /** Used for built-in method references. */ 1386 | var funcProto = Function.prototype; 1387 | 1388 | /** Used to resolve the decompiled source of functions. */ 1389 | var funcToString = funcProto.toString; 1390 | 1391 | /** 1392 | * Converts `func` to its source code. 1393 | * 1394 | * @private 1395 | * @param {Function} func The function to convert. 1396 | * @returns {string} Returns the source code. 1397 | */ 1398 | function toSource(func) { 1399 | if (func != null) { 1400 | try { 1401 | return funcToString.call(func); 1402 | } catch (e) {} 1403 | try { 1404 | return (func + ''); 1405 | } catch (e) {} 1406 | } 1407 | return ''; 1408 | } 1409 | 1410 | var _toSource = toSource; 1411 | 1412 | var isFunction$1 = isFunction_1, 1413 | isMasked$1 = _isMasked, 1414 | isObject$5 = isObject_1, 1415 | toSource$1 = _toSource; 1416 | 1417 | /** 1418 | * Used to match `RegExp` 1419 | * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 1420 | */ 1421 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; 1422 | 1423 | /** Used to detect host constructors (Safari). */ 1424 | var reIsHostCtor = /^\[object .+?Constructor\]$/; 1425 | 1426 | /** Used for built-in method references. */ 1427 | var funcProto$1 = Function.prototype, 1428 | objectProto$2 = Object.prototype; 1429 | 1430 | /** Used to resolve the decompiled source of functions. */ 1431 | var funcToString$1 = funcProto$1.toString; 1432 | 1433 | /** Used to check objects for own properties. */ 1434 | var hasOwnProperty$2 = objectProto$2.hasOwnProperty; 1435 | 1436 | /** Used to detect if a method is native. */ 1437 | var reIsNative = RegExp('^' + 1438 | funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&') 1439 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 1440 | ); 1441 | 1442 | /** 1443 | * The base implementation of `_.isNative` without bad shim checks. 1444 | * 1445 | * @private 1446 | * @param {*} value The value to check. 1447 | * @returns {boolean} Returns `true` if `value` is a native function, 1448 | * else `false`. 1449 | */ 1450 | function baseIsNative(value) { 1451 | if (!isObject$5(value) || isMasked$1(value)) { 1452 | return false; 1453 | } 1454 | var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor; 1455 | return pattern.test(toSource$1(value)); 1456 | } 1457 | 1458 | var _baseIsNative = baseIsNative; 1459 | 1460 | /** 1461 | * Gets the value at `key` of `object`. 1462 | * 1463 | * @private 1464 | * @param {Object} [object] The object to query. 1465 | * @param {string} key The key of the property to get. 1466 | * @returns {*} Returns the property value. 1467 | */ 1468 | function getValue(object, key) { 1469 | return object == null ? undefined : object[key]; 1470 | } 1471 | 1472 | var _getValue = getValue; 1473 | 1474 | var baseIsNative$1 = _baseIsNative, 1475 | getValue$1 = _getValue; 1476 | 1477 | /** 1478 | * Gets the native function at `key` of `object`. 1479 | * 1480 | * @private 1481 | * @param {Object} object The object to query. 1482 | * @param {string} key The key of the method to get. 1483 | * @returns {*} Returns the function if it's native, else `undefined`. 1484 | */ 1485 | function getNative(object, key) { 1486 | var value = getValue$1(object, key); 1487 | return baseIsNative$1(value) ? value : undefined; 1488 | } 1489 | 1490 | var _getNative = getNative; 1491 | 1492 | var getNative$1 = _getNative, 1493 | root$4 = _root; 1494 | 1495 | /* Built-in method references that are verified to be native. */ 1496 | var Map = getNative$1(root$4, 'Map'); 1497 | 1498 | var _Map = Map; 1499 | 1500 | var getNative$2 = _getNative; 1501 | 1502 | /* Built-in method references that are verified to be native. */ 1503 | var nativeCreate = getNative$2(Object, 'create'); 1504 | 1505 | var _nativeCreate = nativeCreate; 1506 | 1507 | var nativeCreate$1 = _nativeCreate; 1508 | 1509 | /** 1510 | * Removes all key-value entries from the hash. 1511 | * 1512 | * @private 1513 | * @name clear 1514 | * @memberOf Hash 1515 | */ 1516 | function hashClear() { 1517 | this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {}; 1518 | this.size = 0; 1519 | } 1520 | 1521 | var _hashClear = hashClear; 1522 | 1523 | /** 1524 | * Removes `key` and its value from the hash. 1525 | * 1526 | * @private 1527 | * @name delete 1528 | * @memberOf Hash 1529 | * @param {Object} hash The hash to modify. 1530 | * @param {string} key The key of the value to remove. 1531 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. 1532 | */ 1533 | function hashDelete(key) { 1534 | var result = this.has(key) && delete this.__data__[key]; 1535 | this.size -= result ? 1 : 0; 1536 | return result; 1537 | } 1538 | 1539 | var _hashDelete = hashDelete; 1540 | 1541 | var nativeCreate$2 = _nativeCreate; 1542 | 1543 | /** Used to stand-in for `undefined` hash values. */ 1544 | var HASH_UNDEFINED = '__lodash_hash_undefined__'; 1545 | 1546 | /** Used for built-in method references. */ 1547 | var objectProto$3 = Object.prototype; 1548 | 1549 | /** Used to check objects for own properties. */ 1550 | var hasOwnProperty$3 = objectProto$3.hasOwnProperty; 1551 | 1552 | /** 1553 | * Gets the hash value for `key`. 1554 | * 1555 | * @private 1556 | * @name get 1557 | * @memberOf Hash 1558 | * @param {string} key The key of the value to get. 1559 | * @returns {*} Returns the entry value. 1560 | */ 1561 | function hashGet(key) { 1562 | var data = this.__data__; 1563 | if (nativeCreate$2) { 1564 | var result = data[key]; 1565 | return result === HASH_UNDEFINED ? undefined : result; 1566 | } 1567 | return hasOwnProperty$3.call(data, key) ? data[key] : undefined; 1568 | } 1569 | 1570 | var _hashGet = hashGet; 1571 | 1572 | var nativeCreate$3 = _nativeCreate; 1573 | 1574 | /** Used for built-in method references. */ 1575 | var objectProto$4 = Object.prototype; 1576 | 1577 | /** Used to check objects for own properties. */ 1578 | var hasOwnProperty$4 = objectProto$4.hasOwnProperty; 1579 | 1580 | /** 1581 | * Checks if a hash value for `key` exists. 1582 | * 1583 | * @private 1584 | * @name has 1585 | * @memberOf Hash 1586 | * @param {string} key The key of the entry to check. 1587 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 1588 | */ 1589 | function hashHas(key) { 1590 | var data = this.__data__; 1591 | return nativeCreate$3 ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key); 1592 | } 1593 | 1594 | var _hashHas = hashHas; 1595 | 1596 | var nativeCreate$4 = _nativeCreate; 1597 | 1598 | /** Used to stand-in for `undefined` hash values. */ 1599 | var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; 1600 | 1601 | /** 1602 | * Sets the hash `key` to `value`. 1603 | * 1604 | * @private 1605 | * @name set 1606 | * @memberOf Hash 1607 | * @param {string} key The key of the value to set. 1608 | * @param {*} value The value to set. 1609 | * @returns {Object} Returns the hash instance. 1610 | */ 1611 | function hashSet(key, value) { 1612 | var data = this.__data__; 1613 | this.size += this.has(key) ? 0 : 1; 1614 | data[key] = (nativeCreate$4 && value === undefined) ? HASH_UNDEFINED$1 : value; 1615 | return this; 1616 | } 1617 | 1618 | var _hashSet = hashSet; 1619 | 1620 | var hashClear$1 = _hashClear, 1621 | hashDelete$1 = _hashDelete, 1622 | hashGet$1 = _hashGet, 1623 | hashHas$1 = _hashHas, 1624 | hashSet$1 = _hashSet; 1625 | 1626 | /** 1627 | * Creates a hash object. 1628 | * 1629 | * @private 1630 | * @constructor 1631 | * @param {Array} [entries] The key-value pairs to cache. 1632 | */ 1633 | function Hash(entries) { 1634 | var this$1 = this; 1635 | 1636 | var index = -1, 1637 | length = entries == null ? 0 : entries.length; 1638 | 1639 | this.clear(); 1640 | while (++index < length) { 1641 | var entry = entries[index]; 1642 | this$1.set(entry[0], entry[1]); 1643 | } 1644 | } 1645 | 1646 | // Add methods to `Hash`. 1647 | Hash.prototype.clear = hashClear$1; 1648 | Hash.prototype['delete'] = hashDelete$1; 1649 | Hash.prototype.get = hashGet$1; 1650 | Hash.prototype.has = hashHas$1; 1651 | Hash.prototype.set = hashSet$1; 1652 | 1653 | var _Hash = Hash; 1654 | 1655 | var Hash$1 = _Hash, 1656 | ListCache$2 = _ListCache, 1657 | Map$1 = _Map; 1658 | 1659 | /** 1660 | * Removes all key-value entries from the map. 1661 | * 1662 | * @private 1663 | * @name clear 1664 | * @memberOf MapCache 1665 | */ 1666 | function mapCacheClear() { 1667 | this.size = 0; 1668 | this.__data__ = { 1669 | 'hash': new Hash$1, 1670 | 'map': new (Map$1 || ListCache$2), 1671 | 'string': new Hash$1 1672 | }; 1673 | } 1674 | 1675 | var _mapCacheClear = mapCacheClear; 1676 | 1677 | /** 1678 | * Checks if `value` is suitable for use as unique object key. 1679 | * 1680 | * @private 1681 | * @param {*} value The value to check. 1682 | * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 1683 | */ 1684 | function isKeyable(value) { 1685 | var type = typeof value; 1686 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 1687 | ? (value !== '__proto__') 1688 | : (value === null); 1689 | } 1690 | 1691 | var _isKeyable = isKeyable; 1692 | 1693 | var isKeyable$1 = _isKeyable; 1694 | 1695 | /** 1696 | * Gets the data for `map`. 1697 | * 1698 | * @private 1699 | * @param {Object} map The map to query. 1700 | * @param {string} key The reference key. 1701 | * @returns {*} Returns the map data. 1702 | */ 1703 | function getMapData(map, key) { 1704 | var data = map.__data__; 1705 | return isKeyable$1(key) 1706 | ? data[typeof key == 'string' ? 'string' : 'hash'] 1707 | : data.map; 1708 | } 1709 | 1710 | var _getMapData = getMapData; 1711 | 1712 | var getMapData$1 = _getMapData; 1713 | 1714 | /** 1715 | * Removes `key` and its value from the map. 1716 | * 1717 | * @private 1718 | * @name delete 1719 | * @memberOf MapCache 1720 | * @param {string} key The key of the value to remove. 1721 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. 1722 | */ 1723 | function mapCacheDelete(key) { 1724 | var result = getMapData$1(this, key)['delete'](key); 1725 | this.size -= result ? 1 : 0; 1726 | return result; 1727 | } 1728 | 1729 | var _mapCacheDelete = mapCacheDelete; 1730 | 1731 | var getMapData$2 = _getMapData; 1732 | 1733 | /** 1734 | * Gets the map value for `key`. 1735 | * 1736 | * @private 1737 | * @name get 1738 | * @memberOf MapCache 1739 | * @param {string} key The key of the value to get. 1740 | * @returns {*} Returns the entry value. 1741 | */ 1742 | function mapCacheGet(key) { 1743 | return getMapData$2(this, key).get(key); 1744 | } 1745 | 1746 | var _mapCacheGet = mapCacheGet; 1747 | 1748 | var getMapData$3 = _getMapData; 1749 | 1750 | /** 1751 | * Checks if a map value for `key` exists. 1752 | * 1753 | * @private 1754 | * @name has 1755 | * @memberOf MapCache 1756 | * @param {string} key The key of the entry to check. 1757 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 1758 | */ 1759 | function mapCacheHas(key) { 1760 | return getMapData$3(this, key).has(key); 1761 | } 1762 | 1763 | var _mapCacheHas = mapCacheHas; 1764 | 1765 | var getMapData$4 = _getMapData; 1766 | 1767 | /** 1768 | * Sets the map `key` to `value`. 1769 | * 1770 | * @private 1771 | * @name set 1772 | * @memberOf MapCache 1773 | * @param {string} key The key of the value to set. 1774 | * @param {*} value The value to set. 1775 | * @returns {Object} Returns the map cache instance. 1776 | */ 1777 | function mapCacheSet(key, value) { 1778 | var data = getMapData$4(this, key), 1779 | size = data.size; 1780 | 1781 | data.set(key, value); 1782 | this.size += data.size == size ? 0 : 1; 1783 | return this; 1784 | } 1785 | 1786 | var _mapCacheSet = mapCacheSet; 1787 | 1788 | var mapCacheClear$1 = _mapCacheClear, 1789 | mapCacheDelete$1 = _mapCacheDelete, 1790 | mapCacheGet$1 = _mapCacheGet, 1791 | mapCacheHas$1 = _mapCacheHas, 1792 | mapCacheSet$1 = _mapCacheSet; 1793 | 1794 | /** 1795 | * Creates a map cache object to store key-value pairs. 1796 | * 1797 | * @private 1798 | * @constructor 1799 | * @param {Array} [entries] The key-value pairs to cache. 1800 | */ 1801 | function MapCache(entries) { 1802 | var this$1 = this; 1803 | 1804 | var index = -1, 1805 | length = entries == null ? 0 : entries.length; 1806 | 1807 | this.clear(); 1808 | while (++index < length) { 1809 | var entry = entries[index]; 1810 | this$1.set(entry[0], entry[1]); 1811 | } 1812 | } 1813 | 1814 | // Add methods to `MapCache`. 1815 | MapCache.prototype.clear = mapCacheClear$1; 1816 | MapCache.prototype['delete'] = mapCacheDelete$1; 1817 | MapCache.prototype.get = mapCacheGet$1; 1818 | MapCache.prototype.has = mapCacheHas$1; 1819 | MapCache.prototype.set = mapCacheSet$1; 1820 | 1821 | var _MapCache = MapCache; 1822 | 1823 | var ListCache$3 = _ListCache, 1824 | Map$2 = _Map, 1825 | MapCache$1 = _MapCache; 1826 | 1827 | /** Used as the size to enable large array optimizations. */ 1828 | var LARGE_ARRAY_SIZE = 200; 1829 | 1830 | /** 1831 | * Sets the stack `key` to `value`. 1832 | * 1833 | * @private 1834 | * @name set 1835 | * @memberOf Stack 1836 | * @param {string} key The key of the value to set. 1837 | * @param {*} value The value to set. 1838 | * @returns {Object} Returns the stack cache instance. 1839 | */ 1840 | function stackSet(key, value) { 1841 | var data = this.__data__; 1842 | if (data instanceof ListCache$3) { 1843 | var pairs = data.__data__; 1844 | if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 1845 | pairs.push([key, value]); 1846 | this.size = ++data.size; 1847 | return this; 1848 | } 1849 | data = this.__data__ = new MapCache$1(pairs); 1850 | } 1851 | data.set(key, value); 1852 | this.size = data.size; 1853 | return this; 1854 | } 1855 | 1856 | var _stackSet = stackSet; 1857 | 1858 | var ListCache$4 = _ListCache, 1859 | stackClear$1 = _stackClear, 1860 | stackDelete$1 = _stackDelete, 1861 | stackGet$1 = _stackGet, 1862 | stackHas$1 = _stackHas, 1863 | stackSet$1 = _stackSet; 1864 | 1865 | /** 1866 | * Creates a stack cache object to store key-value pairs. 1867 | * 1868 | * @private 1869 | * @constructor 1870 | * @param {Array} [entries] The key-value pairs to cache. 1871 | */ 1872 | function Stack(entries) { 1873 | var data = this.__data__ = new ListCache$4(entries); 1874 | this.size = data.size; 1875 | } 1876 | 1877 | // Add methods to `Stack`. 1878 | Stack.prototype.clear = stackClear$1; 1879 | Stack.prototype['delete'] = stackDelete$1; 1880 | Stack.prototype.get = stackGet$1; 1881 | Stack.prototype.has = stackHas$1; 1882 | Stack.prototype.set = stackSet$1; 1883 | 1884 | var _Stack = Stack; 1885 | 1886 | /** Used to stand-in for `undefined` hash values. */ 1887 | var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; 1888 | 1889 | /** 1890 | * Adds `value` to the array cache. 1891 | * 1892 | * @private 1893 | * @name add 1894 | * @memberOf SetCache 1895 | * @alias push 1896 | * @param {*} value The value to cache. 1897 | * @returns {Object} Returns the cache instance. 1898 | */ 1899 | function setCacheAdd(value) { 1900 | this.__data__.set(value, HASH_UNDEFINED$2); 1901 | return this; 1902 | } 1903 | 1904 | var _setCacheAdd = setCacheAdd; 1905 | 1906 | /** 1907 | * Checks if `value` is in the array cache. 1908 | * 1909 | * @private 1910 | * @name has 1911 | * @memberOf SetCache 1912 | * @param {*} value The value to search for. 1913 | * @returns {number} Returns `true` if `value` is found, else `false`. 1914 | */ 1915 | function setCacheHas(value) { 1916 | return this.__data__.has(value); 1917 | } 1918 | 1919 | var _setCacheHas = setCacheHas; 1920 | 1921 | var MapCache$2 = _MapCache, 1922 | setCacheAdd$1 = _setCacheAdd, 1923 | setCacheHas$1 = _setCacheHas; 1924 | 1925 | /** 1926 | * 1927 | * Creates an array cache object to store unique values. 1928 | * 1929 | * @private 1930 | * @constructor 1931 | * @param {Array} [values] The values to cache. 1932 | */ 1933 | function SetCache(values) { 1934 | var this$1 = this; 1935 | 1936 | var index = -1, 1937 | length = values == null ? 0 : values.length; 1938 | 1939 | this.__data__ = new MapCache$2; 1940 | while (++index < length) { 1941 | this$1.add(values[index]); 1942 | } 1943 | } 1944 | 1945 | // Add methods to `SetCache`. 1946 | SetCache.prototype.add = SetCache.prototype.push = setCacheAdd$1; 1947 | SetCache.prototype.has = setCacheHas$1; 1948 | 1949 | var _SetCache = SetCache; 1950 | 1951 | /** 1952 | * A specialized version of `_.some` for arrays without support for iteratee 1953 | * shorthands. 1954 | * 1955 | * @private 1956 | * @param {Array} [array] The array to iterate over. 1957 | * @param {Function} predicate The function invoked per iteration. 1958 | * @returns {boolean} Returns `true` if any element passes the predicate check, 1959 | * else `false`. 1960 | */ 1961 | function arraySome(array, predicate) { 1962 | var index = -1, 1963 | length = array == null ? 0 : array.length; 1964 | 1965 | while (++index < length) { 1966 | if (predicate(array[index], index, array)) { 1967 | return true; 1968 | } 1969 | } 1970 | return false; 1971 | } 1972 | 1973 | var _arraySome = arraySome; 1974 | 1975 | /** 1976 | * Checks if a `cache` value for `key` exists. 1977 | * 1978 | * @private 1979 | * @param {Object} cache The cache to query. 1980 | * @param {string} key The key of the entry to check. 1981 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 1982 | */ 1983 | function cacheHas(cache, key) { 1984 | return cache.has(key); 1985 | } 1986 | 1987 | var _cacheHas = cacheHas; 1988 | 1989 | var SetCache$1 = _SetCache, 1990 | arraySome$1 = _arraySome, 1991 | cacheHas$1 = _cacheHas; 1992 | 1993 | /** Used to compose bitmasks for value comparisons. */ 1994 | var COMPARE_PARTIAL_FLAG = 1, 1995 | COMPARE_UNORDERED_FLAG = 2; 1996 | 1997 | /** 1998 | * A specialized version of `baseIsEqualDeep` for arrays with support for 1999 | * partial deep comparisons. 2000 | * 2001 | * @private 2002 | * @param {Array} array The array to compare. 2003 | * @param {Array} other The other array to compare. 2004 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 2005 | * @param {Function} customizer The function to customize comparisons. 2006 | * @param {Function} equalFunc The function to determine equivalents of values. 2007 | * @param {Object} stack Tracks traversed `array` and `other` objects. 2008 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 2009 | */ 2010 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 2011 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 2012 | arrLength = array.length, 2013 | othLength = other.length; 2014 | 2015 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 2016 | return false; 2017 | } 2018 | // Assume cyclic values are equal. 2019 | var stacked = stack.get(array); 2020 | if (stacked && stack.get(other)) { 2021 | return stacked == other; 2022 | } 2023 | var index = -1, 2024 | result = true, 2025 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache$1 : undefined; 2026 | 2027 | stack.set(array, other); 2028 | stack.set(other, array); 2029 | 2030 | // Ignore non-index properties. 2031 | while (++index < arrLength) { 2032 | var arrValue = array[index], 2033 | othValue = other[index]; 2034 | 2035 | if (customizer) { 2036 | var compared = isPartial 2037 | ? customizer(othValue, arrValue, index, other, array, stack) 2038 | : customizer(arrValue, othValue, index, array, other, stack); 2039 | } 2040 | if (compared !== undefined) { 2041 | if (compared) { 2042 | continue; 2043 | } 2044 | result = false; 2045 | break; 2046 | } 2047 | // Recursively compare arrays (susceptible to call stack limits). 2048 | if (seen) { 2049 | if (!arraySome$1(other, function(othValue, othIndex) { 2050 | if (!cacheHas$1(seen, othIndex) && 2051 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 2052 | return seen.push(othIndex); 2053 | } 2054 | })) { 2055 | result = false; 2056 | break; 2057 | } 2058 | } else if (!( 2059 | arrValue === othValue || 2060 | equalFunc(arrValue, othValue, bitmask, customizer, stack) 2061 | )) { 2062 | result = false; 2063 | break; 2064 | } 2065 | } 2066 | stack['delete'](array); 2067 | stack['delete'](other); 2068 | return result; 2069 | } 2070 | 2071 | var _equalArrays = equalArrays; 2072 | 2073 | var root$5 = _root; 2074 | 2075 | /** Built-in value references. */ 2076 | var Uint8Array = root$5.Uint8Array; 2077 | 2078 | var _Uint8Array = Uint8Array; 2079 | 2080 | /** 2081 | * Converts `map` to its key-value pairs. 2082 | * 2083 | * @private 2084 | * @param {Object} map The map to convert. 2085 | * @returns {Array} Returns the key-value pairs. 2086 | */ 2087 | function mapToArray(map) { 2088 | var index = -1, 2089 | result = Array(map.size); 2090 | 2091 | map.forEach(function(value, key) { 2092 | result[++index] = [key, value]; 2093 | }); 2094 | return result; 2095 | } 2096 | 2097 | var _mapToArray = mapToArray; 2098 | 2099 | /** 2100 | * Converts `set` to an array of its values. 2101 | * 2102 | * @private 2103 | * @param {Object} set The set to convert. 2104 | * @returns {Array} Returns the values. 2105 | */ 2106 | function setToArray(set) { 2107 | var index = -1, 2108 | result = Array(set.size); 2109 | 2110 | set.forEach(function(value) { 2111 | result[++index] = value; 2112 | }); 2113 | return result; 2114 | } 2115 | 2116 | var _setToArray = setToArray; 2117 | 2118 | var Symbol$3 = _Symbol, 2119 | Uint8Array$1 = _Uint8Array, 2120 | eq$2 = eq_1, 2121 | equalArrays$1 = _equalArrays, 2122 | mapToArray$1 = _mapToArray, 2123 | setToArray$1 = _setToArray; 2124 | 2125 | /** Used to compose bitmasks for value comparisons. */ 2126 | var COMPARE_PARTIAL_FLAG$1 = 1, 2127 | COMPARE_UNORDERED_FLAG$1 = 2; 2128 | 2129 | /** `Object#toString` result references. */ 2130 | var boolTag = '[object Boolean]', 2131 | dateTag = '[object Date]', 2132 | errorTag = '[object Error]', 2133 | mapTag = '[object Map]', 2134 | numberTag = '[object Number]', 2135 | regexpTag = '[object RegExp]', 2136 | setTag = '[object Set]', 2137 | stringTag = '[object String]', 2138 | symbolTag$1 = '[object Symbol]'; 2139 | 2140 | var arrayBufferTag = '[object ArrayBuffer]', 2141 | dataViewTag = '[object DataView]'; 2142 | 2143 | /** Used to convert symbols to primitives and strings. */ 2144 | var symbolProto = Symbol$3 ? Symbol$3.prototype : undefined, 2145 | symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; 2146 | 2147 | /** 2148 | * A specialized version of `baseIsEqualDeep` for comparing objects of 2149 | * the same `toStringTag`. 2150 | * 2151 | * **Note:** This function only supports comparing values with tags of 2152 | * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 2153 | * 2154 | * @private 2155 | * @param {Object} object The object to compare. 2156 | * @param {Object} other The other object to compare. 2157 | * @param {string} tag The `toStringTag` of the objects to compare. 2158 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 2159 | * @param {Function} customizer The function to customize comparisons. 2160 | * @param {Function} equalFunc The function to determine equivalents of values. 2161 | * @param {Object} stack Tracks traversed `object` and `other` objects. 2162 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 2163 | */ 2164 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 2165 | switch (tag) { 2166 | case dataViewTag: 2167 | if ((object.byteLength != other.byteLength) || 2168 | (object.byteOffset != other.byteOffset)) { 2169 | return false; 2170 | } 2171 | object = object.buffer; 2172 | other = other.buffer; 2173 | 2174 | case arrayBufferTag: 2175 | if ((object.byteLength != other.byteLength) || 2176 | !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) { 2177 | return false; 2178 | } 2179 | return true; 2180 | 2181 | case boolTag: 2182 | case dateTag: 2183 | case numberTag: 2184 | // Coerce booleans to `1` or `0` and dates to milliseconds. 2185 | // Invalid dates are coerced to `NaN`. 2186 | return eq$2(+object, +other); 2187 | 2188 | case errorTag: 2189 | return object.name == other.name && object.message == other.message; 2190 | 2191 | case regexpTag: 2192 | case stringTag: 2193 | // Coerce regexes to strings and treat strings, primitives and objects, 2194 | // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 2195 | // for more details. 2196 | return object == (other + ''); 2197 | 2198 | case mapTag: 2199 | var convert = mapToArray$1; 2200 | 2201 | case setTag: 2202 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1; 2203 | convert || (convert = setToArray$1); 2204 | 2205 | if (object.size != other.size && !isPartial) { 2206 | return false; 2207 | } 2208 | // Assume cyclic values are equal. 2209 | var stacked = stack.get(object); 2210 | if (stacked) { 2211 | return stacked == other; 2212 | } 2213 | bitmask |= COMPARE_UNORDERED_FLAG$1; 2214 | 2215 | // Recursively compare objects (susceptible to call stack limits). 2216 | stack.set(object, other); 2217 | var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 2218 | stack['delete'](object); 2219 | return result; 2220 | 2221 | case symbolTag$1: 2222 | if (symbolValueOf) { 2223 | return symbolValueOf.call(object) == symbolValueOf.call(other); 2224 | } 2225 | } 2226 | return false; 2227 | } 2228 | 2229 | var _equalByTag = equalByTag; 2230 | 2231 | /** 2232 | * Appends the elements of `values` to `array`. 2233 | * 2234 | * @private 2235 | * @param {Array} array The array to modify. 2236 | * @param {Array} values The values to append. 2237 | * @returns {Array} Returns `array`. 2238 | */ 2239 | function arrayPush(array, values) { 2240 | var index = -1, 2241 | length = values.length, 2242 | offset = array.length; 2243 | 2244 | while (++index < length) { 2245 | array[offset + index] = values[index]; 2246 | } 2247 | return array; 2248 | } 2249 | 2250 | var _arrayPush = arrayPush; 2251 | 2252 | /** 2253 | * Checks if `value` is classified as an `Array` object. 2254 | * 2255 | * @static 2256 | * @memberOf _ 2257 | * @since 0.1.0 2258 | * @category Lang 2259 | * @param {*} value The value to check. 2260 | * @returns {boolean} Returns `true` if `value` is an array, else `false`. 2261 | * @example 2262 | * 2263 | * _.isArray([1, 2, 3]); 2264 | * // => true 2265 | * 2266 | * _.isArray(document.body.children); 2267 | * // => false 2268 | * 2269 | * _.isArray('abc'); 2270 | * // => false 2271 | * 2272 | * _.isArray(_.noop); 2273 | * // => false 2274 | */ 2275 | var isArray = Array.isArray; 2276 | 2277 | var isArray_1 = isArray; 2278 | 2279 | var arrayPush$1 = _arrayPush, 2280 | isArray$1 = isArray_1; 2281 | 2282 | /** 2283 | * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 2284 | * `keysFunc` and `symbolsFunc` to get the enumerable property names and 2285 | * symbols of `object`. 2286 | * 2287 | * @private 2288 | * @param {Object} object The object to query. 2289 | * @param {Function} keysFunc The function to get the keys of `object`. 2290 | * @param {Function} symbolsFunc The function to get the symbols of `object`. 2291 | * @returns {Array} Returns the array of property names and symbols. 2292 | */ 2293 | function baseGetAllKeys(object, keysFunc, symbolsFunc) { 2294 | var result = keysFunc(object); 2295 | return isArray$1(object) ? result : arrayPush$1(result, symbolsFunc(object)); 2296 | } 2297 | 2298 | var _baseGetAllKeys = baseGetAllKeys; 2299 | 2300 | /** 2301 | * A specialized version of `_.filter` for arrays without support for 2302 | * iteratee shorthands. 2303 | * 2304 | * @private 2305 | * @param {Array} [array] The array to iterate over. 2306 | * @param {Function} predicate The function invoked per iteration. 2307 | * @returns {Array} Returns the new filtered array. 2308 | */ 2309 | function arrayFilter(array, predicate) { 2310 | var index = -1, 2311 | length = array == null ? 0 : array.length, 2312 | resIndex = 0, 2313 | result = []; 2314 | 2315 | while (++index < length) { 2316 | var value = array[index]; 2317 | if (predicate(value, index, array)) { 2318 | result[resIndex++] = value; 2319 | } 2320 | } 2321 | return result; 2322 | } 2323 | 2324 | var _arrayFilter = arrayFilter; 2325 | 2326 | /** 2327 | * This method returns a new empty array. 2328 | * 2329 | * @static 2330 | * @memberOf _ 2331 | * @since 4.13.0 2332 | * @category Util 2333 | * @returns {Array} Returns the new empty array. 2334 | * @example 2335 | * 2336 | * var arrays = _.times(2, _.stubArray); 2337 | * 2338 | * console.log(arrays); 2339 | * // => [[], []] 2340 | * 2341 | * console.log(arrays[0] === arrays[1]); 2342 | * // => false 2343 | */ 2344 | function stubArray() { 2345 | return []; 2346 | } 2347 | 2348 | var stubArray_1 = stubArray; 2349 | 2350 | var arrayFilter$1 = _arrayFilter, 2351 | stubArray$1 = stubArray_1; 2352 | 2353 | /** Used for built-in method references. */ 2354 | var objectProto$5 = Object.prototype; 2355 | 2356 | /** Built-in value references. */ 2357 | var propertyIsEnumerable = objectProto$5.propertyIsEnumerable; 2358 | 2359 | /* Built-in method references for those with the same name as other `lodash` methods. */ 2360 | var nativeGetSymbols = Object.getOwnPropertySymbols; 2361 | 2362 | /** 2363 | * Creates an array of the own enumerable symbols of `object`. 2364 | * 2365 | * @private 2366 | * @param {Object} object The object to query. 2367 | * @returns {Array} Returns the array of symbols. 2368 | */ 2369 | var getSymbols = !nativeGetSymbols ? stubArray$1 : function(object) { 2370 | if (object == null) { 2371 | return []; 2372 | } 2373 | object = Object(object); 2374 | return arrayFilter$1(nativeGetSymbols(object), function(symbol) { 2375 | return propertyIsEnumerable.call(object, symbol); 2376 | }); 2377 | }; 2378 | 2379 | var _getSymbols = getSymbols; 2380 | 2381 | /** 2382 | * The base implementation of `_.times` without support for iteratee shorthands 2383 | * or max array length checks. 2384 | * 2385 | * @private 2386 | * @param {number} n The number of times to invoke `iteratee`. 2387 | * @param {Function} iteratee The function invoked per iteration. 2388 | * @returns {Array} Returns the array of results. 2389 | */ 2390 | function baseTimes(n, iteratee) { 2391 | var index = -1, 2392 | result = Array(n); 2393 | 2394 | while (++index < n) { 2395 | result[index] = iteratee(index); 2396 | } 2397 | return result; 2398 | } 2399 | 2400 | var _baseTimes = baseTimes; 2401 | 2402 | var baseGetTag$3 = _baseGetTag, 2403 | isObjectLike$2 = isObjectLike_1; 2404 | 2405 | /** `Object#toString` result references. */ 2406 | var argsTag = '[object Arguments]'; 2407 | 2408 | /** 2409 | * The base implementation of `_.isArguments`. 2410 | * 2411 | * @private 2412 | * @param {*} value The value to check. 2413 | * @returns {boolean} Returns `true` if `value` is an `arguments` object, 2414 | */ 2415 | function baseIsArguments(value) { 2416 | return isObjectLike$2(value) && baseGetTag$3(value) == argsTag; 2417 | } 2418 | 2419 | var _baseIsArguments = baseIsArguments; 2420 | 2421 | var baseIsArguments$1 = _baseIsArguments, 2422 | isObjectLike$3 = isObjectLike_1; 2423 | 2424 | /** Used for built-in method references. */ 2425 | var objectProto$6 = Object.prototype; 2426 | 2427 | /** Used to check objects for own properties. */ 2428 | var hasOwnProperty$5 = objectProto$6.hasOwnProperty; 2429 | 2430 | /** Built-in value references. */ 2431 | var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; 2432 | 2433 | /** 2434 | * Checks if `value` is likely an `arguments` object. 2435 | * 2436 | * @static 2437 | * @memberOf _ 2438 | * @since 0.1.0 2439 | * @category Lang 2440 | * @param {*} value The value to check. 2441 | * @returns {boolean} Returns `true` if `value` is an `arguments` object, 2442 | * else `false`. 2443 | * @example 2444 | * 2445 | * _.isArguments(function() { return arguments; }()); 2446 | * // => true 2447 | * 2448 | * _.isArguments([1, 2, 3]); 2449 | * // => false 2450 | */ 2451 | var isArguments = baseIsArguments$1(function() { return arguments; }()) ? baseIsArguments$1 : function(value) { 2452 | return isObjectLike$3(value) && hasOwnProperty$5.call(value, 'callee') && 2453 | !propertyIsEnumerable$1.call(value, 'callee'); 2454 | }; 2455 | 2456 | var isArguments_1 = isArguments; 2457 | 2458 | /** 2459 | * This method returns `false`. 2460 | * 2461 | * @static 2462 | * @memberOf _ 2463 | * @since 4.13.0 2464 | * @category Util 2465 | * @returns {boolean} Returns `false`. 2466 | * @example 2467 | * 2468 | * _.times(2, _.stubFalse); 2469 | * // => [false, false] 2470 | */ 2471 | function stubFalse() { 2472 | return false; 2473 | } 2474 | 2475 | var stubFalse_1 = stubFalse; 2476 | 2477 | var isBuffer_1 = createCommonjsModule(function (module, exports) { 2478 | var root = _root, 2479 | stubFalse = stubFalse_1; 2480 | 2481 | /** Detect free variable `exports`. */ 2482 | var freeExports = exports && !exports.nodeType && exports; 2483 | 2484 | /** Detect free variable `module`. */ 2485 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; 2486 | 2487 | /** Detect the popular CommonJS extension `module.exports`. */ 2488 | var moduleExports = freeModule && freeModule.exports === freeExports; 2489 | 2490 | /** Built-in value references. */ 2491 | var Buffer = moduleExports ? root.Buffer : undefined; 2492 | 2493 | /* Built-in method references for those with the same name as other `lodash` methods. */ 2494 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; 2495 | 2496 | /** 2497 | * Checks if `value` is a buffer. 2498 | * 2499 | * @static 2500 | * @memberOf _ 2501 | * @since 4.3.0 2502 | * @category Lang 2503 | * @param {*} value The value to check. 2504 | * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 2505 | * @example 2506 | * 2507 | * _.isBuffer(new Buffer(2)); 2508 | * // => true 2509 | * 2510 | * _.isBuffer(new Uint8Array(2)); 2511 | * // => false 2512 | */ 2513 | var isBuffer = nativeIsBuffer || stubFalse; 2514 | 2515 | module.exports = isBuffer; 2516 | }); 2517 | 2518 | /** Used as references for various `Number` constants. */ 2519 | var MAX_SAFE_INTEGER = 9007199254740991; 2520 | 2521 | /** Used to detect unsigned integer values. */ 2522 | var reIsUint = /^(?:0|[1-9]\d*)$/; 2523 | 2524 | /** 2525 | * Checks if `value` is a valid array-like index. 2526 | * 2527 | * @private 2528 | * @param {*} value The value to check. 2529 | * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 2530 | * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 2531 | */ 2532 | function isIndex(value, length) { 2533 | var type = typeof value; 2534 | length = length == null ? MAX_SAFE_INTEGER : length; 2535 | 2536 | return !!length && 2537 | (type == 'number' || 2538 | (type != 'symbol' && reIsUint.test(value))) && 2539 | (value > -1 && value % 1 == 0 && value < length); 2540 | } 2541 | 2542 | var _isIndex = isIndex; 2543 | 2544 | /** Used as references for various `Number` constants. */ 2545 | var MAX_SAFE_INTEGER$1 = 9007199254740991; 2546 | 2547 | /** 2548 | * Checks if `value` is a valid array-like length. 2549 | * 2550 | * **Note:** This method is loosely based on 2551 | * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 2552 | * 2553 | * @static 2554 | * @memberOf _ 2555 | * @since 4.0.0 2556 | * @category Lang 2557 | * @param {*} value The value to check. 2558 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 2559 | * @example 2560 | * 2561 | * _.isLength(3); 2562 | * // => true 2563 | * 2564 | * _.isLength(Number.MIN_VALUE); 2565 | * // => false 2566 | * 2567 | * _.isLength(Infinity); 2568 | * // => false 2569 | * 2570 | * _.isLength('3'); 2571 | * // => false 2572 | */ 2573 | function isLength(value) { 2574 | return typeof value == 'number' && 2575 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1; 2576 | } 2577 | 2578 | var isLength_1 = isLength; 2579 | 2580 | var baseGetTag$4 = _baseGetTag, 2581 | isLength$1 = isLength_1, 2582 | isObjectLike$4 = isObjectLike_1; 2583 | 2584 | /** `Object#toString` result references. */ 2585 | var argsTag$1 = '[object Arguments]', 2586 | arrayTag = '[object Array]', 2587 | boolTag$1 = '[object Boolean]', 2588 | dateTag$1 = '[object Date]', 2589 | errorTag$1 = '[object Error]', 2590 | funcTag$1 = '[object Function]', 2591 | mapTag$1 = '[object Map]', 2592 | numberTag$1 = '[object Number]', 2593 | objectTag = '[object Object]', 2594 | regexpTag$1 = '[object RegExp]', 2595 | setTag$1 = '[object Set]', 2596 | stringTag$1 = '[object String]', 2597 | weakMapTag = '[object WeakMap]'; 2598 | 2599 | var arrayBufferTag$1 = '[object ArrayBuffer]', 2600 | dataViewTag$1 = '[object DataView]', 2601 | float32Tag = '[object Float32Array]', 2602 | float64Tag = '[object Float64Array]', 2603 | int8Tag = '[object Int8Array]', 2604 | int16Tag = '[object Int16Array]', 2605 | int32Tag = '[object Int32Array]', 2606 | uint8Tag = '[object Uint8Array]', 2607 | uint8ClampedTag = '[object Uint8ClampedArray]', 2608 | uint16Tag = '[object Uint16Array]', 2609 | uint32Tag = '[object Uint32Array]'; 2610 | 2611 | /** Used to identify `toStringTag` values of typed arrays. */ 2612 | var typedArrayTags = {}; 2613 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 2614 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 2615 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 2616 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 2617 | typedArrayTags[uint32Tag] = true; 2618 | typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] = 2619 | typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = 2620 | typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag$1] = 2621 | typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = 2622 | typedArrayTags[mapTag$1] = typedArrayTags[numberTag$1] = 2623 | typedArrayTags[objectTag] = typedArrayTags[regexpTag$1] = 2624 | typedArrayTags[setTag$1] = typedArrayTags[stringTag$1] = 2625 | typedArrayTags[weakMapTag] = false; 2626 | 2627 | /** 2628 | * The base implementation of `_.isTypedArray` without Node.js optimizations. 2629 | * 2630 | * @private 2631 | * @param {*} value The value to check. 2632 | * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 2633 | */ 2634 | function baseIsTypedArray(value) { 2635 | return isObjectLike$4(value) && 2636 | isLength$1(value.length) && !!typedArrayTags[baseGetTag$4(value)]; 2637 | } 2638 | 2639 | var _baseIsTypedArray = baseIsTypedArray; 2640 | 2641 | /** 2642 | * The base implementation of `_.unary` without support for storing metadata. 2643 | * 2644 | * @private 2645 | * @param {Function} func The function to cap arguments for. 2646 | * @returns {Function} Returns the new capped function. 2647 | */ 2648 | function baseUnary(func) { 2649 | return function(value) { 2650 | return func(value); 2651 | }; 2652 | } 2653 | 2654 | var _baseUnary = baseUnary; 2655 | 2656 | var _nodeUtil = createCommonjsModule(function (module, exports) { 2657 | var freeGlobal = _freeGlobal; 2658 | 2659 | /** Detect free variable `exports`. */ 2660 | var freeExports = exports && !exports.nodeType && exports; 2661 | 2662 | /** Detect free variable `module`. */ 2663 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; 2664 | 2665 | /** Detect the popular CommonJS extension `module.exports`. */ 2666 | var moduleExports = freeModule && freeModule.exports === freeExports; 2667 | 2668 | /** Detect free variable `process` from Node.js. */ 2669 | var freeProcess = moduleExports && freeGlobal.process; 2670 | 2671 | /** Used to access faster Node.js helpers. */ 2672 | var nodeUtil = (function() { 2673 | try { 2674 | // Use `util.types` for Node.js 10+. 2675 | var types = freeModule && freeModule.require && freeModule.require('util').types; 2676 | 2677 | if (types) { 2678 | return types; 2679 | } 2680 | 2681 | // Legacy `process.binding('util')` for Node.js < 10. 2682 | return freeProcess && freeProcess.binding && freeProcess.binding('util'); 2683 | } catch (e) {} 2684 | }()); 2685 | 2686 | module.exports = nodeUtil; 2687 | }); 2688 | 2689 | var baseIsTypedArray$1 = _baseIsTypedArray, 2690 | baseUnary$1 = _baseUnary, 2691 | nodeUtil = _nodeUtil; 2692 | 2693 | /* Node.js helper references. */ 2694 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 2695 | 2696 | /** 2697 | * Checks if `value` is classified as a typed array. 2698 | * 2699 | * @static 2700 | * @memberOf _ 2701 | * @since 3.0.0 2702 | * @category Lang 2703 | * @param {*} value The value to check. 2704 | * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 2705 | * @example 2706 | * 2707 | * _.isTypedArray(new Uint8Array); 2708 | * // => true 2709 | * 2710 | * _.isTypedArray([]); 2711 | * // => false 2712 | */ 2713 | var isTypedArray = nodeIsTypedArray ? baseUnary$1(nodeIsTypedArray) : baseIsTypedArray$1; 2714 | 2715 | var isTypedArray_1 = isTypedArray; 2716 | 2717 | var baseTimes$1 = _baseTimes, 2718 | isArguments$1 = isArguments_1, 2719 | isArray$2 = isArray_1, 2720 | isBuffer = isBuffer_1, 2721 | isIndex$1 = _isIndex, 2722 | isTypedArray$1 = isTypedArray_1; 2723 | 2724 | /** Used for built-in method references. */ 2725 | var objectProto$7 = Object.prototype; 2726 | 2727 | /** Used to check objects for own properties. */ 2728 | var hasOwnProperty$6 = objectProto$7.hasOwnProperty; 2729 | 2730 | /** 2731 | * Creates an array of the enumerable property names of the array-like `value`. 2732 | * 2733 | * @private 2734 | * @param {*} value The value to query. 2735 | * @param {boolean} inherited Specify returning inherited property names. 2736 | * @returns {Array} Returns the array of property names. 2737 | */ 2738 | function arrayLikeKeys(value, inherited) { 2739 | var isArr = isArray$2(value), 2740 | isArg = !isArr && isArguments$1(value), 2741 | isBuff = !isArr && !isArg && isBuffer(value), 2742 | isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), 2743 | skipIndexes = isArr || isArg || isBuff || isType, 2744 | result = skipIndexes ? baseTimes$1(value.length, String) : [], 2745 | length = result.length; 2746 | 2747 | for (var key in value) { 2748 | if ((inherited || hasOwnProperty$6.call(value, key)) && 2749 | !(skipIndexes && ( 2750 | // Safari 9 has enumerable `arguments.length` in strict mode. 2751 | key == 'length' || 2752 | // Node.js 0.10 has enumerable non-index properties on buffers. 2753 | (isBuff && (key == 'offset' || key == 'parent')) || 2754 | // PhantomJS 2 has enumerable non-index properties on typed arrays. 2755 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 2756 | // Skip index properties. 2757 | isIndex$1(key, length) 2758 | ))) { 2759 | result.push(key); 2760 | } 2761 | } 2762 | return result; 2763 | } 2764 | 2765 | var _arrayLikeKeys = arrayLikeKeys; 2766 | 2767 | /** Used for built-in method references. */ 2768 | var objectProto$8 = Object.prototype; 2769 | 2770 | /** 2771 | * Checks if `value` is likely a prototype object. 2772 | * 2773 | * @private 2774 | * @param {*} value The value to check. 2775 | * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 2776 | */ 2777 | function isPrototype(value) { 2778 | var Ctor = value && value.constructor, 2779 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8; 2780 | 2781 | return value === proto; 2782 | } 2783 | 2784 | var _isPrototype = isPrototype; 2785 | 2786 | /** 2787 | * Creates a unary function that invokes `func` with its argument transformed. 2788 | * 2789 | * @private 2790 | * @param {Function} func The function to wrap. 2791 | * @param {Function} transform The argument transform. 2792 | * @returns {Function} Returns the new function. 2793 | */ 2794 | function overArg(func, transform) { 2795 | return function(arg) { 2796 | return func(transform(arg)); 2797 | }; 2798 | } 2799 | 2800 | var _overArg = overArg; 2801 | 2802 | var overArg$1 = _overArg; 2803 | 2804 | /* Built-in method references for those with the same name as other `lodash` methods. */ 2805 | var nativeKeys = overArg$1(Object.keys, Object); 2806 | 2807 | var _nativeKeys = nativeKeys; 2808 | 2809 | var isPrototype$1 = _isPrototype, 2810 | nativeKeys$1 = _nativeKeys; 2811 | 2812 | /** Used for built-in method references. */ 2813 | var objectProto$9 = Object.prototype; 2814 | 2815 | /** Used to check objects for own properties. */ 2816 | var hasOwnProperty$7 = objectProto$9.hasOwnProperty; 2817 | 2818 | /** 2819 | * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 2820 | * 2821 | * @private 2822 | * @param {Object} object The object to query. 2823 | * @returns {Array} Returns the array of property names. 2824 | */ 2825 | function baseKeys(object) { 2826 | if (!isPrototype$1(object)) { 2827 | return nativeKeys$1(object); 2828 | } 2829 | var result = []; 2830 | for (var key in Object(object)) { 2831 | if (hasOwnProperty$7.call(object, key) && key != 'constructor') { 2832 | result.push(key); 2833 | } 2834 | } 2835 | return result; 2836 | } 2837 | 2838 | var _baseKeys = baseKeys; 2839 | 2840 | var isFunction$2 = isFunction_1, 2841 | isLength$2 = isLength_1; 2842 | 2843 | /** 2844 | * Checks if `value` is array-like. A value is considered array-like if it's 2845 | * not a function and has a `value.length` that's an integer greater than or 2846 | * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 2847 | * 2848 | * @static 2849 | * @memberOf _ 2850 | * @since 4.0.0 2851 | * @category Lang 2852 | * @param {*} value The value to check. 2853 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 2854 | * @example 2855 | * 2856 | * _.isArrayLike([1, 2, 3]); 2857 | * // => true 2858 | * 2859 | * _.isArrayLike(document.body.children); 2860 | * // => true 2861 | * 2862 | * _.isArrayLike('abc'); 2863 | * // => true 2864 | * 2865 | * _.isArrayLike(_.noop); 2866 | * // => false 2867 | */ 2868 | function isArrayLike(value) { 2869 | return value != null && isLength$2(value.length) && !isFunction$2(value); 2870 | } 2871 | 2872 | var isArrayLike_1 = isArrayLike; 2873 | 2874 | var arrayLikeKeys$1 = _arrayLikeKeys, 2875 | baseKeys$1 = _baseKeys, 2876 | isArrayLike$1 = isArrayLike_1; 2877 | 2878 | /** 2879 | * Creates an array of the own enumerable property names of `object`. 2880 | * 2881 | * **Note:** Non-object values are coerced to objects. See the 2882 | * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 2883 | * for more details. 2884 | * 2885 | * @static 2886 | * @since 0.1.0 2887 | * @memberOf _ 2888 | * @category Object 2889 | * @param {Object} object The object to query. 2890 | * @returns {Array} Returns the array of property names. 2891 | * @example 2892 | * 2893 | * function Foo() { 2894 | * this.a = 1; 2895 | * this.b = 2; 2896 | * } 2897 | * 2898 | * Foo.prototype.c = 3; 2899 | * 2900 | * _.keys(new Foo); 2901 | * // => ['a', 'b'] (iteration order is not guaranteed) 2902 | * 2903 | * _.keys('hi'); 2904 | * // => ['0', '1'] 2905 | */ 2906 | function keys(object) { 2907 | return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys$1(object); 2908 | } 2909 | 2910 | var keys_1 = keys; 2911 | 2912 | var baseGetAllKeys$1 = _baseGetAllKeys, 2913 | getSymbols$1 = _getSymbols, 2914 | keys$1 = keys_1; 2915 | 2916 | /** 2917 | * Creates an array of own enumerable property names and symbols of `object`. 2918 | * 2919 | * @private 2920 | * @param {Object} object The object to query. 2921 | * @returns {Array} Returns the array of property names and symbols. 2922 | */ 2923 | function getAllKeys(object) { 2924 | return baseGetAllKeys$1(object, keys$1, getSymbols$1); 2925 | } 2926 | 2927 | var _getAllKeys = getAllKeys; 2928 | 2929 | var getAllKeys$1 = _getAllKeys; 2930 | 2931 | /** Used to compose bitmasks for value comparisons. */ 2932 | var COMPARE_PARTIAL_FLAG$2 = 1; 2933 | 2934 | /** Used for built-in method references. */ 2935 | var objectProto$a = Object.prototype; 2936 | 2937 | /** Used to check objects for own properties. */ 2938 | var hasOwnProperty$8 = objectProto$a.hasOwnProperty; 2939 | 2940 | /** 2941 | * A specialized version of `baseIsEqualDeep` for objects with support for 2942 | * partial deep comparisons. 2943 | * 2944 | * @private 2945 | * @param {Object} object The object to compare. 2946 | * @param {Object} other The other object to compare. 2947 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 2948 | * @param {Function} customizer The function to customize comparisons. 2949 | * @param {Function} equalFunc The function to determine equivalents of values. 2950 | * @param {Object} stack Tracks traversed `object` and `other` objects. 2951 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 2952 | */ 2953 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 2954 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2, 2955 | objProps = getAllKeys$1(object), 2956 | objLength = objProps.length, 2957 | othProps = getAllKeys$1(other), 2958 | othLength = othProps.length; 2959 | 2960 | if (objLength != othLength && !isPartial) { 2961 | return false; 2962 | } 2963 | var index = objLength; 2964 | while (index--) { 2965 | var key = objProps[index]; 2966 | if (!(isPartial ? key in other : hasOwnProperty$8.call(other, key))) { 2967 | return false; 2968 | } 2969 | } 2970 | // Assume cyclic values are equal. 2971 | var stacked = stack.get(object); 2972 | if (stacked && stack.get(other)) { 2973 | return stacked == other; 2974 | } 2975 | var result = true; 2976 | stack.set(object, other); 2977 | stack.set(other, object); 2978 | 2979 | var skipCtor = isPartial; 2980 | while (++index < objLength) { 2981 | key = objProps[index]; 2982 | var objValue = object[key], 2983 | othValue = other[key]; 2984 | 2985 | if (customizer) { 2986 | var compared = isPartial 2987 | ? customizer(othValue, objValue, key, other, object, stack) 2988 | : customizer(objValue, othValue, key, object, other, stack); 2989 | } 2990 | // Recursively compare objects (susceptible to call stack limits). 2991 | if (!(compared === undefined 2992 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 2993 | : compared 2994 | )) { 2995 | result = false; 2996 | break; 2997 | } 2998 | skipCtor || (skipCtor = key == 'constructor'); 2999 | } 3000 | if (result && !skipCtor) { 3001 | var objCtor = object.constructor, 3002 | othCtor = other.constructor; 3003 | 3004 | // Non `Object` object instances with different constructors are not equal. 3005 | if (objCtor != othCtor && 3006 | ('constructor' in object && 'constructor' in other) && 3007 | !(typeof objCtor == 'function' && objCtor instanceof objCtor && 3008 | typeof othCtor == 'function' && othCtor instanceof othCtor)) { 3009 | result = false; 3010 | } 3011 | } 3012 | stack['delete'](object); 3013 | stack['delete'](other); 3014 | return result; 3015 | } 3016 | 3017 | var _equalObjects = equalObjects; 3018 | 3019 | var getNative$3 = _getNative, 3020 | root$6 = _root; 3021 | 3022 | /* Built-in method references that are verified to be native. */ 3023 | var DataView = getNative$3(root$6, 'DataView'); 3024 | 3025 | var _DataView = DataView; 3026 | 3027 | var getNative$4 = _getNative, 3028 | root$7 = _root; 3029 | 3030 | /* Built-in method references that are verified to be native. */ 3031 | var Promise = getNative$4(root$7, 'Promise'); 3032 | 3033 | var _Promise = Promise; 3034 | 3035 | var getNative$5 = _getNative, 3036 | root$8 = _root; 3037 | 3038 | /* Built-in method references that are verified to be native. */ 3039 | var Set = getNative$5(root$8, 'Set'); 3040 | 3041 | var _Set = Set; 3042 | 3043 | var getNative$6 = _getNative, 3044 | root$9 = _root; 3045 | 3046 | /* Built-in method references that are verified to be native. */ 3047 | var WeakMap = getNative$6(root$9, 'WeakMap'); 3048 | 3049 | var _WeakMap = WeakMap; 3050 | 3051 | var DataView$1 = _DataView, 3052 | Map$3 = _Map, 3053 | Promise$1 = _Promise, 3054 | Set$1 = _Set, 3055 | WeakMap$1 = _WeakMap, 3056 | baseGetTag$5 = _baseGetTag, 3057 | toSource$2 = _toSource; 3058 | 3059 | /** `Object#toString` result references. */ 3060 | var mapTag$2 = '[object Map]', 3061 | objectTag$1 = '[object Object]', 3062 | promiseTag = '[object Promise]', 3063 | setTag$2 = '[object Set]', 3064 | weakMapTag$1 = '[object WeakMap]'; 3065 | 3066 | var dataViewTag$2 = '[object DataView]'; 3067 | 3068 | /** Used to detect maps, sets, and weakmaps. */ 3069 | var dataViewCtorString = toSource$2(DataView$1), 3070 | mapCtorString = toSource$2(Map$3), 3071 | promiseCtorString = toSource$2(Promise$1), 3072 | setCtorString = toSource$2(Set$1), 3073 | weakMapCtorString = toSource$2(WeakMap$1); 3074 | 3075 | /** 3076 | * Gets the `toStringTag` of `value`. 3077 | * 3078 | * @private 3079 | * @param {*} value The value to query. 3080 | * @returns {string} Returns the `toStringTag`. 3081 | */ 3082 | var getTag = baseGetTag$5; 3083 | 3084 | // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 3085 | if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$2) || 3086 | (Map$3 && getTag(new Map$3) != mapTag$2) || 3087 | (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || 3088 | (Set$1 && getTag(new Set$1) != setTag$2) || 3089 | (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag$1)) { 3090 | getTag = function(value) { 3091 | var result = baseGetTag$5(value), 3092 | Ctor = result == objectTag$1 ? value.constructor : undefined, 3093 | ctorString = Ctor ? toSource$2(Ctor) : ''; 3094 | 3095 | if (ctorString) { 3096 | switch (ctorString) { 3097 | case dataViewCtorString: return dataViewTag$2; 3098 | case mapCtorString: return mapTag$2; 3099 | case promiseCtorString: return promiseTag; 3100 | case setCtorString: return setTag$2; 3101 | case weakMapCtorString: return weakMapTag$1; 3102 | } 3103 | } 3104 | return result; 3105 | }; 3106 | } 3107 | 3108 | var _getTag = getTag; 3109 | 3110 | var Stack$1 = _Stack, 3111 | equalArrays$2 = _equalArrays, 3112 | equalByTag$1 = _equalByTag, 3113 | equalObjects$1 = _equalObjects, 3114 | getTag$1 = _getTag, 3115 | isArray$3 = isArray_1, 3116 | isBuffer$1 = isBuffer_1, 3117 | isTypedArray$2 = isTypedArray_1; 3118 | 3119 | /** Used to compose bitmasks for value comparisons. */ 3120 | var COMPARE_PARTIAL_FLAG$3 = 1; 3121 | 3122 | /** `Object#toString` result references. */ 3123 | var argsTag$2 = '[object Arguments]', 3124 | arrayTag$1 = '[object Array]', 3125 | objectTag$2 = '[object Object]'; 3126 | 3127 | /** Used for built-in method references. */ 3128 | var objectProto$b = Object.prototype; 3129 | 3130 | /** Used to check objects for own properties. */ 3131 | var hasOwnProperty$9 = objectProto$b.hasOwnProperty; 3132 | 3133 | /** 3134 | * A specialized version of `baseIsEqual` for arrays and objects which performs 3135 | * deep comparisons and tracks traversed objects enabling objects with circular 3136 | * references to be compared. 3137 | * 3138 | * @private 3139 | * @param {Object} object The object to compare. 3140 | * @param {Object} other The other object to compare. 3141 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 3142 | * @param {Function} customizer The function to customize comparisons. 3143 | * @param {Function} equalFunc The function to determine equivalents of values. 3144 | * @param {Object} [stack] Tracks traversed `object` and `other` objects. 3145 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 3146 | */ 3147 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 3148 | var objIsArr = isArray$3(object), 3149 | othIsArr = isArray$3(other), 3150 | objTag = objIsArr ? arrayTag$1 : getTag$1(object), 3151 | othTag = othIsArr ? arrayTag$1 : getTag$1(other); 3152 | 3153 | objTag = objTag == argsTag$2 ? objectTag$2 : objTag; 3154 | othTag = othTag == argsTag$2 ? objectTag$2 : othTag; 3155 | 3156 | var objIsObj = objTag == objectTag$2, 3157 | othIsObj = othTag == objectTag$2, 3158 | isSameTag = objTag == othTag; 3159 | 3160 | if (isSameTag && isBuffer$1(object)) { 3161 | if (!isBuffer$1(other)) { 3162 | return false; 3163 | } 3164 | objIsArr = true; 3165 | objIsObj = false; 3166 | } 3167 | if (isSameTag && !objIsObj) { 3168 | stack || (stack = new Stack$1); 3169 | return (objIsArr || isTypedArray$2(object)) 3170 | ? equalArrays$2(object, other, bitmask, customizer, equalFunc, stack) 3171 | : equalByTag$1(object, other, objTag, bitmask, customizer, equalFunc, stack); 3172 | } 3173 | if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) { 3174 | var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, '__wrapped__'), 3175 | othIsWrapped = othIsObj && hasOwnProperty$9.call(other, '__wrapped__'); 3176 | 3177 | if (objIsWrapped || othIsWrapped) { 3178 | var objUnwrapped = objIsWrapped ? object.value() : object, 3179 | othUnwrapped = othIsWrapped ? other.value() : other; 3180 | 3181 | stack || (stack = new Stack$1); 3182 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 3183 | } 3184 | } 3185 | if (!isSameTag) { 3186 | return false; 3187 | } 3188 | stack || (stack = new Stack$1); 3189 | return equalObjects$1(object, other, bitmask, customizer, equalFunc, stack); 3190 | } 3191 | 3192 | var _baseIsEqualDeep = baseIsEqualDeep; 3193 | 3194 | var baseIsEqualDeep$1 = _baseIsEqualDeep, 3195 | isObjectLike$5 = isObjectLike_1; 3196 | 3197 | /** 3198 | * The base implementation of `_.isEqual` which supports partial comparisons 3199 | * and tracks traversed objects. 3200 | * 3201 | * @private 3202 | * @param {*} value The value to compare. 3203 | * @param {*} other The other value to compare. 3204 | * @param {boolean} bitmask The bitmask flags. 3205 | * 1 - Unordered comparison 3206 | * 2 - Partial comparison 3207 | * @param {Function} [customizer] The function to customize comparisons. 3208 | * @param {Object} [stack] Tracks traversed `value` and `other` objects. 3209 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 3210 | */ 3211 | function baseIsEqual(value, other, bitmask, customizer, stack) { 3212 | if (value === other) { 3213 | return true; 3214 | } 3215 | if (value == null || other == null || (!isObjectLike$5(value) && !isObjectLike$5(other))) { 3216 | return value !== value && other !== other; 3217 | } 3218 | return baseIsEqualDeep$1(value, other, bitmask, customizer, baseIsEqual, stack); 3219 | } 3220 | 3221 | var _baseIsEqual = baseIsEqual; 3222 | 3223 | var baseIsEqual$1 = _baseIsEqual; 3224 | 3225 | /** 3226 | * Performs a deep comparison between two values to determine if they are 3227 | * equivalent. 3228 | * 3229 | * **Note:** This method supports comparing arrays, array buffers, booleans, 3230 | * date objects, error objects, maps, numbers, `Object` objects, regexes, 3231 | * sets, strings, symbols, and typed arrays. `Object` objects are compared 3232 | * by their own, not inherited, enumerable properties. Functions and DOM 3233 | * nodes are compared by strict equality, i.e. `===`. 3234 | * 3235 | * @static 3236 | * @memberOf _ 3237 | * @since 0.1.0 3238 | * @category Lang 3239 | * @param {*} value The value to compare. 3240 | * @param {*} other The other value to compare. 3241 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 3242 | * @example 3243 | * 3244 | * var object = { 'a': 1 }; 3245 | * var other = { 'a': 1 }; 3246 | * 3247 | * _.isEqual(object, other); 3248 | * // => true 3249 | * 3250 | * object === other; 3251 | * // => false 3252 | */ 3253 | function isEqual(value, other) { 3254 | return baseIsEqual$1(value, other); 3255 | } 3256 | 3257 | var isEqual_1 = isEqual; 3258 | 3259 | var toPrecision = function (num, precision) { 3260 | var p = precision | 0; 3261 | return p > 0 ? parseFloat(num.toFixed(p)) : num 3262 | }; 3263 | 3264 | var VueCtrlComponent = { 3265 | name: 'v-ctrl', 3266 | abstract: true, 3267 | props: { 3268 | direction: { 3269 | type: String, 3270 | default: 'h', 3271 | validator: function validator (val) { 3272 | return ['v', 'h', 'vh', 'hv'].indexOf(val) > -1 3273 | } 3274 | }, 3275 | throttle: { 3276 | type: Number, 3277 | default: 80 3278 | }, 3279 | precision: { 3280 | type: Number 3281 | } 3282 | }, 3283 | 3284 | methods: { 3285 | msdown: function msdown (e) { 3286 | e.preventDefault(); 3287 | document.addEventListener('mousemove', this.msmove); 3288 | document.addEventListener('mouseup', this.msup); 3289 | this.next(e); 3290 | }, 3291 | 3292 | msmove: function msmove (e) { 3293 | e.preventDefault(); 3294 | this.next(e); 3295 | }, 3296 | 3297 | msup: function msup (e) { 3298 | this.next(e); 3299 | document.removeEventListener('mousemove', this.msmove); 3300 | document.removeEventListener('mouseup', this.msup); 3301 | }, 3302 | 3303 | notify: function notify (val) { 3304 | if (isEqual_1(this.memo, val) === false) { 3305 | this.memo = val; 3306 | this.$emit('change', val); 3307 | } 3308 | }, 3309 | 3310 | next: function next (ref) { 3311 | if ( ref === void 0 ) { ref = {}; } 3312 | var clientX = ref.clientX; if ( clientX === void 0 ) { clientX = 0; } 3313 | var clientY = ref.clientY; if ( clientY === void 0 ) { clientY = 0; } 3314 | 3315 | var ref$1 = this; 3316 | var direction = ref$1.direction; 3317 | var adjust = ref$1.adjust; 3318 | var rect = this.$el.getBoundingClientRect(); 3319 | 3320 | var left = rect.left; 3321 | var width = rect.width; 3322 | var deltaX = clientX - left; 3323 | var x = adjust(deltaX / width); 3324 | 3325 | if (direction === 'h') { 3326 | return this.notify(x) 3327 | } 3328 | 3329 | var top = rect.top; 3330 | var height = rect.height; 3331 | var deltaY = clientY - top; 3332 | var y = adjust(deltaY / height); 3333 | 3334 | if (direction === 'v') { 3335 | return this.notify(y) 3336 | } 3337 | 3338 | // both direction 3339 | this.notify([x, y]); 3340 | }, 3341 | 3342 | adjust: function adjust (num) { 3343 | return toPrecision(clamp_1(num, 0, 1), this.precision) 3344 | } 3345 | }, 3346 | 3347 | render: function render (h) { 3348 | return this.$slots.default[0] 3349 | }, 3350 | 3351 | created: function created () { 3352 | var ref = this; 3353 | var msdown = ref.msdown; 3354 | var msmove = ref.msmove; 3355 | 3356 | this.msdown = msdown.bind(this); 3357 | this.msmove = throttle_1(msmove.bind(this), this.throttle); 3358 | 3359 | this.memo = null; 3360 | }, 3361 | 3362 | mounted: function mounted () { 3363 | this.$el.addEventListener('mousedown', this.msdown); 3364 | }, 3365 | 3366 | destroyed: function destroyed () { 3367 | this.$el.removeEventListener('mousedown', this.msdown); 3368 | }, 3369 | 3370 | install: function install () { 3371 | Vue.component(VueCtrlComponent.name, VueCtrlComponent); 3372 | } 3373 | }; 3374 | 3375 | if (typeof window !== 'undefined' && window.Vue) { 3376 | Vue.use(VueCtrlComponent); 3377 | } 3378 | 3379 | var index$2 = { VueCtrlComponent: VueCtrlComponent }; 3380 | //# sourceMappingURL=index.esm.js.map 3381 | 3382 | function styleInject(css, ref) { 3383 | if ( ref === void 0 ) { ref = {}; } 3384 | var insertAt = ref.insertAt; 3385 | 3386 | if (!css || typeof document === 'undefined') { return; } 3387 | 3388 | var head = document.head || document.getElementsByTagName('head')[0]; 3389 | var style = document.createElement('style'); 3390 | style.type = 'text/css'; 3391 | 3392 | if (insertAt === 'top') { 3393 | if (head.firstChild) { 3394 | head.insertBefore(style, head.firstChild); 3395 | } else { 3396 | head.appendChild(style); 3397 | } 3398 | } else { 3399 | head.appendChild(style); 3400 | } 3401 | 3402 | if (style.styleSheet) { 3403 | style.styleSheet.cssText = css; 3404 | } else { 3405 | style.appendChild(document.createTextNode(css)); 3406 | } 3407 | } 3408 | 3409 | var css = ".cp__wrapper {\n width: 250px;\n margin: 0;\n background: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3);\n box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3);\n font-family: Menlo, 'Microsoft Yahei', sans-serif;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.cp__v-ctrl {\n position: relative;\n}\n\n.cp__thumb {\n position: absolute;\n width: 12px;\n height: 12px;\n top: 0;\n border-radius: 50%;\n margin-top: -1px;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%);\n background-color: #f8f8f8;\n -webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .368627);\n box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .368627);\n cursor: default;\n}\n\n\n.cp__saturation {\n position: relative;\n width: 100%;\n padding-bottom: 55%;\n border-radius: 2px 2px 0 0;\n overflow: hidden\n}\n\n\n.cp__saturation > div {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n}\n\n\n.cp__saturation > .msk-white {\n background: -webkit-gradient(linear, left top, right top, from(#fff), to(hsla(0, 0%, 100%, 0)));\n background: linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0));\n}\n\n\n.cp__saturation > .msk-black {\n background: -webkit-gradient(linear, left bottom, left top, from(#000), to(transparent));\n background: linear-gradient(0deg, #000, transparent);\n}\n\n\n.cp__saturation > .cp__thumb {\n background-color: transparent;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0, 0, 0, .3), 0 0 1px 2px rgba(0, 0, 0, .4);\n box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0, 0, 0, .3), 0 0 1px 2px rgba(0, 0, 0, .4);\n}\n\n\n.cp__ctrl-pane {\n position: relative;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 16px 16px 12px\n}\n\n\n.cp__ctrl-pane > div {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n\n.cp__tracks {\n -webkit-box-flex: 1;\n -ms-flex: 1 0 0px;\n flex: 1 0 0;\n}\n\n.cp__ctrl-bar {\n height: 10px;\n}\n\n.cp__ctrl-hue {\n background: -webkit-gradient(linear, right top, left top, from(red), color-stop(17%, #ff0), color-stop(33%, #0f0), color-stop(50%, #0ff), color-stop(67%, #00f), color-stop(83%, #f0f), to(red));\n background: linear-gradient(-90deg, red, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, red);\n}\n\n.cp__ctrl-alpha {\n margin-top: 8px;\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) left center;\n}\n\n.cp__preview {\n position: relative;\n width: 28px;\n height: 28px;\n margin-right: 5px;\n overflow: hidden;\n border-radius: 50%;\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) center\n}\n\n.cp__preview > div {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n border: 1px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n.cp__fm-fields {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1\n}\n\n.cp__fm-fields > div {\n padding-left: 6px;\n -webkit-box-flex: 1;\n -ms-flex: 1 0 0px;\n flex: 1 0 0;\n}\n\n.cp__fm-fields input {\n width: 100%;\n height: 22px;\n font-size: 11px;\n text-align: center;\n color: rgb(51, 51, 51);\n border-radius: 2px;\n border: none;\n -webkit-box-shadow: rgb(218, 218, 218) 0px 0px 0px 1px inset;\n box-shadow: rgb(218, 218, 218) 0px 0px 0px 1px inset;\n -webkit-transition: -webkit-box-shadow 0.2s ease;\n transition: -webkit-box-shadow 0.2s ease;\n transition: box-shadow 0.2s ease;\n transition: box-shadow 0.2s ease, -webkit-box-shadow 0.2s ease;\n -moz-appearance: textfield;\n}\n\n.cp__fm-fields input:focus {\n outline: 0;\n -webkit-box-shadow: rgb(0, 125, 255) 0px 0px 0px 1px inset;\n box-shadow: rgb(0, 125, 255) 0px 0px 0px 1px inset;\n}\n\n.cp__fm-fields input::-webkit-inner-spin-button,\n .cp__fm-fields input::-webkit-outer-spin-button {\n -webkit-appearance: none !important;\n margin: 0;\n}\n\n.cp__fm-fields span {\n display: block;\n margin-top: 12px;\n text-transform: uppercase;\n font-size: 11px;\n line-height: 11px;\n color: rgb(150, 150, 150);\n text-align: center;\n}\n\n/* color format switcher */\n.cp__fm-switcher {\n position: relative;\n width: 32px;\n text-align: right\n}\n.cp__fm-switcher > div {\n position: relative;\n margin-right: -4px;\n margin-top: 12px;\n cursor: pointer;\n}\n.cp__fm-switcher > div > svg {\n width: 24px;\n height: 24px;\n border-radius: 5px;\n background: transparent;\n border: 1px solid transparent;\n}\n.cp__fm-switcher > div > svg:hover {\n border-color: rgb(238, 238, 238);\n background: rgb(238, 238, 238);\n}\n"; 3410 | styleInject(css); 3411 | 3412 | var colorModes = Object.freeze({ 3413 | rgba: ['r', 'g', 'b', 'a'], 3414 | hsla: ['h', 's', 'l', 'a'], 3415 | hex: ['hex'] 3416 | }); 3417 | 3418 | var VColorComponent = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"cp__wrapper"},[_c('v-ctrl',{attrs:{"direction":"vh","precision":2,"throttle":80},on:{"change":_vm.onSaturationChange}},[_c('div',{staticClass:"cp__v-ctrl cp__saturation"},[_c('div',{staticClass:"msk-hue",style:(_vm.styles.saturationPane)}),_vm._v(" "),_c('div',{staticClass:"msk-white"}),_vm._v(" "),_c('div',{staticClass:"msk-black"}),_vm._v(" "),_c('p',{staticClass:"cp__thumb",style:(_vm.styles.saturationThumb)})])]),_vm._v(" "),_c('div',{staticClass:"cp__ctrl-pane"},[_c('div',[_c('div',{staticClass:"cp__preview"},[_c('div',{style:(_vm.styles.preview)})]),_vm._v(" "),_c('div',{staticClass:"cp__tracks"},[_c('v-ctrl',{attrs:{"direction":"h","precision":2,"throttle":80},on:{"change":_vm.onHueChange}},[_c('div',{staticClass:"cp__v-ctrl cp__ctrl-bar cp__ctrl-hue"},[_c('div',{staticClass:"cp__thumb",style:(_vm.styles.hueThumb)})])]),_vm._v(" "),_c('v-ctrl',{attrs:{"direction":"h","precision":2,"throttle":80},on:{"change":_vm.onAlphaChange}},[_c('div',{staticClass:"cp__v-ctrl cp__ctrl-alpha"},[_c('div',{staticClass:"cp__thumb",style:(_vm.styles.alphaThumb)}),_vm._v(" "),_c('div',{staticClass:"cp__ctrl-bar",style:(_vm.styles.alphaTrack)})])])],1)]),_vm._v(" "),_c('div',{staticStyle:{"margin-top":"10px"}},[_c('div',{staticClass:"cp__fm-fields"},_vm._l((_vm.colorModes[_vm.currentMode]),function(k){return _c('div',{key:k},[_c('div',{staticStyle:{"position":"relative"}},[_c('input',{attrs:{"type":_vm.constrains[k].type,"maxlength":_vm.constrains[k].maxlength},domProps:{"value":_vm.colorModel[k]},on:{"change":function($event){_vm.handleInput(k, $event);}}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(k))])])])})),_vm._v(" "),_c('div',{staticClass:"cp__fm-switcher"},[_c('div',{on:{"click":function($event){_vm.changecurrentMode();}}},[_c('svg',{attrs:{"viewBox":"0 0 24 24"}},[_c('path',{attrs:{"fill":"#333","d":"M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}}),_vm._v(" "),_c('path',{attrs:{"fill":"#333","d":"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15Z"}})])])])])])],1)},staticRenderFns: [], 3419 | name: 'color-picker', 3420 | props: { 3421 | color: { 3422 | type: String, 3423 | default: '#ff0000' 3424 | } 3425 | }, 3426 | 3427 | components: { 3428 | 'v-ctrl': index$2.VueCtrlComponent 3429 | }, 3430 | 3431 | data: function data () { 3432 | var ref = this; 3433 | var color = ref.color; 3434 | 3435 | var commonNumber = { 3436 | type: 'number', 3437 | maxlength: 3, 3438 | }; 3439 | var percentValue = { 3440 | type: 'string', 3441 | maxlength: 4 3442 | }; 3443 | 3444 | return Object.assign({}, this.digestProp(color), 3445 | {currentMode: getColorType(color), 3446 | colorModes: colorModes, 3447 | colorModel: { 3448 | hex: '', 3449 | r: '', 3450 | g: '', 3451 | b: '', 3452 | h: '', 3453 | s: '', 3454 | l: '', 3455 | a: '' 3456 | }, 3457 | constrains: { 3458 | r: commonNumber, 3459 | g: commonNumber, 3460 | b: commonNumber, 3461 | h: commonNumber, 3462 | s: percentValue, 3463 | l: percentValue, 3464 | a: { 3465 | type: 'number', 3466 | maxlength: 4 3467 | }, 3468 | hex: { 3469 | type: 'string', 3470 | maxlength: 9 3471 | } 3472 | }}) 3473 | }, 3474 | 3475 | watch: { 3476 | color: { 3477 | immediate: true, 3478 | handler: function handler (newVal, oldVal) { 3479 | if (newVal !== oldVal) { 3480 | index(this, this.digestProp(newVal)); 3481 | } 3482 | } 3483 | }, 3484 | rgba: { 3485 | immediate: true, 3486 | handler: function handler (newVal, oldVal) { 3487 | if (("" + newVal) !== ("" + oldVal)) { 3488 | this.emitChange(); 3489 | } 3490 | } 3491 | } 3492 | }, 3493 | 3494 | computed: { 3495 | hsva: function hsva () { 3496 | var ref = this; 3497 | var hue = ref.hue; 3498 | var alpha = ref.alpha; 3499 | var ref_saturation = ref.saturation; 3500 | var x = ref_saturation.x; 3501 | var y = ref_saturation.y; 3502 | return [ 3503 | hue * 360, 3504 | x * 100, 3505 | (1 - y) * 100, 3506 | alpha 3507 | ] 3508 | }, 3509 | 3510 | rgba: function rgba () { 3511 | var ref = this; 3512 | var alpha = ref.alpha; 3513 | var hsva = ref.hsva; 3514 | var ref$1 = hsv2rgb_1(hsva); 3515 | var r = ref$1[0]; 3516 | var g = ref$1[1]; 3517 | var b = ref$1[2]; 3518 | return [ 3519 | Math.round(r), 3520 | Math.round(g), 3521 | Math.round(b), 3522 | alpha 3523 | ] 3524 | }, 3525 | 3526 | hsla: function hsla () { 3527 | var ref = this; 3528 | var alpha = ref.alpha; 3529 | var hsva = ref.hsva; 3530 | var ref$1 = hsv2hsl_1(hsva); 3531 | var h = ref$1[0]; 3532 | var s = ref$1[1]; 3533 | var l = ref$1[2]; 3534 | return [ 3535 | Math.round(h), 3536 | ((Math.round(s)) + "%"), 3537 | ((Math.round(l)) + "%"), 3538 | alpha 3539 | ] 3540 | }, 3541 | 3542 | hex: function hex () { 3543 | return rgb2hex_1(this.rgba) 3544 | }, 3545 | 3546 | previewBorderColor: function previewBorderColor () { 3547 | var ref = this.rgba; 3548 | var r = ref[0]; 3549 | var g = ref[1]; 3550 | var b = ref[2]; 3551 | if ((r + g + b) / 3 > 235) { 3552 | return "rgba(160,160,160,0.8)" 3553 | } 3554 | return 'transparent' 3555 | }, 3556 | 3557 | styles: function styles () { 3558 | var ref = this; 3559 | var rgba = ref.rgba; 3560 | var alpha = ref.alpha; 3561 | var hue = ref.hue; 3562 | var saturation = ref.saturation; 3563 | var strRGB = rgba.slice(0, 3).join(', '); 3564 | 3565 | var strHueRGB = hsl2rgb_1([hue * 360, 100, 50]) 3566 | .map(function (v) { return Math.round(v); }) 3567 | .join(', '); 3568 | 3569 | return { 3570 | preview: { 3571 | backgroundColor: ("rgba(" + (rgba.join(', ')) + ")"), 3572 | borderColor: this.previewBorderColor 3573 | }, 3574 | saturationPane: { 3575 | backgroundColor: ("rgb(" + strHueRGB + ")") 3576 | }, 3577 | saturationThumb: { 3578 | left: toPercent(saturation.x), 3579 | top: toPercent(saturation.y) 3580 | }, 3581 | alphaTrack: { 3582 | backgroundImage: "linear-gradient(to right, " + 3583 | "rgba(" + strRGB + ", 0) 0%, rgb(" + strRGB + ") 100%)" 3584 | }, 3585 | alphaThumb: { 3586 | left: toPercent(alpha) 3587 | }, 3588 | hueThumb: { 3589 | left: toPercent(1 - hue) 3590 | } 3591 | } 3592 | } 3593 | }, 3594 | 3595 | methods: { 3596 | digestProp: function digestProp (val) { 3597 | var rgba = index$1(val); 3598 | var alpha = rgba[3] == null ? 1 : rgba[3]; 3599 | var ref = rgb2hsv_1(rgba); 3600 | var hue = ref[0]; 3601 | var saturation = ref[1]; 3602 | var value = ref[2]; 3603 | 3604 | // format of alpha: `.2f` 3605 | // according to Chrome DevTool 3606 | var _alpha = parseFloat(alpha.toFixed(2)); 3607 | 3608 | return { 3609 | alpha: _alpha, 3610 | hue: hue / 360, 3611 | saturation: { 3612 | x: saturation / 100, 3613 | y: 1 - value / 100 3614 | } 3615 | } 3616 | }, 3617 | onSaturationChange: function onSaturationChange (ref) { 3618 | var x = ref[0]; 3619 | var y = ref[1]; 3620 | 3621 | this.saturation = { x: x, y: y }; 3622 | }, 3623 | onHueChange: function onHueChange (e) { 3624 | this.hue = 1 - e; 3625 | }, 3626 | onAlphaChange: function onAlphaChange (e) { 3627 | // format of alpha: `.2f` 3628 | // according to Chrome DevTool 3629 | this.alpha = parseFloat(e.toFixed(2)); 3630 | }, 3631 | 3632 | emitChange: function emitChange () { 3633 | var ref = this; 3634 | var alpha = ref.alpha; 3635 | var hex = ref.hex; 3636 | var rgba = ref.rgba; 3637 | var hsla = ref.hsla; 3638 | var hexVal = simplifyHex( 3639 | alpha === 1 ? hex.slice(0, 7) : hex 3640 | ); 3641 | 3642 | this.$emit('change', { 3643 | rgba: rgba, 3644 | hsla: hsla, 3645 | hex: hexVal 3646 | }); 3647 | 3648 | // this ensures that every component in 3649 | // our model is up to date 3650 | var h = hsla[0]; 3651 | var s = hsla[1]; 3652 | var l = hsla[2]; 3653 | var r = rgba[0]; 3654 | var g = rgba[1]; 3655 | var b = rgba[2]; 3656 | var shortHex = index(this.colorModel, { 3657 | r: r, g: g, b: b, h: h, s: s, l: l, 3658 | a: alpha, 3659 | hex: hexVal 3660 | }); 3661 | }, 3662 | 3663 | changecurrentMode: function changecurrentMode () { 3664 | var modes = Object.keys(this.colorModes); 3665 | var index$$1 = modes.indexOf(this.currentMode); 3666 | this.currentMode = modes[(index$$1 + 1) % modes.length]; 3667 | }, 3668 | 3669 | handleInput: function handleInput (type, event) { 3670 | var ref = this; 3671 | var currentMode = ref.currentMode; 3672 | var colorModel = ref.colorModel; 3673 | var value = event.target.value; 3674 | var num = Number(value); 3675 | var changed = false; 3676 | 3677 | switch (type) { 3678 | case 'a': 3679 | if (colorModel[type] !== num && !isNaN(num)) { 3680 | colorModel[type] = clamp_1(num, 0, 1); 3681 | changed = true; 3682 | } 3683 | break 3684 | 3685 | case 'r': 3686 | case 'g': 3687 | case 'b': 3688 | if (colorModel[type] !== num && !isNaN(num)) { 3689 | colorModel[type] = clamp_1(num, 0, 255) | 0; 3690 | changed = true; 3691 | } 3692 | break 3693 | 3694 | case 'h': 3695 | if (colorModel[type] !== num && !isNaN(num)) { 3696 | colorModel[type] = clamp_1(num, 0, 360) | 0; 3697 | changed = true; 3698 | } 3699 | break 3700 | 3701 | case 's': 3702 | case 'l': 3703 | if (value.slice(-1) === '%' && colorModel[type] !== value) { 3704 | num = parseFloat(value); 3705 | colorModel[type] = (clamp_1(num, 0, 360) | 0) + "%"; 3706 | changed = true; 3707 | } 3708 | break 3709 | 3710 | case 'hex': 3711 | if (value[0] === '#') { 3712 | if (colorModel[type] !== value && index$1(value).every(function (i) { return !isNaN(i); })) { 3713 | colorModel[type] = simplifyHex(value); 3714 | changed = true; 3715 | } 3716 | } 3717 | break 3718 | } 3719 | 3720 | if (changed) { 3721 | var h = colorModel.h; 3722 | var s = colorModel.s; 3723 | var l = colorModel.l; 3724 | var r = colorModel.r; 3725 | var g = colorModel.g; 3726 | var b = colorModel.b; 3727 | var a = colorModel.a; 3728 | var hex = colorModel.hex; 3729 | var literal = hex; 3730 | 3731 | if (currentMode === 'rgba') { 3732 | literal = "rgba(" + ([r, g, b, a]) + ")"; 3733 | } else if (currentMode === 'hsla') { 3734 | literal = "hsla(" + ([h, s, l, a]) + ")"; 3735 | } 3736 | 3737 | index(this, this.digestProp(literal)); 3738 | } 3739 | } 3740 | }, 3741 | 3742 | created: function created () { 3743 | this.handleInput = debounce_1(this.handleInput.bind(this), 50); 3744 | } 3745 | } 3746 | 3747 | function toPercent (n, precision) { 3748 | if ( precision === void 0 ) precision = 3; 3749 | 3750 | // eslint-disable-next-line 3751 | var num = (n * 100).toPrecision(precision | 0); 3752 | return (num + "%") 3753 | } 3754 | 3755 | function getColorType (color) { 3756 | if (color[0] === '#') { 3757 | return 'hex' 3758 | } 3759 | 3760 | if (color.indexOf('rgb') === 0) { 3761 | return 'rgba' 3762 | } 3763 | 3764 | if (color.indexOf('hsl') === 0) { 3765 | return 'hsla' 3766 | } 3767 | 3768 | browser(false, (color + " is not valid color value!")); 3769 | } 3770 | 3771 | function simplifyHex (val) { 3772 | return val.replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3([0-9a-f]?)\4$/, '#$1$2$3$4') 3773 | } 3774 | 3775 | VColorComponent.install = function (Vue) { 3776 | Vue.config.devtools = "development" !== 'production'; 3777 | Vue.component(VColorComponent.name, VColorComponent); 3778 | }; 3779 | 3780 | window.Vue.use(VColorComponent); 3781 | 3782 | window.vm = new window.Vue({ 3783 | el: '#app', 3784 | template: "\n", 3785 | data: function data () { 3786 | return { 3787 | color: '#f0f' 3788 | } 3789 | }, 3790 | methods: { 3791 | onChange: function onChange (e) { 3792 | console.log(e); 3793 | } 3794 | } 3795 | }); 3796 | 3797 | }))); 3798 | //# sourceMappingURL=demo.js.map 3799 | -------------------------------------------------------------------------------- /dist/index.css: -------------------------------------------------------------------------------- 1 | .cp__wrapper { 2 | width: 250px; 3 | margin: 0; 4 | background: #fff; 5 | border-radius: 2px; 6 | -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3); 7 | box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3); 8 | font-family: Menlo, 'Microsoft Yahei', sans-serif; 9 | -webkit-user-select: none; 10 | -moz-user-select: none; 11 | -ms-user-select: none; 12 | user-select: none; 13 | } 14 | 15 | .cp__v-ctrl { 16 | position: relative; 17 | } 18 | 19 | .cp__thumb { 20 | position: absolute; 21 | width: 12px; 22 | height: 12px; 23 | top: 0; 24 | border-radius: 50%; 25 | margin-top: -1px; 26 | -webkit-transform: translateX(-50%); 27 | transform: translateX(-50%); 28 | background-color: #f8f8f8; 29 | -webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .368627); 30 | box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .368627); 31 | cursor: default; 32 | } 33 | 34 | 35 | .cp__saturation { 36 | position: relative; 37 | width: 100%; 38 | padding-bottom: 55%; 39 | border-radius: 2px 2px 0 0; 40 | overflow: hidden 41 | } 42 | 43 | 44 | .cp__saturation > div { 45 | position: absolute; 46 | top: 0; 47 | left: 0; 48 | right: 0; 49 | bottom: 0; 50 | margin: 0; 51 | } 52 | 53 | 54 | .cp__saturation > .msk-white { 55 | background: -webkit-gradient(linear, left top, right top, from(#fff), to(hsla(0, 0%, 100%, 0))); 56 | background: linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0)); 57 | } 58 | 59 | 60 | .cp__saturation > .msk-black { 61 | background: -webkit-gradient(linear, left bottom, left top, from(#000), to(transparent)); 62 | background: linear-gradient(0deg, #000, transparent); 63 | } 64 | 65 | 66 | .cp__saturation > .cp__thumb { 67 | background-color: transparent; 68 | -webkit-transform: translate(-50%, -50%); 69 | transform: translate(-50%, -50%); 70 | -webkit-box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0, 0, 0, .3), 0 0 1px 2px rgba(0, 0, 0, .4); 71 | box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0, 0, 0, .3), 0 0 1px 2px rgba(0, 0, 0, .4); 72 | } 73 | 74 | 75 | .cp__ctrl-pane { 76 | position: relative; 77 | width: 100%; 78 | -webkit-box-sizing: border-box; 79 | box-sizing: border-box; 80 | padding: 16px 16px 12px 81 | } 82 | 83 | 84 | .cp__ctrl-pane > div { 85 | display: -webkit-box; 86 | display: -ms-flexbox; 87 | display: flex; 88 | -webkit-box-align: center; 89 | -ms-flex-align: center; 90 | align-items: center; 91 | } 92 | 93 | 94 | .cp__tracks { 95 | -webkit-box-flex: 1; 96 | -ms-flex: 1 0 0px; 97 | flex: 1 0 0; 98 | } 99 | 100 | .cp__ctrl-bar { 101 | height: 10px; 102 | } 103 | 104 | .cp__ctrl-hue { 105 | background: -webkit-gradient(linear, right top, left top, from(red), color-stop(17%, #ff0), color-stop(33%, #0f0), color-stop(50%, #0ff), color-stop(67%, #00f), color-stop(83%, #f0f), to(red)); 106 | background: linear-gradient(-90deg, red, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, red); 107 | } 108 | 109 | .cp__ctrl-alpha { 110 | margin-top: 8px; 111 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) left center; 112 | } 113 | 114 | .cp__preview { 115 | position: relative; 116 | width: 28px; 117 | height: 28px; 118 | margin-right: 5px; 119 | overflow: hidden; 120 | border-radius: 50%; 121 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) center 122 | } 123 | 124 | .cp__preview > div { 125 | position: absolute; 126 | left: 0; 127 | top: 0; 128 | width: 100%; 129 | height: 100%; 130 | border-radius: 50%; 131 | border: 1px solid transparent; 132 | -webkit-box-sizing: border-box; 133 | box-sizing: border-box; 134 | } 135 | 136 | .cp__fm-fields { 137 | display: -webkit-box; 138 | display: -ms-flexbox; 139 | display: flex; 140 | -webkit-box-flex: 1; 141 | -ms-flex: 1; 142 | flex: 1 143 | } 144 | 145 | .cp__fm-fields > div { 146 | padding-left: 6px; 147 | -webkit-box-flex: 1; 148 | -ms-flex: 1 0 0px; 149 | flex: 1 0 0; 150 | } 151 | 152 | .cp__fm-fields input { 153 | width: 100%; 154 | height: 22px; 155 | font-size: 11px; 156 | text-align: center; 157 | color: rgb(51, 51, 51); 158 | border-radius: 2px; 159 | border: none; 160 | -webkit-box-shadow: rgb(218, 218, 218) 0px 0px 0px 1px inset; 161 | box-shadow: rgb(218, 218, 218) 0px 0px 0px 1px inset; 162 | -webkit-transition: -webkit-box-shadow 0.2s ease; 163 | transition: -webkit-box-shadow 0.2s ease; 164 | transition: box-shadow 0.2s ease; 165 | transition: box-shadow 0.2s ease, -webkit-box-shadow 0.2s ease; 166 | -moz-appearance: textfield; 167 | } 168 | 169 | .cp__fm-fields input:focus { 170 | outline: 0; 171 | -webkit-box-shadow: rgb(0, 125, 255) 0px 0px 0px 1px inset; 172 | box-shadow: rgb(0, 125, 255) 0px 0px 0px 1px inset; 173 | } 174 | 175 | .cp__fm-fields input::-webkit-inner-spin-button, 176 | .cp__fm-fields input::-webkit-outer-spin-button { 177 | -webkit-appearance: none !important; 178 | margin: 0; 179 | } 180 | 181 | .cp__fm-fields span { 182 | display: block; 183 | margin-top: 12px; 184 | text-transform: uppercase; 185 | font-size: 11px; 186 | line-height: 11px; 187 | color: rgb(150, 150, 150); 188 | text-align: center; 189 | } 190 | 191 | /* color format switcher */ 192 | .cp__fm-switcher { 193 | position: relative; 194 | width: 32px; 195 | text-align: right 196 | } 197 | .cp__fm-switcher > div { 198 | position: relative; 199 | margin-right: -4px; 200 | margin-top: 12px; 201 | cursor: pointer; 202 | } 203 | .cp__fm-switcher > div > svg { 204 | width: 24px; 205 | height: 24px; 206 | border-radius: 5px; 207 | background: transparent; 208 | border: 1px solid transparent; 209 | } 210 | .cp__fm-switcher > div > svg:hover { 211 | border-color: rgb(238, 238, 238); 212 | background: rgb(238, 238, 238); 213 | } 214 | -------------------------------------------------------------------------------- /dist/index.esm.js: -------------------------------------------------------------------------------- 1 | import throttle from 'lodash/throttle'; 2 | import clamp from 'lodash/clamp'; 3 | import isEqual from 'lodash/isEqual'; 4 | import debounce from 'lodash/debounce'; 5 | 6 | /** 7 | * Copyright (c) 2013-present, Facebook, Inc. 8 | * 9 | * This source code is licensed under the MIT license found in the 10 | * LICENSE file in the root directory of this source tree. 11 | */ 12 | 13 | /** 14 | * Use invariant() to assert state which your program assumes to be true. 15 | * 16 | * Provide sprintf-style format (only %s is supported) and arguments 17 | * to provide information about what broke and what you were 18 | * expecting. 19 | * 20 | * The invariant message will be stripped in production, but the invariant 21 | * will remain to ensure logic does not differ in production. 22 | */ 23 | 24 | var invariant = function(condition, format, a, b, c, d, e, f) { 25 | 26 | if (!condition) { 27 | var error; 28 | if (format === undefined) { 29 | error = new Error( 30 | 'Minified exception occurred; use the non-minified dev environment ' + 31 | 'for the full error message and additional helpful warnings.' 32 | ); 33 | } else { 34 | var args = [a, b, c, d, e, f]; 35 | var argIndex = 0; 36 | error = new Error( 37 | format.replace(/%s/g, function() { return args[argIndex++]; }) 38 | ); 39 | error.name = 'Invariant Violation'; 40 | } 41 | 42 | error.framesToPop = 1; // we don't care about invariant's own frame 43 | throw error; 44 | } 45 | }; 46 | 47 | var browser = invariant; 48 | 49 | /* 50 | object-assign 51 | (c) Sindre Sorhus 52 | @license MIT 53 | */ 54 | /* eslint-disable no-unused-vars */ 55 | var getOwnPropertySymbols = Object.getOwnPropertySymbols; 56 | var hasOwnProperty = Object.prototype.hasOwnProperty; 57 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; 58 | 59 | function toObject(val) { 60 | if (val === null || val === undefined) { 61 | throw new TypeError('Object.assign cannot be called with null or undefined'); 62 | } 63 | 64 | return Object(val); 65 | } 66 | 67 | function shouldUseNative() { 68 | try { 69 | if (!Object.assign) { 70 | return false; 71 | } 72 | 73 | // Detect buggy property enumeration order in older V8 versions. 74 | 75 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 76 | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 77 | test1[5] = 'de'; 78 | if (Object.getOwnPropertyNames(test1)[0] === '5') { 79 | return false; 80 | } 81 | 82 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 83 | var test2 = {}; 84 | for (var i = 0; i < 10; i++) { 85 | test2['_' + String.fromCharCode(i)] = i; 86 | } 87 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 88 | return test2[n]; 89 | }); 90 | if (order2.join('') !== '0123456789') { 91 | return false; 92 | } 93 | 94 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 95 | var test3 = {}; 96 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 97 | test3[letter] = letter; 98 | }); 99 | if (Object.keys(Object.assign({}, test3)).join('') !== 100 | 'abcdefghijklmnopqrst') { 101 | return false; 102 | } 103 | 104 | return true; 105 | } catch (err) { 106 | // We don't expect any of the above to throw, but better to be safe. 107 | return false; 108 | } 109 | } 110 | 111 | var index = shouldUseNative() ? Object.assign : function (target, source) { 112 | var arguments$1 = arguments; 113 | 114 | var from; 115 | var to = toObject(target); 116 | var symbols; 117 | 118 | for (var s = 1; s < arguments.length; s++) { 119 | from = Object(arguments$1[s]); 120 | 121 | for (var key in from) { 122 | if (hasOwnProperty.call(from, key)) { 123 | to[key] = from[key]; 124 | } 125 | } 126 | 127 | if (getOwnPropertySymbols) { 128 | symbols = getOwnPropertySymbols(from); 129 | for (var i = 0; i < symbols.length; i++) { 130 | if (propIsEnumerable.call(from, symbols[i])) { 131 | to[symbols[i]] = from[symbols[i]]; 132 | } 133 | } 134 | } 135 | } 136 | 137 | return to; 138 | }; 139 | 140 | var component = /-?\d+(\.\d+)?%?/g; 141 | function extractComponents(color) { 142 | return color.match(component); 143 | } 144 | 145 | var extractComponents_1 = extractComponents; 146 | 147 | var extractComponents$1 = /*#__PURE__*/Object.freeze({ 148 | default: extractComponents_1, 149 | __moduleExports: extractComponents_1 150 | }); 151 | 152 | function clamp$1(val, min, max) { 153 | return Math.min(Math.max(val, min), max); 154 | } 155 | 156 | var clamp_1 = clamp$1; 157 | 158 | var clamp$2 = /*#__PURE__*/Object.freeze({ 159 | default: clamp_1, 160 | __moduleExports: clamp_1 161 | }); 162 | 163 | var require$$0 = ( extractComponents$1 && extractComponents_1 ) || extractComponents$1; 164 | 165 | var require$$1 = ( clamp$2 && clamp_1 ) || clamp$2; 166 | 167 | var extractComponents$2 = require$$0; 168 | var clamp$3 = require$$1; 169 | 170 | function parseHslComponent(component, i) { 171 | component = parseFloat(component); 172 | 173 | switch(i) { 174 | case 0: 175 | return clamp$3(component, 0, 360); 176 | case 1: 177 | case 2: 178 | return clamp$3(component, 0, 100); 179 | case 3: 180 | return clamp$3(component, 0, 1); 181 | } 182 | } 183 | 184 | function hsl(color) { 185 | return extractComponents$2(color).map(parseHslComponent); 186 | } 187 | 188 | var hsl_1 = hsl; 189 | 190 | var hsl$1 = /*#__PURE__*/Object.freeze({ 191 | default: hsl_1, 192 | __moduleExports: hsl_1 193 | }); 194 | 195 | function expand(hex) { 196 | var result = "#"; 197 | 198 | for (var i = 1; i < hex.length; i++) { 199 | var val = hex.charAt(i); 200 | result += val + val; 201 | } 202 | 203 | return result; 204 | } 205 | 206 | function hex(hex) { 207 | // #RGB or #RGBA 208 | if(hex.length === 4 || hex.length === 5) { 209 | hex = expand(hex); 210 | } 211 | 212 | var rgb = [ 213 | parseInt(hex.substring(1,3), 16), 214 | parseInt(hex.substring(3,5), 16), 215 | parseInt(hex.substring(5,7), 16) 216 | ]; 217 | 218 | // #RRGGBBAA 219 | if (hex.length === 9) { 220 | var alpha = parseFloat((parseInt(hex.substring(7,9), 16) / 255).toFixed(2)); 221 | rgb.push(alpha); 222 | } 223 | 224 | return rgb; 225 | } 226 | 227 | var hex_1 = hex; 228 | 229 | var hex$1 = /*#__PURE__*/Object.freeze({ 230 | default: hex_1, 231 | __moduleExports: hex_1 232 | }); 233 | 234 | var extractComponents$3 = require$$0; 235 | var clamp$4 = require$$1; 236 | 237 | function parseRgbComponent(component, i) { 238 | if (i < 3) { 239 | if (component.indexOf('%') != -1) { 240 | return Math.round(255 * clamp$4(parseInt(component, 10), 0, 100)/100); 241 | } else { 242 | return clamp$4(parseInt(component, 10), 0, 255); 243 | } 244 | } else { 245 | return clamp$4(parseFloat(component), 0, 1); 246 | } 247 | } 248 | 249 | function rgb(color) { 250 | return extractComponents$3(color).map(parseRgbComponent); 251 | } 252 | 253 | var rgb_1 = rgb; 254 | 255 | var rgb$1 = /*#__PURE__*/Object.freeze({ 256 | default: rgb_1, 257 | __moduleExports: rgb_1 258 | }); 259 | 260 | function hsl2rgb(hsl) { 261 | var h = hsl[0] / 360, 262 | s = hsl[1] / 100, 263 | l = hsl[2] / 100, 264 | t1, t2, t3, rgb, val; 265 | 266 | if (s == 0) { 267 | val = l * 255; 268 | return [val, val, val]; 269 | } 270 | 271 | if (l < 0.5) 272 | { t2 = l * (1 + s); } 273 | else 274 | { t2 = l + s - l * s; } 275 | t1 = 2 * l - t2; 276 | 277 | rgb = [0, 0, 0]; 278 | for (var i = 0; i < 3; i++) { 279 | t3 = h + 1 / 3 * - (i - 1); 280 | t3 < 0 && t3++; 281 | t3 > 1 && t3--; 282 | 283 | if (6 * t3 < 1) 284 | { val = t1 + (t2 - t1) * 6 * t3; } 285 | else if (2 * t3 < 1) 286 | { val = t2; } 287 | else if (3 * t3 < 2) 288 | { val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; } 289 | else 290 | { val = t1; } 291 | 292 | rgb[i] = val * 255; 293 | } 294 | 295 | return rgb; 296 | } 297 | 298 | var hsl2rgb_1 = hsl2rgb; 299 | 300 | var require$$0$1 = ( hsl$1 && hsl_1 ) || hsl$1; 301 | 302 | var require$$1$1 = ( hex$1 && hex_1 ) || hex$1; 303 | 304 | var require$$2 = ( rgb$1 && rgb_1 ) || rgb$1; 305 | 306 | var hsl$2 = require$$0$1; 307 | var hex$2 = require$$1$1; 308 | var rgb$2 = require$$2; 309 | var hsl2rgb$1 = hsl2rgb_1; 310 | 311 | function hsl2rgbParse(color) { 312 | var h = hsl$2(color); 313 | var r = hsl2rgb$1(h); 314 | 315 | // handle alpha since hsl2rgb doesn't know (or care!) about it 316 | if(h.length === 4) { 317 | r.push(h[3]); 318 | } 319 | 320 | return r; 321 | } 322 | 323 | var space2parser = { 324 | "#" : hex$2, 325 | "hsl" : hsl2rgbParse, 326 | "rgb" : rgb$2 327 | }; 328 | 329 | function parse(color) { 330 | for(var scheme in space2parser) { 331 | if(color.indexOf(scheme) === 0) { 332 | return space2parser[scheme](color); 333 | } 334 | } 335 | } 336 | 337 | parse.rgb = rgb$2; 338 | parse.hsl = hsl$2; 339 | parse.hex = hex$2; 340 | 341 | var index$1 = parse; 342 | 343 | function rgb2hsv(rgb) { 344 | var r = rgb[0], 345 | g = rgb[1], 346 | b = rgb[2], 347 | min = Math.min(r, g, b), 348 | max = Math.max(r, g, b), 349 | delta = max - min, 350 | h, s, v; 351 | 352 | if (max == 0) 353 | { s = 0; } 354 | else 355 | { s = (delta/max * 1000)/10; } 356 | 357 | if (max == min) 358 | { h = 0; } 359 | else if (r == max) 360 | { h = (g - b) / delta; } 361 | else if (g == max) 362 | { h = 2 + (b - r) / delta; } 363 | else if (b == max) 364 | { h = 4 + (r - g) / delta; } 365 | 366 | h = Math.min(h * 60, 360); 367 | 368 | if (h < 0) 369 | { h += 360; } 370 | 371 | v = ((max / 255) * 1000) / 10; 372 | 373 | return [h, s, v]; 374 | } 375 | 376 | var rgb2hsv_1 = rgb2hsv; 377 | 378 | var clamp$5 = require$$1; 379 | 380 | function componentToHex(c) { 381 | var value = Math.round(clamp$5(c, 0, 255)); 382 | var hex = value.toString(16); 383 | 384 | return hex.length == 1 ? "0" + hex : hex; 385 | } 386 | 387 | function rgb2hex(rgb) { 388 | var alpha = rgb.length === 4 ? componentToHex(rgb[3] * 255) : ""; 389 | 390 | return "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]) + alpha; 391 | } 392 | 393 | var rgb2hex_1 = rgb2hex; 394 | 395 | function hsv2hsl(hsv) { 396 | var h = hsv[0], 397 | s = hsv[1] / 100, 398 | v = hsv[2] / 100, 399 | sl, l; 400 | 401 | l = (2 - s) * v; 402 | sl = s * v; 403 | sl /= (l <= 1) ? l : 2 - l; 404 | sl = sl || 0; 405 | l /= 2; 406 | return [h, sl * 100, l * 100]; 407 | } 408 | 409 | var hsv2hsl_1 = hsv2hsl; 410 | 411 | function hsv2rgb(hsv) { 412 | var h = hsv[0] / 60, 413 | s = hsv[1] / 100, 414 | v = hsv[2] / 100, 415 | hi = Math.floor(h) % 6; 416 | 417 | var f = h - Math.floor(h), 418 | p = 255 * v * (1 - s), 419 | q = 255 * v * (1 - (s * f)), 420 | t = 255 * v * (1 - (s * (1 - f))), 421 | v = 255 * v; 422 | 423 | switch(hi) { 424 | case 0: 425 | return [v, t, p]; 426 | case 1: 427 | return [q, v, p]; 428 | case 2: 429 | return [p, v, t]; 430 | case 3: 431 | return [p, q, v]; 432 | case 4: 433 | return [t, p, v]; 434 | case 5: 435 | return [v, p, q]; 436 | } 437 | } 438 | 439 | var hsv2rgb_1 = hsv2rgb; 440 | 441 | var toPrecision = function (num, precision) { 442 | var p = precision | 0; 443 | return p > 0 ? parseFloat(num.toFixed(p)) : num 444 | }; 445 | 446 | var VueCtrlComponent = { 447 | name: 'v-ctrl', 448 | abstract: true, 449 | props: { 450 | direction: { 451 | type: String, 452 | default: 'h', 453 | validator: function validator (val) { 454 | return ['v', 'h', 'vh', 'hv'].indexOf(val) > -1 455 | } 456 | }, 457 | throttle: { 458 | type: Number, 459 | default: 80 460 | }, 461 | precision: { 462 | type: Number 463 | } 464 | }, 465 | 466 | methods: { 467 | msdown: function msdown (e) { 468 | e.preventDefault(); 469 | document.addEventListener('mousemove', this.msmove); 470 | document.addEventListener('mouseup', this.msup); 471 | this.next(e); 472 | }, 473 | 474 | msmove: function msmove (e) { 475 | e.preventDefault(); 476 | this.next(e); 477 | }, 478 | 479 | msup: function msup (e) { 480 | this.next(e); 481 | document.removeEventListener('mousemove', this.msmove); 482 | document.removeEventListener('mouseup', this.msup); 483 | }, 484 | 485 | notify: function notify (val) { 486 | if (isEqual(this.memo, val) === false) { 487 | this.memo = val; 488 | this.$emit('change', val); 489 | } 490 | }, 491 | 492 | next: function next (ref) { 493 | if ( ref === void 0 ) { ref = {}; } 494 | var clientX = ref.clientX; if ( clientX === void 0 ) { clientX = 0; } 495 | var clientY = ref.clientY; if ( clientY === void 0 ) { clientY = 0; } 496 | 497 | var ref$1 = this; 498 | var direction = ref$1.direction; 499 | var adjust = ref$1.adjust; 500 | var rect = this.$el.getBoundingClientRect(); 501 | 502 | var left = rect.left; 503 | var width = rect.width; 504 | var deltaX = clientX - left; 505 | var x = adjust(deltaX / width); 506 | 507 | if (direction === 'h') { 508 | return this.notify(x) 509 | } 510 | 511 | var top = rect.top; 512 | var height = rect.height; 513 | var deltaY = clientY - top; 514 | var y = adjust(deltaY / height); 515 | 516 | if (direction === 'v') { 517 | return this.notify(y) 518 | } 519 | 520 | // both direction 521 | this.notify([x, y]); 522 | }, 523 | 524 | adjust: function adjust (num) { 525 | return toPrecision(clamp(num, 0, 1), this.precision) 526 | } 527 | }, 528 | 529 | render: function render (h) { 530 | return this.$slots.default[0] 531 | }, 532 | 533 | created: function created () { 534 | var ref = this; 535 | var msdown = ref.msdown; 536 | var msmove = ref.msmove; 537 | 538 | this.msdown = msdown.bind(this); 539 | this.msmove = throttle(msmove.bind(this), this.throttle); 540 | 541 | this.memo = null; 542 | }, 543 | 544 | mounted: function mounted () { 545 | this.$el.addEventListener('mousedown', this.msdown); 546 | }, 547 | 548 | destroyed: function destroyed () { 549 | this.$el.removeEventListener('mousedown', this.msdown); 550 | }, 551 | 552 | install: function install () { 553 | Vue.component(VueCtrlComponent.name, VueCtrlComponent); 554 | } 555 | }; 556 | 557 | if (typeof window !== 'undefined' && window.Vue) { 558 | Vue.use(VueCtrlComponent); 559 | } 560 | 561 | var index$2 = { VueCtrlComponent: VueCtrlComponent }; 562 | 563 | var colorModes = Object.freeze({ 564 | rgba: ['r', 'g', 'b', 'a'], 565 | hsla: ['h', 's', 'l', 'a'], 566 | hex: ['hex'] 567 | }); 568 | 569 | var VColorComponent = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"cp__wrapper"},[_c('v-ctrl',{attrs:{"direction":"vh","precision":2,"throttle":80},on:{"change":_vm.onSaturationChange}},[_c('div',{staticClass:"cp__v-ctrl cp__saturation"},[_c('div',{staticClass:"msk-hue",style:(_vm.styles.saturationPane)}),_vm._v(" "),_c('div',{staticClass:"msk-white"}),_vm._v(" "),_c('div',{staticClass:"msk-black"}),_vm._v(" "),_c('p',{staticClass:"cp__thumb",style:(_vm.styles.saturationThumb)})])]),_vm._v(" "),_c('div',{staticClass:"cp__ctrl-pane"},[_c('div',[_c('div',{staticClass:"cp__preview"},[_c('div',{style:(_vm.styles.preview)})]),_vm._v(" "),_c('div',{staticClass:"cp__tracks"},[_c('v-ctrl',{attrs:{"direction":"h","precision":2,"throttle":80},on:{"change":_vm.onHueChange}},[_c('div',{staticClass:"cp__v-ctrl cp__ctrl-bar cp__ctrl-hue"},[_c('div',{staticClass:"cp__thumb",style:(_vm.styles.hueThumb)})])]),_vm._v(" "),_c('v-ctrl',{attrs:{"direction":"h","precision":2,"throttle":80},on:{"change":_vm.onAlphaChange}},[_c('div',{staticClass:"cp__v-ctrl cp__ctrl-alpha"},[_c('div',{staticClass:"cp__thumb",style:(_vm.styles.alphaThumb)}),_vm._v(" "),_c('div',{staticClass:"cp__ctrl-bar",style:(_vm.styles.alphaTrack)})])])],1)]),_vm._v(" "),_c('div',{staticStyle:{"margin-top":"10px"}},[_c('div',{staticClass:"cp__fm-fields"},_vm._l((_vm.colorModes[_vm.currentMode]),function(k){return _c('div',{key:k},[_c('div',{staticStyle:{"position":"relative"}},[_c('input',{attrs:{"type":_vm.constrains[k].type,"maxlength":_vm.constrains[k].maxlength},domProps:{"value":_vm.colorModel[k]},on:{"change":function($event){_vm.handleInput(k, $event);}}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(k))])])])})),_vm._v(" "),_c('div',{staticClass:"cp__fm-switcher"},[_c('div',{on:{"click":function($event){_vm.changecurrentMode();}}},[_c('svg',{attrs:{"viewBox":"0 0 24 24"}},[_c('path',{attrs:{"fill":"#333","d":"M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}}),_vm._v(" "),_c('path',{attrs:{"fill":"#333","d":"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15Z"}})])])])])])],1)},staticRenderFns: [], 570 | name: 'color-picker', 571 | props: { 572 | color: { 573 | type: String, 574 | default: '#ff0000' 575 | } 576 | }, 577 | 578 | components: { 579 | 'v-ctrl': index$2.VueCtrlComponent 580 | }, 581 | 582 | data: function data () { 583 | var ref = this; 584 | var color = ref.color; 585 | 586 | var commonNumber = { 587 | type: 'number', 588 | maxlength: 3, 589 | }; 590 | var percentValue = { 591 | type: 'string', 592 | maxlength: 4 593 | }; 594 | 595 | return Object.assign({}, this.digestProp(color), 596 | {currentMode: getColorType(color), 597 | colorModes: colorModes, 598 | colorModel: { 599 | hex: '', 600 | r: '', 601 | g: '', 602 | b: '', 603 | h: '', 604 | s: '', 605 | l: '', 606 | a: '' 607 | }, 608 | constrains: { 609 | r: commonNumber, 610 | g: commonNumber, 611 | b: commonNumber, 612 | h: commonNumber, 613 | s: percentValue, 614 | l: percentValue, 615 | a: { 616 | type: 'number', 617 | maxlength: 4 618 | }, 619 | hex: { 620 | type: 'string', 621 | maxlength: 9 622 | } 623 | }}) 624 | }, 625 | 626 | watch: { 627 | color: { 628 | immediate: true, 629 | handler: function handler (newVal, oldVal) { 630 | if (newVal !== oldVal) { 631 | index(this, this.digestProp(newVal)); 632 | } 633 | } 634 | }, 635 | rgba: { 636 | immediate: true, 637 | handler: function handler (newVal, oldVal) { 638 | if (("" + newVal) !== ("" + oldVal)) { 639 | this.emitChange(); 640 | } 641 | } 642 | } 643 | }, 644 | 645 | computed: { 646 | hsva: function hsva () { 647 | var ref = this; 648 | var hue = ref.hue; 649 | var alpha = ref.alpha; 650 | var ref_saturation = ref.saturation; 651 | var x = ref_saturation.x; 652 | var y = ref_saturation.y; 653 | return [ 654 | hue * 360, 655 | x * 100, 656 | (1 - y) * 100, 657 | alpha 658 | ] 659 | }, 660 | 661 | rgba: function rgba () { 662 | var ref = this; 663 | var alpha = ref.alpha; 664 | var hsva = ref.hsva; 665 | var ref$1 = hsv2rgb_1(hsva); 666 | var r = ref$1[0]; 667 | var g = ref$1[1]; 668 | var b = ref$1[2]; 669 | return [ 670 | Math.round(r), 671 | Math.round(g), 672 | Math.round(b), 673 | alpha 674 | ] 675 | }, 676 | 677 | hsla: function hsla () { 678 | var ref = this; 679 | var alpha = ref.alpha; 680 | var hsva = ref.hsva; 681 | var ref$1 = hsv2hsl_1(hsva); 682 | var h = ref$1[0]; 683 | var s = ref$1[1]; 684 | var l = ref$1[2]; 685 | return [ 686 | Math.round(h), 687 | ((Math.round(s)) + "%"), 688 | ((Math.round(l)) + "%"), 689 | alpha 690 | ] 691 | }, 692 | 693 | hex: function hex () { 694 | return rgb2hex_1(this.rgba) 695 | }, 696 | 697 | previewBorderColor: function previewBorderColor () { 698 | var ref = this.rgba; 699 | var r = ref[0]; 700 | var g = ref[1]; 701 | var b = ref[2]; 702 | if ((r + g + b) / 3 > 235) { 703 | return "rgba(160,160,160,0.8)" 704 | } 705 | return 'transparent' 706 | }, 707 | 708 | styles: function styles () { 709 | var ref = this; 710 | var rgba = ref.rgba; 711 | var alpha = ref.alpha; 712 | var hue = ref.hue; 713 | var saturation = ref.saturation; 714 | var strRGB = rgba.slice(0, 3).join(', '); 715 | 716 | var strHueRGB = hsl2rgb_1([hue * 360, 100, 50]) 717 | .map(function (v) { return Math.round(v); }) 718 | .join(', '); 719 | 720 | return { 721 | preview: { 722 | backgroundColor: ("rgba(" + (rgba.join(', ')) + ")"), 723 | borderColor: this.previewBorderColor 724 | }, 725 | saturationPane: { 726 | backgroundColor: ("rgb(" + strHueRGB + ")") 727 | }, 728 | saturationThumb: { 729 | left: toPercent(saturation.x), 730 | top: toPercent(saturation.y) 731 | }, 732 | alphaTrack: { 733 | backgroundImage: "linear-gradient(to right, " + 734 | "rgba(" + strRGB + ", 0) 0%, rgb(" + strRGB + ") 100%)" 735 | }, 736 | alphaThumb: { 737 | left: toPercent(alpha) 738 | }, 739 | hueThumb: { 740 | left: toPercent(1 - hue) 741 | } 742 | } 743 | } 744 | }, 745 | 746 | methods: { 747 | digestProp: function digestProp (val) { 748 | var rgba = index$1(val); 749 | var alpha = rgba[3] == null ? 1 : rgba[3]; 750 | var ref = rgb2hsv_1(rgba); 751 | var hue = ref[0]; 752 | var saturation = ref[1]; 753 | var value = ref[2]; 754 | 755 | // format of alpha: `.2f` 756 | // according to Chrome DevTool 757 | var _alpha = parseFloat(alpha.toFixed(2)); 758 | 759 | return { 760 | alpha: _alpha, 761 | hue: hue / 360, 762 | saturation: { 763 | x: saturation / 100, 764 | y: 1 - value / 100 765 | } 766 | } 767 | }, 768 | onSaturationChange: function onSaturationChange (ref) { 769 | var x = ref[0]; 770 | var y = ref[1]; 771 | 772 | this.saturation = { x: x, y: y }; 773 | }, 774 | onHueChange: function onHueChange (e) { 775 | this.hue = 1 - e; 776 | }, 777 | onAlphaChange: function onAlphaChange (e) { 778 | // format of alpha: `.2f` 779 | // according to Chrome DevTool 780 | this.alpha = parseFloat(e.toFixed(2)); 781 | }, 782 | 783 | emitChange: function emitChange () { 784 | var ref = this; 785 | var alpha = ref.alpha; 786 | var hex = ref.hex; 787 | var rgba = ref.rgba; 788 | var hsla = ref.hsla; 789 | var hexVal = simplifyHex( 790 | alpha === 1 ? hex.slice(0, 7) : hex 791 | ); 792 | 793 | this.$emit('change', { 794 | rgba: rgba, 795 | hsla: hsla, 796 | hex: hexVal 797 | }); 798 | 799 | // this ensures that every component in 800 | // our model is up to date 801 | var h = hsla[0]; 802 | var s = hsla[1]; 803 | var l = hsla[2]; 804 | var r = rgba[0]; 805 | var g = rgba[1]; 806 | var b = rgba[2]; 807 | var shortHex = index(this.colorModel, { 808 | r: r, g: g, b: b, h: h, s: s, l: l, 809 | a: alpha, 810 | hex: hexVal 811 | }); 812 | }, 813 | 814 | changecurrentMode: function changecurrentMode () { 815 | var modes = Object.keys(this.colorModes); 816 | var index$$1 = modes.indexOf(this.currentMode); 817 | this.currentMode = modes[(index$$1 + 1) % modes.length]; 818 | }, 819 | 820 | handleInput: function handleInput (type, event) { 821 | var ref = this; 822 | var currentMode = ref.currentMode; 823 | var colorModel = ref.colorModel; 824 | var value = event.target.value; 825 | var num = Number(value); 826 | var changed = false; 827 | 828 | switch (type) { 829 | case 'a': 830 | if (colorModel[type] !== num && !isNaN(num)) { 831 | colorModel[type] = clamp(num, 0, 1); 832 | changed = true; 833 | } 834 | break 835 | 836 | case 'r': 837 | case 'g': 838 | case 'b': 839 | if (colorModel[type] !== num && !isNaN(num)) { 840 | colorModel[type] = clamp(num, 0, 255) | 0; 841 | changed = true; 842 | } 843 | break 844 | 845 | case 'h': 846 | if (colorModel[type] !== num && !isNaN(num)) { 847 | colorModel[type] = clamp(num, 0, 360) | 0; 848 | changed = true; 849 | } 850 | break 851 | 852 | case 's': 853 | case 'l': 854 | if (value.slice(-1) === '%' && colorModel[type] !== value) { 855 | num = parseFloat(value); 856 | colorModel[type] = (clamp(num, 0, 360) | 0) + "%"; 857 | changed = true; 858 | } 859 | break 860 | 861 | case 'hex': 862 | if (value[0] === '#') { 863 | if (colorModel[type] !== value && index$1(value).every(function (i) { return !isNaN(i); })) { 864 | colorModel[type] = simplifyHex(value); 865 | changed = true; 866 | } 867 | } 868 | break 869 | } 870 | 871 | if (changed) { 872 | var h = colorModel.h; 873 | var s = colorModel.s; 874 | var l = colorModel.l; 875 | var r = colorModel.r; 876 | var g = colorModel.g; 877 | var b = colorModel.b; 878 | var a = colorModel.a; 879 | var hex = colorModel.hex; 880 | var literal = hex; 881 | 882 | if (currentMode === 'rgba') { 883 | literal = "rgba(" + ([r, g, b, a]) + ")"; 884 | } else if (currentMode === 'hsla') { 885 | literal = "hsla(" + ([h, s, l, a]) + ")"; 886 | } 887 | 888 | index(this, this.digestProp(literal)); 889 | } 890 | } 891 | }, 892 | 893 | created: function created () { 894 | this.handleInput = debounce(this.handleInput.bind(this), 50); 895 | } 896 | } 897 | 898 | function toPercent (n, precision) { 899 | if ( precision === void 0 ) precision = 3; 900 | 901 | // eslint-disable-next-line 902 | var num = (n * 100).toPrecision(precision | 0); 903 | return (num + "%") 904 | } 905 | 906 | function getColorType (color) { 907 | if (color[0] === '#') { 908 | return 'hex' 909 | } 910 | 911 | if (color.indexOf('rgb') === 0) { 912 | return 'rgba' 913 | } 914 | 915 | if (color.indexOf('hsl') === 0) { 916 | return 'hsla' 917 | } 918 | 919 | browser(false, (color + " is not valid color value!")); 920 | } 921 | 922 | function simplifyHex (val) { 923 | return val.replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3([0-9a-f]?)\4$/, '#$1$2$3$4') 924 | } 925 | 926 | VColorComponent.install = function (Vue) { 927 | Vue.config.devtools = "production" !== 'production'; 928 | Vue.component(VColorComponent.name, VColorComponent); 929 | }; 930 | 931 | export default VColorComponent; 932 | //# sourceMappingURL=index.esm.js.map 933 | -------------------------------------------------------------------------------- /dist/index.esm.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.esm.js","sources":["../node_modules/invariant/browser.js","../node_modules/object-assign/index.js","../node_modules/pure-color/parse/extractComponents.js","../node_modules/pure-color/util/clamp.js","../node_modules/pure-color/parse/hsl.js","../node_modules/pure-color/parse/hex.js","../node_modules/pure-color/parse/rgb.js","../node_modules/pure-color/convert/hsl2rgb.js","../node_modules/pure-color/parse/index.js","../node_modules/pure-color/convert/rgb2hsv.js","../node_modules/pure-color/convert/rgb2hex.js","../node_modules/pure-color/convert/hsv2hsl.js","../node_modules/pure-color/convert/hsv2rgb.js","../node_modules/v-ctrl/dist/index.esm.js","../src/color-picker.vue","../src/index.js"],"sourcesContent":["/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","var component = /-?\\d+(\\.\\d+)?%?/g;\nfunction extractComponents(color) {\n return color.match(component);\n}\n\nmodule.exports = extractComponents;","function clamp(val, min, max) {\n return Math.min(Math.max(val, min), max);\n}\n\nmodule.exports = clamp;","var extractComponents = require(\"./extractComponents\");\nvar clamp = require(\"../util/clamp\");\n\nfunction parseHslComponent(component, i) {\n component = parseFloat(component);\n\n switch(i) {\n case 0:\n return clamp(component, 0, 360);\n case 1:\n case 2:\n return clamp(component, 0, 100);\n case 3:\n return clamp(component, 0, 1);\n }\n}\n\nfunction hsl(color) {\n return extractComponents(color).map(parseHslComponent);\n}\n\nmodule.exports = hsl;","function expand(hex) {\n var result = \"#\";\n\n for (var i = 1; i < hex.length; i++) {\n var val = hex.charAt(i);\n result += val + val;\n }\n\n return result;\n}\n\nfunction hex(hex) {\n // #RGB or #RGBA\n if(hex.length === 4 || hex.length === 5) {\n hex = expand(hex);\n }\n\n var rgb = [\n parseInt(hex.substring(1,3), 16),\n parseInt(hex.substring(3,5), 16),\n parseInt(hex.substring(5,7), 16)\n ];\n\n // #RRGGBBAA\n if (hex.length === 9) {\n var alpha = parseFloat((parseInt(hex.substring(7,9), 16) / 255).toFixed(2));\n rgb.push(alpha);\n }\n\n return rgb;\n}\n\nmodule.exports = hex;","var extractComponents = require(\"./extractComponents\");\nvar clamp = require(\"../util/clamp\");\n\nfunction parseRgbComponent(component, i) {\n if (i < 3) {\n if (component.indexOf('%') != -1) {\n return Math.round(255 * clamp(parseInt(component, 10), 0, 100)/100);\n } else {\n return clamp(parseInt(component, 10), 0, 255);\n }\n } else {\n return clamp(parseFloat(component), 0, 1);\n } \n}\n\nfunction rgb(color) {\n return extractComponents(color).map(parseRgbComponent);\n}\n\nmodule.exports = rgb;","function hsl2rgb(hsl) {\n var h = hsl[0] / 360,\n s = hsl[1] / 100,\n l = hsl[2] / 100,\n t1, t2, t3, rgb, val;\n\n if (s == 0) {\n val = l * 255;\n return [val, val, val];\n }\n\n if (l < 0.5)\n t2 = l * (1 + s);\n else\n t2 = l + s - l * s;\n t1 = 2 * l - t2;\n\n rgb = [0, 0, 0];\n for (var i = 0; i < 3; i++) {\n t3 = h + 1 / 3 * - (i - 1);\n t3 < 0 && t3++;\n t3 > 1 && t3--;\n\n if (6 * t3 < 1)\n val = t1 + (t2 - t1) * 6 * t3;\n else if (2 * t3 < 1)\n val = t2;\n else if (3 * t3 < 2)\n val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n else\n val = t1;\n\n rgb[i] = val * 255;\n }\n\n return rgb;\n}\n\nmodule.exports = hsl2rgb;","var hsl = require(\"./hsl\");\nvar hex = require(\"./hex\");\nvar rgb = require(\"./rgb\");\nvar hsl2rgb = require(\"../convert/hsl2rgb\");\n\nfunction hsl2rgbParse(color) {\n var h = hsl(color);\n var r = hsl2rgb(h);\n\n // handle alpha since hsl2rgb doesn't know (or care!) about it\n if(h.length === 4) {\n r.push(h[3]);\n }\n\n return r;\n}\n\nvar space2parser = {\n \"#\" : hex,\n \"hsl\" : hsl2rgbParse,\n \"rgb\" : rgb\n};\n\nfunction parse(color) {\n for(var scheme in space2parser) {\n if(color.indexOf(scheme) === 0) {\n return space2parser[scheme](color);\n }\n }\n}\n\nparse.rgb = rgb;\nparse.hsl = hsl;\nparse.hex = hex;\n\nmodule.exports = parse;","function rgb2hsv(rgb) {\n var r = rgb[0],\n g = rgb[1],\n b = rgb[2],\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n delta = max - min,\n h, s, v;\n\n if (max == 0)\n s = 0;\n else\n s = (delta/max * 1000)/10;\n\n if (max == min)\n h = 0;\n else if (r == max)\n h = (g - b) / delta;\n else if (g == max)\n h = 2 + (b - r) / delta;\n else if (b == max)\n h = 4 + (r - g) / delta;\n\n h = Math.min(h * 60, 360);\n\n if (h < 0)\n h += 360;\n\n v = ((max / 255) * 1000) / 10;\n\n return [h, s, v];\n}\n\nmodule.exports = rgb2hsv;","var clamp = require(\"../util/clamp\");\n\nfunction componentToHex(c) {\n var value = Math.round(clamp(c, 0, 255));\n var hex = value.toString(16);\n\n return hex.length == 1 ? \"0\" + hex : hex;\n}\n\nfunction rgb2hex(rgb) {\n var alpha = rgb.length === 4 ? componentToHex(rgb[3] * 255) : \"\";\n\n return \"#\" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]) + alpha;\n}\n\nmodule.exports = rgb2hex;","function hsv2hsl(hsv) {\n var h = hsv[0],\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n sl, l;\n\n l = (2 - s) * v;\n sl = s * v;\n sl /= (l <= 1) ? l : 2 - l;\n sl = sl || 0;\n l /= 2;\n return [h, sl * 100, l * 100];\n}\n\nmodule.exports = hsv2hsl;","function hsv2rgb(hsv) {\n var h = hsv[0] / 60,\n s = hsv[1] / 100,\n v = hsv[2] / 100,\n hi = Math.floor(h) % 6;\n\n var f = h - Math.floor(h),\n p = 255 * v * (1 - s),\n q = 255 * v * (1 - (s * f)),\n t = 255 * v * (1 - (s * (1 - f))),\n v = 255 * v;\n\n switch(hi) {\n case 0:\n return [v, t, p];\n case 1:\n return [q, v, p];\n case 2:\n return [p, v, t];\n case 3:\n return [p, q, v];\n case 4:\n return [t, p, v];\n case 5:\n return [v, p, q];\n }\n}\n\nmodule.exports = hsv2rgb;","import throttle from 'lodash/throttle';\nimport clamp from 'lodash/clamp';\nimport isEqual from 'lodash/isEqual';\n\nvar toPrecision = function (num, precision) {\n var p = precision | 0;\n return p > 0 ? parseFloat(num.toFixed(p)) : num\n};\n\nvar VueCtrlComponent = {\n name: 'v-ctrl',\n abstract: true,\n props: {\n direction: {\n type: String,\n default: 'h',\n validator: function validator (val) {\n return ['v', 'h', 'vh', 'hv'].indexOf(val) > -1\n }\n },\n throttle: {\n type: Number,\n default: 80\n },\n precision: {\n type: Number\n }\n },\n\n methods: {\n msdown: function msdown (e) {\n e.preventDefault();\n document.addEventListener('mousemove', this.msmove);\n document.addEventListener('mouseup', this.msup);\n this.next(e);\n },\n \n msmove: function msmove (e) {\n e.preventDefault();\n this.next(e);\n },\n \n msup: function msup (e) {\n this.next(e);\n document.removeEventListener('mousemove', this.msmove);\n document.removeEventListener('mouseup', this.msup);\n },\n \n notify: function notify (val) {\n if (isEqual(this.memo, val) === false) {\n this.memo = val;\n this.$emit('change', val);\n }\n },\n\n next: function next (ref) {\n if ( ref === void 0 ) ref = {};\n var clientX = ref.clientX; if ( clientX === void 0 ) clientX = 0;\n var clientY = ref.clientY; if ( clientY === void 0 ) clientY = 0;\n\n var ref$1 = this;\n var direction = ref$1.direction;\n var adjust = ref$1.adjust;\n var rect = this.$el.getBoundingClientRect();\n\n var left = rect.left;\n var width = rect.width;\n var deltaX = clientX - left;\n var x = adjust(deltaX / width);\n\n if (direction === 'h') {\n return this.notify(x)\n }\n \n var top = rect.top;\n var height = rect.height;\n var deltaY = clientY - top;\n var y = adjust(deltaY / height);\n\n if (direction === 'v') {\n return this.notify(y)\n }\n\n // both direction\n this.notify([x, y]);\n },\n\n adjust: function adjust (num) {\n return toPrecision(clamp(num, 0, 1), this.precision)\n }\n },\n\n render: function render (h) {\n return this.$slots.default[0]\n },\n\n created: function created () {\n var ref = this;\n var msdown = ref.msdown;\n var msmove = ref.msmove;\n\n this.msdown = msdown.bind(this);\n this.msmove = throttle(msmove.bind(this), this.throttle);\n\n this.memo = null;\n },\n\n mounted: function mounted () {\n this.$el.addEventListener('mousedown', this.msdown);\n },\n\n destroyed: function destroyed () {\n this.$el.removeEventListener('mousedown', this.msdown);\n },\n\n install: function install () {\n Vue.component(VueCtrlComponent.name, VueCtrlComponent);\n }\n};\n\nif (typeof window !== 'undefined' && window.Vue) {\n Vue.use(VueCtrlComponent);\n}\n\nvar index = { VueCtrlComponent: VueCtrlComponent }\n\nexport default index;\n//# sourceMappingURL=index.esm.js.map\n","\n\n\n","import VColorComponent from './color-picker.vue'\n\nVColorComponent.install = Vue => {\n Vue.config.devtools = process.env.NODE_ENV !== 'production'\n Vue.component(VColorComponent.name, VColorComponent)\n}\n\nexport default VColorComponent\n"],"names":["arguments","clamp","extractComponents","hsl","require$$0","hex","require$$1","rgb","hsl2rgb","require$$3","index","const","VCtrl","objectAssign","hsv2rgb","hsv2hsl","rgb2hex","parse2rgb","rgb2hsv","let","invariant"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;AAoBA,IAAI,SAAS,GAAG,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;;EAO5D,IAAI,CAAC,SAAS,EAAE;IACd,IAAI,KAAK,CAAC;IACV,IAAI,MAAM,KAAK,SAAS,EAAE;MACxB,KAAK,GAAG,IAAI,KAAK;QACf,oEAAoE;QACpE,6DAA6D;OAC9D,CAAC;KACH,MAAM;MACL,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;MAC9B,IAAI,QAAQ,GAAG,CAAC,CAAC;MACjB,KAAK,GAAG,IAAI,KAAK;QACf,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;OAC/D,CAAC;MACF,KAAK,CAAC,IAAI,GAAG,qBAAqB,CAAC;KACpC;;IAED,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,KAAK,CAAC;GACb;CACF,CAAC;;AAEF,WAAc,GAAG,SAAS,CAAC;;AChD3B;;;;;;AAQA,IAAI,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACzD,IAAI,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACrD,IAAI,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;;AAE7D,SAAS,QAAQ,CAAC,GAAG,EAAE;CACtB,IAAI,GAAG,KA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;EAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IAC9B,OAAO,MAAM;GACd;;EAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IAC9B,OAAO,MAAM;GACd;;EAEDS,OAAS,CAAC,KAAK,GAAE,KAAQ,+BAA2B,GAAE;CACvD;;AAED,SAAS,WAAW,EAAE,GAAG,EAAE;EACzB,OAAO,GAAG,CAAC,OAAO,CAAC,qDAAqD,EAAE,WAAW,CAAC;CACvF;;ACtZD,eAAe,CAAC,OAAO,GAAG,UAAA,GAAG,EAAC;EAC5B,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,YAAoB,KAAK,aAAY;EAC3D,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,EAAC;CACrD;;;;"} -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | v-color 6 | 7 | 8 | 9 |
loading...
10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "v-color", 3 | "version": "1.1.2", 4 | "description": "Chrome-flavored color picker in Vue.js", 5 | "keywords": [ 6 | "color-picker", 7 | "chrome-flavored" 8 | ], 9 | "main": "dist/index.js", 10 | "module": "dist/index.esm.js", 11 | "unpkg": "dist/index.js", 12 | "files": [ 13 | "dist" 14 | ], 15 | "scripts": { 16 | "server": "browser-sync start --server --port 1126 --reload-delay 1 --files \"index.html, ./dist/**\"", 17 | "build:watch": "cross-env NODE_ENV=development rollup -c rollup.config.js -w", 18 | "build:dev": "cross-env NODE_ENV=development rollup -c rollup.config.js", 19 | "build": "cross-env NODE_ENV=production rollup -c rollup.config.js", 20 | "start": "run-p build:watch server" 21 | }, 22 | "devDependencies": { 23 | "browser-sync": "^2.18.8", 24 | "cross-env": "^3.1.4", 25 | "npm-run-all": "^4.0.1", 26 | "postcss-cssnext": "^3.1.0", 27 | "rollup": "^0.59.2", 28 | "rollup-plugin-buble": "^0.15.0", 29 | "rollup-plugin-commonjs": "^7.0.0", 30 | "rollup-plugin-node-resolve": "^2.0.0", 31 | "rollup-plugin-postcss": "^1.6.1", 32 | "rollup-plugin-replace": "^1.1.1", 33 | "rollup-plugin-vue": "^2.2.20" 34 | }, 35 | "dependencies": { 36 | "invariant": "^2.2.4", 37 | "lodash": "^4.17.10", 38 | "object-assign": "^4.1.1", 39 | "pure-color": "^1.3.0", 40 | "v-ctrl": "^1.1.0" 41 | }, 42 | "license": "MIT", 43 | "repository": { 44 | "type": "git", 45 | "url": "https://github.com/v-comp/v-color.git" 46 | }, 47 | "bugs": { 48 | "url": "https://github.com/v-comp/v-color/issues" 49 | }, 50 | "homepage": "https://github.com/v-comp/v-color#readme", 51 | "author": "wemlion " 52 | } 53 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import buble from 'rollup-plugin-buble' 2 | import commonjs from 'rollup-plugin-commonjs' 3 | import resolve from 'rollup-plugin-node-resolve' 4 | import vue from 'rollup-plugin-vue' 5 | import replace from 'rollup-plugin-replace' 6 | import postcss from 'rollup-plugin-postcss' 7 | 8 | const NODE_ENV = process.env.NODE_ENV 9 | const isDEV = NODE_ENV !== 'production' 10 | const plugins = [ 11 | replace({ 12 | 'process.env.NODE_ENV': JSON.stringify(NODE_ENV) 13 | }), 14 | postcss({ 15 | extract: isDEV ? false : './dist/index.css' 16 | }), 17 | vue({ 18 | css: false, 19 | compileTemplate: true 20 | }), 21 | commonjs(), 22 | resolve({ 23 | jsnext: true, 24 | main: true, 25 | browser: true 26 | }), 27 | buble({ 28 | objectAssign: 'Object.assign' 29 | }) 30 | ] 31 | 32 | let options = [ 33 | { 34 | input: './src/index.js', 35 | output: { 36 | file: 'dist/index.esm.js', 37 | format: 'es', 38 | sourcemap: true, 39 | strict: true 40 | }, 41 | external: id => /^lodash/.test(id), 42 | plugins 43 | }, 44 | { 45 | input: './src/index.js', 46 | output: { 47 | file: 'dist/index.js', 48 | format: 'umd', 49 | name: 'VColor', 50 | sourcemap: true, 51 | strict: true 52 | }, 53 | plugins 54 | } 55 | ] 56 | 57 | if (isDEV) { 58 | options = [{ 59 | input: './demo.js', 60 | output: { 61 | file: 'dist/demo.js', 62 | format: 'umd', 63 | sourcemap: true, 64 | strict: true 65 | }, 66 | plugins 67 | }] 68 | } 69 | 70 | export default options 71 | -------------------------------------------------------------------------------- /src/color-picker.css: -------------------------------------------------------------------------------- 1 | .cp__wrapper { 2 | width: 250px; 3 | margin: 0; 4 | background: #fff; 5 | border-radius: 2px; 6 | box-shadow: 0 0 2px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.3); 7 | font-family: Menlo, 'Microsoft Yahei', sans-serif; 8 | user-select: none; 9 | } 10 | 11 | .cp__v-ctrl { 12 | position: relative; 13 | } 14 | 15 | .cp__thumb { 16 | position: absolute; 17 | width: 12px; 18 | height: 12px; 19 | top: 0; 20 | border-radius: 50%; 21 | margin-top: -1px; 22 | transform: translateX(-50%); 23 | background-color: #f8f8f8; 24 | box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.368627); 25 | cursor: default; 26 | } 27 | 28 | 29 | .cp__saturation { 30 | position: relative; 31 | width: 100%; 32 | padding-bottom: 55%; 33 | border-radius: 2px 2px 0 0; 34 | overflow: hidden; 35 | 36 | & > div { 37 | position: absolute; 38 | top: 0; 39 | left: 0; 40 | right: 0; 41 | bottom: 0; 42 | margin: 0; 43 | } 44 | 45 | 46 | & > .msk-white { 47 | background: linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0)); 48 | } 49 | 50 | & > .msk-black { 51 | background: linear-gradient(0deg, #000, transparent); 52 | } 53 | 54 | & > .cp__thumb { 55 | background-color: transparent; 56 | transform: translate(-50%, -50%); 57 | box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0, 0, 0, 0.3), 0 0 1px 2px rgba(0, 0, 0, 0.4); 58 | } 59 | } 60 | 61 | 62 | .cp__ctrl-pane { 63 | position: relative; 64 | width: 100%; 65 | box-sizing: border-box; 66 | padding: 16px 16px 12px; 67 | 68 | & > div { 69 | display: flex; 70 | align-items: center; 71 | } 72 | } 73 | 74 | 75 | .cp__tracks { 76 | flex: 1 0 0; 77 | } 78 | 79 | .cp__ctrl-bar { 80 | height: 10px; 81 | } 82 | 83 | .cp__ctrl-hue { 84 | background: linear-gradient(-90deg, red, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, red); 85 | } 86 | 87 | .cp__ctrl-alpha { 88 | margin-top: 8px; 89 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) left center; 90 | } 91 | 92 | .cp__preview { 93 | position: relative; 94 | width: 28px; 95 | height: 28px; 96 | margin-right: 5px; 97 | overflow: hidden; 98 | border-radius: 50%; 99 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==) center; 100 | 101 | & > div { 102 | position: absolute; 103 | left: 0; 104 | top: 0; 105 | width: 100%; 106 | height: 100%; 107 | border-radius: 50%; 108 | border: 1px solid transparent; 109 | box-sizing: border-box; 110 | } 111 | } 112 | 113 | .cp__fm-fields { 114 | display: flex; 115 | flex: 1; 116 | 117 | & > div { 118 | padding-left: 6px; 119 | flex: 1 0 0; 120 | } 121 | 122 | & input { 123 | width: 100%; 124 | height: 22px; 125 | font-size: 11px; 126 | text-align: center; 127 | color: rgb(51, 51, 51); 128 | border-radius: 2px; 129 | border: none; 130 | box-shadow: rgb(218, 218, 218) 0px 0px 0px 1px inset; 131 | transition: box-shadow 0.2s ease; 132 | -moz-appearance: textfield; 133 | 134 | &:focus { 135 | outline: 0; 136 | box-shadow: rgb(0, 125, 255) 0px 0px 0px 1px inset; 137 | } 138 | 139 | &::-webkit-inner-spin-button, 140 | &::-webkit-outer-spin-button { 141 | -webkit-appearance: none !important; 142 | margin: 0; 143 | } 144 | } 145 | 146 | & span { 147 | display: block; 148 | margin-top: 12px; 149 | text-transform: uppercase; 150 | font-size: 11px; 151 | line-height: 11px; 152 | color: rgb(150, 150, 150); 153 | text-align: center; 154 | } 155 | } 156 | 157 | /* color format switcher */ 158 | .cp__fm-switcher { 159 | position: relative; 160 | width: 32px; 161 | text-align: right; 162 | 163 | & > div { 164 | position: relative; 165 | margin-right: -4px; 166 | margin-top: 12px; 167 | cursor: pointer; 168 | 169 | & > svg { 170 | width: 24px; 171 | height: 24px; 172 | border-radius: 5px; 173 | background: transparent; 174 | border: 1px solid transparent; 175 | 176 | &:hover { 177 | border-color: rgb(238, 238, 238); 178 | background: rgb(238, 238, 238) 179 | } 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /src/color-picker.vue: -------------------------------------------------------------------------------- 1 | 75 | 76 | 411 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import VColorComponent from './color-picker.vue' 2 | 3 | VColorComponent.install = Vue => { 4 | Vue.config.devtools = process.env.NODE_ENV !== 'production' 5 | Vue.component(VColorComponent.name, VColorComponent) 6 | } 7 | 8 | export default VColorComponent 9 | --------------------------------------------------------------------------------