@kdcloudjs/kdesign 1.7.1 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/kdesign-complete.less +45 -43
  3. package/dist/kdesign.css +11 -6
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +1591 -1794
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +5 -5
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/color-picker/constant/colorTypes.js +3 -3
  11. package/es/color-picker/style/index.css +8 -2
  12. package/es/color-picker/style/index.less +5 -1
  13. package/es/config-provider/compDefaultProps.d.ts +1 -0
  14. package/es/config-provider/compDefaultProps.js +1 -0
  15. package/es/dropdown/dropdown.js +2 -7
  16. package/es/dropdown/menu.js +3 -0
  17. package/es/modal/modal.d.ts +7 -1
  18. package/es/modal/modal.js +29 -5
  19. package/es/select/select.js +6 -3
  20. package/es/tree/tree.d.ts +1 -0
  21. package/es/tree/tree.js +3 -0
  22. package/es/tree/treeHooks.js +1 -1
  23. package/es/tree/treeNode.d.ts +2 -0
  24. package/es/tree/treeNode.js +8 -5
  25. package/es/tree-select/style/index.css +2 -3
  26. package/es/tree-select/style/index.less +2 -4
  27. package/es/tree-select/style/token.less +38 -38
  28. package/es/tree-select/tree-select.js +1 -0
  29. package/lib/color-picker/constant/colorTypes.js +3 -3
  30. package/lib/color-picker/style/index.css +8 -2
  31. package/lib/color-picker/style/index.less +5 -1
  32. package/lib/config-provider/compDefaultProps.d.ts +1 -0
  33. package/lib/config-provider/compDefaultProps.js +1 -0
  34. package/lib/dropdown/dropdown.js +2 -7
  35. package/lib/dropdown/menu.js +3 -0
  36. package/lib/modal/modal.d.ts +7 -1
  37. package/lib/modal/modal.js +31 -7
  38. package/lib/select/select.js +6 -3
  39. package/lib/tree/tree.d.ts +1 -0
  40. package/lib/tree/tree.js +3 -0
  41. package/lib/tree/treeHooks.js +1 -1
  42. package/lib/tree/treeNode.d.ts +2 -0
  43. package/lib/tree/treeNode.js +8 -5
  44. package/lib/tree-select/style/index.css +2 -3
  45. package/lib/tree-select/style/index.less +2 -4
  46. package/lib/tree-select/style/token.less +38 -38
  47. package/lib/tree-select/tree-select.js +1 -0
  48. package/package.json +1 -1
package/dist/kdesign.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/kdesign v1.7.0
3
+ * @kdcloudjs/kdesign v1.7.2
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -9078,13 +9078,13 @@ var colorTypes = [{
9078
9078
  value: '#b2b2b2'
9079
9079
  }, {
9080
9080
  type: 'HSB',
9081
- value: 'hsb(0,0%,70%)'
9081
+ value: 'hsb(0, 0%, 70%)'
9082
9082
  }, {
9083
9083
  type: 'RGB',
9084
- value: 'rgb(178,178,178)'
9084
+ value: 'rgb(178, 178, 178)'
9085
9085
  }, {
9086
9086
  type: 'HSL',
9087
- value: 'hsl(0,0%,70%)'
9087
+ value: 'hsl(0, 0%, 70%)'
9088
9088
  }];
9089
9089
 
9090
9090
  /***/ }),
@@ -9936,6 +9936,7 @@ var compDefaultProps = {
9936
9936
  placeholder: '请输入需要搜索的内容',
9937
9937
  optionLabelProp: 'title',
9938
9938
  treeNodeFilterProp: 'title',
9939
+ treeExpandOnClickNode: true,
9939
9940
  showSearch: true,
9940
9941
  switcherIcon: function switcherIcon() {
9941
9942
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_index__WEBPACK_IMPORTED_MODULE_2__["Icon"], {
@@ -15617,7 +15618,7 @@ var findItem = function findItem(element) {
15617
15618
  }
15618
15619
  };
15619
15620
  var Dropdown = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["forwardRef"](function (props, ref) {
15620
- var _menu$props, _menu$props2, _menu$props3, _menu$props4, _menu$props5, _menu$props5$children, _menu$props5$children2, _menu$props6, _menu$props6$children, _menu$props6$children2, _menu$props7, _menu$props7$children, _menu$props7$children2, _menu$props7$children3, _menu$props8;
15621
+ var _menu$props, _menu$props2, _menu$props3;
15621
15622
  var _React$useContext = react__WEBPACK_IMPORTED_MODULE_11__["useContext"](_config_provider_ConfigContext__WEBPACK_IMPORTED_MODULE_13__["default"]),
15622
15623
  getPrefixCls = _React$useContext.getPrefixCls,
15623
15624
  pkgPrefixCls = _React$useContext.prefixCls,
@@ -15677,12 +15678,7 @@ var Dropdown = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["forwardRef"](fu
15677
15678
  onClick: handleItemClick,
15678
15679
  selectable: menuSelectable
15679
15680
  });
15680
- var isItem = react__WEBPACK_IMPORTED_MODULE_11__["Children"].count((_menu$props4 = menu.props) === null || _menu$props4 === void 0 ? void 0 : _menu$props4.children) === 1 && ((_menu$props5 = menu.props) === null || _menu$props5 === void 0 ? void 0 : (_menu$props5$children = _menu$props5.children) === null || _menu$props5$children === void 0 ? void 0 : (_menu$props5$children2 = _menu$props5$children.type) === null || _menu$props5$children2 === void 0 ? void 0 : _menu$props5$children2.displayName) === 'DropdownMenuItem' || Array.isArray((_menu$props6 = menu.props) === null || _menu$props6 === void 0 ? void 0 : (_menu$props6$children = _menu$props6.children) === null || _menu$props6$children === void 0 ? void 0 : (_menu$props6$children2 = _menu$props6$children.props) === null || _menu$props6$children2 === void 0 ? void 0 : _menu$props6$children2.children) || ((_menu$props7 = menu.props) === null || _menu$props7 === void 0 ? void 0 : (_menu$props7$children = _menu$props7.children) === null || _menu$props7$children === void 0 ? void 0 : (_menu$props7$children2 = _menu$props7$children.props) === null || _menu$props7$children2 === void 0 ? void 0 : (_menu$props7$children3 = _menu$props7$children2.children.type) === null || _menu$props7$children3 === void 0 ? void 0 : _menu$props7$children3.displayName) === 'DropdownMenuItem';
15681
- var menuElement = isMenu ? Array.isArray((_menu$props8 = menu.props) === null || _menu$props8 === void 0 ? void 0 : _menu$props8.children) || isItem ? cloneObj : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["createElement"]("ul", {
15682
- className: "".concat(prefixCls, "-menu"),
15683
- onClick: handleItemClick,
15684
- role: "menu"
15685
- }, menu.props.children) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["createElement"]("ul", {
15681
+ var menuElement = isMenu ? cloneObj : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["createElement"]("ul", {
15686
15682
  className: "".concat(prefixCls, "-menu"),
15687
15683
  onClick: handleItemClick,
15688
15684
  role: "menu"
@@ -15798,6 +15794,9 @@ var Menu = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__["forwardRef"](functio
15798
15794
  // className前缀
15799
15795
  var prefixCls = getPrefixCls(pkgPrefixCls, 'dropdown-menu', customPrefixcls);
15800
15796
  var cloneItem = function cloneItem(item, index) {
15797
+ if (! /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__["isValidElement"](item)) {
15798
+ return item;
15799
+ }
15801
15800
  var key = item.key || index;
15802
15801
  var selected = selectable && String(selectedKey) === String(key);
15803
15802
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__["cloneElement"](item, {
@@ -24007,30 +24006,34 @@ __webpack_require__.r(__webpack_exports__);
24007
24006
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__);
24008
24007
  /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
24009
24008
  /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);
24010
- /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.includes.js */ "./node_modules/core-js/modules/es.array.includes.js");
24011
- /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_3__);
24012
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js");
24013
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__);
24014
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "react");
24015
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
24016
- /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../index */ "./components/index.tsx");
24017
- /* harmony import */ var _button_button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../button/button */ "./components/button/button.tsx");
24018
- /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-dom */ "react-dom");
24019
- /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_8__);
24020
- /* harmony import */ var _utils_type__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../_utils/type */ "./components/_utils/type.ts");
24021
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
24022
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_10__);
24023
- /* harmony import */ var _config_provider_ConfigContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../config-provider/ConfigContext */ "./components/config-provider/ConfigContext.tsx");
24024
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../_utils */ "./components/_utils/index.ts");
24025
- /* harmony import */ var _utils_devwarning__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../_utils/devwarning */ "./components/_utils/devwarning.ts");
24026
- /* harmony import */ var react_draggable__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react-draggable */ "./node_modules/react-draggable/build/cjs/cjs.js");
24027
- /* harmony import */ var react_draggable__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(react_draggable__WEBPACK_IMPORTED_MODULE_14__);
24028
- /* harmony import */ var _locale_locale__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../locale/locale */ "./components/locale/locale.tsx");
24029
- /* harmony import */ var _utils_hooks__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../_utils/hooks */ "./components/_utils/hooks.tsx");
24009
+ /* harmony import */ var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");
24010
+ /* harmony import */ var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__);
24011
+ /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.array.includes.js */ "./node_modules/core-js/modules/es.array.includes.js");
24012
+ /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_4__);
24013
+ /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js");
24014
+ /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__);
24015
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "react");
24016
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
24017
+ /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../index */ "./components/index.tsx");
24018
+ /* harmony import */ var _button_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../button/button */ "./components/button/button.tsx");
24019
+ /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-dom */ "react-dom");
24020
+ /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_9__);
24021
+ /* harmony import */ var _utils_type__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../_utils/type */ "./components/_utils/type.ts");
24022
+ /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
24023
+ /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_11__);
24024
+ /* harmony import */ var _config_provider_ConfigContext__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../config-provider/ConfigContext */ "./components/config-provider/ConfigContext.tsx");
24025
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../_utils */ "./components/_utils/index.ts");
24026
+ /* harmony import */ var _utils_devwarning__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../_utils/devwarning */ "./components/_utils/devwarning.ts");
24027
+ /* harmony import */ var react_draggable__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react-draggable */ "./node_modules/react-draggable/build/cjs/cjs.js");
24028
+ /* harmony import */ var react_draggable__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(react_draggable__WEBPACK_IMPORTED_MODULE_15__);
24029
+ /* harmony import */ var _locale_locale__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../locale/locale */ "./components/locale/locale.tsx");
24030
+ /* harmony import */ var _utils_hooks__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../_utils/hooks */ "./components/_utils/hooks.tsx");
24030
24031
 
24031
24032
 
24032
24033
 
24033
24034
 
24035
+ var _excluded = ["body", "bodyClassName", "bodyStyle", "cancelButtonProps", "cancelText", "className", "closable", "closeIcon", "destroyOnClose", "draggable", "focusTriggerAfterClose", "footer", "footerClassName", "footerStyle", "footerBtnOrder", "getContainer", "height", "keyboard", "mask", "maskClosable", "maskStyle", "okButtonProps", "okText", "onCancel", "onOk", "prefixCls", "title", "titleIcon", "type", "visible", "width", "showline", "onDragStart", "onDrag", "onDragStop", "bounds"];
24036
+
24034
24037
 
24035
24038
 
24036
24039
 
@@ -24045,14 +24048,14 @@ __webpack_require__.r(__webpack_exports__);
24045
24048
 
24046
24049
 
24047
24050
  var ConfirmModalTypes = ['confirm', 'normal'];
24048
- var ModalTypes = Object(_utils_type__WEBPACK_IMPORTED_MODULE_9__["tuple"])('confirm', 'warning', 'error', 'normal');
24049
- var Modal = function Modal(props) {
24051
+ var ModalTypes = Object(_utils_type__WEBPACK_IMPORTED_MODULE_10__["tuple"])('confirm', 'warning', 'error', 'normal');
24052
+ var InternalModal = function InternalModal(props, ref) {
24050
24053
  var _classNames3, _classNames4;
24051
- var _useContext = Object(react__WEBPACK_IMPORTED_MODULE_5__["useContext"])(_config_provider_ConfigContext__WEBPACK_IMPORTED_MODULE_11__["default"]),
24054
+ var _useContext = Object(react__WEBPACK_IMPORTED_MODULE_6__["useContext"])(_config_provider_ConfigContext__WEBPACK_IMPORTED_MODULE_12__["default"]),
24052
24055
  getPrefixCls = _useContext.getPrefixCls,
24053
24056
  prefixCls = _useContext.prefixCls,
24054
24057
  userDefaultProps = _useContext.compDefaultProps;
24055
- var modalProps = Object(_utils__WEBPACK_IMPORTED_MODULE_12__["getCompProps"])('Modal', userDefaultProps, props); // 属性需要合并一遍用户定义的默认属性
24058
+ var modalProps = Object(_utils__WEBPACK_IMPORTED_MODULE_13__["getCompProps"])('Modal', userDefaultProps, props); // 属性需要合并一遍用户定义的默认属性
24056
24059
  var body = modalProps.body,
24057
24060
  bodyClassName = modalProps.bodyClassName,
24058
24061
  bodyStyle = modalProps.bodyStyle,
@@ -24084,43 +24087,49 @@ var Modal = function Modal(props) {
24084
24087
  type = modalProps.type,
24085
24088
  visible = modalProps.visible,
24086
24089
  width = modalProps.width,
24087
- showline = modalProps.showline;
24090
+ showline = modalProps.showline,
24091
+ onDragStart = modalProps.onDragStart,
24092
+ onDrag = modalProps.onDrag,
24093
+ onDragStop = modalProps.onDragStop,
24094
+ bounds = modalProps.bounds,
24095
+ others = _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3___default()(modalProps, _excluded);
24088
24096
  var isForceController = visible !== undefined;
24089
- var _useState = Object(react__WEBPACK_IMPORTED_MODULE_5__["useState"])(isForceController ? visible : true),
24097
+ var _useState = Object(react__WEBPACK_IMPORTED_MODULE_6__["useState"])(isForceController ? visible : true),
24090
24098
  _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),
24091
24099
  innerVisible = _useState2[0],
24092
24100
  setInnerVisible = _useState2[1]; // 需要根据visible来判断,不能一开始为true再去设置false
24093
- var previousActiveElement = Object(react__WEBPACK_IMPORTED_MODULE_5__["useRef"])(null);
24094
- var containerRef = Object(react__WEBPACK_IMPORTED_MODULE_5__["useRef"])(null);
24101
+ var previousActiveElement = Object(react__WEBPACK_IMPORTED_MODULE_6__["useRef"])(null);
24102
+ var innerRef = Object(react__WEBPACK_IMPORTED_MODULE_6__["useRef"])(null);
24103
+ var containerRef = ref || innerRef;
24095
24104
  var modalPrefixCls = getPrefixCls(prefixCls, 'modal', customPrefixcls);
24096
- Object(_utils_devwarning__WEBPACK_IMPORTED_MODULE_13__["default"])(ModalTypes.indexOf(type) === -1, 'modal', "cannot found modal type '".concat(type, "'"));
24105
+ Object(_utils_devwarning__WEBPACK_IMPORTED_MODULE_14__["default"])(ModalTypes.indexOf(type) === -1, 'modal', "cannot found modal type '".concat(type, "'"));
24097
24106
  var modalContainer = typeof getContainer === 'function' ? getContainer() : getContainer;
24098
24107
  if (modalContainer !== false && !(modalContainer instanceof HTMLElement)) {
24099
24108
  try {
24100
24109
  modalContainer = document.querySelector(modalContainer);
24101
24110
  } catch (error) {
24102
- Object(_utils_devwarning__WEBPACK_IMPORTED_MODULE_13__["default"])(true, 'modal', 'getContainer"s returnValue/value is not a correct CSSSelector');
24111
+ Object(_utils_devwarning__WEBPACK_IMPORTED_MODULE_14__["default"])(true, 'modal', 'getContainer"s returnValue/value is not a correct CSSSelector');
24103
24112
  }
24104
24113
  modalContainer = document.body;
24105
24114
  }
24106
- Object(_utils_hooks__WEBPACK_IMPORTED_MODULE_16__["useHideDocumentScrollBar"])(isForceController ? !!visible : !!innerVisible, modalContainer === document.body, !!mask);
24107
- var closeModal = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function () {
24115
+ Object(_utils_hooks__WEBPACK_IMPORTED_MODULE_17__["useHideDocumentScrollBar"])(isForceController ? !!visible : !!innerVisible, modalContainer === document.body, !!mask);
24116
+ var closeModal = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function () {
24108
24117
  setInnerVisible(false);
24109
24118
  }, []);
24110
- var proxyCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function (onDoingAction, event) {
24119
+ var proxyCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function (onDoingAction, event) {
24111
24120
  onDoingAction && onDoingAction(event);
24112
24121
  if (isForceController) {
24113
24122
  return;
24114
24123
  }
24115
24124
  closeModal();
24116
24125
  }, [isForceController, closeModal]);
24117
- var escapeToCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function (evt) {
24126
+ var escapeToCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function (evt) {
24118
24127
  // In Internet Explorer 9 and Firefox 36 and earlier, the Esc key returns "Esc" instead of "Escape"
24119
24128
  if (['Escape', 'Esc'].includes(evt.key)) {
24120
24129
  proxyCloseModal(onCancel);
24121
24130
  }
24122
24131
  }, [proxyCloseModal, onCancel]);
24123
- var enterToCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function (evt) {
24132
+ var enterToCloseModal = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function (evt) {
24124
24133
  if (evt.key === 'Enter' && evt.target === containerRef.current) {
24125
24134
  proxyCloseModal(onOk);
24126
24135
  // 无效
@@ -24130,42 +24139,42 @@ var Modal = function Modal(props) {
24130
24139
  var isConfirmType = ConfirmModalTypes.includes(type);
24131
24140
  var isNormalBtn = !footerBtnOrder || footerBtnOrder === 'normal';
24132
24141
  var finalCancelButtonProps = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({
24133
- onClick: Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function (event) {
24142
+ onClick: Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function (event) {
24134
24143
  proxyCloseModal(onCancel, event);
24135
24144
  }, [onCancel, proxyCloseModal]),
24136
24145
  type: 'second',
24137
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()("".concat(modalPrefixCls, "-cancel-btn"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "".concat(modalPrefixCls, "-margin-btn"), isConfirmType && isNormalBtn))
24146
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()("".concat(modalPrefixCls, "-cancel-btn"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "".concat(modalPrefixCls, "-margin-btn"), isConfirmType && isNormalBtn))
24138
24147
  }, cancelButtonProps);
24139
24148
  var finalOkButtonProps = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({
24140
- onClick: Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function (event) {
24149
+ onClick: Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function (event) {
24141
24150
  proxyCloseModal(onOk, event);
24142
24151
  }, [onOk, proxyCloseModal]),
24143
24152
  type: ConfirmModalTypes.includes(type) ? 'primary' : 'second',
24144
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()("".concat(modalPrefixCls, "-ok-btn"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "".concat(modalPrefixCls, "-margin-btn"), isConfirmType && !isNormalBtn))
24153
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()("".concat(modalPrefixCls, "-ok-btn"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "".concat(modalPrefixCls, "-margin-btn"), isConfirmType && !isNormalBtn))
24145
24154
  }, okButtonProps);
24146
- var generatorFooterByType = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function () {
24155
+ var generatorFooterByType = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function () {
24147
24156
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'confirm';
24148
24157
  switch (type) {
24149
24158
  case 'error':
24150
24159
  case 'warning':
24151
24160
  {
24152
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24161
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24153
24162
  className: "".concat(modalPrefixCls, "-iknow-node")
24154
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_7__["default"], finalOkButtonProps, okText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_15__["getLangMsg"])('Modal', 'iknowText')));
24163
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_8__["default"], finalOkButtonProps, okText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_16__["getLangMsg"])('Modal', 'iknowText')));
24155
24164
  }
24156
24165
  case 'confirm':
24157
24166
  case 'normal':
24158
24167
  default:
24159
24168
  {
24160
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_5___default.a.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24169
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_6___default.a.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24161
24170
  className: "".concat(modalPrefixCls, "-cancel-node")
24162
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_7__["default"], finalCancelButtonProps, cancelText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_15__["getLangMsg"])('Modal', 'cancelText'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24171
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_8__["default"], finalCancelButtonProps, cancelText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_16__["getLangMsg"])('Modal', 'cancelText'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24163
24172
  className: "".concat(modalPrefixCls, "-ok-node")
24164
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_7__["default"], finalOkButtonProps, okText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_15__["getLangMsg"])('Modal', 'okText'))));
24173
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(_button_button__WEBPACK_IMPORTED_MODULE_8__["default"], finalOkButtonProps, okText || Object(_locale_locale__WEBPACK_IMPORTED_MODULE_16__["getLangMsg"])('Modal', 'okText'))));
24165
24174
  }
24166
24175
  }
24167
24176
  }, [modalPrefixCls, okText, cancelText, finalCancelButtonProps, finalOkButtonProps]);
24168
- Object(react__WEBPACK_IMPORTED_MODULE_5__["useEffect"])(function () {
24177
+ Object(react__WEBPACK_IMPORTED_MODULE_6__["useEffect"])(function () {
24169
24178
  if (isForceController) {
24170
24179
  // 强控制下只有下面该条件成立获取焦点
24171
24180
  if (focusTriggerAfterClose && visible === true) {
@@ -24184,7 +24193,7 @@ var Modal = function Modal(props) {
24184
24193
  }
24185
24194
  };
24186
24195
  }, [focusTriggerAfterClose, visible, isForceController]);
24187
- Object(react__WEBPACK_IMPORTED_MODULE_5__["useEffect"])(function () {
24196
+ Object(react__WEBPACK_IMPORTED_MODULE_6__["useEffect"])(function () {
24188
24197
  if (keyboard) {
24189
24198
  document.body.addEventListener('keydown', escapeToCloseModal);
24190
24199
  }
@@ -24192,16 +24201,16 @@ var Modal = function Modal(props) {
24192
24201
  document.body.removeEventListener('keydown', escapeToCloseModal);
24193
24202
  };
24194
24203
  }, [keyboard, escapeToCloseModal, proxyCloseModal, onCancel]);
24195
- var handleMaskClick = Object(react__WEBPACK_IMPORTED_MODULE_5__["useCallback"])(function () {
24204
+ var handleMaskClick = Object(react__WEBPACK_IMPORTED_MODULE_6__["useCallback"])(function () {
24196
24205
  if (maskClosable) {
24197
24206
  proxyCloseModal(onCancel);
24198
24207
  }
24199
24208
  }, [proxyCloseModal, onCancel, maskClosable]);
24200
24209
  var isHidden = !destroyOnClose && !(isForceController ? visible : innerVisible);
24201
- var modalClasses = classnames__WEBPACK_IMPORTED_MODULE_10___default()(modalPrefixCls, className, (_classNames3 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container"), true), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container-hidden"), isHidden), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container-show"), !isHidden), _classNames3));
24210
+ var modalClasses = classnames__WEBPACK_IMPORTED_MODULE_11___default()(modalPrefixCls, className, (_classNames3 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container"), true), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container-hidden"), isHidden), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames3, "".concat(modalPrefixCls, "-container-show"), !isHidden), _classNames3));
24202
24211
  var headerClass = "".concat(modalPrefixCls, "-header");
24203
- var container = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24204
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()((_classNames4 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-container-box"), true), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-has-container-box"), modalContainer), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-showline"), showline), _classNames4)),
24212
+ var container = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24213
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()((_classNames4 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-container-box"), true), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-has-container-box"), modalContainer), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_classNames4, "".concat(modalPrefixCls, "-showline"), showline), _classNames4)),
24205
24214
  style: {
24206
24215
  width: width,
24207
24216
  height: height
@@ -24209,32 +24218,36 @@ var Modal = function Modal(props) {
24209
24218
  ref: containerRef,
24210
24219
  tabIndex: -1,
24211
24220
  onKeyDown: enterToCloseModal
24212
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24221
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24213
24222
  className: headerClass
24214
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24223
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24215
24224
  className: "".concat(modalPrefixCls, "-title-container")
24216
- }, titleIcon !== undefined ? titleIcon : type !== 'normal' && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24217
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()("".concat(modalPrefixCls, "-title-icon"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "modal-".concat(type, "-title-icon-bgcolor"), type))
24218
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24225
+ }, titleIcon !== undefined ? titleIcon : type !== 'normal' && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24226
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()("".concat(modalPrefixCls, "-title-icon"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, "modal-".concat(type, "-title-icon-bgcolor"), type))
24227
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24219
24228
  className: "".concat(modalPrefixCls, "-title")
24220
- }, title)), closable && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24229
+ }, title)), closable && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24221
24230
  className: "".concat(modalPrefixCls, "-close-icon"),
24222
24231
  onClick: function onClick() {
24223
24232
  return proxyCloseModal(onCancel);
24224
24233
  }
24225
- }, closeIcon || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(_index__WEBPACK_IMPORTED_MODULE_6__["Icon"], {
24234
+ }, closeIcon || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(_index__WEBPACK_IMPORTED_MODULE_7__["Icon"], {
24226
24235
  type: "close"
24227
- }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24228
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()("".concat(modalPrefixCls, "-body"), bodyClassName),
24236
+ }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24237
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()("".concat(modalPrefixCls, "-body"), bodyClassName),
24229
24238
  style: bodyStyle
24230
- }, body), footer !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24231
- className: classnames__WEBPACK_IMPORTED_MODULE_10___default()("".concat(modalPrefixCls, "-footer"), "".concat(modalPrefixCls, "-").concat(type, "-footer"), footerClassName),
24239
+ }, body), footer !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24240
+ className: classnames__WEBPACK_IMPORTED_MODULE_11___default()("".concat(modalPrefixCls, "-footer"), "".concat(modalPrefixCls, "-").concat(type, "-footer"), footerClassName),
24232
24241
  style: _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({
24233
24242
  flexDirection: !footer && (!footerBtnOrder || footerBtnOrder === 'normal') ? 'row' : 'row-reverse'
24234
24243
  }, footerStyle || {})
24235
24244
  }, footer || generatorFooterByType(type)));
24236
24245
  // 没有容器应该是不用居中的
24237
24246
  // 但仍可拖拽
24247
+ var handleDragStart = function handleDragStart(e, data) {
24248
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
24249
+ onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(e, data);
24250
+ };
24238
24251
  var defaultPosition = modalContainer ? {
24239
24252
  x: -(width / 2),
24240
24253
  y: -(height / 2)
@@ -24242,22 +24255,27 @@ var Modal = function Modal(props) {
24242
24255
  x: 0,
24243
24256
  y: 0
24244
24257
  };
24245
- var comp = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24258
+ var comp = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({
24246
24259
  className: modalClasses
24247
- }, mask && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement("div", {
24260
+ }, others), mask && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", {
24248
24261
  onClick: handleMaskClick,
24249
24262
  className: "".concat(modalPrefixCls, "-mask"),
24250
24263
  style: maskStyle
24251
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(react_draggable__WEBPACK_IMPORTED_MODULE_14___default.a, {
24264
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(react_draggable__WEBPACK_IMPORTED_MODULE_15___default.a, {
24252
24265
  defaultPosition: defaultPosition,
24253
24266
  handle: ".".concat(headerClass),
24254
24267
  disabled: !draggable,
24268
+ onStart: handleDragStart,
24269
+ onDrag: onDrag,
24270
+ onStop: onDragStop,
24271
+ bounds: bounds,
24255
24272
  cancel: ".".concat(modalPrefixCls, "-title-container, .").concat(modalPrefixCls, "-close-icon")
24256
24273
  }, container));
24257
24274
  var renderComp = ((isForceController ? visible : innerVisible) || !destroyOnClose) && comp;
24258
- if (modalContainer && renderComp) return /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_8___default.a.createPortal(renderComp, modalContainer);
24275
+ if (modalContainer && renderComp) return /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_9___default.a.createPortal(renderComp, modalContainer);
24259
24276
  return renderComp || null;
24260
24277
  };
24278
+ var Modal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.forwardRef(InternalModal);
24261
24279
  Modal.displayName = 'Modal';
24262
24280
  /* harmony default export */ __webpack_exports__["default"] = (Modal);
24263
24281
 
@@ -28392,10 +28410,11 @@ var InternalSelect = function InternalSelect(props, ref) {
28392
28410
  _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
28393
28411
  singleVal = _useState4[0],
28394
28412
  setSingleVal = _useState4[1];
28395
- var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_18__["useState"])(!!props.visible || defaultOpen),
28413
+ var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_18__["useState"])(typeof props.visible === 'undefined' ? !!defaultOpen : !!props.visible),
28396
28414
  _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_3___default()(_useState5, 2),
28397
28415
  optionShow = _useState6[0],
28398
- setOptionShow = _useState6[1]; // 下拉列表是否展示
28416
+ setOptionShow = _useState6[1];
28417
+ // 下拉列表是否展示
28399
28418
  // const [searchInput, setSearchInput] = useState<string>('') // 搜索框值
28400
28419
  var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_18__["useState"])(''),
28401
28420
  _useState8 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_3___default()(_useState7, 2),
@@ -28426,7 +28445,9 @@ var InternalSelect = function InternalSelect(props, ref) {
28426
28445
  // 多选,单选公共样式
28427
28446
  var commCls = classnames__WEBPACK_IMPORTED_MODULE_21___default()((_classNames6 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(_classNames6, "".concat(selectPrefixCls, "-size-").concat(size), size), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), _classNames6));
28428
28447
  Object(react__WEBPACK_IMPORTED_MODULE_18__["useEffect"])(function () {
28429
- setOptionShow(!!props.visible);
28448
+ if (typeof props.visible !== 'undefined') {
28449
+ setOptionShow(props.visible);
28450
+ }
28430
28451
  }, [props.visible]);
28431
28452
 
28432
28453
  // realchildren更新时数据处理---待解决
@@ -35063,6 +35084,7 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
35063
35084
  icon: treeIcon,
35064
35085
  showIcon: showTreeIcon,
35065
35086
  switcherIcon: switcherIcon,
35087
+ onlyExpandOnClickIcon: true,
35066
35088
  notFoundContent: renderNotContent(),
35067
35089
  filterTreeNode: defFilterTreeNode,
35068
35090
  onSelect: handleSelect,
@@ -35440,6 +35462,8 @@ var InternalTree = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_13___default.a.fo
35440
35462
  filterTreeNode = TreeProps.filterTreeNode,
35441
35463
  filterValue = TreeProps.filterValue,
35442
35464
  expandOnClickNode = TreeProps.expandOnClickNode,
35465
+ _TreeProps$onlyExpand = TreeProps.onlyExpandOnClickIcon,
35466
+ onlyExpandOnClickIcon = _TreeProps$onlyExpand === void 0 ? false : _TreeProps$onlyExpand,
35443
35467
  loadData = TreeProps.loadData,
35444
35468
  notFoundContent = TreeProps.notFoundContent;
35445
35469
  var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
@@ -35777,6 +35801,7 @@ var InternalTree = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_13___default.a.fo
35777
35801
  item.dragOver = dragOverNodeKey === item.key && dropPosition === 0;
35778
35802
  item.dropPosition = dropPosition;
35779
35803
  item.expandOnClickNode = expandOnClickNode;
35804
+ item.onlyExpandOnClickIcon = onlyExpandOnClickIcon;
35780
35805
  item.loading = loadingKeys.has(item.key) && !loadedKeys.has(item.key);
35781
35806
  item.loadData = loadData;
35782
35807
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_13___default.a.createElement(_treeNode__WEBPACK_IMPORTED_MODULE_18__["default"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, item, {
@@ -35933,7 +35958,7 @@ var useSelect = function useSelect(selectedKeysProps, defaultSelectedKeys) {
35933
35958
  selectedKeys = _useState2[0],
35934
35959
  setSelectedKeys = _useState2[1];
35935
35960
  Object(react__WEBPACK_IMPORTED_MODULE_3__["useEffect"])(function () {
35936
- setSelectedKeys(selectedKeysProps);
35961
+ selectedKeysProps && setSelectedKeys(selectedKeysProps);
35937
35962
  }, [selectedKeysProps]);
35938
35963
  return [selectedKeys, setSelectedKeys];
35939
35964
  };
@@ -35990,7 +36015,7 @@ __webpack_require__.r(__webpack_exports__);
35990
36015
 
35991
36016
 
35992
36017
 
35993
- var _excluded = ["nodeKey", "prefixCls", "selectable", "checkable", "className", "icon", "switcherIcon", "disabled", "draggable", "pos", "checked", "level", "getDragNode", "hasChildNode", "expand", "title", "showLine", "showIcon", "selected", "setDragNode", "style", "indeterminate", "estimatedItemSize", "dragOver", "dropPosition", "expandOnClickNode", "loading", "onExpand", "onCheck", "onDragStart", "onDragOver", "onDragLeave", "onDragEnter", "onDragEnd", "onDrop", "onSelect"];
36018
+ var _excluded = ["nodeKey", "prefixCls", "selectable", "checkable", "className", "icon", "switcherIcon", "disabled", "draggable", "pos", "checked", "level", "getDragNode", "hasChildNode", "expand", "title", "showLine", "showIcon", "selected", "setDragNode", "style", "indeterminate", "estimatedItemSize", "dragOver", "dropPosition", "expandOnClickNode", "onlyExpandOnClickIcon", "loading", "onExpand", "onCheck", "onDragStart", "onDragOver", "onDragLeave", "onDragEnter", "onDragEnd", "onDrop", "onSelect"];
35994
36019
 
35995
36020
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35996
36021
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -36033,6 +36058,7 @@ var TreeNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.forwar
36033
36058
  dragOver = TreeNodeProps.dragOver,
36034
36059
  dropPosition = TreeNodeProps.dropPosition,
36035
36060
  expandOnClickNode = TreeNodeProps.expandOnClickNode,
36061
+ onlyExpandOnClickIcon = TreeNodeProps.onlyExpandOnClickIcon,
36036
36062
  loading = TreeNodeProps.loading,
36037
36063
  onExpand = TreeNodeProps.onExpand,
36038
36064
  onCheck = TreeNodeProps.onCheck,
@@ -36152,12 +36178,12 @@ var TreeNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.forwar
36152
36178
  if (Array.isArray(switcherIcon) && switcherIcon.length === 2) {
36153
36179
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.createElement("span", {
36154
36180
  className: classnames__WEBPACK_IMPORTED_MODULE_12___default()("".concat(treeNodePrefixCls, "-icon"), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()({}, "".concat(treeNodePrefixCls, "-icon-hover"), !expandOnClickNode)),
36155
- onClick: expandOnClickNode ? undefined : handleExpandIconClick
36181
+ onClick: expandOnClickNode ? onlyExpandOnClickIcon ? handleExpandIconClick : undefined : handleExpandIconClick
36156
36182
  }, expandState ? renderIcon(switcherIcon[1]) : renderIcon(switcherIcon[0]));
36157
36183
  }
36158
36184
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.createElement("span", {
36159
36185
  className: classnames__WEBPACK_IMPORTED_MODULE_12___default()("".concat(treeNodePrefixCls, "-icon"), (_classNames3 = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_classNames3, "".concat(treeNodePrefixCls, "-animation-expand"), expandState), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_classNames3, "".concat(treeNodePrefixCls, "-animation-collapse"), !expandState), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_classNames3, "".concat(treeNodePrefixCls, "-icon-hover"), !expandOnClickNode), _classNames3)),
36160
- onClick: expandOnClickNode ? undefined : handleExpandIconClick
36186
+ onClick: expandOnClickNode ? onlyExpandOnClickIcon ? handleExpandIconClick : undefined : handleExpandIconClick
36161
36187
  }, renderIcon(switcherIcon || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_16__["default"], {
36162
36188
  type: "arrow-right-solid"
36163
36189
  })));
@@ -36225,9 +36251,11 @@ var TreeNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11___default.a.forwar
36225
36251
  }, [expandState, nodeData, nodeKey, onExpand, setExpandState]);
36226
36252
  var handleClick = react__WEBPACK_IMPORTED_MODULE_11___default.a.useCallback(function (e) {
36227
36253
  e.stopPropagation();
36228
- expandOnClickNode && handleExpandIconClick();
36254
+ if (expandOnClickNode) {
36255
+ !onlyExpandOnClickIcon && handleExpandIconClick();
36256
+ }
36229
36257
  handleSelect(e);
36230
- }, [expandOnClickNode, handleExpandIconClick, handleSelect]);
36258
+ }, [expandOnClickNode, handleExpandIconClick, handleSelect, onlyExpandOnClickIcon]);
36231
36259
  var handleDragStart = react__WEBPACK_IMPORTED_MODULE_11___default.a.useCallback(function (e) {
36232
36260
  if (!draggable) return;
36233
36261
  setDragNode(nodeData);
@@ -58447,160 +58475,159 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
58447
58475
  /***/ (function(module, exports, __webpack_require__) {
58448
58476
 
58449
58477
  "use strict";
58450
-
58451
-
58452
- module.exports = {
58453
- "aliceblue": [240, 248, 255],
58454
- "antiquewhite": [250, 235, 215],
58455
- "aqua": [0, 255, 255],
58456
- "aquamarine": [127, 255, 212],
58457
- "azure": [240, 255, 255],
58458
- "beige": [245, 245, 220],
58459
- "bisque": [255, 228, 196],
58460
- "black": [0, 0, 0],
58461
- "blanchedalmond": [255, 235, 205],
58462
- "blue": [0, 0, 255],
58463
- "blueviolet": [138, 43, 226],
58464
- "brown": [165, 42, 42],
58465
- "burlywood": [222, 184, 135],
58466
- "cadetblue": [95, 158, 160],
58467
- "chartreuse": [127, 255, 0],
58468
- "chocolate": [210, 105, 30],
58469
- "coral": [255, 127, 80],
58470
- "cornflowerblue": [100, 149, 237],
58471
- "cornsilk": [255, 248, 220],
58472
- "crimson": [220, 20, 60],
58473
- "cyan": [0, 255, 255],
58474
- "darkblue": [0, 0, 139],
58475
- "darkcyan": [0, 139, 139],
58476
- "darkgoldenrod": [184, 134, 11],
58477
- "darkgray": [169, 169, 169],
58478
- "darkgreen": [0, 100, 0],
58479
- "darkgrey": [169, 169, 169],
58480
- "darkkhaki": [189, 183, 107],
58481
- "darkmagenta": [139, 0, 139],
58482
- "darkolivegreen": [85, 107, 47],
58483
- "darkorange": [255, 140, 0],
58484
- "darkorchid": [153, 50, 204],
58485
- "darkred": [139, 0, 0],
58486
- "darksalmon": [233, 150, 122],
58487
- "darkseagreen": [143, 188, 143],
58488
- "darkslateblue": [72, 61, 139],
58489
- "darkslategray": [47, 79, 79],
58490
- "darkslategrey": [47, 79, 79],
58491
- "darkturquoise": [0, 206, 209],
58492
- "darkviolet": [148, 0, 211],
58493
- "deeppink": [255, 20, 147],
58494
- "deepskyblue": [0, 191, 255],
58495
- "dimgray": [105, 105, 105],
58496
- "dimgrey": [105, 105, 105],
58497
- "dodgerblue": [30, 144, 255],
58498
- "firebrick": [178, 34, 34],
58499
- "floralwhite": [255, 250, 240],
58500
- "forestgreen": [34, 139, 34],
58501
- "fuchsia": [255, 0, 255],
58502
- "gainsboro": [220, 220, 220],
58503
- "ghostwhite": [248, 248, 255],
58504
- "gold": [255, 215, 0],
58505
- "goldenrod": [218, 165, 32],
58506
- "gray": [128, 128, 128],
58507
- "green": [0, 128, 0],
58508
- "greenyellow": [173, 255, 47],
58509
- "grey": [128, 128, 128],
58510
- "honeydew": [240, 255, 240],
58511
- "hotpink": [255, 105, 180],
58512
- "indianred": [205, 92, 92],
58513
- "indigo": [75, 0, 130],
58514
- "ivory": [255, 255, 240],
58515
- "khaki": [240, 230, 140],
58516
- "lavender": [230, 230, 250],
58517
- "lavenderblush": [255, 240, 245],
58518
- "lawngreen": [124, 252, 0],
58519
- "lemonchiffon": [255, 250, 205],
58520
- "lightblue": [173, 216, 230],
58521
- "lightcoral": [240, 128, 128],
58522
- "lightcyan": [224, 255, 255],
58523
- "lightgoldenrodyellow": [250, 250, 210],
58524
- "lightgray": [211, 211, 211],
58525
- "lightgreen": [144, 238, 144],
58526
- "lightgrey": [211, 211, 211],
58527
- "lightpink": [255, 182, 193],
58528
- "lightsalmon": [255, 160, 122],
58529
- "lightseagreen": [32, 178, 170],
58530
- "lightskyblue": [135, 206, 250],
58531
- "lightslategray": [119, 136, 153],
58532
- "lightslategrey": [119, 136, 153],
58533
- "lightsteelblue": [176, 196, 222],
58534
- "lightyellow": [255, 255, 224],
58535
- "lime": [0, 255, 0],
58536
- "limegreen": [50, 205, 50],
58537
- "linen": [250, 240, 230],
58538
- "magenta": [255, 0, 255],
58539
- "maroon": [128, 0, 0],
58540
- "mediumaquamarine": [102, 205, 170],
58541
- "mediumblue": [0, 0, 205],
58542
- "mediumorchid": [186, 85, 211],
58543
- "mediumpurple": [147, 112, 219],
58544
- "mediumseagreen": [60, 179, 113],
58545
- "mediumslateblue": [123, 104, 238],
58546
- "mediumspringgreen": [0, 250, 154],
58547
- "mediumturquoise": [72, 209, 204],
58548
- "mediumvioletred": [199, 21, 133],
58549
- "midnightblue": [25, 25, 112],
58550
- "mintcream": [245, 255, 250],
58551
- "mistyrose": [255, 228, 225],
58552
- "moccasin": [255, 228, 181],
58553
- "navajowhite": [255, 222, 173],
58554
- "navy": [0, 0, 128],
58555
- "oldlace": [253, 245, 230],
58556
- "olive": [128, 128, 0],
58557
- "olivedrab": [107, 142, 35],
58558
- "orange": [255, 165, 0],
58559
- "orangered": [255, 69, 0],
58560
- "orchid": [218, 112, 214],
58561
- "palegoldenrod": [238, 232, 170],
58562
- "palegreen": [152, 251, 152],
58563
- "paleturquoise": [175, 238, 238],
58564
- "palevioletred": [219, 112, 147],
58565
- "papayawhip": [255, 239, 213],
58566
- "peachpuff": [255, 218, 185],
58567
- "peru": [205, 133, 63],
58568
- "pink": [255, 192, 203],
58569
- "plum": [221, 160, 221],
58570
- "powderblue": [176, 224, 230],
58571
- "purple": [128, 0, 128],
58572
- "rebeccapurple": [102, 51, 153],
58573
- "red": [255, 0, 0],
58574
- "rosybrown": [188, 143, 143],
58575
- "royalblue": [65, 105, 225],
58576
- "saddlebrown": [139, 69, 19],
58577
- "salmon": [250, 128, 114],
58578
- "sandybrown": [244, 164, 96],
58579
- "seagreen": [46, 139, 87],
58580
- "seashell": [255, 245, 238],
58581
- "sienna": [160, 82, 45],
58582
- "silver": [192, 192, 192],
58583
- "skyblue": [135, 206, 235],
58584
- "slateblue": [106, 90, 205],
58585
- "slategray": [112, 128, 144],
58586
- "slategrey": [112, 128, 144],
58587
- "snow": [255, 250, 250],
58588
- "springgreen": [0, 255, 127],
58589
- "steelblue": [70, 130, 180],
58590
- "tan": [210, 180, 140],
58591
- "teal": [0, 128, 128],
58592
- "thistle": [216, 191, 216],
58593
- "tomato": [255, 99, 71],
58594
- "turquoise": [64, 224, 208],
58595
- "violet": [238, 130, 238],
58596
- "wheat": [245, 222, 179],
58597
- "white": [255, 255, 255],
58598
- "whitesmoke": [245, 245, 245],
58599
- "yellow": [255, 255, 0],
58600
- "yellowgreen": [154, 205, 50]
58601
- };
58602
58478
 
58603
58479
 
58480
+ module.exports = {
58481
+ "aliceblue": [240, 248, 255],
58482
+ "antiquewhite": [250, 235, 215],
58483
+ "aqua": [0, 255, 255],
58484
+ "aquamarine": [127, 255, 212],
58485
+ "azure": [240, 255, 255],
58486
+ "beige": [245, 245, 220],
58487
+ "bisque": [255, 228, 196],
58488
+ "black": [0, 0, 0],
58489
+ "blanchedalmond": [255, 235, 205],
58490
+ "blue": [0, 0, 255],
58491
+ "blueviolet": [138, 43, 226],
58492
+ "brown": [165, 42, 42],
58493
+ "burlywood": [222, 184, 135],
58494
+ "cadetblue": [95, 158, 160],
58495
+ "chartreuse": [127, 255, 0],
58496
+ "chocolate": [210, 105, 30],
58497
+ "coral": [255, 127, 80],
58498
+ "cornflowerblue": [100, 149, 237],
58499
+ "cornsilk": [255, 248, 220],
58500
+ "crimson": [220, 20, 60],
58501
+ "cyan": [0, 255, 255],
58502
+ "darkblue": [0, 0, 139],
58503
+ "darkcyan": [0, 139, 139],
58504
+ "darkgoldenrod": [184, 134, 11],
58505
+ "darkgray": [169, 169, 169],
58506
+ "darkgreen": [0, 100, 0],
58507
+ "darkgrey": [169, 169, 169],
58508
+ "darkkhaki": [189, 183, 107],
58509
+ "darkmagenta": [139, 0, 139],
58510
+ "darkolivegreen": [85, 107, 47],
58511
+ "darkorange": [255, 140, 0],
58512
+ "darkorchid": [153, 50, 204],
58513
+ "darkred": [139, 0, 0],
58514
+ "darksalmon": [233, 150, 122],
58515
+ "darkseagreen": [143, 188, 143],
58516
+ "darkslateblue": [72, 61, 139],
58517
+ "darkslategray": [47, 79, 79],
58518
+ "darkslategrey": [47, 79, 79],
58519
+ "darkturquoise": [0, 206, 209],
58520
+ "darkviolet": [148, 0, 211],
58521
+ "deeppink": [255, 20, 147],
58522
+ "deepskyblue": [0, 191, 255],
58523
+ "dimgray": [105, 105, 105],
58524
+ "dimgrey": [105, 105, 105],
58525
+ "dodgerblue": [30, 144, 255],
58526
+ "firebrick": [178, 34, 34],
58527
+ "floralwhite": [255, 250, 240],
58528
+ "forestgreen": [34, 139, 34],
58529
+ "fuchsia": [255, 0, 255],
58530
+ "gainsboro": [220, 220, 220],
58531
+ "ghostwhite": [248, 248, 255],
58532
+ "gold": [255, 215, 0],
58533
+ "goldenrod": [218, 165, 32],
58534
+ "gray": [128, 128, 128],
58535
+ "green": [0, 128, 0],
58536
+ "greenyellow": [173, 255, 47],
58537
+ "grey": [128, 128, 128],
58538
+ "honeydew": [240, 255, 240],
58539
+ "hotpink": [255, 105, 180],
58540
+ "indianred": [205, 92, 92],
58541
+ "indigo": [75, 0, 130],
58542
+ "ivory": [255, 255, 240],
58543
+ "khaki": [240, 230, 140],
58544
+ "lavender": [230, 230, 250],
58545
+ "lavenderblush": [255, 240, 245],
58546
+ "lawngreen": [124, 252, 0],
58547
+ "lemonchiffon": [255, 250, 205],
58548
+ "lightblue": [173, 216, 230],
58549
+ "lightcoral": [240, 128, 128],
58550
+ "lightcyan": [224, 255, 255],
58551
+ "lightgoldenrodyellow": [250, 250, 210],
58552
+ "lightgray": [211, 211, 211],
58553
+ "lightgreen": [144, 238, 144],
58554
+ "lightgrey": [211, 211, 211],
58555
+ "lightpink": [255, 182, 193],
58556
+ "lightsalmon": [255, 160, 122],
58557
+ "lightseagreen": [32, 178, 170],
58558
+ "lightskyblue": [135, 206, 250],
58559
+ "lightslategray": [119, 136, 153],
58560
+ "lightslategrey": [119, 136, 153],
58561
+ "lightsteelblue": [176, 196, 222],
58562
+ "lightyellow": [255, 255, 224],
58563
+ "lime": [0, 255, 0],
58564
+ "limegreen": [50, 205, 50],
58565
+ "linen": [250, 240, 230],
58566
+ "magenta": [255, 0, 255],
58567
+ "maroon": [128, 0, 0],
58568
+ "mediumaquamarine": [102, 205, 170],
58569
+ "mediumblue": [0, 0, 205],
58570
+ "mediumorchid": [186, 85, 211],
58571
+ "mediumpurple": [147, 112, 219],
58572
+ "mediumseagreen": [60, 179, 113],
58573
+ "mediumslateblue": [123, 104, 238],
58574
+ "mediumspringgreen": [0, 250, 154],
58575
+ "mediumturquoise": [72, 209, 204],
58576
+ "mediumvioletred": [199, 21, 133],
58577
+ "midnightblue": [25, 25, 112],
58578
+ "mintcream": [245, 255, 250],
58579
+ "mistyrose": [255, 228, 225],
58580
+ "moccasin": [255, 228, 181],
58581
+ "navajowhite": [255, 222, 173],
58582
+ "navy": [0, 0, 128],
58583
+ "oldlace": [253, 245, 230],
58584
+ "olive": [128, 128, 0],
58585
+ "olivedrab": [107, 142, 35],
58586
+ "orange": [255, 165, 0],
58587
+ "orangered": [255, 69, 0],
58588
+ "orchid": [218, 112, 214],
58589
+ "palegoldenrod": [238, 232, 170],
58590
+ "palegreen": [152, 251, 152],
58591
+ "paleturquoise": [175, 238, 238],
58592
+ "palevioletred": [219, 112, 147],
58593
+ "papayawhip": [255, 239, 213],
58594
+ "peachpuff": [255, 218, 185],
58595
+ "peru": [205, 133, 63],
58596
+ "pink": [255, 192, 203],
58597
+ "plum": [221, 160, 221],
58598
+ "powderblue": [176, 224, 230],
58599
+ "purple": [128, 0, 128],
58600
+ "rebeccapurple": [102, 51, 153],
58601
+ "red": [255, 0, 0],
58602
+ "rosybrown": [188, 143, 143],
58603
+ "royalblue": [65, 105, 225],
58604
+ "saddlebrown": [139, 69, 19],
58605
+ "salmon": [250, 128, 114],
58606
+ "sandybrown": [244, 164, 96],
58607
+ "seagreen": [46, 139, 87],
58608
+ "seashell": [255, 245, 238],
58609
+ "sienna": [160, 82, 45],
58610
+ "silver": [192, 192, 192],
58611
+ "skyblue": [135, 206, 235],
58612
+ "slateblue": [106, 90, 205],
58613
+ "slategray": [112, 128, 144],
58614
+ "slategrey": [112, 128, 144],
58615
+ "snow": [255, 250, 250],
58616
+ "springgreen": [0, 255, 127],
58617
+ "steelblue": [70, 130, 180],
58618
+ "tan": [210, 180, 140],
58619
+ "teal": [0, 128, 128],
58620
+ "thistle": [216, 191, 216],
58621
+ "tomato": [255, 99, 71],
58622
+ "turquoise": [64, 224, 208],
58623
+ "violet": [238, 130, 238],
58624
+ "wheat": [245, 222, 179],
58625
+ "white": [255, 255, 255],
58626
+ "whitesmoke": [245, 245, 245],
58627
+ "yellow": [255, 255, 0],
58628
+ "yellowgreen": [154, 205, 50]
58629
+ };
58630
+
58604
58631
  /***/ }),
58605
58632
 
58606
58633
  /***/ "./node_modules/color-string/index.js":
@@ -58614,246 +58641,193 @@ module.exports = {
58614
58641
  var colorNames = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
58615
58642
  var swizzle = __webpack_require__(/*! simple-swizzle */ "./node_modules/simple-swizzle/index.js");
58616
58643
  var hasOwnProperty = Object.hasOwnProperty;
58617
-
58618
58644
  var reverseNames = Object.create(null);
58619
58645
 
58620
58646
  // create a list of reverse color names
58621
58647
  for (var name in colorNames) {
58622
- if (hasOwnProperty.call(colorNames, name)) {
58623
- reverseNames[colorNames[name]] = name;
58624
- }
58648
+ if (hasOwnProperty.call(colorNames, name)) {
58649
+ reverseNames[colorNames[name]] = name;
58650
+ }
58625
58651
  }
58626
-
58627
58652
  var cs = module.exports = {
58628
- to: {},
58629
- get: {}
58653
+ to: {},
58654
+ get: {}
58630
58655
  };
58631
-
58632
58656
  cs.get = function (string) {
58633
- var prefix = string.substring(0, 3).toLowerCase();
58634
- var val;
58635
- var model;
58636
- switch (prefix) {
58637
- case 'hsl':
58638
- val = cs.get.hsl(string);
58639
- model = 'hsl';
58640
- break;
58641
- case 'hwb':
58642
- val = cs.get.hwb(string);
58643
- model = 'hwb';
58644
- break;
58645
- default:
58646
- val = cs.get.rgb(string);
58647
- model = 'rgb';
58648
- break;
58649
- }
58650
-
58651
- if (!val) {
58652
- return null;
58653
- }
58654
-
58655
- return {model: model, value: val};
58657
+ var prefix = string.substring(0, 3).toLowerCase();
58658
+ var val;
58659
+ var model;
58660
+ switch (prefix) {
58661
+ case 'hsl':
58662
+ val = cs.get.hsl(string);
58663
+ model = 'hsl';
58664
+ break;
58665
+ case 'hwb':
58666
+ val = cs.get.hwb(string);
58667
+ model = 'hwb';
58668
+ break;
58669
+ default:
58670
+ val = cs.get.rgb(string);
58671
+ model = 'rgb';
58672
+ break;
58673
+ }
58674
+ if (!val) {
58675
+ return null;
58676
+ }
58677
+ return {
58678
+ model: model,
58679
+ value: val
58680
+ };
58656
58681
  };
58657
-
58658
58682
  cs.get.rgb = function (string) {
58659
- if (!string) {
58660
- return null;
58661
- }
58662
-
58663
- var abbr = /^#([a-f0-9]{3,4})$/i;
58664
- var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
58665
- var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
58666
- var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
58667
- var keyword = /^(\w+)$/;
58668
-
58669
- var rgb = [0, 0, 0, 1];
58670
- var match;
58671
- var i;
58672
- var hexAlpha;
58673
-
58674
- if (match = string.match(hex)) {
58675
- hexAlpha = match[2];
58676
- match = match[1];
58677
-
58678
- for (i = 0; i < 3; i++) {
58679
- // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
58680
- var i2 = i * 2;
58681
- rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
58682
- }
58683
-
58684
- if (hexAlpha) {
58685
- rgb[3] = parseInt(hexAlpha, 16) / 255;
58686
- }
58687
- } else if (match = string.match(abbr)) {
58688
- match = match[1];
58689
- hexAlpha = match[3];
58690
-
58691
- for (i = 0; i < 3; i++) {
58692
- rgb[i] = parseInt(match[i] + match[i], 16);
58693
- }
58694
-
58695
- if (hexAlpha) {
58696
- rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
58697
- }
58698
- } else if (match = string.match(rgba)) {
58699
- for (i = 0; i < 3; i++) {
58700
- rgb[i] = parseInt(match[i + 1], 0);
58701
- }
58702
-
58703
- if (match[4]) {
58704
- if (match[5]) {
58705
- rgb[3] = parseFloat(match[4]) * 0.01;
58706
- } else {
58707
- rgb[3] = parseFloat(match[4]);
58708
- }
58709
- }
58710
- } else if (match = string.match(per)) {
58711
- for (i = 0; i < 3; i++) {
58712
- rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
58713
- }
58714
-
58715
- if (match[4]) {
58716
- if (match[5]) {
58717
- rgb[3] = parseFloat(match[4]) * 0.01;
58718
- } else {
58719
- rgb[3] = parseFloat(match[4]);
58720
- }
58721
- }
58722
- } else if (match = string.match(keyword)) {
58723
- if (match[1] === 'transparent') {
58724
- return [0, 0, 0, 0];
58725
- }
58726
-
58727
- if (!hasOwnProperty.call(colorNames, match[1])) {
58728
- return null;
58729
- }
58730
-
58731
- rgb = colorNames[match[1]];
58732
- rgb[3] = 1;
58733
-
58734
- return rgb;
58735
- } else {
58736
- return null;
58737
- }
58738
-
58739
- for (i = 0; i < 3; i++) {
58740
- rgb[i] = clamp(rgb[i], 0, 255);
58741
- }
58742
- rgb[3] = clamp(rgb[3], 0, 1);
58743
-
58744
- return rgb;
58683
+ if (!string) {
58684
+ return null;
58685
+ }
58686
+ var abbr = /^#([a-f0-9]{3,4})$/i;
58687
+ var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
58688
+ var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
58689
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
58690
+ var keyword = /^(\w+)$/;
58691
+ var rgb = [0, 0, 0, 1];
58692
+ var match;
58693
+ var i;
58694
+ var hexAlpha;
58695
+ if (match = string.match(hex)) {
58696
+ hexAlpha = match[2];
58697
+ match = match[1];
58698
+ for (i = 0; i < 3; i++) {
58699
+ // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
58700
+ var i2 = i * 2;
58701
+ rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
58702
+ }
58703
+ if (hexAlpha) {
58704
+ rgb[3] = parseInt(hexAlpha, 16) / 255;
58705
+ }
58706
+ } else if (match = string.match(abbr)) {
58707
+ match = match[1];
58708
+ hexAlpha = match[3];
58709
+ for (i = 0; i < 3; i++) {
58710
+ rgb[i] = parseInt(match[i] + match[i], 16);
58711
+ }
58712
+ if (hexAlpha) {
58713
+ rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
58714
+ }
58715
+ } else if (match = string.match(rgba)) {
58716
+ for (i = 0; i < 3; i++) {
58717
+ rgb[i] = parseInt(match[i + 1], 0);
58718
+ }
58719
+ if (match[4]) {
58720
+ if (match[5]) {
58721
+ rgb[3] = parseFloat(match[4]) * 0.01;
58722
+ } else {
58723
+ rgb[3] = parseFloat(match[4]);
58724
+ }
58725
+ }
58726
+ } else if (match = string.match(per)) {
58727
+ for (i = 0; i < 3; i++) {
58728
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
58729
+ }
58730
+ if (match[4]) {
58731
+ if (match[5]) {
58732
+ rgb[3] = parseFloat(match[4]) * 0.01;
58733
+ } else {
58734
+ rgb[3] = parseFloat(match[4]);
58735
+ }
58736
+ }
58737
+ } else if (match = string.match(keyword)) {
58738
+ if (match[1] === 'transparent') {
58739
+ return [0, 0, 0, 0];
58740
+ }
58741
+ if (!hasOwnProperty.call(colorNames, match[1])) {
58742
+ return null;
58743
+ }
58744
+ rgb = colorNames[match[1]];
58745
+ rgb[3] = 1;
58746
+ return rgb;
58747
+ } else {
58748
+ return null;
58749
+ }
58750
+ for (i = 0; i < 3; i++) {
58751
+ rgb[i] = clamp(rgb[i], 0, 255);
58752
+ }
58753
+ rgb[3] = clamp(rgb[3], 0, 1);
58754
+ return rgb;
58745
58755
  };
58746
-
58747
58756
  cs.get.hsl = function (string) {
58748
- if (!string) {
58749
- return null;
58750
- }
58751
-
58752
- var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
58753
- var match = string.match(hsl);
58754
-
58755
- if (match) {
58756
- var alpha = parseFloat(match[4]);
58757
- var h = ((parseFloat(match[1]) % 360) + 360) % 360;
58758
- var s = clamp(parseFloat(match[2]), 0, 100);
58759
- var l = clamp(parseFloat(match[3]), 0, 100);
58760
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
58761
-
58762
- return [h, s, l, a];
58763
- }
58764
-
58765
- return null;
58757
+ if (!string) {
58758
+ return null;
58759
+ }
58760
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
58761
+ var match = string.match(hsl);
58762
+ if (match) {
58763
+ var alpha = parseFloat(match[4]);
58764
+ var h = (parseFloat(match[1]) % 360 + 360) % 360;
58765
+ var s = clamp(parseFloat(match[2]), 0, 100);
58766
+ var l = clamp(parseFloat(match[3]), 0, 100);
58767
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
58768
+ return [h, s, l, a];
58769
+ }
58770
+ return null;
58766
58771
  };
58767
-
58768
58772
  cs.get.hwb = function (string) {
58769
- if (!string) {
58770
- return null;
58771
- }
58772
-
58773
- var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
58774
- var match = string.match(hwb);
58775
-
58776
- if (match) {
58777
- var alpha = parseFloat(match[4]);
58778
- var h = ((parseFloat(match[1]) % 360) + 360) % 360;
58779
- var w = clamp(parseFloat(match[2]), 0, 100);
58780
- var b = clamp(parseFloat(match[3]), 0, 100);
58781
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
58782
- return [h, w, b, a];
58783
- }
58784
-
58785
- return null;
58773
+ if (!string) {
58774
+ return null;
58775
+ }
58776
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
58777
+ var match = string.match(hwb);
58778
+ if (match) {
58779
+ var alpha = parseFloat(match[4]);
58780
+ var h = (parseFloat(match[1]) % 360 + 360) % 360;
58781
+ var w = clamp(parseFloat(match[2]), 0, 100);
58782
+ var b = clamp(parseFloat(match[3]), 0, 100);
58783
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
58784
+ return [h, w, b, a];
58785
+ }
58786
+ return null;
58786
58787
  };
58787
-
58788
58788
  cs.to.hex = function () {
58789
- var rgba = swizzle(arguments);
58790
-
58791
- return (
58792
- '#' +
58793
- hexDouble(rgba[0]) +
58794
- hexDouble(rgba[1]) +
58795
- hexDouble(rgba[2]) +
58796
- (rgba[3] < 1
58797
- ? (hexDouble(Math.round(rgba[3] * 255)))
58798
- : '')
58799
- );
58789
+ var rgba = swizzle(arguments);
58790
+ return '#' + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : '');
58800
58791
  };
58801
-
58802
58792
  cs.to.rgb = function () {
58803
- var rgba = swizzle(arguments);
58804
-
58805
- return rgba.length < 4 || rgba[3] === 1
58806
- ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
58807
- : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
58793
+ var rgba = swizzle(arguments);
58794
+ return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
58808
58795
  };
58809
-
58810
58796
  cs.to.rgb.percent = function () {
58811
- var rgba = swizzle(arguments);
58812
-
58813
- var r = Math.round(rgba[0] / 255 * 100);
58814
- var g = Math.round(rgba[1] / 255 * 100);
58815
- var b = Math.round(rgba[2] / 255 * 100);
58816
-
58817
- return rgba.length < 4 || rgba[3] === 1
58818
- ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
58819
- : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
58797
+ var rgba = swizzle(arguments);
58798
+ var r = Math.round(rgba[0] / 255 * 100);
58799
+ var g = Math.round(rgba[1] / 255 * 100);
58800
+ var b = Math.round(rgba[2] / 255 * 100);
58801
+ return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
58820
58802
  };
58821
-
58822
58803
  cs.to.hsl = function () {
58823
- var hsla = swizzle(arguments);
58824
- return hsla.length < 4 || hsla[3] === 1
58825
- ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
58826
- : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
58804
+ var hsla = swizzle(arguments);
58805
+ return hsla.length < 4 || hsla[3] === 1 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
58827
58806
  };
58828
58807
 
58829
58808
  // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
58830
58809
  // (hwb have alpha optional & 1 is default value)
58831
58810
  cs.to.hwb = function () {
58832
- var hwba = swizzle(arguments);
58833
-
58834
- var a = '';
58835
- if (hwba.length >= 4 && hwba[3] !== 1) {
58836
- a = ', ' + hwba[3];
58837
- }
58838
-
58839
- return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
58811
+ var hwba = swizzle(arguments);
58812
+ var a = '';
58813
+ if (hwba.length >= 4 && hwba[3] !== 1) {
58814
+ a = ', ' + hwba[3];
58815
+ }
58816
+ return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
58840
58817
  };
58841
-
58842
58818
  cs.to.keyword = function (rgb) {
58843
- return reverseNames[rgb.slice(0, 3)];
58819
+ return reverseNames[rgb.slice(0, 3)];
58844
58820
  };
58845
58821
 
58846
58822
  // helpers
58847
58823
  function clamp(num, min, max) {
58848
- return Math.min(Math.max(min, num), max);
58824
+ return Math.min(Math.max(min, num), max);
58849
58825
  }
58850
-
58851
58826
  function hexDouble(num) {
58852
- var str = Math.round(num).toString(16).toUpperCase();
58853
- return (str.length < 2) ? '0' + str : str;
58827
+ var str = Math.round(num).toString(16).toUpperCase();
58828
+ return str.length < 2 ? '0' + str : str;
58854
58829
  }
58855
58830
 
58856
-
58857
58831
  /***/ }),
58858
58832
 
58859
58833
  /***/ "./node_modules/color/index.js":
@@ -58863,504 +58837,435 @@ function hexDouble(num) {
58863
58837
  /*! no static exports found */
58864
58838
  /***/ (function(module, exports, __webpack_require__) {
58865
58839
 
58866
- const colorString = __webpack_require__(/*! color-string */ "./node_modules/color-string/index.js");
58867
- const convert = __webpack_require__(/*! color-convert */ "./node_modules/color/node_modules/color-convert/index.js");
58868
-
58869
- const skippedModels = [
58870
- // To be honest, I don't really feel like keyword belongs in color convert, but eh.
58871
- 'keyword',
58872
-
58873
- // Gray conflicts with some method names, and has its own method defined.
58874
- 'gray',
58875
-
58876
- // Shouldn't really be in color-convert either...
58877
- 'hex',
58878
- ];
58879
-
58880
- const hashedModelKeys = {};
58881
- for (const model of Object.keys(convert)) {
58882
- hashedModelKeys[[...convert[model].labels].sort().join('')] = model;
58883
- }
58884
-
58885
- const limiters = {};
58886
-
58840
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
58841
+ var _slicedToArray = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
58842
+ var _toConsumableArray = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
58843
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
58844
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
58845
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
58846
+ var colorString = __webpack_require__(/*! color-string */ "./node_modules/color-string/index.js");
58847
+ var convert = __webpack_require__(/*! color-convert */ "./node_modules/color/node_modules/color-convert/index.js");
58848
+ var skippedModels = [
58849
+ // To be honest, I don't really feel like keyword belongs in color convert, but eh.
58850
+ 'keyword',
58851
+ // Gray conflicts with some method names, and has its own method defined.
58852
+ 'gray',
58853
+ // Shouldn't really be in color-convert either...
58854
+ 'hex'];
58855
+ var hashedModelKeys = {};
58856
+ for (var _i = 0, _Object$keys = Object.keys(convert); _i < _Object$keys.length; _i++) {
58857
+ var model = _Object$keys[_i];
58858
+ hashedModelKeys[_toConsumableArray(convert[model].labels).sort().join('')] = model;
58859
+ }
58860
+ var limiters = {};
58887
58861
  function Color(object, model) {
58888
- if (!(this instanceof Color)) {
58889
- return new Color(object, model);
58890
- }
58891
-
58892
- if (model && model in skippedModels) {
58893
- model = null;
58894
- }
58895
-
58896
- if (model && !(model in convert)) {
58897
- throw new Error('Unknown model: ' + model);
58898
- }
58899
-
58900
- let i;
58901
- let channels;
58902
-
58903
- if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
58904
- this.model = 'rgb';
58905
- this.color = [0, 0, 0];
58906
- this.valpha = 1;
58907
- } else if (object instanceof Color) {
58908
- this.model = object.model;
58909
- this.color = [...object.color];
58910
- this.valpha = object.valpha;
58911
- } else if (typeof object === 'string') {
58912
- const result = colorString.get(object);
58913
- if (result === null) {
58914
- throw new Error('Unable to parse color from string: ' + object);
58915
- }
58916
-
58917
- this.model = result.model;
58918
- channels = convert[this.model].channels;
58919
- this.color = result.value.slice(0, channels);
58920
- this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
58921
- } else if (object.length > 0) {
58922
- this.model = model || 'rgb';
58923
- channels = convert[this.model].channels;
58924
- const newArray = Array.prototype.slice.call(object, 0, channels);
58925
- this.color = zeroArray(newArray, channels);
58926
- this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
58927
- } else if (typeof object === 'number') {
58928
- // This is always RGB - can be converted later on.
58929
- this.model = 'rgb';
58930
- this.color = [
58931
- (object >> 16) & 0xFF,
58932
- (object >> 8) & 0xFF,
58933
- object & 0xFF,
58934
- ];
58935
- this.valpha = 1;
58936
- } else {
58937
- this.valpha = 1;
58938
-
58939
- const keys = Object.keys(object);
58940
- if ('alpha' in object) {
58941
- keys.splice(keys.indexOf('alpha'), 1);
58942
- this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
58943
- }
58944
-
58945
- const hashedKeys = keys.sort().join('');
58946
- if (!(hashedKeys in hashedModelKeys)) {
58947
- throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
58948
- }
58949
-
58950
- this.model = hashedModelKeys[hashedKeys];
58951
-
58952
- const {labels} = convert[this.model];
58953
- const color = [];
58954
- for (i = 0; i < labels.length; i++) {
58955
- color.push(object[labels[i]]);
58956
- }
58957
-
58958
- this.color = zeroArray(color);
58959
- }
58960
-
58961
- // Perform limitations (clamping, etc.)
58962
- if (limiters[this.model]) {
58963
- channels = convert[this.model].channels;
58964
- for (i = 0; i < channels; i++) {
58965
- const limit = limiters[this.model][i];
58966
- if (limit) {
58967
- this.color[i] = limit(this.color[i]);
58968
- }
58969
- }
58970
- }
58971
-
58972
- this.valpha = Math.max(0, Math.min(1, this.valpha));
58862
+ if (!(this instanceof Color)) {
58863
+ return new Color(object, model);
58864
+ }
58865
+ if (model && model in skippedModels) {
58866
+ model = null;
58867
+ }
58868
+ if (model && !(model in convert)) {
58869
+ throw new Error('Unknown model: ' + model);
58870
+ }
58871
+ var i;
58872
+ var channels;
58873
+ if (object == null) {
58874
+ // eslint-disable-line no-eq-null,eqeqeq
58875
+ this.model = 'rgb';
58876
+ this.color = [0, 0, 0];
58877
+ this.valpha = 1;
58878
+ } else if (object instanceof Color) {
58879
+ this.model = object.model;
58880
+ this.color = _toConsumableArray(object.color);
58881
+ this.valpha = object.valpha;
58882
+ } else if (typeof object === 'string') {
58883
+ var result = colorString.get(object);
58884
+ if (result === null) {
58885
+ throw new Error('Unable to parse color from string: ' + object);
58886
+ }
58887
+ this.model = result.model;
58888
+ channels = convert[this.model].channels;
58889
+ this.color = result.value.slice(0, channels);
58890
+ this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
58891
+ } else if (object.length > 0) {
58892
+ this.model = model || 'rgb';
58893
+ channels = convert[this.model].channels;
58894
+ var newArray = Array.prototype.slice.call(object, 0, channels);
58895
+ this.color = zeroArray(newArray, channels);
58896
+ this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
58897
+ } else if (typeof object === 'number') {
58898
+ // This is always RGB - can be converted later on.
58899
+ this.model = 'rgb';
58900
+ this.color = [object >> 16 & 0xFF, object >> 8 & 0xFF, object & 0xFF];
58901
+ this.valpha = 1;
58902
+ } else {
58903
+ this.valpha = 1;
58904
+ var keys = Object.keys(object);
58905
+ if ('alpha' in object) {
58906
+ keys.splice(keys.indexOf('alpha'), 1);
58907
+ this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
58908
+ }
58909
+ var hashedKeys = keys.sort().join('');
58910
+ if (!(hashedKeys in hashedModelKeys)) {
58911
+ throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
58912
+ }
58913
+ this.model = hashedModelKeys[hashedKeys];
58914
+ var labels = convert[this.model].labels;
58915
+ var color = [];
58916
+ for (i = 0; i < labels.length; i++) {
58917
+ color.push(object[labels[i]]);
58918
+ }
58919
+ this.color = zeroArray(color);
58920
+ }
58973
58921
 
58974
- if (Object.freeze) {
58975
- Object.freeze(this);
58976
- }
58922
+ // Perform limitations (clamping, etc.)
58923
+ if (limiters[this.model]) {
58924
+ channels = convert[this.model].channels;
58925
+ for (i = 0; i < channels; i++) {
58926
+ var limit = limiters[this.model][i];
58927
+ if (limit) {
58928
+ this.color[i] = limit(this.color[i]);
58929
+ }
58930
+ }
58931
+ }
58932
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
58933
+ if (Object.freeze) {
58934
+ Object.freeze(this);
58935
+ }
58977
58936
  }
58978
-
58979
58937
  Color.prototype = {
58980
- toString() {
58981
- return this.string();
58982
- },
58983
-
58984
- toJSON() {
58985
- return this[this.model]();
58986
- },
58987
-
58988
- string(places) {
58989
- let self = this.model in colorString.to ? this : this.rgb();
58990
- self = self.round(typeof places === 'number' ? places : 1);
58991
- const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
58992
- return colorString.to[self.model](args);
58993
- },
58994
-
58995
- percentString(places) {
58996
- const self = this.rgb().round(typeof places === 'number' ? places : 1);
58997
- const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
58998
- return colorString.to.rgb.percent(args);
58999
- },
59000
-
59001
- array() {
59002
- return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
59003
- },
59004
-
59005
- object() {
59006
- const result = {};
59007
- const {channels} = convert[this.model];
59008
- const {labels} = convert[this.model];
59009
-
59010
- for (let i = 0; i < channels; i++) {
59011
- result[labels[i]] = this.color[i];
59012
- }
59013
-
59014
- if (this.valpha !== 1) {
59015
- result.alpha = this.valpha;
59016
- }
59017
-
59018
- return result;
59019
- },
59020
-
59021
- unitArray() {
59022
- const rgb = this.rgb().color;
59023
- rgb[0] /= 255;
59024
- rgb[1] /= 255;
59025
- rgb[2] /= 255;
59026
-
59027
- if (this.valpha !== 1) {
59028
- rgb.push(this.valpha);
59029
- }
59030
-
59031
- return rgb;
59032
- },
59033
-
59034
- unitObject() {
59035
- const rgb = this.rgb().object();
59036
- rgb.r /= 255;
59037
- rgb.g /= 255;
59038
- rgb.b /= 255;
59039
-
59040
- if (this.valpha !== 1) {
59041
- rgb.alpha = this.valpha;
59042
- }
59043
-
59044
- return rgb;
59045
- },
59046
-
59047
- round(places) {
59048
- places = Math.max(places || 0, 0);
59049
- return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
59050
- },
59051
-
59052
- alpha(value) {
59053
- if (value !== undefined) {
59054
- return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
59055
- }
59056
-
59057
- return this.valpha;
59058
- },
59059
-
59060
- // Rgb
59061
- red: getset('rgb', 0, maxfn(255)),
59062
- green: getset('rgb', 1, maxfn(255)),
59063
- blue: getset('rgb', 2, maxfn(255)),
59064
-
59065
- hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
59066
-
59067
- saturationl: getset('hsl', 1, maxfn(100)),
59068
- lightness: getset('hsl', 2, maxfn(100)),
59069
-
59070
- saturationv: getset('hsv', 1, maxfn(100)),
59071
- value: getset('hsv', 2, maxfn(100)),
59072
-
59073
- chroma: getset('hcg', 1, maxfn(100)),
59074
- gray: getset('hcg', 2, maxfn(100)),
59075
-
59076
- white: getset('hwb', 1, maxfn(100)),
59077
- wblack: getset('hwb', 2, maxfn(100)),
59078
-
59079
- cyan: getset('cmyk', 0, maxfn(100)),
59080
- magenta: getset('cmyk', 1, maxfn(100)),
59081
- yellow: getset('cmyk', 2, maxfn(100)),
59082
- black: getset('cmyk', 3, maxfn(100)),
59083
-
59084
- x: getset('xyz', 0, maxfn(95.047)),
59085
- y: getset('xyz', 1, maxfn(100)),
59086
- z: getset('xyz', 2, maxfn(108.833)),
59087
-
59088
- l: getset('lab', 0, maxfn(100)),
59089
- a: getset('lab', 1),
59090
- b: getset('lab', 2),
59091
-
59092
- keyword(value) {
59093
- if (value !== undefined) {
59094
- return new Color(value);
59095
- }
59096
-
59097
- return convert[this.model].keyword(this.color);
59098
- },
59099
-
59100
- hex(value) {
59101
- if (value !== undefined) {
59102
- return new Color(value);
59103
- }
59104
-
59105
- return colorString.to.hex(this.rgb().round().color);
59106
- },
59107
-
59108
- hexa(value) {
59109
- if (value !== undefined) {
59110
- return new Color(value);
59111
- }
59112
-
59113
- const rgbArray = this.rgb().round().color;
59114
-
59115
- let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
59116
- if (alphaHex.length === 1) {
59117
- alphaHex = '0' + alphaHex;
59118
- }
59119
-
59120
- return colorString.to.hex(rgbArray) + alphaHex;
59121
- },
59122
-
59123
- rgbNumber() {
59124
- const rgb = this.rgb().color;
59125
- return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
59126
- },
59127
-
59128
- luminosity() {
59129
- // http://www.w3.org/TR/WCAG20/#relativeluminancedef
59130
- const rgb = this.rgb().color;
59131
-
59132
- const lum = [];
59133
- for (const [i, element] of rgb.entries()) {
59134
- const chan = element / 255;
59135
- lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
59136
- }
59137
-
59138
- return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
59139
- },
59140
-
59141
- contrast(color2) {
59142
- // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
59143
- const lum1 = this.luminosity();
59144
- const lum2 = color2.luminosity();
59145
-
59146
- if (lum1 > lum2) {
59147
- return (lum1 + 0.05) / (lum2 + 0.05);
59148
- }
59149
-
59150
- return (lum2 + 0.05) / (lum1 + 0.05);
59151
- },
59152
-
59153
- level(color2) {
59154
- // https://www.w3.org/TR/WCAG/#contrast-enhanced
59155
- const contrastRatio = this.contrast(color2);
59156
- if (contrastRatio >= 7) {
59157
- return 'AAA';
59158
- }
59159
-
59160
- return (contrastRatio >= 4.5) ? 'AA' : '';
59161
- },
59162
-
59163
- isDark() {
59164
- // YIQ equation from http://24ways.org/2010/calculating-color-contrast
59165
- const rgb = this.rgb().color;
59166
- const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
59167
- return yiq < 128;
59168
- },
59169
-
59170
- isLight() {
59171
- return !this.isDark();
59172
- },
59173
-
59174
- negate() {
59175
- const rgb = this.rgb();
59176
- for (let i = 0; i < 3; i++) {
59177
- rgb.color[i] = 255 - rgb.color[i];
59178
- }
59179
-
59180
- return rgb;
59181
- },
59182
-
59183
- lighten(ratio) {
59184
- const hsl = this.hsl();
59185
- hsl.color[2] += hsl.color[2] * ratio;
59186
- return hsl;
59187
- },
59188
-
59189
- darken(ratio) {
59190
- const hsl = this.hsl();
59191
- hsl.color[2] -= hsl.color[2] * ratio;
59192
- return hsl;
59193
- },
59194
-
59195
- saturate(ratio) {
59196
- const hsl = this.hsl();
59197
- hsl.color[1] += hsl.color[1] * ratio;
59198
- return hsl;
59199
- },
59200
-
59201
- desaturate(ratio) {
59202
- const hsl = this.hsl();
59203
- hsl.color[1] -= hsl.color[1] * ratio;
59204
- return hsl;
59205
- },
59206
-
59207
- whiten(ratio) {
59208
- const hwb = this.hwb();
59209
- hwb.color[1] += hwb.color[1] * ratio;
59210
- return hwb;
59211
- },
59212
-
59213
- blacken(ratio) {
59214
- const hwb = this.hwb();
59215
- hwb.color[2] += hwb.color[2] * ratio;
59216
- return hwb;
59217
- },
59218
-
59219
- grayscale() {
59220
- // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
59221
- const rgb = this.rgb().color;
59222
- const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
59223
- return Color.rgb(value, value, value);
59224
- },
59225
-
59226
- fade(ratio) {
59227
- return this.alpha(this.valpha - (this.valpha * ratio));
59228
- },
59229
-
59230
- opaquer(ratio) {
59231
- return this.alpha(this.valpha + (this.valpha * ratio));
59232
- },
59233
-
59234
- rotate(degrees) {
59235
- const hsl = this.hsl();
59236
- let hue = hsl.color[0];
59237
- hue = (hue + degrees) % 360;
59238
- hue = hue < 0 ? 360 + hue : hue;
59239
- hsl.color[0] = hue;
59240
- return hsl;
59241
- },
59242
-
59243
- mix(mixinColor, weight) {
59244
- // Ported from sass implementation in C
59245
- // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
59246
- if (!mixinColor || !mixinColor.rgb) {
59247
- throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
59248
- }
59249
-
59250
- const color1 = mixinColor.rgb();
59251
- const color2 = this.rgb();
59252
- const p = weight === undefined ? 0.5 : weight;
59253
-
59254
- const w = 2 * p - 1;
59255
- const a = color1.alpha() - color2.alpha();
59256
-
59257
- const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
59258
- const w2 = 1 - w1;
59259
-
59260
- return Color.rgb(
59261
- w1 * color1.red() + w2 * color2.red(),
59262
- w1 * color1.green() + w2 * color2.green(),
59263
- w1 * color1.blue() + w2 * color2.blue(),
59264
- color1.alpha() * p + color2.alpha() * (1 - p));
59265
- },
58938
+ toString: function toString() {
58939
+ return this.string();
58940
+ },
58941
+ toJSON: function toJSON() {
58942
+ return this[this.model]();
58943
+ },
58944
+ string: function string(places) {
58945
+ var self = this.model in colorString.to ? this : this.rgb();
58946
+ self = self.round(typeof places === 'number' ? places : 1);
58947
+ var args = self.valpha === 1 ? self.color : [].concat(_toConsumableArray(self.color), [this.valpha]);
58948
+ return colorString.to[self.model](args);
58949
+ },
58950
+ percentString: function percentString(places) {
58951
+ var self = this.rgb().round(typeof places === 'number' ? places : 1);
58952
+ var args = self.valpha === 1 ? self.color : [].concat(_toConsumableArray(self.color), [this.valpha]);
58953
+ return colorString.to.rgb.percent(args);
58954
+ },
58955
+ array: function array() {
58956
+ return this.valpha === 1 ? _toConsumableArray(this.color) : [].concat(_toConsumableArray(this.color), [this.valpha]);
58957
+ },
58958
+ object: function object() {
58959
+ var result = {};
58960
+ var channels = convert[this.model].channels;
58961
+ var labels = convert[this.model].labels;
58962
+ for (var i = 0; i < channels; i++) {
58963
+ result[labels[i]] = this.color[i];
58964
+ }
58965
+ if (this.valpha !== 1) {
58966
+ result.alpha = this.valpha;
58967
+ }
58968
+ return result;
58969
+ },
58970
+ unitArray: function unitArray() {
58971
+ var rgb = this.rgb().color;
58972
+ rgb[0] /= 255;
58973
+ rgb[1] /= 255;
58974
+ rgb[2] /= 255;
58975
+ if (this.valpha !== 1) {
58976
+ rgb.push(this.valpha);
58977
+ }
58978
+ return rgb;
58979
+ },
58980
+ unitObject: function unitObject() {
58981
+ var rgb = this.rgb().object();
58982
+ rgb.r /= 255;
58983
+ rgb.g /= 255;
58984
+ rgb.b /= 255;
58985
+ if (this.valpha !== 1) {
58986
+ rgb.alpha = this.valpha;
58987
+ }
58988
+ return rgb;
58989
+ },
58990
+ round: function round(places) {
58991
+ places = Math.max(places || 0, 0);
58992
+ return new Color([].concat(_toConsumableArray(this.color.map(roundToPlace(places))), [this.valpha]), this.model);
58993
+ },
58994
+ alpha: function alpha(value) {
58995
+ if (value !== undefined) {
58996
+ return new Color([].concat(_toConsumableArray(this.color), [Math.max(0, Math.min(1, value))]), this.model);
58997
+ }
58998
+ return this.valpha;
58999
+ },
59000
+ // Rgb
59001
+ red: getset('rgb', 0, maxfn(255)),
59002
+ green: getset('rgb', 1, maxfn(255)),
59003
+ blue: getset('rgb', 2, maxfn(255)),
59004
+ hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (value) {
59005
+ return (value % 360 + 360) % 360;
59006
+ }),
59007
+ saturationl: getset('hsl', 1, maxfn(100)),
59008
+ lightness: getset('hsl', 2, maxfn(100)),
59009
+ saturationv: getset('hsv', 1, maxfn(100)),
59010
+ value: getset('hsv', 2, maxfn(100)),
59011
+ chroma: getset('hcg', 1, maxfn(100)),
59012
+ gray: getset('hcg', 2, maxfn(100)),
59013
+ white: getset('hwb', 1, maxfn(100)),
59014
+ wblack: getset('hwb', 2, maxfn(100)),
59015
+ cyan: getset('cmyk', 0, maxfn(100)),
59016
+ magenta: getset('cmyk', 1, maxfn(100)),
59017
+ yellow: getset('cmyk', 2, maxfn(100)),
59018
+ black: getset('cmyk', 3, maxfn(100)),
59019
+ x: getset('xyz', 0, maxfn(95.047)),
59020
+ y: getset('xyz', 1, maxfn(100)),
59021
+ z: getset('xyz', 2, maxfn(108.833)),
59022
+ l: getset('lab', 0, maxfn(100)),
59023
+ a: getset('lab', 1),
59024
+ b: getset('lab', 2),
59025
+ keyword: function keyword(value) {
59026
+ if (value !== undefined) {
59027
+ return new Color(value);
59028
+ }
59029
+ return convert[this.model].keyword(this.color);
59030
+ },
59031
+ hex: function hex(value) {
59032
+ if (value !== undefined) {
59033
+ return new Color(value);
59034
+ }
59035
+ return colorString.to.hex(this.rgb().round().color);
59036
+ },
59037
+ hexa: function hexa(value) {
59038
+ if (value !== undefined) {
59039
+ return new Color(value);
59040
+ }
59041
+ var rgbArray = this.rgb().round().color;
59042
+ var alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
59043
+ if (alphaHex.length === 1) {
59044
+ alphaHex = '0' + alphaHex;
59045
+ }
59046
+ return colorString.to.hex(rgbArray) + alphaHex;
59047
+ },
59048
+ rgbNumber: function rgbNumber() {
59049
+ var rgb = this.rgb().color;
59050
+ return (rgb[0] & 0xFF) << 16 | (rgb[1] & 0xFF) << 8 | rgb[2] & 0xFF;
59051
+ },
59052
+ luminosity: function luminosity() {
59053
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
59054
+ var rgb = this.rgb().color;
59055
+ var lum = [];
59056
+ var _iterator = _createForOfIteratorHelper(rgb.entries()),
59057
+ _step;
59058
+ try {
59059
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
59060
+ var _step$value = _slicedToArray(_step.value, 2),
59061
+ i = _step$value[0],
59062
+ element = _step$value[1];
59063
+ var chan = element / 255;
59064
+ lum[i] = chan <= 0.04045 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
59065
+ }
59066
+ } catch (err) {
59067
+ _iterator.e(err);
59068
+ } finally {
59069
+ _iterator.f();
59070
+ }
59071
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
59072
+ },
59073
+ contrast: function contrast(color2) {
59074
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
59075
+ var lum1 = this.luminosity();
59076
+ var lum2 = color2.luminosity();
59077
+ if (lum1 > lum2) {
59078
+ return (lum1 + 0.05) / (lum2 + 0.05);
59079
+ }
59080
+ return (lum2 + 0.05) / (lum1 + 0.05);
59081
+ },
59082
+ level: function level(color2) {
59083
+ // https://www.w3.org/TR/WCAG/#contrast-enhanced
59084
+ var contrastRatio = this.contrast(color2);
59085
+ if (contrastRatio >= 7) {
59086
+ return 'AAA';
59087
+ }
59088
+ return contrastRatio >= 4.5 ? 'AA' : '';
59089
+ },
59090
+ isDark: function isDark() {
59091
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
59092
+ var rgb = this.rgb().color;
59093
+ var yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
59094
+ return yiq < 128;
59095
+ },
59096
+ isLight: function isLight() {
59097
+ return !this.isDark();
59098
+ },
59099
+ negate: function negate() {
59100
+ var rgb = this.rgb();
59101
+ for (var i = 0; i < 3; i++) {
59102
+ rgb.color[i] = 255 - rgb.color[i];
59103
+ }
59104
+ return rgb;
59105
+ },
59106
+ lighten: function lighten(ratio) {
59107
+ var hsl = this.hsl();
59108
+ hsl.color[2] += hsl.color[2] * ratio;
59109
+ return hsl;
59110
+ },
59111
+ darken: function darken(ratio) {
59112
+ var hsl = this.hsl();
59113
+ hsl.color[2] -= hsl.color[2] * ratio;
59114
+ return hsl;
59115
+ },
59116
+ saturate: function saturate(ratio) {
59117
+ var hsl = this.hsl();
59118
+ hsl.color[1] += hsl.color[1] * ratio;
59119
+ return hsl;
59120
+ },
59121
+ desaturate: function desaturate(ratio) {
59122
+ var hsl = this.hsl();
59123
+ hsl.color[1] -= hsl.color[1] * ratio;
59124
+ return hsl;
59125
+ },
59126
+ whiten: function whiten(ratio) {
59127
+ var hwb = this.hwb();
59128
+ hwb.color[1] += hwb.color[1] * ratio;
59129
+ return hwb;
59130
+ },
59131
+ blacken: function blacken(ratio) {
59132
+ var hwb = this.hwb();
59133
+ hwb.color[2] += hwb.color[2] * ratio;
59134
+ return hwb;
59135
+ },
59136
+ grayscale: function grayscale() {
59137
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
59138
+ var rgb = this.rgb().color;
59139
+ var value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
59140
+ return Color.rgb(value, value, value);
59141
+ },
59142
+ fade: function fade(ratio) {
59143
+ return this.alpha(this.valpha - this.valpha * ratio);
59144
+ },
59145
+ opaquer: function opaquer(ratio) {
59146
+ return this.alpha(this.valpha + this.valpha * ratio);
59147
+ },
59148
+ rotate: function rotate(degrees) {
59149
+ var hsl = this.hsl();
59150
+ var hue = hsl.color[0];
59151
+ hue = (hue + degrees) % 360;
59152
+ hue = hue < 0 ? 360 + hue : hue;
59153
+ hsl.color[0] = hue;
59154
+ return hsl;
59155
+ },
59156
+ mix: function mix(mixinColor, weight) {
59157
+ // Ported from sass implementation in C
59158
+ // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
59159
+ if (!mixinColor || !mixinColor.rgb) {
59160
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + _typeof(mixinColor));
59161
+ }
59162
+ var color1 = mixinColor.rgb();
59163
+ var color2 = this.rgb();
59164
+ var p = weight === undefined ? 0.5 : weight;
59165
+ var w = 2 * p - 1;
59166
+ var a = color1.alpha() - color2.alpha();
59167
+ var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
59168
+ var w2 = 1 - w1;
59169
+ return Color.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p));
59170
+ }
59266
59171
  };
59267
59172
 
59268
59173
  // Model conversion methods and static constructors
59269
- for (const model of Object.keys(convert)) {
59270
- if (skippedModels.includes(model)) {
59271
- continue;
59272
- }
59273
-
59274
- const {channels} = convert[model];
59275
-
59276
- // Conversion methods
59277
- Color.prototype[model] = function (...args) {
59278
- if (this.model === model) {
59279
- return new Color(this);
59280
- }
59281
-
59282
- if (args.length > 0) {
59283
- return new Color(args, model);
59284
- }
59285
-
59286
- return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
59287
- };
59174
+ var _loop = function _loop() {
59175
+ var model = _Object$keys2[_i2];
59176
+ if (skippedModels.includes(model)) {
59177
+ return "continue";
59178
+ }
59179
+ var channels = convert[model].channels;
59288
59180
 
59289
- // 'static' construction methods
59290
- Color[model] = function (...args) {
59291
- let color = args[0];
59292
- if (typeof color === 'number') {
59293
- color = zeroArray(args, channels);
59294
- }
59181
+ // Conversion methods
59182
+ Color.prototype[model] = function () {
59183
+ if (this.model === model) {
59184
+ return new Color(this);
59185
+ }
59186
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59187
+ args[_key] = arguments[_key];
59188
+ }
59189
+ if (args.length > 0) {
59190
+ return new Color(args, model);
59191
+ }
59192
+ return new Color([].concat(_toConsumableArray(assertArray(convert[this.model][model].raw(this.color))), [this.valpha]), model);
59193
+ };
59295
59194
 
59296
- return new Color(color, model);
59297
- };
59195
+ // 'static' construction methods
59196
+ Color[model] = function () {
59197
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
59198
+ args[_key2] = arguments[_key2];
59199
+ }
59200
+ var color = args[0];
59201
+ if (typeof color === 'number') {
59202
+ color = zeroArray(args, channels);
59203
+ }
59204
+ return new Color(color, model);
59205
+ };
59206
+ };
59207
+ for (var _i2 = 0, _Object$keys2 = Object.keys(convert); _i2 < _Object$keys2.length; _i2++) {
59208
+ var _ret = _loop();
59209
+ if (_ret === "continue") continue;
59298
59210
  }
59299
-
59300
59211
  function roundTo(number, places) {
59301
- return Number(number.toFixed(places));
59212
+ return Number(number.toFixed(places));
59302
59213
  }
59303
-
59304
59214
  function roundToPlace(places) {
59305
- return function (number) {
59306
- return roundTo(number, places);
59307
- };
59215
+ return function (number) {
59216
+ return roundTo(number, places);
59217
+ };
59308
59218
  }
59309
-
59310
59219
  function getset(model, channel, modifier) {
59311
- model = Array.isArray(model) ? model : [model];
59312
-
59313
- for (const m of model) {
59314
- (limiters[m] || (limiters[m] = []))[channel] = modifier;
59315
- }
59316
-
59317
- model = model[0];
59318
-
59319
- return function (value) {
59320
- let result;
59321
-
59322
- if (value !== undefined) {
59323
- if (modifier) {
59324
- value = modifier(value);
59325
- }
59326
-
59327
- result = this[model]();
59328
- result.color[channel] = value;
59329
- return result;
59330
- }
59331
-
59332
- result = this[model]().color[channel];
59333
- if (modifier) {
59334
- result = modifier(result);
59335
- }
59336
-
59337
- return result;
59338
- };
59220
+ model = Array.isArray(model) ? model : [model];
59221
+ var _iterator2 = _createForOfIteratorHelper(model),
59222
+ _step2;
59223
+ try {
59224
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
59225
+ var m = _step2.value;
59226
+ (limiters[m] || (limiters[m] = []))[channel] = modifier;
59227
+ }
59228
+ } catch (err) {
59229
+ _iterator2.e(err);
59230
+ } finally {
59231
+ _iterator2.f();
59232
+ }
59233
+ model = model[0];
59234
+ return function (value) {
59235
+ var result;
59236
+ if (value !== undefined) {
59237
+ if (modifier) {
59238
+ value = modifier(value);
59239
+ }
59240
+ result = this[model]();
59241
+ result.color[channel] = value;
59242
+ return result;
59243
+ }
59244
+ result = this[model]().color[channel];
59245
+ if (modifier) {
59246
+ result = modifier(result);
59247
+ }
59248
+ return result;
59249
+ };
59339
59250
  }
59340
-
59341
59251
  function maxfn(max) {
59342
- return function (v) {
59343
- return Math.max(0, Math.min(max, v));
59344
- };
59252
+ return function (v) {
59253
+ return Math.max(0, Math.min(max, v));
59254
+ };
59345
59255
  }
59346
-
59347
59256
  function assertArray(value) {
59348
- return Array.isArray(value) ? value : [value];
59257
+ return Array.isArray(value) ? value : [value];
59349
59258
  }
59350
-
59351
59259
  function zeroArray(array, length) {
59352
- for (let i = 0; i < length; i++) {
59353
- if (typeof array[i] !== 'number') {
59354
- array[i] = 0;
59355
- }
59356
- }
59357
-
59358
- return array;
59260
+ for (var i = 0; i < length; i++) {
59261
+ if (typeof array[i] !== 'number') {
59262
+ array[i] = 0;
59263
+ }
59264
+ }
59265
+ return array;
59359
59266
  }
59360
-
59361
59267
  module.exports = Color;
59362
59268
 
59363
-
59364
59269
  /***/ }),
59365
59270
 
59366
59271
  /***/ "./node_modules/color/node_modules/color-convert/conversions.js":
@@ -59370,847 +59275,764 @@ module.exports = Color;
59370
59275
  /*! no static exports found */
59371
59276
  /***/ (function(module, exports, __webpack_require__) {
59372
59277
 
59278
+ var _slicedToArray = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
59373
59279
  /* MIT license */
59374
59280
  /* eslint-disable no-mixed-operators */
59375
- const cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
59281
+ var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
59376
59282
 
59377
59283
  // NOTE: conversions should only return primitive values (i.e. arrays, or
59378
59284
  // values that give correct `typeof` results).
59379
59285
  // do not use box values types (i.e. Number(), String(), etc.)
59380
59286
 
59381
- const reverseKeywords = {};
59382
- for (const key of Object.keys(cssKeywords)) {
59383
- reverseKeywords[cssKeywords[key]] = key;
59384
- }
59385
-
59386
- const convert = {
59387
- rgb: {channels: 3, labels: 'rgb'},
59388
- hsl: {channels: 3, labels: 'hsl'},
59389
- hsv: {channels: 3, labels: 'hsv'},
59390
- hwb: {channels: 3, labels: 'hwb'},
59391
- cmyk: {channels: 4, labels: 'cmyk'},
59392
- xyz: {channels: 3, labels: 'xyz'},
59393
- lab: {channels: 3, labels: 'lab'},
59394
- lch: {channels: 3, labels: 'lch'},
59395
- hex: {channels: 1, labels: ['hex']},
59396
- keyword: {channels: 1, labels: ['keyword']},
59397
- ansi16: {channels: 1, labels: ['ansi16']},
59398
- ansi256: {channels: 1, labels: ['ansi256']},
59399
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
59400
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
59401
- gray: {channels: 1, labels: ['gray']}
59287
+ var reverseKeywords = {};
59288
+ for (var _i = 0, _Object$keys = Object.keys(cssKeywords); _i < _Object$keys.length; _i++) {
59289
+ var key = _Object$keys[_i];
59290
+ reverseKeywords[cssKeywords[key]] = key;
59291
+ }
59292
+ var convert = {
59293
+ rgb: {
59294
+ channels: 3,
59295
+ labels: 'rgb'
59296
+ },
59297
+ hsl: {
59298
+ channels: 3,
59299
+ labels: 'hsl'
59300
+ },
59301
+ hsv: {
59302
+ channels: 3,
59303
+ labels: 'hsv'
59304
+ },
59305
+ hwb: {
59306
+ channels: 3,
59307
+ labels: 'hwb'
59308
+ },
59309
+ cmyk: {
59310
+ channels: 4,
59311
+ labels: 'cmyk'
59312
+ },
59313
+ xyz: {
59314
+ channels: 3,
59315
+ labels: 'xyz'
59316
+ },
59317
+ lab: {
59318
+ channels: 3,
59319
+ labels: 'lab'
59320
+ },
59321
+ lch: {
59322
+ channels: 3,
59323
+ labels: 'lch'
59324
+ },
59325
+ hex: {
59326
+ channels: 1,
59327
+ labels: ['hex']
59328
+ },
59329
+ keyword: {
59330
+ channels: 1,
59331
+ labels: ['keyword']
59332
+ },
59333
+ ansi16: {
59334
+ channels: 1,
59335
+ labels: ['ansi16']
59336
+ },
59337
+ ansi256: {
59338
+ channels: 1,
59339
+ labels: ['ansi256']
59340
+ },
59341
+ hcg: {
59342
+ channels: 3,
59343
+ labels: ['h', 'c', 'g']
59344
+ },
59345
+ apple: {
59346
+ channels: 3,
59347
+ labels: ['r16', 'g16', 'b16']
59348
+ },
59349
+ gray: {
59350
+ channels: 1,
59351
+ labels: ['gray']
59352
+ }
59402
59353
  };
59403
-
59404
59354
  module.exports = convert;
59405
59355
 
59406
59356
  // Hide .channels and .labels properties
59407
- for (const model of Object.keys(convert)) {
59408
- if (!('channels' in convert[model])) {
59409
- throw new Error('missing channels property: ' + model);
59410
- }
59411
-
59412
- if (!('labels' in convert[model])) {
59413
- throw new Error('missing channel labels property: ' + model);
59414
- }
59415
-
59416
- if (convert[model].labels.length !== convert[model].channels) {
59417
- throw new Error('channel and label counts mismatch: ' + model);
59418
- }
59419
-
59420
- const {channels, labels} = convert[model];
59421
- delete convert[model].channels;
59422
- delete convert[model].labels;
59423
- Object.defineProperty(convert[model], 'channels', {value: channels});
59424
- Object.defineProperty(convert[model], 'labels', {value: labels});
59357
+ for (var _i2 = 0, _Object$keys2 = Object.keys(convert); _i2 < _Object$keys2.length; _i2++) {
59358
+ var model = _Object$keys2[_i2];
59359
+ if (!('channels' in convert[model])) {
59360
+ throw new Error('missing channels property: ' + model);
59361
+ }
59362
+ if (!('labels' in convert[model])) {
59363
+ throw new Error('missing channel labels property: ' + model);
59364
+ }
59365
+ if (convert[model].labels.length !== convert[model].channels) {
59366
+ throw new Error('channel and label counts mismatch: ' + model);
59367
+ }
59368
+ var _convert$model = convert[model],
59369
+ channels = _convert$model.channels,
59370
+ labels = _convert$model.labels;
59371
+ delete convert[model].channels;
59372
+ delete convert[model].labels;
59373
+ Object.defineProperty(convert[model], 'channels', {
59374
+ value: channels
59375
+ });
59376
+ Object.defineProperty(convert[model], 'labels', {
59377
+ value: labels
59378
+ });
59425
59379
  }
59426
-
59427
59380
  convert.rgb.hsl = function (rgb) {
59428
- const r = rgb[0] / 255;
59429
- const g = rgb[1] / 255;
59430
- const b = rgb[2] / 255;
59431
- const min = Math.min(r, g, b);
59432
- const max = Math.max(r, g, b);
59433
- const delta = max - min;
59434
- let h;
59435
- let s;
59436
-
59437
- if (max === min) {
59438
- h = 0;
59439
- } else if (r === max) {
59440
- h = (g - b) / delta;
59441
- } else if (g === max) {
59442
- h = 2 + (b - r) / delta;
59443
- } else if (b === max) {
59444
- h = 4 + (r - g) / delta;
59445
- }
59446
-
59447
- h = Math.min(h * 60, 360);
59448
-
59449
- if (h < 0) {
59450
- h += 360;
59451
- }
59452
-
59453
- const l = (min + max) / 2;
59454
-
59455
- if (max === min) {
59456
- s = 0;
59457
- } else if (l <= 0.5) {
59458
- s = delta / (max + min);
59459
- } else {
59460
- s = delta / (2 - max - min);
59461
- }
59462
-
59463
- return [h, s * 100, l * 100];
59381
+ var r = rgb[0] / 255;
59382
+ var g = rgb[1] / 255;
59383
+ var b = rgb[2] / 255;
59384
+ var min = Math.min(r, g, b);
59385
+ var max = Math.max(r, g, b);
59386
+ var delta = max - min;
59387
+ var h;
59388
+ var s;
59389
+ if (max === min) {
59390
+ h = 0;
59391
+ } else if (r === max) {
59392
+ h = (g - b) / delta;
59393
+ } else if (g === max) {
59394
+ h = 2 + (b - r) / delta;
59395
+ } else if (b === max) {
59396
+ h = 4 + (r - g) / delta;
59397
+ }
59398
+ h = Math.min(h * 60, 360);
59399
+ if (h < 0) {
59400
+ h += 360;
59401
+ }
59402
+ var l = (min + max) / 2;
59403
+ if (max === min) {
59404
+ s = 0;
59405
+ } else if (l <= 0.5) {
59406
+ s = delta / (max + min);
59407
+ } else {
59408
+ s = delta / (2 - max - min);
59409
+ }
59410
+ return [h, s * 100, l * 100];
59464
59411
  };
59465
-
59466
59412
  convert.rgb.hsv = function (rgb) {
59467
- let rdif;
59468
- let gdif;
59469
- let bdif;
59470
- let h;
59471
- let s;
59472
-
59473
- const r = rgb[0] / 255;
59474
- const g = rgb[1] / 255;
59475
- const b = rgb[2] / 255;
59476
- const v = Math.max(r, g, b);
59477
- const diff = v - Math.min(r, g, b);
59478
- const diffc = function (c) {
59479
- return (v - c) / 6 / diff + 1 / 2;
59480
- };
59481
-
59482
- if (diff === 0) {
59483
- h = 0;
59484
- s = 0;
59485
- } else {
59486
- s = diff / v;
59487
- rdif = diffc(r);
59488
- gdif = diffc(g);
59489
- bdif = diffc(b);
59490
-
59491
- if (r === v) {
59492
- h = bdif - gdif;
59493
- } else if (g === v) {
59494
- h = (1 / 3) + rdif - bdif;
59495
- } else if (b === v) {
59496
- h = (2 / 3) + gdif - rdif;
59497
- }
59498
-
59499
- if (h < 0) {
59500
- h += 1;
59501
- } else if (h > 1) {
59502
- h -= 1;
59503
- }
59504
- }
59505
-
59506
- return [
59507
- h * 360,
59508
- s * 100,
59509
- v * 100
59510
- ];
59413
+ var rdif;
59414
+ var gdif;
59415
+ var bdif;
59416
+ var h;
59417
+ var s;
59418
+ var r = rgb[0] / 255;
59419
+ var g = rgb[1] / 255;
59420
+ var b = rgb[2] / 255;
59421
+ var v = Math.max(r, g, b);
59422
+ var diff = v - Math.min(r, g, b);
59423
+ var diffc = function diffc(c) {
59424
+ return (v - c) / 6 / diff + 1 / 2;
59425
+ };
59426
+ if (diff === 0) {
59427
+ h = 0;
59428
+ s = 0;
59429
+ } else {
59430
+ s = diff / v;
59431
+ rdif = diffc(r);
59432
+ gdif = diffc(g);
59433
+ bdif = diffc(b);
59434
+ if (r === v) {
59435
+ h = bdif - gdif;
59436
+ } else if (g === v) {
59437
+ h = 1 / 3 + rdif - bdif;
59438
+ } else if (b === v) {
59439
+ h = 2 / 3 + gdif - rdif;
59440
+ }
59441
+ if (h < 0) {
59442
+ h += 1;
59443
+ } else if (h > 1) {
59444
+ h -= 1;
59445
+ }
59446
+ }
59447
+ return [h * 360, s * 100, v * 100];
59511
59448
  };
59512
-
59513
59449
  convert.rgb.hwb = function (rgb) {
59514
- const r = rgb[0];
59515
- const g = rgb[1];
59516
- let b = rgb[2];
59517
- const h = convert.rgb.hsl(rgb)[0];
59518
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
59519
-
59520
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
59521
-
59522
- return [h, w * 100, b * 100];
59450
+ var r = rgb[0];
59451
+ var g = rgb[1];
59452
+ var b = rgb[2];
59453
+ var h = convert.rgb.hsl(rgb)[0];
59454
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
59455
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
59456
+ return [h, w * 100, b * 100];
59523
59457
  };
59524
-
59525
59458
  convert.rgb.cmyk = function (rgb) {
59526
- const r = rgb[0] / 255;
59527
- const g = rgb[1] / 255;
59528
- const b = rgb[2] / 255;
59529
-
59530
- const k = Math.min(1 - r, 1 - g, 1 - b);
59531
- const c = (1 - r - k) / (1 - k) || 0;
59532
- const m = (1 - g - k) / (1 - k) || 0;
59533
- const y = (1 - b - k) / (1 - k) || 0;
59534
-
59535
- return [c * 100, m * 100, y * 100, k * 100];
59459
+ var r = rgb[0] / 255;
59460
+ var g = rgb[1] / 255;
59461
+ var b = rgb[2] / 255;
59462
+ var k = Math.min(1 - r, 1 - g, 1 - b);
59463
+ var c = (1 - r - k) / (1 - k) || 0;
59464
+ var m = (1 - g - k) / (1 - k) || 0;
59465
+ var y = (1 - b - k) / (1 - k) || 0;
59466
+ return [c * 100, m * 100, y * 100, k * 100];
59536
59467
  };
59537
-
59538
59468
  function comparativeDistance(x, y) {
59539
- /*
59540
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
59541
- */
59542
- return (
59543
- ((x[0] - y[0]) ** 2) +
59544
- ((x[1] - y[1]) ** 2) +
59545
- ((x[2] - y[2]) ** 2)
59546
- );
59469
+ /*
59470
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
59471
+ */
59472
+ return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
59547
59473
  }
59548
-
59549
59474
  convert.rgb.keyword = function (rgb) {
59550
- const reversed = reverseKeywords[rgb];
59551
- if (reversed) {
59552
- return reversed;
59553
- }
59554
-
59555
- let currentClosestDistance = Infinity;
59556
- let currentClosestKeyword;
59557
-
59558
- for (const keyword of Object.keys(cssKeywords)) {
59559
- const value = cssKeywords[keyword];
59560
-
59561
- // Compute comparative distance
59562
- const distance = comparativeDistance(rgb, value);
59475
+ var reversed = reverseKeywords[rgb];
59476
+ if (reversed) {
59477
+ return reversed;
59478
+ }
59479
+ var currentClosestDistance = Infinity;
59480
+ var currentClosestKeyword;
59481
+ for (var _i3 = 0, _Object$keys3 = Object.keys(cssKeywords); _i3 < _Object$keys3.length; _i3++) {
59482
+ var keyword = _Object$keys3[_i3];
59483
+ var value = cssKeywords[keyword];
59563
59484
 
59564
- // Check if its less, if so set as closest
59565
- if (distance < currentClosestDistance) {
59566
- currentClosestDistance = distance;
59567
- currentClosestKeyword = keyword;
59568
- }
59569
- }
59485
+ // Compute comparative distance
59486
+ var distance = comparativeDistance(rgb, value);
59570
59487
 
59571
- return currentClosestKeyword;
59488
+ // Check if its less, if so set as closest
59489
+ if (distance < currentClosestDistance) {
59490
+ currentClosestDistance = distance;
59491
+ currentClosestKeyword = keyword;
59492
+ }
59493
+ }
59494
+ return currentClosestKeyword;
59572
59495
  };
59573
-
59574
59496
  convert.keyword.rgb = function (keyword) {
59575
- return cssKeywords[keyword];
59497
+ return cssKeywords[keyword];
59576
59498
  };
59577
-
59578
59499
  convert.rgb.xyz = function (rgb) {
59579
- let r = rgb[0] / 255;
59580
- let g = rgb[1] / 255;
59581
- let b = rgb[2] / 255;
59582
-
59583
- // Assume sRGB
59584
- r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
59585
- g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
59586
- b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
59587
-
59588
- const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
59589
- const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
59590
- const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
59591
-
59592
- return [x * 100, y * 100, z * 100];
59500
+ var r = rgb[0] / 255;
59501
+ var g = rgb[1] / 255;
59502
+ var b = rgb[2] / 255;
59503
+
59504
+ // Assume sRGB
59505
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
59506
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
59507
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
59508
+ var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
59509
+ var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
59510
+ var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
59511
+ return [x * 100, y * 100, z * 100];
59593
59512
  };
59594
-
59595
59513
  convert.rgb.lab = function (rgb) {
59596
- const xyz = convert.rgb.xyz(rgb);
59597
- let x = xyz[0];
59598
- let y = xyz[1];
59599
- let z = xyz[2];
59600
-
59601
- x /= 95.047;
59602
- y /= 100;
59603
- z /= 108.883;
59604
-
59605
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
59606
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
59607
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
59608
-
59609
- const l = (116 * y) - 16;
59610
- const a = 500 * (x - y);
59611
- const b = 200 * (y - z);
59612
-
59613
- return [l, a, b];
59514
+ var xyz = convert.rgb.xyz(rgb);
59515
+ var x = xyz[0];
59516
+ var y = xyz[1];
59517
+ var z = xyz[2];
59518
+ x /= 95.047;
59519
+ y /= 100;
59520
+ z /= 108.883;
59521
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
59522
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
59523
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
59524
+ var l = 116 * y - 16;
59525
+ var a = 500 * (x - y);
59526
+ var b = 200 * (y - z);
59527
+ return [l, a, b];
59614
59528
  };
59615
-
59616
59529
  convert.hsl.rgb = function (hsl) {
59617
- const h = hsl[0] / 360;
59618
- const s = hsl[1] / 100;
59619
- const l = hsl[2] / 100;
59620
- let t2;
59621
- let t3;
59622
- let val;
59623
-
59624
- if (s === 0) {
59625
- val = l * 255;
59626
- return [val, val, val];
59627
- }
59628
-
59629
- if (l < 0.5) {
59630
- t2 = l * (1 + s);
59631
- } else {
59632
- t2 = l + s - l * s;
59633
- }
59634
-
59635
- const t1 = 2 * l - t2;
59636
-
59637
- const rgb = [0, 0, 0];
59638
- for (let i = 0; i < 3; i++) {
59639
- t3 = h + 1 / 3 * -(i - 1);
59640
- if (t3 < 0) {
59641
- t3++;
59642
- }
59643
-
59644
- if (t3 > 1) {
59645
- t3--;
59646
- }
59647
-
59648
- if (6 * t3 < 1) {
59649
- val = t1 + (t2 - t1) * 6 * t3;
59650
- } else if (2 * t3 < 1) {
59651
- val = t2;
59652
- } else if (3 * t3 < 2) {
59653
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
59654
- } else {
59655
- val = t1;
59656
- }
59657
-
59658
- rgb[i] = val * 255;
59659
- }
59660
-
59661
- return rgb;
59530
+ var h = hsl[0] / 360;
59531
+ var s = hsl[1] / 100;
59532
+ var l = hsl[2] / 100;
59533
+ var t2;
59534
+ var t3;
59535
+ var val;
59536
+ if (s === 0) {
59537
+ val = l * 255;
59538
+ return [val, val, val];
59539
+ }
59540
+ if (l < 0.5) {
59541
+ t2 = l * (1 + s);
59542
+ } else {
59543
+ t2 = l + s - l * s;
59544
+ }
59545
+ var t1 = 2 * l - t2;
59546
+ var rgb = [0, 0, 0];
59547
+ for (var i = 0; i < 3; i++) {
59548
+ t3 = h + 1 / 3 * -(i - 1);
59549
+ if (t3 < 0) {
59550
+ t3++;
59551
+ }
59552
+ if (t3 > 1) {
59553
+ t3--;
59554
+ }
59555
+ if (6 * t3 < 1) {
59556
+ val = t1 + (t2 - t1) * 6 * t3;
59557
+ } else if (2 * t3 < 1) {
59558
+ val = t2;
59559
+ } else if (3 * t3 < 2) {
59560
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
59561
+ } else {
59562
+ val = t1;
59563
+ }
59564
+ rgb[i] = val * 255;
59565
+ }
59566
+ return rgb;
59662
59567
  };
59663
-
59664
59568
  convert.hsl.hsv = function (hsl) {
59665
- const h = hsl[0];
59666
- let s = hsl[1] / 100;
59667
- let l = hsl[2] / 100;
59668
- let smin = s;
59669
- const lmin = Math.max(l, 0.01);
59670
-
59671
- l *= 2;
59672
- s *= (l <= 1) ? l : 2 - l;
59673
- smin *= lmin <= 1 ? lmin : 2 - lmin;
59674
- const v = (l + s) / 2;
59675
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
59676
-
59677
- return [h, sv * 100, v * 100];
59569
+ var h = hsl[0];
59570
+ var s = hsl[1] / 100;
59571
+ var l = hsl[2] / 100;
59572
+ var smin = s;
59573
+ var lmin = Math.max(l, 0.01);
59574
+ l *= 2;
59575
+ s *= l <= 1 ? l : 2 - l;
59576
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
59577
+ var v = (l + s) / 2;
59578
+ var sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
59579
+ return [h, sv * 100, v * 100];
59678
59580
  };
59679
-
59680
59581
  convert.hsv.rgb = function (hsv) {
59681
- const h = hsv[0] / 60;
59682
- const s = hsv[1] / 100;
59683
- let v = hsv[2] / 100;
59684
- const hi = Math.floor(h) % 6;
59685
-
59686
- const f = h - Math.floor(h);
59687
- const p = 255 * v * (1 - s);
59688
- const q = 255 * v * (1 - (s * f));
59689
- const t = 255 * v * (1 - (s * (1 - f)));
59690
- v *= 255;
59691
-
59692
- switch (hi) {
59693
- case 0:
59694
- return [v, t, p];
59695
- case 1:
59696
- return [q, v, p];
59697
- case 2:
59698
- return [p, v, t];
59699
- case 3:
59700
- return [p, q, v];
59701
- case 4:
59702
- return [t, p, v];
59703
- case 5:
59704
- return [v, p, q];
59705
- }
59582
+ var h = hsv[0] / 60;
59583
+ var s = hsv[1] / 100;
59584
+ var v = hsv[2] / 100;
59585
+ var hi = Math.floor(h) % 6;
59586
+ var f = h - Math.floor(h);
59587
+ var p = 255 * v * (1 - s);
59588
+ var q = 255 * v * (1 - s * f);
59589
+ var t = 255 * v * (1 - s * (1 - f));
59590
+ v *= 255;
59591
+ switch (hi) {
59592
+ case 0:
59593
+ return [v, t, p];
59594
+ case 1:
59595
+ return [q, v, p];
59596
+ case 2:
59597
+ return [p, v, t];
59598
+ case 3:
59599
+ return [p, q, v];
59600
+ case 4:
59601
+ return [t, p, v];
59602
+ case 5:
59603
+ return [v, p, q];
59604
+ }
59706
59605
  };
59707
-
59708
59606
  convert.hsv.hsl = function (hsv) {
59709
- const h = hsv[0];
59710
- const s = hsv[1] / 100;
59711
- const v = hsv[2] / 100;
59712
- const vmin = Math.max(v, 0.01);
59713
- let sl;
59714
- let l;
59715
-
59716
- l = (2 - s) * v;
59717
- const lmin = (2 - s) * vmin;
59718
- sl = s * vmin;
59719
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
59720
- sl = sl || 0;
59721
- l /= 2;
59722
-
59723
- return [h, sl * 100, l * 100];
59607
+ var h = hsv[0];
59608
+ var s = hsv[1] / 100;
59609
+ var v = hsv[2] / 100;
59610
+ var vmin = Math.max(v, 0.01);
59611
+ var sl;
59612
+ var l;
59613
+ l = (2 - s) * v;
59614
+ var lmin = (2 - s) * vmin;
59615
+ sl = s * vmin;
59616
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
59617
+ sl = sl || 0;
59618
+ l /= 2;
59619
+ return [h, sl * 100, l * 100];
59724
59620
  };
59725
59621
 
59726
59622
  // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
59727
59623
  convert.hwb.rgb = function (hwb) {
59728
- const h = hwb[0] / 360;
59729
- let wh = hwb[1] / 100;
59730
- let bl = hwb[2] / 100;
59731
- const ratio = wh + bl;
59732
- let f;
59733
-
59734
- // Wh + bl cant be > 1
59735
- if (ratio > 1) {
59736
- wh /= ratio;
59737
- bl /= ratio;
59738
- }
59739
-
59740
- const i = Math.floor(6 * h);
59741
- const v = 1 - bl;
59742
- f = 6 * h - i;
59743
-
59744
- if ((i & 0x01) !== 0) {
59745
- f = 1 - f;
59746
- }
59747
-
59748
- const n = wh + f * (v - wh); // Linear interpolation
59749
-
59750
- let r;
59751
- let g;
59752
- let b;
59753
- /* eslint-disable max-statements-per-line,no-multi-spaces */
59754
- switch (i) {
59755
- default:
59756
- case 6:
59757
- case 0: r = v; g = n; b = wh; break;
59758
- case 1: r = n; g = v; b = wh; break;
59759
- case 2: r = wh; g = v; b = n; break;
59760
- case 3: r = wh; g = n; b = v; break;
59761
- case 4: r = n; g = wh; b = v; break;
59762
- case 5: r = v; g = wh; b = n; break;
59763
- }
59764
- /* eslint-enable max-statements-per-line,no-multi-spaces */
59624
+ var h = hwb[0] / 360;
59625
+ var wh = hwb[1] / 100;
59626
+ var bl = hwb[2] / 100;
59627
+ var ratio = wh + bl;
59628
+ var f;
59629
+
59630
+ // Wh + bl cant be > 1
59631
+ if (ratio > 1) {
59632
+ wh /= ratio;
59633
+ bl /= ratio;
59634
+ }
59635
+ var i = Math.floor(6 * h);
59636
+ var v = 1 - bl;
59637
+ f = 6 * h - i;
59638
+ if ((i & 0x01) !== 0) {
59639
+ f = 1 - f;
59640
+ }
59641
+ var n = wh + f * (v - wh); // Linear interpolation
59642
+
59643
+ var r;
59644
+ var g;
59645
+ var b;
59646
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
59647
+ switch (i) {
59648
+ default:
59649
+ case 6:
59650
+ case 0:
59651
+ r = v;
59652
+ g = n;
59653
+ b = wh;
59654
+ break;
59655
+ case 1:
59656
+ r = n;
59657
+ g = v;
59658
+ b = wh;
59659
+ break;
59660
+ case 2:
59661
+ r = wh;
59662
+ g = v;
59663
+ b = n;
59664
+ break;
59665
+ case 3:
59666
+ r = wh;
59667
+ g = n;
59668
+ b = v;
59669
+ break;
59670
+ case 4:
59671
+ r = n;
59672
+ g = wh;
59673
+ b = v;
59674
+ break;
59675
+ case 5:
59676
+ r = v;
59677
+ g = wh;
59678
+ b = n;
59679
+ break;
59680
+ }
59681
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
59765
59682
 
59766
- return [r * 255, g * 255, b * 255];
59683
+ return [r * 255, g * 255, b * 255];
59767
59684
  };
59768
-
59769
59685
  convert.cmyk.rgb = function (cmyk) {
59770
- const c = cmyk[0] / 100;
59771
- const m = cmyk[1] / 100;
59772
- const y = cmyk[2] / 100;
59773
- const k = cmyk[3] / 100;
59774
-
59775
- const r = 1 - Math.min(1, c * (1 - k) + k);
59776
- const g = 1 - Math.min(1, m * (1 - k) + k);
59777
- const b = 1 - Math.min(1, y * (1 - k) + k);
59778
-
59779
- return [r * 255, g * 255, b * 255];
59686
+ var c = cmyk[0] / 100;
59687
+ var m = cmyk[1] / 100;
59688
+ var y = cmyk[2] / 100;
59689
+ var k = cmyk[3] / 100;
59690
+ var r = 1 - Math.min(1, c * (1 - k) + k);
59691
+ var g = 1 - Math.min(1, m * (1 - k) + k);
59692
+ var b = 1 - Math.min(1, y * (1 - k) + k);
59693
+ return [r * 255, g * 255, b * 255];
59780
59694
  };
59781
-
59782
59695
  convert.xyz.rgb = function (xyz) {
59783
- const x = xyz[0] / 100;
59784
- const y = xyz[1] / 100;
59785
- const z = xyz[2] / 100;
59786
- let r;
59787
- let g;
59788
- let b;
59789
-
59790
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
59791
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
59792
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
59793
-
59794
- // Assume sRGB
59795
- r = r > 0.0031308
59796
- ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
59797
- : r * 12.92;
59798
-
59799
- g = g > 0.0031308
59800
- ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
59801
- : g * 12.92;
59802
-
59803
- b = b > 0.0031308
59804
- ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
59805
- : b * 12.92;
59806
-
59807
- r = Math.min(Math.max(0, r), 1);
59808
- g = Math.min(Math.max(0, g), 1);
59809
- b = Math.min(Math.max(0, b), 1);
59810
-
59811
- return [r * 255, g * 255, b * 255];
59696
+ var x = xyz[0] / 100;
59697
+ var y = xyz[1] / 100;
59698
+ var z = xyz[2] / 100;
59699
+ var r;
59700
+ var g;
59701
+ var b;
59702
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
59703
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
59704
+ b = x * 0.0557 + y * -0.2040 + z * 1.0570;
59705
+
59706
+ // Assume sRGB
59707
+ r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
59708
+ g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
59709
+ b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
59710
+ r = Math.min(Math.max(0, r), 1);
59711
+ g = Math.min(Math.max(0, g), 1);
59712
+ b = Math.min(Math.max(0, b), 1);
59713
+ return [r * 255, g * 255, b * 255];
59812
59714
  };
59813
-
59814
59715
  convert.xyz.lab = function (xyz) {
59815
- let x = xyz[0];
59816
- let y = xyz[1];
59817
- let z = xyz[2];
59818
-
59819
- x /= 95.047;
59820
- y /= 100;
59821
- z /= 108.883;
59822
-
59823
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
59824
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
59825
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
59826
-
59827
- const l = (116 * y) - 16;
59828
- const a = 500 * (x - y);
59829
- const b = 200 * (y - z);
59830
-
59831
- return [l, a, b];
59716
+ var x = xyz[0];
59717
+ var y = xyz[1];
59718
+ var z = xyz[2];
59719
+ x /= 95.047;
59720
+ y /= 100;
59721
+ z /= 108.883;
59722
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
59723
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
59724
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
59725
+ var l = 116 * y - 16;
59726
+ var a = 500 * (x - y);
59727
+ var b = 200 * (y - z);
59728
+ return [l, a, b];
59832
59729
  };
59833
-
59834
59730
  convert.lab.xyz = function (lab) {
59835
- const l = lab[0];
59836
- const a = lab[1];
59837
- const b = lab[2];
59838
- let x;
59839
- let y;
59840
- let z;
59841
-
59842
- y = (l + 16) / 116;
59843
- x = a / 500 + y;
59844
- z = y - b / 200;
59845
-
59846
- const y2 = y ** 3;
59847
- const x2 = x ** 3;
59848
- const z2 = z ** 3;
59849
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
59850
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
59851
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
59852
-
59853
- x *= 95.047;
59854
- y *= 100;
59855
- z *= 108.883;
59856
-
59857
- return [x, y, z];
59731
+ var l = lab[0];
59732
+ var a = lab[1];
59733
+ var b = lab[2];
59734
+ var x;
59735
+ var y;
59736
+ var z;
59737
+ y = (l + 16) / 116;
59738
+ x = a / 500 + y;
59739
+ z = y - b / 200;
59740
+ var y2 = Math.pow(y, 3);
59741
+ var x2 = Math.pow(x, 3);
59742
+ var z2 = Math.pow(z, 3);
59743
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
59744
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
59745
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
59746
+ x *= 95.047;
59747
+ y *= 100;
59748
+ z *= 108.883;
59749
+ return [x, y, z];
59858
59750
  };
59859
-
59860
59751
  convert.lab.lch = function (lab) {
59861
- const l = lab[0];
59862
- const a = lab[1];
59863
- const b = lab[2];
59864
- let h;
59865
-
59866
- const hr = Math.atan2(b, a);
59867
- h = hr * 360 / 2 / Math.PI;
59868
-
59869
- if (h < 0) {
59870
- h += 360;
59871
- }
59872
-
59873
- const c = Math.sqrt(a * a + b * b);
59874
-
59875
- return [l, c, h];
59752
+ var l = lab[0];
59753
+ var a = lab[1];
59754
+ var b = lab[2];
59755
+ var h;
59756
+ var hr = Math.atan2(b, a);
59757
+ h = hr * 360 / 2 / Math.PI;
59758
+ if (h < 0) {
59759
+ h += 360;
59760
+ }
59761
+ var c = Math.sqrt(a * a + b * b);
59762
+ return [l, c, h];
59876
59763
  };
59877
-
59878
59764
  convert.lch.lab = function (lch) {
59879
- const l = lch[0];
59880
- const c = lch[1];
59881
- const h = lch[2];
59882
-
59883
- const hr = h / 360 * 2 * Math.PI;
59884
- const a = c * Math.cos(hr);
59885
- const b = c * Math.sin(hr);
59886
-
59887
- return [l, a, b];
59888
- };
59889
-
59890
- convert.rgb.ansi16 = function (args, saturation = null) {
59891
- const [r, g, b] = args;
59892
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
59893
-
59894
- value = Math.round(value / 50);
59895
-
59896
- if (value === 0) {
59897
- return 30;
59898
- }
59899
-
59900
- let ansi = 30
59901
- + ((Math.round(b / 255) << 2)
59902
- | (Math.round(g / 255) << 1)
59903
- | Math.round(r / 255));
59904
-
59905
- if (value === 2) {
59906
- ansi += 60;
59907
- }
59908
-
59909
- return ansi;
59765
+ var l = lch[0];
59766
+ var c = lch[1];
59767
+ var h = lch[2];
59768
+ var hr = h / 360 * 2 * Math.PI;
59769
+ var a = c * Math.cos(hr);
59770
+ var b = c * Math.sin(hr);
59771
+ return [l, a, b];
59772
+ };
59773
+ convert.rgb.ansi16 = function (args) {
59774
+ var saturation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
59775
+ var _args = _slicedToArray(args, 3),
59776
+ r = _args[0],
59777
+ g = _args[1],
59778
+ b = _args[2];
59779
+ var value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
59780
+
59781
+ value = Math.round(value / 50);
59782
+ if (value === 0) {
59783
+ return 30;
59784
+ }
59785
+ var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
59786
+ if (value === 2) {
59787
+ ansi += 60;
59788
+ }
59789
+ return ansi;
59910
59790
  };
59911
-
59912
59791
  convert.hsv.ansi16 = function (args) {
59913
- // Optimization here; we already know the value and don't need to get
59914
- // it converted for us.
59915
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
59792
+ // Optimization here; we already know the value and don't need to get
59793
+ // it converted for us.
59794
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
59916
59795
  };
59917
-
59918
59796
  convert.rgb.ansi256 = function (args) {
59919
- const r = args[0];
59920
- const g = args[1];
59921
- const b = args[2];
59922
-
59923
- // We use the extended greyscale palette here, with the exception of
59924
- // black and white. normal palette only has 4 greyscale shades.
59925
- if (r === g && g === b) {
59926
- if (r < 8) {
59927
- return 16;
59928
- }
59929
-
59930
- if (r > 248) {
59931
- return 231;
59932
- }
59797
+ var r = args[0];
59798
+ var g = args[1];
59799
+ var b = args[2];
59933
59800
 
59934
- return Math.round(((r - 8) / 247) * 24) + 232;
59935
- }
59936
-
59937
- const ansi = 16
59938
- + (36 * Math.round(r / 255 * 5))
59939
- + (6 * Math.round(g / 255 * 5))
59940
- + Math.round(b / 255 * 5);
59941
-
59942
- return ansi;
59801
+ // We use the extended greyscale palette here, with the exception of
59802
+ // black and white. normal palette only has 4 greyscale shades.
59803
+ if (r === g && g === b) {
59804
+ if (r < 8) {
59805
+ return 16;
59806
+ }
59807
+ if (r > 248) {
59808
+ return 231;
59809
+ }
59810
+ return Math.round((r - 8) / 247 * 24) + 232;
59811
+ }
59812
+ var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
59813
+ return ansi;
59943
59814
  };
59944
-
59945
59815
  convert.ansi16.rgb = function (args) {
59946
- let color = args % 10;
59947
-
59948
- // Handle greyscale
59949
- if (color === 0 || color === 7) {
59950
- if (args > 50) {
59951
- color += 3.5;
59952
- }
59953
-
59954
- color = color / 10.5 * 255;
59955
-
59956
- return [color, color, color];
59957
- }
59816
+ var color = args % 10;
59958
59817
 
59959
- const mult = (~~(args > 50) + 1) * 0.5;
59960
- const r = ((color & 1) * mult) * 255;
59961
- const g = (((color >> 1) & 1) * mult) * 255;
59962
- const b = (((color >> 2) & 1) * mult) * 255;
59963
-
59964
- return [r, g, b];
59818
+ // Handle greyscale
59819
+ if (color === 0 || color === 7) {
59820
+ if (args > 50) {
59821
+ color += 3.5;
59822
+ }
59823
+ color = color / 10.5 * 255;
59824
+ return [color, color, color];
59825
+ }
59826
+ var mult = (~~(args > 50) + 1) * 0.5;
59827
+ var r = (color & 1) * mult * 255;
59828
+ var g = (color >> 1 & 1) * mult * 255;
59829
+ var b = (color >> 2 & 1) * mult * 255;
59830
+ return [r, g, b];
59965
59831
  };
59966
-
59967
59832
  convert.ansi256.rgb = function (args) {
59968
- // Handle greyscale
59969
- if (args >= 232) {
59970
- const c = (args - 232) * 10 + 8;
59971
- return [c, c, c];
59972
- }
59973
-
59974
- args -= 16;
59975
-
59976
- let rem;
59977
- const r = Math.floor(args / 36) / 5 * 255;
59978
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
59979
- const b = (rem % 6) / 5 * 255;
59980
-
59981
- return [r, g, b];
59833
+ // Handle greyscale
59834
+ if (args >= 232) {
59835
+ var c = (args - 232) * 10 + 8;
59836
+ return [c, c, c];
59837
+ }
59838
+ args -= 16;
59839
+ var rem;
59840
+ var r = Math.floor(args / 36) / 5 * 255;
59841
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
59842
+ var b = rem % 6 / 5 * 255;
59843
+ return [r, g, b];
59982
59844
  };
59983
-
59984
59845
  convert.rgb.hex = function (args) {
59985
- const integer = ((Math.round(args[0]) & 0xFF) << 16)
59986
- + ((Math.round(args[1]) & 0xFF) << 8)
59987
- + (Math.round(args[2]) & 0xFF);
59988
-
59989
- const string = integer.toString(16).toUpperCase();
59990
- return '000000'.substring(string.length) + string;
59846
+ var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
59847
+ var string = integer.toString(16).toUpperCase();
59848
+ return '000000'.substring(string.length) + string;
59991
59849
  };
59992
-
59993
59850
  convert.hex.rgb = function (args) {
59994
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
59995
- if (!match) {
59996
- return [0, 0, 0];
59997
- }
59998
-
59999
- let colorString = match[0];
60000
-
60001
- if (match[0].length === 3) {
60002
- colorString = colorString.split('').map(char => {
60003
- return char + char;
60004
- }).join('');
60005
- }
60006
-
60007
- const integer = parseInt(colorString, 16);
60008
- const r = (integer >> 16) & 0xFF;
60009
- const g = (integer >> 8) & 0xFF;
60010
- const b = integer & 0xFF;
60011
-
60012
- return [r, g, b];
59851
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
59852
+ if (!match) {
59853
+ return [0, 0, 0];
59854
+ }
59855
+ var colorString = match[0];
59856
+ if (match[0].length === 3) {
59857
+ colorString = colorString.split('').map(function (char) {
59858
+ return char + char;
59859
+ }).join('');
59860
+ }
59861
+ var integer = parseInt(colorString, 16);
59862
+ var r = integer >> 16 & 0xFF;
59863
+ var g = integer >> 8 & 0xFF;
59864
+ var b = integer & 0xFF;
59865
+ return [r, g, b];
60013
59866
  };
60014
-
60015
59867
  convert.rgb.hcg = function (rgb) {
60016
- const r = rgb[0] / 255;
60017
- const g = rgb[1] / 255;
60018
- const b = rgb[2] / 255;
60019
- const max = Math.max(Math.max(r, g), b);
60020
- const min = Math.min(Math.min(r, g), b);
60021
- const chroma = (max - min);
60022
- let grayscale;
60023
- let hue;
60024
-
60025
- if (chroma < 1) {
60026
- grayscale = min / (1 - chroma);
60027
- } else {
60028
- grayscale = 0;
60029
- }
60030
-
60031
- if (chroma <= 0) {
60032
- hue = 0;
60033
- } else
60034
- if (max === r) {
60035
- hue = ((g - b) / chroma) % 6;
60036
- } else
60037
- if (max === g) {
60038
- hue = 2 + (b - r) / chroma;
60039
- } else {
60040
- hue = 4 + (r - g) / chroma;
60041
- }
60042
-
60043
- hue /= 6;
60044
- hue %= 1;
60045
-
60046
- return [hue * 360, chroma * 100, grayscale * 100];
59868
+ var r = rgb[0] / 255;
59869
+ var g = rgb[1] / 255;
59870
+ var b = rgb[2] / 255;
59871
+ var max = Math.max(Math.max(r, g), b);
59872
+ var min = Math.min(Math.min(r, g), b);
59873
+ var chroma = max - min;
59874
+ var grayscale;
59875
+ var hue;
59876
+ if (chroma < 1) {
59877
+ grayscale = min / (1 - chroma);
59878
+ } else {
59879
+ grayscale = 0;
59880
+ }
59881
+ if (chroma <= 0) {
59882
+ hue = 0;
59883
+ } else if (max === r) {
59884
+ hue = (g - b) / chroma % 6;
59885
+ } else if (max === g) {
59886
+ hue = 2 + (b - r) / chroma;
59887
+ } else {
59888
+ hue = 4 + (r - g) / chroma;
59889
+ }
59890
+ hue /= 6;
59891
+ hue %= 1;
59892
+ return [hue * 360, chroma * 100, grayscale * 100];
60047
59893
  };
60048
-
60049
59894
  convert.hsl.hcg = function (hsl) {
60050
- const s = hsl[1] / 100;
60051
- const l = hsl[2] / 100;
60052
-
60053
- const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
60054
-
60055
- let f = 0;
60056
- if (c < 1.0) {
60057
- f = (l - 0.5 * c) / (1.0 - c);
60058
- }
60059
-
60060
- return [hsl[0], c * 100, f * 100];
59895
+ var s = hsl[1] / 100;
59896
+ var l = hsl[2] / 100;
59897
+ var c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
59898
+ var f = 0;
59899
+ if (c < 1.0) {
59900
+ f = (l - 0.5 * c) / (1.0 - c);
59901
+ }
59902
+ return [hsl[0], c * 100, f * 100];
60061
59903
  };
60062
-
60063
59904
  convert.hsv.hcg = function (hsv) {
60064
- const s = hsv[1] / 100;
60065
- const v = hsv[2] / 100;
60066
-
60067
- const c = s * v;
60068
- let f = 0;
60069
-
60070
- if (c < 1.0) {
60071
- f = (v - c) / (1 - c);
60072
- }
60073
-
60074
- return [hsv[0], c * 100, f * 100];
59905
+ var s = hsv[1] / 100;
59906
+ var v = hsv[2] / 100;
59907
+ var c = s * v;
59908
+ var f = 0;
59909
+ if (c < 1.0) {
59910
+ f = (v - c) / (1 - c);
59911
+ }
59912
+ return [hsv[0], c * 100, f * 100];
60075
59913
  };
60076
-
60077
59914
  convert.hcg.rgb = function (hcg) {
60078
- const h = hcg[0] / 360;
60079
- const c = hcg[1] / 100;
60080
- const g = hcg[2] / 100;
60081
-
60082
- if (c === 0.0) {
60083
- return [g * 255, g * 255, g * 255];
60084
- }
60085
-
60086
- const pure = [0, 0, 0];
60087
- const hi = (h % 1) * 6;
60088
- const v = hi % 1;
60089
- const w = 1 - v;
60090
- let mg = 0;
60091
-
60092
- /* eslint-disable max-statements-per-line */
60093
- switch (Math.floor(hi)) {
60094
- case 0:
60095
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
60096
- case 1:
60097
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
60098
- case 2:
60099
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
60100
- case 3:
60101
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
60102
- case 4:
60103
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
60104
- default:
60105
- pure[0] = 1; pure[1] = 0; pure[2] = w;
60106
- }
60107
- /* eslint-enable max-statements-per-line */
60108
-
60109
- mg = (1.0 - c) * g;
59915
+ var h = hcg[0] / 360;
59916
+ var c = hcg[1] / 100;
59917
+ var g = hcg[2] / 100;
59918
+ if (c === 0.0) {
59919
+ return [g * 255, g * 255, g * 255];
59920
+ }
59921
+ var pure = [0, 0, 0];
59922
+ var hi = h % 1 * 6;
59923
+ var v = hi % 1;
59924
+ var w = 1 - v;
59925
+ var mg = 0;
59926
+
59927
+ /* eslint-disable max-statements-per-line */
59928
+ switch (Math.floor(hi)) {
59929
+ case 0:
59930
+ pure[0] = 1;
59931
+ pure[1] = v;
59932
+ pure[2] = 0;
59933
+ break;
59934
+ case 1:
59935
+ pure[0] = w;
59936
+ pure[1] = 1;
59937
+ pure[2] = 0;
59938
+ break;
59939
+ case 2:
59940
+ pure[0] = 0;
59941
+ pure[1] = 1;
59942
+ pure[2] = v;
59943
+ break;
59944
+ case 3:
59945
+ pure[0] = 0;
59946
+ pure[1] = w;
59947
+ pure[2] = 1;
59948
+ break;
59949
+ case 4:
59950
+ pure[0] = v;
59951
+ pure[1] = 0;
59952
+ pure[2] = 1;
59953
+ break;
59954
+ default:
59955
+ pure[0] = 1;
59956
+ pure[1] = 0;
59957
+ pure[2] = w;
59958
+ }
59959
+ /* eslint-enable max-statements-per-line */
60110
59960
 
60111
- return [
60112
- (c * pure[0] + mg) * 255,
60113
- (c * pure[1] + mg) * 255,
60114
- (c * pure[2] + mg) * 255
60115
- ];
59961
+ mg = (1.0 - c) * g;
59962
+ return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
60116
59963
  };
60117
-
60118
59964
  convert.hcg.hsv = function (hcg) {
60119
- const c = hcg[1] / 100;
60120
- const g = hcg[2] / 100;
60121
-
60122
- const v = c + g * (1.0 - c);
60123
- let f = 0;
60124
-
60125
- if (v > 0.0) {
60126
- f = c / v;
60127
- }
60128
-
60129
- return [hcg[0], f * 100, v * 100];
59965
+ var c = hcg[1] / 100;
59966
+ var g = hcg[2] / 100;
59967
+ var v = c + g * (1.0 - c);
59968
+ var f = 0;
59969
+ if (v > 0.0) {
59970
+ f = c / v;
59971
+ }
59972
+ return [hcg[0], f * 100, v * 100];
60130
59973
  };
60131
-
60132
59974
  convert.hcg.hsl = function (hcg) {
60133
- const c = hcg[1] / 100;
60134
- const g = hcg[2] / 100;
60135
-
60136
- const l = g * (1.0 - c) + 0.5 * c;
60137
- let s = 0;
60138
-
60139
- if (l > 0.0 && l < 0.5) {
60140
- s = c / (2 * l);
60141
- } else
60142
- if (l >= 0.5 && l < 1.0) {
60143
- s = c / (2 * (1 - l));
60144
- }
60145
-
60146
- return [hcg[0], s * 100, l * 100];
59975
+ var c = hcg[1] / 100;
59976
+ var g = hcg[2] / 100;
59977
+ var l = g * (1.0 - c) + 0.5 * c;
59978
+ var s = 0;
59979
+ if (l > 0.0 && l < 0.5) {
59980
+ s = c / (2 * l);
59981
+ } else if (l >= 0.5 && l < 1.0) {
59982
+ s = c / (2 * (1 - l));
59983
+ }
59984
+ return [hcg[0], s * 100, l * 100];
60147
59985
  };
60148
-
60149
59986
  convert.hcg.hwb = function (hcg) {
60150
- const c = hcg[1] / 100;
60151
- const g = hcg[2] / 100;
60152
- const v = c + g * (1.0 - c);
60153
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
59987
+ var c = hcg[1] / 100;
59988
+ var g = hcg[2] / 100;
59989
+ var v = c + g * (1.0 - c);
59990
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
60154
59991
  };
60155
-
60156
59992
  convert.hwb.hcg = function (hwb) {
60157
- const w = hwb[1] / 100;
60158
- const b = hwb[2] / 100;
60159
- const v = 1 - b;
60160
- const c = v - w;
60161
- let g = 0;
60162
-
60163
- if (c < 1) {
60164
- g = (v - c) / (1 - c);
60165
- }
60166
-
60167
- return [hwb[0], c * 100, g * 100];
59993
+ var w = hwb[1] / 100;
59994
+ var b = hwb[2] / 100;
59995
+ var v = 1 - b;
59996
+ var c = v - w;
59997
+ var g = 0;
59998
+ if (c < 1) {
59999
+ g = (v - c) / (1 - c);
60000
+ }
60001
+ return [hwb[0], c * 100, g * 100];
60168
60002
  };
60169
-
60170
60003
  convert.apple.rgb = function (apple) {
60171
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
60004
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
60172
60005
  };
60173
-
60174
60006
  convert.rgb.apple = function (rgb) {
60175
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
60007
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
60176
60008
  };
60177
-
60178
60009
  convert.gray.rgb = function (args) {
60179
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
60010
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
60180
60011
  };
60181
-
60182
60012
  convert.gray.hsl = function (args) {
60183
- return [0, 0, args[0]];
60013
+ return [0, 0, args[0]];
60184
60014
  };
60185
-
60186
60015
  convert.gray.hsv = convert.gray.hsl;
60187
-
60188
60016
  convert.gray.hwb = function (gray) {
60189
- return [0, 100, gray[0]];
60017
+ return [0, 100, gray[0]];
60190
60018
  };
60191
-
60192
60019
  convert.gray.cmyk = function (gray) {
60193
- return [0, 0, 0, gray[0]];
60020
+ return [0, 0, 0, gray[0]];
60194
60021
  };
60195
-
60196
60022
  convert.gray.lab = function (gray) {
60197
- return [gray[0], 0, 0];
60023
+ return [gray[0], 0, 0];
60198
60024
  };
60199
-
60200
60025
  convert.gray.hex = function (gray) {
60201
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
60202
- const integer = (val << 16) + (val << 8) + val;
60203
-
60204
- const string = integer.toString(16).toUpperCase();
60205
- return '000000'.substring(string.length) + string;
60026
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
60027
+ var integer = (val << 16) + (val << 8) + val;
60028
+ var string = integer.toString(16).toUpperCase();
60029
+ return '000000'.substring(string.length) + string;
60206
60030
  };
60207
-
60208
60031
  convert.rgb.gray = function (rgb) {
60209
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
60210
- return [val / 255 * 100];
60032
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
60033
+ return [val / 255 * 100];
60211
60034
  };
60212
60035
 
60213
-
60214
60036
  /***/ }),
60215
60037
 
60216
60038
  /***/ "./node_modules/color/node_modules/color-convert/index.js":
@@ -60220,89 +60042,81 @@ convert.rgb.gray = function (rgb) {
60220
60042
  /*! no static exports found */
60221
60043
  /***/ (function(module, exports, __webpack_require__) {
60222
60044
 
60223
- const conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
60224
- const route = __webpack_require__(/*! ./route */ "./node_modules/color/node_modules/color-convert/route.js");
60225
-
60226
- const convert = {};
60227
-
60228
- const models = Object.keys(conversions);
60229
-
60045
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
60046
+ var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
60047
+ var route = __webpack_require__(/*! ./route */ "./node_modules/color/node_modules/color-convert/route.js");
60048
+ var convert = {};
60049
+ var models = Object.keys(conversions);
60230
60050
  function wrapRaw(fn) {
60231
- const wrappedFn = function (...args) {
60232
- const arg0 = args[0];
60233
- if (arg0 === undefined || arg0 === null) {
60234
- return arg0;
60235
- }
60236
-
60237
- if (arg0.length > 1) {
60238
- args = arg0;
60239
- }
60240
-
60241
- return fn(args);
60242
- };
60243
-
60244
- // Preserve .conversion property if there is one
60245
- if ('conversion' in fn) {
60246
- wrappedFn.conversion = fn.conversion;
60247
- }
60051
+ var wrappedFn = function wrappedFn() {
60052
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60053
+ args[_key] = arguments[_key];
60054
+ }
60055
+ var arg0 = args[0];
60056
+ if (arg0 === undefined || arg0 === null) {
60057
+ return arg0;
60058
+ }
60059
+ if (arg0.length > 1) {
60060
+ args = arg0;
60061
+ }
60062
+ return fn(args);
60063
+ };
60248
60064
 
60249
- return wrappedFn;
60065
+ // Preserve .conversion property if there is one
60066
+ if ('conversion' in fn) {
60067
+ wrappedFn.conversion = fn.conversion;
60068
+ }
60069
+ return wrappedFn;
60250
60070
  }
60251
-
60252
60071
  function wrapRounded(fn) {
60253
- const wrappedFn = function (...args) {
60254
- const arg0 = args[0];
60255
-
60256
- if (arg0 === undefined || arg0 === null) {
60257
- return arg0;
60258
- }
60259
-
60260
- if (arg0.length > 1) {
60261
- args = arg0;
60262
- }
60263
-
60264
- const result = fn(args);
60265
-
60266
- // We're assuming the result is an array here.
60267
- // see notice in conversions.js; don't use box types
60268
- // in conversion functions.
60269
- if (typeof result === 'object') {
60270
- for (let len = result.length, i = 0; i < len; i++) {
60271
- result[i] = Math.round(result[i]);
60272
- }
60273
- }
60274
-
60275
- return result;
60276
- };
60072
+ var wrappedFn = function wrappedFn() {
60073
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
60074
+ args[_key2] = arguments[_key2];
60075
+ }
60076
+ var arg0 = args[0];
60077
+ if (arg0 === undefined || arg0 === null) {
60078
+ return arg0;
60079
+ }
60080
+ if (arg0.length > 1) {
60081
+ args = arg0;
60082
+ }
60083
+ var result = fn(args);
60277
60084
 
60278
- // Preserve .conversion property if there is one
60279
- if ('conversion' in fn) {
60280
- wrappedFn.conversion = fn.conversion;
60281
- }
60085
+ // We're assuming the result is an array here.
60086
+ // see notice in conversions.js; don't use box types
60087
+ // in conversion functions.
60088
+ if (_typeof(result) === 'object') {
60089
+ for (var len = result.length, i = 0; i < len; i++) {
60090
+ result[i] = Math.round(result[i]);
60091
+ }
60092
+ }
60093
+ return result;
60094
+ };
60282
60095
 
60283
- return wrappedFn;
60096
+ // Preserve .conversion property if there is one
60097
+ if ('conversion' in fn) {
60098
+ wrappedFn.conversion = fn.conversion;
60099
+ }
60100
+ return wrappedFn;
60284
60101
  }
60285
-
60286
- models.forEach(fromModel => {
60287
- convert[fromModel] = {};
60288
-
60289
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
60290
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
60291
-
60292
- const routes = route(fromModel);
60293
- const routeModels = Object.keys(routes);
60294
-
60295
- routeModels.forEach(toModel => {
60296
- const fn = routes[toModel];
60297
-
60298
- convert[fromModel][toModel] = wrapRounded(fn);
60299
- convert[fromModel][toModel].raw = wrapRaw(fn);
60300
- });
60102
+ models.forEach(function (fromModel) {
60103
+ convert[fromModel] = {};
60104
+ Object.defineProperty(convert[fromModel], 'channels', {
60105
+ value: conversions[fromModel].channels
60106
+ });
60107
+ Object.defineProperty(convert[fromModel], 'labels', {
60108
+ value: conversions[fromModel].labels
60109
+ });
60110
+ var routes = route(fromModel);
60111
+ var routeModels = Object.keys(routes);
60112
+ routeModels.forEach(function (toModel) {
60113
+ var fn = routes[toModel];
60114
+ convert[fromModel][toModel] = wrapRounded(fn);
60115
+ convert[fromModel][toModel].raw = wrapRaw(fn);
60116
+ });
60301
60117
  });
60302
-
60303
60118
  module.exports = convert;
60304
60119
 
60305
-
60306
60120
  /***/ }),
60307
60121
 
60308
60122
  /***/ "./node_modules/color/node_modules/color-convert/route.js":
@@ -60312,7 +60126,7 @@ module.exports = convert;
60312
60126
  /*! no static exports found */
60313
60127
  /***/ (function(module, exports, __webpack_require__) {
60314
60128
 
60315
- const conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
60129
+ var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
60316
60130
 
60317
60131
  /*
60318
60132
  This function routes a model to all other models.
@@ -60326,91 +60140,74 @@ const conversions = __webpack_require__(/*! ./conversions */ "./node_modules/col
60326
60140
  */
60327
60141
 
60328
60142
  function buildGraph() {
60329
- const graph = {};
60330
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
60331
- const models = Object.keys(conversions);
60332
-
60333
- for (let len = models.length, i = 0; i < len; i++) {
60334
- graph[models[i]] = {
60335
- // http://jsperf.com/1-vs-infinity
60336
- // micro-opt, but this is simple.
60337
- distance: -1,
60338
- parent: null
60339
- };
60340
- }
60341
-
60342
- return graph;
60143
+ var graph = {};
60144
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
60145
+ var models = Object.keys(conversions);
60146
+ for (var len = models.length, i = 0; i < len; i++) {
60147
+ graph[models[i]] = {
60148
+ // http://jsperf.com/1-vs-infinity
60149
+ // micro-opt, but this is simple.
60150
+ distance: -1,
60151
+ parent: null
60152
+ };
60153
+ }
60154
+ return graph;
60343
60155
  }
60344
60156
 
60345
60157
  // https://en.wikipedia.org/wiki/Breadth-first_search
60346
60158
  function deriveBFS(fromModel) {
60347
- const graph = buildGraph();
60348
- const queue = [fromModel]; // Unshift -> queue -> pop
60349
-
60350
- graph[fromModel].distance = 0;
60351
-
60352
- while (queue.length) {
60353
- const current = queue.pop();
60354
- const adjacents = Object.keys(conversions[current]);
60355
-
60356
- for (let len = adjacents.length, i = 0; i < len; i++) {
60357
- const adjacent = adjacents[i];
60358
- const node = graph[adjacent];
60359
-
60360
- if (node.distance === -1) {
60361
- node.distance = graph[current].distance + 1;
60362
- node.parent = current;
60363
- queue.unshift(adjacent);
60364
- }
60365
- }
60366
- }
60159
+ var graph = buildGraph();
60160
+ var queue = [fromModel]; // Unshift -> queue -> pop
60367
60161
 
60368
- return graph;
60162
+ graph[fromModel].distance = 0;
60163
+ while (queue.length) {
60164
+ var current = queue.pop();
60165
+ var adjacents = Object.keys(conversions[current]);
60166
+ for (var len = adjacents.length, i = 0; i < len; i++) {
60167
+ var adjacent = adjacents[i];
60168
+ var node = graph[adjacent];
60169
+ if (node.distance === -1) {
60170
+ node.distance = graph[current].distance + 1;
60171
+ node.parent = current;
60172
+ queue.unshift(adjacent);
60173
+ }
60174
+ }
60175
+ }
60176
+ return graph;
60369
60177
  }
60370
-
60371
60178
  function link(from, to) {
60372
- return function (args) {
60373
- return to(from(args));
60374
- };
60179
+ return function (args) {
60180
+ return to(from(args));
60181
+ };
60375
60182
  }
60376
-
60377
60183
  function wrapConversion(toModel, graph) {
60378
- const path = [graph[toModel].parent, toModel];
60379
- let fn = conversions[graph[toModel].parent][toModel];
60380
-
60381
- let cur = graph[toModel].parent;
60382
- while (graph[cur].parent) {
60383
- path.unshift(graph[cur].parent);
60384
- fn = link(conversions[graph[cur].parent][cur], fn);
60385
- cur = graph[cur].parent;
60386
- }
60387
-
60388
- fn.conversion = path;
60389
- return fn;
60184
+ var path = [graph[toModel].parent, toModel];
60185
+ var fn = conversions[graph[toModel].parent][toModel];
60186
+ var cur = graph[toModel].parent;
60187
+ while (graph[cur].parent) {
60188
+ path.unshift(graph[cur].parent);
60189
+ fn = link(conversions[graph[cur].parent][cur], fn);
60190
+ cur = graph[cur].parent;
60191
+ }
60192
+ fn.conversion = path;
60193
+ return fn;
60390
60194
  }
60391
-
60392
60195
  module.exports = function (fromModel) {
60393
- const graph = deriveBFS(fromModel);
60394
- const conversion = {};
60395
-
60396
- const models = Object.keys(graph);
60397
- for (let len = models.length, i = 0; i < len; i++) {
60398
- const toModel = models[i];
60399
- const node = graph[toModel];
60400
-
60401
- if (node.parent === null) {
60402
- // No possible conversion, or this node is the source model.
60403
- continue;
60404
- }
60405
-
60406
- conversion[toModel] = wrapConversion(toModel, graph);
60407
- }
60408
-
60409
- return conversion;
60196
+ var graph = deriveBFS(fromModel);
60197
+ var conversion = {};
60198
+ var models = Object.keys(graph);
60199
+ for (var len = models.length, i = 0; i < len; i++) {
60200
+ var toModel = models[i];
60201
+ var node = graph[toModel];
60202
+ if (node.parent === null) {
60203
+ // No possible conversion, or this node is the source model.
60204
+ continue;
60205
+ }
60206
+ conversion[toModel] = wrapConversion(toModel, graph);
60207
+ }
60208
+ return conversion;
60410
60209
  };
60411
60210
 
60412
-
60413
-
60414
60211
  /***/ }),
60415
60212
 
60416
60213
  /***/ "./node_modules/core-js-pure/actual/array/from.js":