@tendaui/react 1.1.1 → 1.1.2
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.
- package/es/_chunks/{dep-D7LanWes.js → dep-4LYjB3c6.js} +3 -18
- package/es/_chunks/dep-4LYjB3c6.js.map +1 -0
- package/es/_chunks/dep-5U9UjDaf.js +345 -0
- package/es/_chunks/dep-5U9UjDaf.js.map +1 -0
- package/es/_chunks/{dep-B7HmDtze.js → dep-B4_O1Vgv.js} +2 -2
- package/es/_chunks/{dep-B7HmDtze.js.map → dep-B4_O1Vgv.js.map} +1 -1
- package/es/_chunks/dep-BP0-apUT.js.map +1 -1
- package/es/_chunks/dep-BRbJGDI9.js +7 -0
- package/es/_chunks/dep-BRbJGDI9.js.map +1 -0
- package/es/_chunks/{dep-EcrDKDlu.js → dep-BYlJzn45.js} +10 -9
- package/es/_chunks/dep-BYlJzn45.js.map +1 -0
- package/es/_chunks/dep-BbeHB7S3.js +116 -0
- package/es/_chunks/dep-BbeHB7S3.js.map +1 -0
- package/es/_chunks/{dep-DB5wmwh1.js → dep-Bjfn7Zv_.js} +2 -2
- package/es/_chunks/{dep-DB5wmwh1.js.map → dep-Bjfn7Zv_.js.map} +1 -1
- package/es/_chunks/{dep-C36au4Ip.js → dep-BuIAffJt.js} +2 -2
- package/es/_chunks/{dep-C36au4Ip.js.map → dep-BuIAffJt.js.map} +1 -1
- package/es/_chunks/{dep-bWaVq_y3.js → dep-ByzdZjUR.js} +2 -2
- package/es/_chunks/dep-ByzdZjUR.js.map +1 -0
- package/es/_chunks/dep-CD_4-1Xb.js +103 -0
- package/es/_chunks/dep-CD_4-1Xb.js.map +1 -0
- package/es/_chunks/{dep-Dk2xX8lh.js → dep-CJCt0IS0.js} +5 -212
- package/es/_chunks/dep-CJCt0IS0.js.map +1 -0
- package/es/_chunks/dep-CMPsNAXF.js +52 -0
- package/es/_chunks/dep-CMPsNAXF.js.map +1 -0
- package/es/_chunks/dep-COy5g3FT.js +512 -0
- package/es/_chunks/dep-COy5g3FT.js.map +1 -0
- package/es/_chunks/{dep-CoIiHOgo.js → dep-CRURwzDj.js} +3 -3
- package/es/_chunks/{dep-CoIiHOgo.js.map → dep-CRURwzDj.js.map} +1 -1
- package/es/_chunks/dep-C_wPqvpm.js +36 -0
- package/es/_chunks/dep-C_wPqvpm.js.map +1 -0
- package/es/_chunks/dep-Ccktr_jk.js +33 -0
- package/es/_chunks/dep-Ccktr_jk.js.map +1 -0
- package/es/_chunks/dep-Chz4ZJCb.js +20 -0
- package/es/_chunks/dep-Chz4ZJCb.js.map +1 -0
- package/es/_chunks/dep-CkmtEv0Y.js +55 -0
- package/es/_chunks/dep-CkmtEv0Y.js.map +1 -0
- package/es/_chunks/dep-DJmE940f.js +764 -0
- package/es/_chunks/dep-DJmE940f.js.map +1 -0
- package/es/_chunks/{dep-DHWwZ2Nj.js → dep-DQ6kXoi8.js} +2 -2
- package/es/_chunks/{dep-DHWwZ2Nj.js.map → dep-DQ6kXoi8.js.map} +1 -1
- package/es/_chunks/{dep-0QH2Ee4R.js → dep-DRwijJcv.js} +5 -5
- package/es/_chunks/dep-DRwijJcv.js.map +1 -0
- package/es/_chunks/dep-DTlQ2dCA.js +46 -0
- package/es/_chunks/dep-DTlQ2dCA.js.map +1 -0
- package/es/_chunks/dep-DURB9x8g.js +170 -0
- package/es/_chunks/dep-DURB9x8g.js.map +1 -0
- package/es/_chunks/{dep-DZ_0EvBk.js → dep-DX65P8M9.js} +4 -45
- package/es/_chunks/dep-DX65P8M9.js.map +1 -0
- package/es/_chunks/{dep-BH5n5r1M.js → dep-DbVHGoUC.js} +2 -2
- package/es/_chunks/dep-DbVHGoUC.js.map +1 -0
- package/es/_chunks/dep-Dlppf0JU.js +214 -0
- package/es/_chunks/dep-Dlppf0JU.js.map +1 -0
- package/es/_chunks/dep-Dr5wkz0z.js +266 -0
- package/es/_chunks/dep-Dr5wkz0z.js.map +1 -0
- package/es/_chunks/dep-DwWrhxkd.js.map +1 -1
- package/es/_chunks/dep-Tshfumgl.js +31 -0
- package/es/_chunks/dep-Tshfumgl.js.map +1 -0
- package/es/_chunks/{dep-u1x3x6MJ.js → dep-gy8uvBaS.js} +2 -2
- package/es/_chunks/{dep-u1x3x6MJ.js.map → dep-gy8uvBaS.js.map} +1 -1
- package/es/_chunks/dep-oUgTcXgm.js +11 -0
- package/es/_chunks/dep-oUgTcXgm.js.map +1 -0
- package/es/_chunks/dep-zOZQ0R9g.js +1181 -0
- package/es/_chunks/dep-zOZQ0R9g.js.map +1 -0
- package/es/alert/Alert.d.ts +7 -0
- package/es/alert/Alert.js +4 -3
- package/es/alert/Alert.js.map +1 -1
- package/es/alert/defaultProps.d.ts +2 -0
- package/es/alert/index.d.ts +5 -0
- package/es/alert/index.js +4 -3
- package/es/alert/index.js.map +1 -1
- package/es/alert/style/css.d.ts +1 -0
- package/es/alert/style/index.d.ts +1 -0
- package/es/alert/type.d.ts +45 -0
- package/es/badge/Badge.d.ts +7 -0
- package/es/badge/Badge.js +3 -2
- package/es/badge/Badge.js.map +1 -1
- package/es/badge/defaultProps.d.ts +2 -0
- package/es/badge/index.d.ts +5 -0
- package/es/badge/index.js +3 -2
- package/es/badge/index.js.map +1 -1
- package/es/badge/style/css.d.ts +1 -0
- package/es/badge/style/index.d.ts +1 -0
- package/es/badge/type.d.ts +50 -0
- package/es/button/Button.d.ts +6 -0
- package/es/button/Button.js +7 -5
- package/es/button/Button.js.map +1 -1
- package/es/button/_example/base.js +171 -0
- package/es/button/_example/base.js.map +1 -0
- package/es/button/_example/icon.js +181 -0
- package/es/button/_example/icon.js.map +1 -0
- package/es/button/defaultProps.d.ts +2 -0
- package/es/button/index.d.ts +5 -0
- package/es/button/index.js +7 -5
- package/es/button/index.js.map +1 -1
- package/es/button/style/css.d.ts +1 -0
- package/es/button/style/index.d.ts +1 -0
- package/es/button/type.d.ts +81 -0
- package/es/checkbox/Checkbox.d.ts +10 -0
- package/es/checkbox/Checkbox.js +5 -4
- package/es/checkbox/Checkbox.js.map +1 -1
- package/es/checkbox/CheckboxGroup.d.ts +14 -0
- package/es/checkbox/CheckboxGroup.js +5 -4
- package/es/checkbox/CheckboxGroup.js.map +1 -1
- package/es/checkbox/defaultProps.d.ts +3 -0
- package/es/checkbox/index.d.ts +11 -0
- package/es/checkbox/index.js +5 -4
- package/es/checkbox/index.js.map +1 -1
- package/es/checkbox/style/css.d.ts +1 -0
- package/es/checkbox/style/index.d.ts +1 -0
- package/es/checkbox/type.d.ts +115 -0
- package/es/color-picker/ColorPickPanel.d.ts +4 -0
- package/es/color-picker/ColorPickPanel.js +44 -0
- package/es/color-picker/ColorPickPanel.js.map +1 -0
- package/es/color-picker/ColorPicker.d.ts +4 -0
- package/es/color-picker/ColorPicker.js +118 -0
- package/es/color-picker/ColorPicker.js.map +1 -0
- package/es/color-picker/components/panel/alpha.d.ts +4 -0
- package/es/color-picker/components/panel/alpha.js +44 -0
- package/es/color-picker/components/panel/alpha.js.map +1 -0
- package/es/color-picker/components/panel/format/index.d.ts +10 -0
- package/es/color-picker/components/panel/format/index.js +128 -0
- package/es/color-picker/components/panel/format/index.js.map +1 -0
- package/es/color-picker/components/panel/format/inputs.d.ts +4 -0
- package/es/color-picker/components/panel/format/inputs.js +147 -0
- package/es/color-picker/components/panel/format/inputs.js.map +1 -0
- package/es/color-picker/components/panel/header.d.ts +13 -0
- package/es/color-picker/components/panel/header.js +60 -0
- package/es/color-picker/components/panel/header.js.map +1 -0
- package/es/color-picker/components/panel/hue.d.ts +4 -0
- package/es/color-picker/components/panel/hue.js +33 -0
- package/es/color-picker/components/panel/hue.js.map +1 -0
- package/es/color-picker/components/panel/index.d.ts +4 -0
- package/es/color-picker/components/panel/index.js +32 -0
- package/es/color-picker/components/panel/index.js.map +1 -0
- package/es/color-picker/components/panel/saturation.d.ts +4 -0
- package/es/color-picker/components/panel/saturation.js +101 -0
- package/es/color-picker/components/panel/saturation.js.map +1 -0
- package/es/color-picker/components/panel/slider.d.ts +11 -0
- package/es/color-picker/components/panel/slider.js +121 -0
- package/es/color-picker/components/panel/slider.js.map +1 -0
- package/es/color-picker/components/panel/swatches.d.ts +11 -0
- package/es/color-picker/components/panel/swatches.js +100 -0
- package/es/color-picker/components/panel/swatches.js.map +1 -0
- package/es/color-picker/components/trigger.d.ts +9 -0
- package/es/color-picker/components/trigger.js +73 -0
- package/es/color-picker/components/trigger.js.map +1 -0
- package/es/color-picker/defaultProps.d.ts +2 -0
- package/es/color-picker/helpers.d.ts +5 -0
- package/es/color-picker/hooks/useClassNames.d.ts +2 -0
- package/es/color-picker/hooks/useStyles.d.ts +14 -0
- package/es/color-picker/index.d.ts +6 -0
- package/es/color-picker/index.js +62 -0
- package/es/color-picker/index.js.map +1 -0
- package/es/color-picker/style/index.css +597 -0
- package/es/color-picker/style/index.d.ts +1 -0
- package/es/color-picker/style/index.js +2 -0
- package/es/color-picker/style/index.js.map +1 -0
- package/es/color-picker/type.d.ts +135 -0
- package/es/color-picker/utils/color-picker/cmyk.d.ts +27 -0
- package/es/color-picker/utils/color-picker/color.d.ts +144 -0
- package/es/color-picker/utils/color-picker/constants.d.ts +30 -0
- package/es/color-picker/utils/color-picker/draggable.d.ts +23 -0
- package/es/color-picker/utils/color-picker/format.d.ts +64 -0
- package/es/color-picker/utils/color-picker/gradient.d.ts +22 -0
- package/es/color-picker/utils/color-picker/index.d.ts +7 -0
- package/es/color-picker/utils/color-picker/index.js +147 -0
- package/es/color-picker/utils/color-picker/index.js.map +1 -0
- package/es/color-picker/utils/color-picker/types.d.ts +28 -0
- package/es/common/Check.d.ts +22 -0
- package/es/common/Check.js +4 -3
- package/es/common/Check.js.map +1 -1
- package/es/common/FakeArrow.d.ts +9 -0
- package/es/common/FakeArrow.js +3 -2
- package/es/common/FakeArrow.js.map +1 -1
- package/es/common/PluginContainer.d.ts +9 -0
- package/es/common/PluginContainer.js +2 -1
- package/es/common/PluginContainer.js.map +1 -1
- package/es/common/Portal.d.ts +16 -0
- package/es/common/Portal.js +6 -3
- package/es/common/Portal.js.map +1 -1
- package/es/common/observe.d.ts +1 -0
- package/es/common.d.ts +81 -0
- package/es/config-provider/ConfigContext.d.ts +13 -0
- package/es/config-provider/ConfigContext.js +5 -16
- package/es/config-provider/ConfigContext.js.map +1 -1
- package/es/config-provider/ConfigProvider.d.ts +25 -0
- package/es/config-provider/ConfigProvider.js +2 -1
- package/es/config-provider/ConfigProvider.js.map +1 -1
- package/es/config-provider/index.d.ts +7 -0
- package/es/config-provider/index.js +2 -1
- package/es/config-provider/index.js.map +1 -1
- package/es/config-provider/type.d.ts +1029 -0
- package/es/dialog/Dialog.d.ts +8 -0
- package/es/dialog/Dialog.js +12 -149
- package/es/dialog/Dialog.js.map +1 -1
- package/es/dialog/DialogCard.d.ts +8 -0
- package/es/dialog/DialogCard.js +9 -7
- package/es/dialog/DialogCard.js.map +1 -1
- package/es/dialog/defaultProps.d.ts +6 -0
- package/es/dialog/hooks/useDialogDrag.d.ts +7 -0
- package/es/dialog/hooks/useDialogEsc.d.ts +3 -0
- package/es/dialog/hooks/useDialogPosition.d.ts +2 -0
- package/es/dialog/hooks/useLockStyle.d.ts +2 -0
- package/es/dialog/index.d.ts +8 -0
- package/es/dialog/index.js +12 -8
- package/es/dialog/index.js.map +1 -1
- package/es/dialog/plugin.d.ts +6 -0
- package/es/dialog/plugin.js +15 -10
- package/es/dialog/plugin.js.map +1 -1
- package/es/dialog/style/css.d.ts +1 -0
- package/es/dialog/style/index.d.ts +1 -0
- package/es/dialog/type.d.ts +227 -0
- package/es/dialog/utils.d.ts +1 -0
- package/es/drawer/Drawer.d.ts +11 -0
- package/es/drawer/Drawer.js +458 -0
- package/es/drawer/Drawer.js.map +1 -0
- package/es/drawer/defaultProps.d.ts +2 -0
- package/es/drawer/hooks/useDrag.d.ts +8 -0
- package/es/drawer/hooks/useLockStyle.d.ts +1 -0
- package/es/drawer/index.d.ts +4 -0
- package/es/drawer/index.js +39 -0
- package/es/drawer/index.js.map +1 -0
- package/es/drawer/style/css.d.ts +1 -0
- package/es/drawer/style/css.js +1 -0
- package/es/drawer/style/index.css +231 -0
- package/es/drawer/style/index.d.ts +1 -0
- package/es/drawer/style/index.js +2 -0
- package/es/drawer/style/index.js.map +1 -0
- package/es/drawer/type.d.ts +199 -0
- package/es/drawer/utils/index.d.ts +23 -0
- package/es/drawer/utils/index.js +46 -0
- package/es/drawer/utils/index.js.map +1 -0
- package/es/fireworks/Fireworks.d.ts +7 -0
- package/es/fireworks/Fireworks.js +139 -0
- package/es/fireworks/Fireworks.js.map +1 -0
- package/es/fireworks/index.d.ts +5 -0
- package/es/fireworks/index.js +16 -0
- package/es/fireworks/index.js.map +1 -0
- package/es/fireworks/style/css.d.ts +1 -0
- package/es/fireworks/style/css.js +2 -0
- package/es/fireworks/style/index.css +121 -0
- package/es/fireworks/style/index.d.ts +1 -0
- package/es/fireworks/style/index.js +2 -0
- package/es/fireworks/style/index.js.map +1 -0
- package/es/fireworks/type.d.ts +69 -0
- package/es/form/Form.d.ts +8 -0
- package/es/form/Form.js +14 -10
- package/es/form/Form.js.map +1 -1
- package/es/form/FormContext.d.ts +59 -0
- package/es/form/FormItem.d.ts +23 -0
- package/es/form/FormItem.js +14 -10
- package/es/form/FormItem.js.map +1 -1
- package/es/form/FormList.d.ts +4 -0
- package/es/form/FormList.js +2 -1
- package/es/form/FormList.js.map +1 -1
- package/es/form/const.d.ts +6 -0
- package/es/form/defaultProps.d.ts +3 -0
- package/es/form/easing.d.ts +2 -0
- package/es/form/formModel.d.ts +37 -0
- package/es/form/hooks/interface.d.ts +16 -0
- package/es/form/hooks/useForm.d.ts +3 -0
- package/es/form/hooks/useFormItemInitialData.d.ts +9 -0
- package/es/form/hooks/useFormItemStyle.d.ts +10 -0
- package/es/form/hooks/useFormItemStyle.js +4 -3
- package/es/form/hooks/useFormItemStyle.js.map +1 -1
- package/es/form/hooks/useInstance.d.ts +16 -0
- package/es/form/hooks/useInstance.js +5 -4
- package/es/form/hooks/useInstance.js.map +1 -1
- package/es/form/hooks/useWatch.d.ts +3 -0
- package/es/form/index.d.ts +7 -0
- package/es/form/index.js +14 -10
- package/es/form/index.js.map +1 -1
- package/es/form/scroll.d.ts +39 -0
- package/es/form/style/css.d.ts +1 -0
- package/es/form/style/index.d.ts +1 -0
- package/es/form/type.d.ts +486 -0
- package/es/form/utils/index.d.ts +5 -0
- package/es/global-config/default-config.d.ts +84 -0
- package/es/global-config/locale/ar_KW.d.ts +239 -0
- package/es/global-config/locale/en_US.d.ts +263 -0
- package/es/global-config/locale/it_IT.d.ts +263 -0
- package/es/global-config/locale/ja_JP.d.ts +263 -0
- package/es/global-config/locale/ko_KR.d.ts +263 -0
- package/es/global-config/locale/ru_RU.d.ts +263 -0
- package/es/global-config/locale/zh_CN.d.ts +263 -0
- package/es/global-config/locale/zh_TW.d.ts +263 -0
- package/es/global-config/mobile/default-config.d.ts +7 -0
- package/es/global-config/mobile/locale/ar_KW.d.ts +98 -0
- package/es/global-config/mobile/locale/en_US.d.ts +99 -0
- package/es/global-config/mobile/locale/it_IT.d.ts +99 -0
- package/es/global-config/mobile/locale/ja_JP.d.ts +99 -0
- package/es/global-config/mobile/locale/ko_KR.d.ts +99 -0
- package/es/global-config/mobile/locale/ru_RU.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_CN.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_TW.d.ts +99 -0
- package/es/global-config/t.d.ts +25 -0
- package/es/hooks/useAttach.d.ts +10 -0
- package/es/hooks/useCommonClassName.d.ts +54 -0
- package/es/hooks/useConfig.d.ts +2 -0
- package/es/hooks/useControlled.d.ts +9 -0
- package/es/hooks/useDeepEffect.d.ts +7 -0
- package/es/hooks/useDefaultProps.d.ts +1 -0
- package/es/hooks/useDomCallback.d.ts +1 -0
- package/es/hooks/useDomRefCallback.d.ts +1 -0
- package/es/hooks/useDragSorter.d.ts +28 -0
- package/es/hooks/useEventCallback.d.ts +9 -0
- package/es/hooks/useGlobalConfig.d.ts +1 -0
- package/es/hooks/useGlobalIcon.d.ts +5 -0
- package/es/hooks/useLastest.d.ts +2 -0
- package/es/hooks/useLayoutEffect.d.ts +3 -0
- package/es/hooks/useMouseEvent.d.ts +25 -0
- package/es/hooks/useMutationObserver.d.ts +4 -0
- package/es/hooks/usePopper.d.ts +19 -0
- package/es/hooks/useResizeObserve.d.ts +1 -0
- package/es/hooks/useRipple.d.ts +0 -0
- package/es/hooks/useSetState.d.ts +7 -0
- package/es/hooks/useVirtualScroll.d.ts +30 -0
- package/es/hooks/useWindowSize.d.ts +6 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +68 -14
- package/es/index.js.map +1 -1
- package/es/input/Input.d.ts +16 -0
- package/es/input/Input.js +5 -5
- package/es/input/Input.js.map +1 -1
- package/es/input/InputGroup.d.ts +10 -0
- package/es/input/defaultProps.d.ts +17 -0
- package/es/input/index.d.ts +6 -0
- package/es/input/index.js +5 -3
- package/es/input/index.js.map +1 -1
- package/es/input/style/css.d.ts +1 -0
- package/es/input/style/index.d.ts +1 -0
- package/es/input/type.d.ts +237 -0
- package/es/input-number/InputNumber.d.ts +17 -0
- package/es/input-number/InputNumber.js +139 -0
- package/es/input-number/InputNumber.js.map +1 -0
- package/es/input-number/defaultProps.d.ts +2 -0
- package/es/input-number/index.d.ts +5 -0
- package/es/input-number/index.js +43 -0
- package/es/input-number/index.js.map +1 -0
- package/es/input-number/style/css.d.ts +1 -0
- package/es/input-number/style/css.js +1 -0
- package/es/input-number/style/index.css +331 -0
- package/es/input-number/style/index.d.ts +1 -0
- package/es/input-number/style/index.js +2 -0
- package/es/input-number/style/index.js.map +1 -0
- package/es/input-number/type.d.ts +156 -0
- package/es/input-number/useInputNumber.d.ts +51 -0
- package/es/input-number/useInputNumber.js +809 -0
- package/es/input-number/useInputNumber.js.map +1 -0
- package/es/ip-input/IPInput.d.ts +5 -0
- package/es/ip-input/IPInput.js +16 -0
- package/es/ip-input/IPInput.js.map +1 -0
- package/es/ip-input/defaultProps.d.ts +2 -0
- package/es/ip-input/index.d.ts +3 -0
- package/es/ip-input/index.js +16 -0
- package/es/ip-input/index.js.map +1 -0
- package/es/ip-input/style/index.css +323 -0
- package/es/ip-input/style/index.d.ts +1 -0
- package/es/ip-input/style/index.js +2 -0
- package/es/ip-input/style/index.js.map +1 -0
- package/es/ip-input/type.d.ts +113 -0
- package/es/ip-input/utils.d.ts +35 -0
- package/es/layout/Aside.d.ts +11 -0
- package/es/layout/Aside.js +41 -0
- package/es/layout/Aside.js.map +1 -0
- package/es/layout/Layout.d.ts +26 -0
- package/es/layout/Layout.js +106 -0
- package/es/layout/Layout.js.map +1 -0
- package/es/layout/defaultProps.d.ts +5 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +19 -0
- package/es/layout/index.js.map +1 -0
- package/es/layout/style/index.css +56 -0
- package/es/layout/style/index.d.ts +1 -0
- package/es/layout/style/index.js +2 -0
- package/es/layout/style/index.js.map +1 -0
- package/es/layout/type.d.ts +38 -0
- package/es/list/List.d.ts +17 -0
- package/es/list/List.js +217 -0
- package/es/list/List.js.map +1 -0
- package/es/list/ListItem.d.ts +15 -0
- package/es/list/ListItem.js +31 -0
- package/es/list/ListItem.js.map +1 -0
- package/es/list/ListItemMeta.d.ts +10 -0
- package/es/list/ListItemMeta.js +45 -0
- package/es/list/ListItemMeta.js.map +1 -0
- package/es/list/defaultProps.d.ts +7 -0
- package/es/list/hooks/useListVirtualScroll.d.ts +24 -0
- package/es/list/index.d.ts +10 -0
- package/es/list/index.js +40 -0
- package/es/list/index.js.map +1 -0
- package/es/list/style/css.d.ts +1 -0
- package/es/list/style/css.js +1 -0
- package/es/list/style/index.css +172 -0
- package/es/list/style/index.d.ts +1 -0
- package/es/list/style/index.js +2 -0
- package/es/list/style/index.js.map +1 -0
- package/es/list/type.d.ts +92 -0
- package/es/loading/Gradient.d.ts +6 -0
- package/es/loading/Gradient.js +4 -3
- package/es/loading/Gradient.js.map +1 -1
- package/es/loading/Loading.d.ts +7 -0
- package/es/loading/Loading.js +7 -5
- package/es/loading/Loading.js.map +1 -1
- package/es/loading/circleAdapter.d.ts +1 -0
- package/es/loading/defaultProps.d.ts +2 -0
- package/es/loading/index.d.ts +5 -0
- package/es/loading/index.js +7 -5
- package/es/loading/index.js.map +1 -1
- package/es/loading/style/css.d.ts +1 -0
- package/es/loading/style/index.d.ts +1 -0
- package/es/loading/type.d.ts +68 -0
- package/es/loading/utils/setStyle.d.ts +7 -0
- package/es/locale/LocalReceiver.d.ts +6 -0
- package/es/locale/ar_KW.d.ts +3 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/it_IT.d.ts +3 -0
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ko_KR.d.ts +3 -0
- package/es/locale/ru_RU.d.ts +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_TW.d.ts +3 -0
- package/es/myform/index.d.ts +0 -0
- package/es/notification/Notify.d.ts +11 -0
- package/es/notification/NotifyContainer.d.ts +13 -0
- package/es/notification/NotifyContainer.js +3 -2
- package/es/notification/NotifyContainer.js.map +1 -1
- package/es/notification/NotifyContext.d.ts +23 -0
- package/es/notification/NotifyContext.js +3 -2
- package/es/notification/NotifyContext.js.map +1 -1
- package/es/notification/NotifyItem.d.ts +4 -0
- package/es/notification/NotifyItem.js +3 -2
- package/es/notification/NotifyItem.js.map +1 -1
- package/es/notification/index.d.ts +3 -0
- package/es/notification/index.js +3 -2
- package/es/notification/index.js.map +1 -1
- package/es/notification/style/css.d.ts +1 -0
- package/es/notification/style/index.d.ts +1 -0
- package/es/notification/type.d.ts +22 -0
- package/es/popup/Popup.d.ts +21 -0
- package/es/popup/Popup.js +36 -100
- package/es/popup/Popup.js.map +1 -1
- package/es/popup/defaultProps.d.ts +5 -0
- package/es/popup/hooks/useTrigger.d.ts +20 -0
- package/es/popup/index.d.ts +5 -0
- package/es/popup/index.js +8 -4
- package/es/popup/index.js.map +1 -1
- package/es/popup/style/css.d.ts +1 -0
- package/es/popup/style/index.d.ts +1 -0
- package/es/popup/type.d.ts +109 -0
- package/es/portal/Portal.d.ts +16 -0
- package/es/portal/Portal.js +2 -1
- package/es/portal/Portal.js.map +1 -1
- package/es/portal/index.d.ts +1 -0
- package/es/portal/index.js +2 -1
- package/es/portal/index.js.map +1 -1
- package/es/radio/Radio.d.ts +8 -0
- package/es/radio/Radio.js +22 -0
- package/es/radio/Radio.js.map +1 -0
- package/es/radio/RadioGroup.d.ts +14 -0
- package/es/radio/RadioGroup.js +22 -0
- package/es/radio/RadioGroup.js.map +1 -0
- package/es/radio/defaultProps.d.ts +3 -0
- package/es/radio/index.d.ts +10 -0
- package/es/radio/index.js +28 -0
- package/es/radio/index.js.map +1 -0
- package/es/radio/style/css.d.ts +0 -0
- package/es/radio/style/css.js +0 -0
- package/es/radio/style/index.css +333 -0
- package/es/radio/style/index.d.ts +1 -0
- package/es/radio/style/index.js +2 -0
- package/es/radio/style/index.js.map +1 -0
- package/es/radio/type.d.ts +117 -0
- package/es/radio/useKeyboard.d.ts +4 -0
- package/es/select/Option.d.ts +24 -0
- package/es/select/Option.js +3 -2
- package/es/select/Option.js.map +1 -1
- package/es/select/OptionGroup.d.ts +7 -0
- package/es/select/OptionGroup.js +4 -3
- package/es/select/OptionGroup.js.map +1 -1
- package/es/select/PopupContent.d.ts +24 -0
- package/es/select/PopupContent.js +6 -4
- package/es/select/PopupContent.js.map +1 -1
- package/es/select/Select.d.ts +13 -0
- package/es/select/Select.js +21 -12
- package/es/select/Select.js.map +1 -1
- package/es/select/defaultProps.d.ts +4 -0
- package/es/select/hooks/useOptions.d.ts +16 -0
- package/es/select/hooks/usePanelVirtualScroll.d.ts +24 -0
- package/es/select/index.d.ts +8 -0
- package/es/select/index.js +14 -8
- package/es/select/index.js.map +1 -1
- package/es/select/style/css.d.ts +1 -0
- package/es/select/style/index.d.ts +1 -0
- package/es/select/type.d.ts +344 -0
- package/es/select/utils/helper.d.ts +18 -0
- package/es/select-input/SelectInput.d.ts +11 -0
- package/es/select-input/SelectInput.js +10 -5
- package/es/select-input/SelectInput.js.map +1 -1
- package/es/select-input/defaultProps.d.ts +2 -0
- package/es/select-input/hook/useMultiple.d.ts +23 -0
- package/es/select-input/hook/useMultiple.js +7 -4
- package/es/select-input/hook/useMultiple.js.map +1 -1
- package/es/select-input/hook/useOverlayInnerStyle.d.ts +11 -0
- package/es/select-input/hook/useSingle.d.ts +16 -0
- package/es/select-input/hook/useSingle.js +5 -3
- package/es/select-input/hook/useSingle.js.map +1 -1
- package/es/select-input/index.d.ts +5 -0
- package/es/select-input/index.js +10 -5
- package/es/select-input/index.js.map +1 -1
- package/es/select-input/interface.d.ts +17 -0
- package/es/select-input/style/css.d.ts +1 -0
- package/es/select-input/style/index.d.ts +1 -0
- package/es/select-input/type.d.ts +243 -0
- package/es/slider/Slider.d.ts +7 -0
- package/es/slider/Slider.js +668 -0
- package/es/slider/Slider.js.map +1 -0
- package/es/slider/SliderHandleButton.d.ts +11 -0
- package/es/slider/SliderHandleButton.js +48 -0
- package/es/slider/SliderHandleButton.js.map +1 -0
- package/es/slider/defaultProps.d.ts +5 -0
- package/es/slider/index.d.ts +5 -0
- package/es/slider/index.js +46 -0
- package/es/slider/index.js.map +1 -0
- package/es/slider/style/css.d.ts +1 -0
- package/es/slider/style/css.js +1 -0
- package/es/slider/style/index.css +252 -0
- package/es/slider/style/index.d.ts +1 -0
- package/es/slider/style/index.js +2 -0
- package/es/slider/style/index.js.map +1 -0
- package/es/slider/type.d.ts +78 -0
- package/es/space/defaultProps.d.ts +0 -0
- package/es/space/index.d.ts +0 -0
- package/es/space/type.d.ts +0 -0
- package/es/style/index.css +24 -34
- package/es/style/index.d.ts +1 -0
- package/es/switch/Switch.d.ts +9 -0
- package/es/switch/Switch.js +9 -47
- package/es/switch/Switch.js.map +1 -1
- package/es/switch/defaultProps.d.ts +2 -0
- package/es/switch/index.d.ts +4 -0
- package/es/switch/index.js +8 -5
- package/es/switch/index.js.map +1 -1
- package/es/switch/style/css.d.ts +1 -0
- package/es/switch/style/index.d.ts +1 -0
- package/es/switch/type.d.ts +48 -0
- package/es/tab/TabBar.d.ts +9 -0
- package/es/tab/TabBar.js +109 -0
- package/es/tab/TabBar.js.map +1 -0
- package/es/tab/TabNav.d.ts +10 -0
- package/es/tab/TabNav.js +123 -0
- package/es/tab/TabNav.js.map +1 -0
- package/es/tab/TabNavItem.d.ts +15 -0
- package/es/tab/TabNavItem.js +65 -0
- package/es/tab/TabNavItem.js.map +1 -0
- package/es/tab/TabPanel.d.ts +9 -0
- package/es/tab/TabPanel.js +11 -0
- package/es/tab/TabPanel.js.map +1 -0
- package/es/tab/Tabs.d.ts +10 -0
- package/es/tab/Tabs.js +95 -0
- package/es/tab/Tabs.js.map +1 -0
- package/es/tab/defaultProps.d.ts +3 -0
- package/es/tab/index.d.ts +8 -0
- package/es/tab/index.js +31 -0
- package/es/tab/index.js.map +1 -0
- package/es/tab/style/index.css +159 -0
- package/es/tab/style/index.d.ts +1 -0
- package/es/tab/style/index.js +2 -0
- package/es/tab/style/index.js.map +1 -0
- package/es/tab/type.d.ts +130 -0
- package/es/tab/useTabClass.d.ts +8 -0
- package/es/table/Cell.d.ts +18 -0
- package/es/table/Cell.js +73 -0
- package/es/table/Cell.js.map +1 -0
- package/es/table/TBody.d.ts +28 -0
- package/es/table/TBody.js +70 -0
- package/es/table/TBody.js.map +1 -0
- package/es/table/THead.d.ts +10 -0
- package/es/table/THead.js +56 -0
- package/es/table/THead.js.map +1 -0
- package/es/table/TR.d.ts +28 -0
- package/es/table/TR.js +76 -0
- package/es/table/TR.js.map +1 -0
- package/es/table/Table.d.ts +6 -0
- package/es/table/Table.js +98 -0
- package/es/table/Table.js.map +1 -0
- package/es/table/defaultProps.d.ts +2 -0
- package/es/table/hooks/index.d.ts +4 -0
- package/es/table/hooks/index.js +98 -0
- package/es/table/hooks/index.js.map +1 -0
- package/es/table/hooks/useTableClassName.d.ts +26 -0
- package/es/table/hooks/useTableStyle.d.ts +11 -0
- package/es/table/index.d.ts +5 -0
- package/es/table/index.js +22 -0
- package/es/table/index.js.map +1 -0
- package/es/table/style/css.d.ts +1 -0
- package/es/table/style/css.js +1 -0
- package/es/table/style/index.css +139 -0
- package/es/table/style/index.d.ts +1 -0
- package/es/table/style/index.js +2 -0
- package/es/table/style/index.js.map +1 -0
- package/es/table/type.d.ts +195 -0
- package/es/tag/Tag.d.ts +14 -0
- package/es/tag/Tag.js +5 -1182
- package/es/tag/Tag.js.map +1 -1
- package/es/tag/defaultProps.d.ts +7 -0
- package/es/tag/index.d.ts +4 -0
- package/es/tag/index.js +5 -3
- package/es/tag/index.js.map +1 -1
- package/es/tag/style/css.d.ts +1 -0
- package/es/tag/style/index.d.ts +1 -0
- package/es/tag/type.d.ts +169 -0
- package/es/tag-input/TagInput.d.ts +9 -0
- package/es/tag-input/TagInput.js +7 -4
- package/es/tag-input/TagInput.js.map +1 -1
- package/es/tag-input/defaultProps.d.ts +2 -0
- package/es/tag-input/hooks/useHover.d.ts +17 -0
- package/es/tag-input/hooks/useTagList.d.ts +30 -0
- package/es/tag-input/hooks/useTagList.js +5 -3
- package/es/tag-input/hooks/useTagList.js.map +1 -1
- package/es/tag-input/hooks/useTagScroll.d.ts +25 -0
- package/es/tag-input/index.d.ts +5 -0
- package/es/tag-input/index.js +7 -4
- package/es/tag-input/index.js.map +1 -1
- package/es/tag-input/style/css.d.ts +1 -0
- package/es/tag-input/style/index.d.ts +1 -0
- package/es/tag-input/type.d.ts +235 -0
- package/es/tag-input/useTagList.d.ts +30 -0
- package/es/tag-input/useTagList.js +5 -3
- package/es/tag-input/useTagList.js.map +1 -1
- package/es/utils/composeRefs.d.ts +2 -0
- package/es/utils/dom.d.ts +7 -0
- package/es/utils/forwardRefWithStatics.d.ts +2 -0
- package/es/utils/getScrollbarWidth.d.ts +6 -0
- package/es/utils/helper.d.ts +46 -0
- package/es/utils/input-number/large-number.d.ts +85 -0
- package/es/utils/input-number/number.d.ts +81 -0
- package/es/utils/isFragment.d.ts +4 -0
- package/es/utils/listener.d.ts +4 -0
- package/es/utils/log/index.d.ts +2 -0
- package/es/utils/log/index.js +27 -0
- package/es/utils/log/index.js.map +1 -0
- package/es/utils/log/log.d.ts +3 -0
- package/es/utils/log/types.d.ts +8 -0
- package/es/utils/noop.d.ts +2 -0
- package/es/utils/number.d.ts +7 -0
- package/es/utils/parentTNode.d.ts +10 -0
- package/es/utils/parseTNode.d.ts +10 -0
- package/es/utils/react-render.d.ts +16 -0
- package/es/utils/ref.d.ts +1 -0
- package/es/utils/refs.d.ts +13 -0
- package/es/utils/scroll.d.ts +3 -0
- package/es/utils/style.d.ts +4 -0
- package/es/utils/transition.d.ts +20 -0
- package/package.json +60 -59
- package/LICENSE +0 -21
- package/es/_chunks/dep-0QH2Ee4R.js.map +0 -1
- package/es/_chunks/dep-BH5n5r1M.js.map +0 -1
- package/es/_chunks/dep-D7LanWes.js.map +0 -1
- package/es/_chunks/dep-DZ_0EvBk.js.map +0 -1
- package/es/_chunks/dep-Dk2xX8lh.js.map +0 -1
- package/es/_chunks/dep-EcrDKDlu.js.map +0 -1
- package/es/_chunks/dep-bWaVq_y3.js.map +0 -1
package/es/tag/Tag.js
CHANGED
|
@@ -3,1191 +3,14 @@ import { _ as _objectWithoutProperties } from '../_chunks/dep-DN7d1SzH.js';
|
|
|
3
3
|
import React, { useMemo, forwardRef } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { IconClose } from '@tendaui/icons';
|
|
6
|
+
import { t as tinycolor } from '../_chunks/dep-zOZQ0R9g.js';
|
|
6
7
|
import { n as noop } from '../_chunks/dep-U1T8CQY9.js';
|
|
7
|
-
import { u as useConfig } from '../_chunks/dep-
|
|
8
|
-
import { u as useGlobalIcon } from '../_chunks/dep-
|
|
8
|
+
import { u as useConfig } from '../_chunks/dep-gy8uvBaS.js';
|
|
9
|
+
import { u as useGlobalIcon } from '../_chunks/dep-ByzdZjUR.js';
|
|
9
10
|
import { u as useDefaultProps } from '../_chunks/dep-DGvfel3I.js';
|
|
10
11
|
import '../_chunks/dep-D-UKOauR.js';
|
|
11
|
-
import '../
|
|
12
|
-
|
|
13
|
-
// This file is autogenerated. It's used to publish ESM to npm.
|
|
14
|
-
function _typeof(obj) {
|
|
15
|
-
"@babel/helpers - typeof";
|
|
16
|
-
|
|
17
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
18
|
-
return typeof obj;
|
|
19
|
-
} : function (obj) {
|
|
20
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
21
|
-
}, _typeof(obj);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// https://github.com/bgrins/TinyColor
|
|
25
|
-
// Brian Grinstead, MIT License
|
|
26
|
-
|
|
27
|
-
var trimLeft = /^\s+/;
|
|
28
|
-
var trimRight = /\s+$/;
|
|
29
|
-
function tinycolor(color, opts) {
|
|
30
|
-
color = color ? color : "";
|
|
31
|
-
opts = opts || {};
|
|
32
|
-
|
|
33
|
-
// If input is already a tinycolor, return itself
|
|
34
|
-
if (color instanceof tinycolor) {
|
|
35
|
-
return color;
|
|
36
|
-
}
|
|
37
|
-
// If we are called as a function, call using new instead
|
|
38
|
-
if (!(this instanceof tinycolor)) {
|
|
39
|
-
return new tinycolor(color, opts);
|
|
40
|
-
}
|
|
41
|
-
var rgb = inputToRGB(color);
|
|
42
|
-
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
43
|
-
this._gradientType = opts.gradientType;
|
|
44
|
-
|
|
45
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
46
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
47
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
48
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
49
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
50
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
51
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
52
|
-
this._ok = rgb.ok;
|
|
53
|
-
}
|
|
54
|
-
tinycolor.prototype = {
|
|
55
|
-
isDark: function isDark() {
|
|
56
|
-
return this.getBrightness() < 128;
|
|
57
|
-
},
|
|
58
|
-
isLight: function isLight() {
|
|
59
|
-
return !this.isDark();
|
|
60
|
-
},
|
|
61
|
-
isValid: function isValid() {
|
|
62
|
-
return this._ok;
|
|
63
|
-
},
|
|
64
|
-
getOriginalInput: function getOriginalInput() {
|
|
65
|
-
return this._originalInput;
|
|
66
|
-
},
|
|
67
|
-
getFormat: function getFormat() {
|
|
68
|
-
return this._format;
|
|
69
|
-
},
|
|
70
|
-
getAlpha: function getAlpha() {
|
|
71
|
-
return this._a;
|
|
72
|
-
},
|
|
73
|
-
getBrightness: function getBrightness() {
|
|
74
|
-
//http://www.w3.org/TR/AERT#color-contrast
|
|
75
|
-
var rgb = this.toRgb();
|
|
76
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
77
|
-
},
|
|
78
|
-
getLuminance: function getLuminance() {
|
|
79
|
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
80
|
-
var rgb = this.toRgb();
|
|
81
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
82
|
-
RsRGB = rgb.r / 255;
|
|
83
|
-
GsRGB = rgb.g / 255;
|
|
84
|
-
BsRGB = rgb.b / 255;
|
|
85
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
86
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
87
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
88
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
89
|
-
},
|
|
90
|
-
setAlpha: function setAlpha(value) {
|
|
91
|
-
this._a = boundAlpha(value);
|
|
92
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
93
|
-
return this;
|
|
94
|
-
},
|
|
95
|
-
toHsv: function toHsv() {
|
|
96
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
97
|
-
return {
|
|
98
|
-
h: hsv.h * 360,
|
|
99
|
-
s: hsv.s,
|
|
100
|
-
v: hsv.v,
|
|
101
|
-
a: this._a
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
toHsvString: function toHsvString() {
|
|
105
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
106
|
-
var h = Math.round(hsv.h * 360),
|
|
107
|
-
s = Math.round(hsv.s * 100),
|
|
108
|
-
v = Math.round(hsv.v * 100);
|
|
109
|
-
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
110
|
-
},
|
|
111
|
-
toHsl: function toHsl() {
|
|
112
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
113
|
-
return {
|
|
114
|
-
h: hsl.h * 360,
|
|
115
|
-
s: hsl.s,
|
|
116
|
-
l: hsl.l,
|
|
117
|
-
a: this._a
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
toHslString: function toHslString() {
|
|
121
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
122
|
-
var h = Math.round(hsl.h * 360),
|
|
123
|
-
s = Math.round(hsl.s * 100),
|
|
124
|
-
l = Math.round(hsl.l * 100);
|
|
125
|
-
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
126
|
-
},
|
|
127
|
-
toHex: function toHex(allow3Char) {
|
|
128
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
129
|
-
},
|
|
130
|
-
toHexString: function toHexString(allow3Char) {
|
|
131
|
-
return "#" + this.toHex(allow3Char);
|
|
132
|
-
},
|
|
133
|
-
toHex8: function toHex8(allow4Char) {
|
|
134
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
135
|
-
},
|
|
136
|
-
toHex8String: function toHex8String(allow4Char) {
|
|
137
|
-
return "#" + this.toHex8(allow4Char);
|
|
138
|
-
},
|
|
139
|
-
toRgb: function toRgb() {
|
|
140
|
-
return {
|
|
141
|
-
r: Math.round(this._r),
|
|
142
|
-
g: Math.round(this._g),
|
|
143
|
-
b: Math.round(this._b),
|
|
144
|
-
a: this._a
|
|
145
|
-
};
|
|
146
|
-
},
|
|
147
|
-
toRgbString: function toRgbString() {
|
|
148
|
-
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
149
|
-
},
|
|
150
|
-
toPercentageRgb: function toPercentageRgb() {
|
|
151
|
-
return {
|
|
152
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
153
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
154
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
155
|
-
a: this._a
|
|
156
|
-
};
|
|
157
|
-
},
|
|
158
|
-
toPercentageRgbString: function toPercentageRgbString() {
|
|
159
|
-
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
160
|
-
},
|
|
161
|
-
toName: function toName() {
|
|
162
|
-
if (this._a === 0) {
|
|
163
|
-
return "transparent";
|
|
164
|
-
}
|
|
165
|
-
if (this._a < 1) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
169
|
-
},
|
|
170
|
-
toFilter: function toFilter(secondColor) {
|
|
171
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
172
|
-
var secondHex8String = hex8String;
|
|
173
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
174
|
-
if (secondColor) {
|
|
175
|
-
var s = tinycolor(secondColor);
|
|
176
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
177
|
-
}
|
|
178
|
-
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
179
|
-
},
|
|
180
|
-
toString: function toString(format) {
|
|
181
|
-
var formatSet = !!format;
|
|
182
|
-
format = format || this._format;
|
|
183
|
-
var formattedString = false;
|
|
184
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
185
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
186
|
-
if (needsAlphaFormat) {
|
|
187
|
-
// Special case for "transparent", all other non-alpha formats
|
|
188
|
-
// will return rgba when there is transparency.
|
|
189
|
-
if (format === "name" && this._a === 0) {
|
|
190
|
-
return this.toName();
|
|
191
|
-
}
|
|
192
|
-
return this.toRgbString();
|
|
193
|
-
}
|
|
194
|
-
if (format === "rgb") {
|
|
195
|
-
formattedString = this.toRgbString();
|
|
196
|
-
}
|
|
197
|
-
if (format === "prgb") {
|
|
198
|
-
formattedString = this.toPercentageRgbString();
|
|
199
|
-
}
|
|
200
|
-
if (format === "hex" || format === "hex6") {
|
|
201
|
-
formattedString = this.toHexString();
|
|
202
|
-
}
|
|
203
|
-
if (format === "hex3") {
|
|
204
|
-
formattedString = this.toHexString(true);
|
|
205
|
-
}
|
|
206
|
-
if (format === "hex4") {
|
|
207
|
-
formattedString = this.toHex8String(true);
|
|
208
|
-
}
|
|
209
|
-
if (format === "hex8") {
|
|
210
|
-
formattedString = this.toHex8String();
|
|
211
|
-
}
|
|
212
|
-
if (format === "name") {
|
|
213
|
-
formattedString = this.toName();
|
|
214
|
-
}
|
|
215
|
-
if (format === "hsl") {
|
|
216
|
-
formattedString = this.toHslString();
|
|
217
|
-
}
|
|
218
|
-
if (format === "hsv") {
|
|
219
|
-
formattedString = this.toHsvString();
|
|
220
|
-
}
|
|
221
|
-
return formattedString || this.toHexString();
|
|
222
|
-
},
|
|
223
|
-
clone: function clone() {
|
|
224
|
-
return tinycolor(this.toString());
|
|
225
|
-
},
|
|
226
|
-
_applyModification: function _applyModification(fn, args) {
|
|
227
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
228
|
-
this._r = color._r;
|
|
229
|
-
this._g = color._g;
|
|
230
|
-
this._b = color._b;
|
|
231
|
-
this.setAlpha(color._a);
|
|
232
|
-
return this;
|
|
233
|
-
},
|
|
234
|
-
lighten: function lighten() {
|
|
235
|
-
return this._applyModification(_lighten, arguments);
|
|
236
|
-
},
|
|
237
|
-
brighten: function brighten() {
|
|
238
|
-
return this._applyModification(_brighten, arguments);
|
|
239
|
-
},
|
|
240
|
-
darken: function darken() {
|
|
241
|
-
return this._applyModification(_darken, arguments);
|
|
242
|
-
},
|
|
243
|
-
desaturate: function desaturate() {
|
|
244
|
-
return this._applyModification(_desaturate, arguments);
|
|
245
|
-
},
|
|
246
|
-
saturate: function saturate() {
|
|
247
|
-
return this._applyModification(_saturate, arguments);
|
|
248
|
-
},
|
|
249
|
-
greyscale: function greyscale() {
|
|
250
|
-
return this._applyModification(_greyscale, arguments);
|
|
251
|
-
},
|
|
252
|
-
spin: function spin() {
|
|
253
|
-
return this._applyModification(_spin, arguments);
|
|
254
|
-
},
|
|
255
|
-
_applyCombination: function _applyCombination(fn, args) {
|
|
256
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
257
|
-
},
|
|
258
|
-
analogous: function analogous() {
|
|
259
|
-
return this._applyCombination(_analogous, arguments);
|
|
260
|
-
},
|
|
261
|
-
complement: function complement() {
|
|
262
|
-
return this._applyCombination(_complement, arguments);
|
|
263
|
-
},
|
|
264
|
-
monochromatic: function monochromatic() {
|
|
265
|
-
return this._applyCombination(_monochromatic, arguments);
|
|
266
|
-
},
|
|
267
|
-
splitcomplement: function splitcomplement() {
|
|
268
|
-
return this._applyCombination(_splitcomplement, arguments);
|
|
269
|
-
},
|
|
270
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
271
|
-
// polyad: function (number) {
|
|
272
|
-
// return this._applyCombination(polyad, [number]);
|
|
273
|
-
// },
|
|
274
|
-
triad: function triad() {
|
|
275
|
-
return this._applyCombination(polyad, [3]);
|
|
276
|
-
},
|
|
277
|
-
tetrad: function tetrad() {
|
|
278
|
-
return this._applyCombination(polyad, [4]);
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
283
|
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
284
|
-
tinycolor.fromRatio = function (color, opts) {
|
|
285
|
-
if (_typeof(color) == "object") {
|
|
286
|
-
var newColor = {};
|
|
287
|
-
for (var i in color) {
|
|
288
|
-
if (color.hasOwnProperty(i)) {
|
|
289
|
-
if (i === "a") {
|
|
290
|
-
newColor[i] = color[i];
|
|
291
|
-
} else {
|
|
292
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
color = newColor;
|
|
297
|
-
}
|
|
298
|
-
return tinycolor(color, opts);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
// Given a string or object, convert that input to RGB
|
|
302
|
-
// Possible string inputs:
|
|
303
|
-
//
|
|
304
|
-
// "red"
|
|
305
|
-
// "#f00" or "f00"
|
|
306
|
-
// "#ff0000" or "ff0000"
|
|
307
|
-
// "#ff000000" or "ff000000"
|
|
308
|
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
309
|
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
310
|
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
311
|
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
312
|
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
313
|
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
314
|
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
315
|
-
//
|
|
316
|
-
function inputToRGB(color) {
|
|
317
|
-
var rgb = {
|
|
318
|
-
r: 0,
|
|
319
|
-
g: 0,
|
|
320
|
-
b: 0
|
|
321
|
-
};
|
|
322
|
-
var a = 1;
|
|
323
|
-
var s = null;
|
|
324
|
-
var v = null;
|
|
325
|
-
var l = null;
|
|
326
|
-
var ok = false;
|
|
327
|
-
var format = false;
|
|
328
|
-
if (typeof color == "string") {
|
|
329
|
-
color = stringInputToObject(color);
|
|
330
|
-
}
|
|
331
|
-
if (_typeof(color) == "object") {
|
|
332
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
333
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
334
|
-
ok = true;
|
|
335
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
336
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
337
|
-
s = convertToPercentage(color.s);
|
|
338
|
-
v = convertToPercentage(color.v);
|
|
339
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
340
|
-
ok = true;
|
|
341
|
-
format = "hsv";
|
|
342
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
343
|
-
s = convertToPercentage(color.s);
|
|
344
|
-
l = convertToPercentage(color.l);
|
|
345
|
-
rgb = hslToRgb(color.h, s, l);
|
|
346
|
-
ok = true;
|
|
347
|
-
format = "hsl";
|
|
348
|
-
}
|
|
349
|
-
if (color.hasOwnProperty("a")) {
|
|
350
|
-
a = color.a;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
a = boundAlpha(a);
|
|
354
|
-
return {
|
|
355
|
-
ok: ok,
|
|
356
|
-
format: color.format || format,
|
|
357
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
358
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
359
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
360
|
-
a: a
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Conversion Functions
|
|
365
|
-
// --------------------
|
|
366
|
-
|
|
367
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
368
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
369
|
-
|
|
370
|
-
// `rgbToRgb`
|
|
371
|
-
// Handle bounds / percentage checking to conform to CSS color spec
|
|
372
|
-
// <http://www.w3.org/TR/css3-color/>
|
|
373
|
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
374
|
-
// *Returns:* { r, g, b } in [0, 255]
|
|
375
|
-
function rgbToRgb(r, g, b) {
|
|
376
|
-
return {
|
|
377
|
-
r: bound01(r, 255) * 255,
|
|
378
|
-
g: bound01(g, 255) * 255,
|
|
379
|
-
b: bound01(b, 255) * 255
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// `rgbToHsl`
|
|
384
|
-
// Converts an RGB color value to HSL.
|
|
385
|
-
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
386
|
-
// *Returns:* { h, s, l } in [0,1]
|
|
387
|
-
function rgbToHsl(r, g, b) {
|
|
388
|
-
r = bound01(r, 255);
|
|
389
|
-
g = bound01(g, 255);
|
|
390
|
-
b = bound01(b, 255);
|
|
391
|
-
var max = Math.max(r, g, b),
|
|
392
|
-
min = Math.min(r, g, b);
|
|
393
|
-
var h,
|
|
394
|
-
s,
|
|
395
|
-
l = (max + min) / 2;
|
|
396
|
-
if (max == min) {
|
|
397
|
-
h = s = 0; // achromatic
|
|
398
|
-
} else {
|
|
399
|
-
var d = max - min;
|
|
400
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
401
|
-
switch (max) {
|
|
402
|
-
case r:
|
|
403
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
404
|
-
break;
|
|
405
|
-
case g:
|
|
406
|
-
h = (b - r) / d + 2;
|
|
407
|
-
break;
|
|
408
|
-
case b:
|
|
409
|
-
h = (r - g) / d + 4;
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
h /= 6;
|
|
413
|
-
}
|
|
414
|
-
return {
|
|
415
|
-
h: h,
|
|
416
|
-
s: s,
|
|
417
|
-
l: l
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// `hslToRgb`
|
|
422
|
-
// Converts an HSL color value to RGB.
|
|
423
|
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
424
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
425
|
-
function hslToRgb(h, s, l) {
|
|
426
|
-
var r, g, b;
|
|
427
|
-
h = bound01(h, 360);
|
|
428
|
-
s = bound01(s, 100);
|
|
429
|
-
l = bound01(l, 100);
|
|
430
|
-
function hue2rgb(p, q, t) {
|
|
431
|
-
if (t < 0) t += 1;
|
|
432
|
-
if (t > 1) t -= 1;
|
|
433
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
434
|
-
if (t < 1 / 2) return q;
|
|
435
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
436
|
-
return p;
|
|
437
|
-
}
|
|
438
|
-
if (s === 0) {
|
|
439
|
-
r = g = b = l; // achromatic
|
|
440
|
-
} else {
|
|
441
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
442
|
-
var p = 2 * l - q;
|
|
443
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
444
|
-
g = hue2rgb(p, q, h);
|
|
445
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
446
|
-
}
|
|
447
|
-
return {
|
|
448
|
-
r: r * 255,
|
|
449
|
-
g: g * 255,
|
|
450
|
-
b: b * 255
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// `rgbToHsv`
|
|
455
|
-
// Converts an RGB color value to HSV
|
|
456
|
-
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
457
|
-
// *Returns:* { h, s, v } in [0,1]
|
|
458
|
-
function rgbToHsv(r, g, b) {
|
|
459
|
-
r = bound01(r, 255);
|
|
460
|
-
g = bound01(g, 255);
|
|
461
|
-
b = bound01(b, 255);
|
|
462
|
-
var max = Math.max(r, g, b),
|
|
463
|
-
min = Math.min(r, g, b);
|
|
464
|
-
var h,
|
|
465
|
-
s,
|
|
466
|
-
v = max;
|
|
467
|
-
var d = max - min;
|
|
468
|
-
s = max === 0 ? 0 : d / max;
|
|
469
|
-
if (max == min) {
|
|
470
|
-
h = 0; // achromatic
|
|
471
|
-
} else {
|
|
472
|
-
switch (max) {
|
|
473
|
-
case r:
|
|
474
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
475
|
-
break;
|
|
476
|
-
case g:
|
|
477
|
-
h = (b - r) / d + 2;
|
|
478
|
-
break;
|
|
479
|
-
case b:
|
|
480
|
-
h = (r - g) / d + 4;
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
h /= 6;
|
|
484
|
-
}
|
|
485
|
-
return {
|
|
486
|
-
h: h,
|
|
487
|
-
s: s,
|
|
488
|
-
v: v
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// `hsvToRgb`
|
|
493
|
-
// Converts an HSV color value to RGB.
|
|
494
|
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
495
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
496
|
-
function hsvToRgb(h, s, v) {
|
|
497
|
-
h = bound01(h, 360) * 6;
|
|
498
|
-
s = bound01(s, 100);
|
|
499
|
-
v = bound01(v, 100);
|
|
500
|
-
var i = Math.floor(h),
|
|
501
|
-
f = h - i,
|
|
502
|
-
p = v * (1 - s),
|
|
503
|
-
q = v * (1 - f * s),
|
|
504
|
-
t = v * (1 - (1 - f) * s),
|
|
505
|
-
mod = i % 6,
|
|
506
|
-
r = [v, q, p, p, t, v][mod],
|
|
507
|
-
g = [t, v, v, q, p, p][mod],
|
|
508
|
-
b = [p, p, t, v, v, q][mod];
|
|
509
|
-
return {
|
|
510
|
-
r: r * 255,
|
|
511
|
-
g: g * 255,
|
|
512
|
-
b: b * 255
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// `rgbToHex`
|
|
517
|
-
// Converts an RGB color to hex
|
|
518
|
-
// Assumes r, g, and b are contained in the set [0, 255]
|
|
519
|
-
// Returns a 3 or 6 character hex
|
|
520
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
521
|
-
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
522
|
-
|
|
523
|
-
// Return a 3 character hex if possible
|
|
524
|
-
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
525
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
526
|
-
}
|
|
527
|
-
return hex.join("");
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// `rgbaToHex`
|
|
531
|
-
// Converts an RGBA color plus alpha transparency to hex
|
|
532
|
-
// Assumes r, g, b are contained in the set [0, 255] and
|
|
533
|
-
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
534
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
535
|
-
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
536
|
-
|
|
537
|
-
// Return a 4 character hex if possible
|
|
538
|
-
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
539
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
540
|
-
}
|
|
541
|
-
return hex.join("");
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// `rgbaToArgbHex`
|
|
545
|
-
// Converts an RGBA color to an ARGB Hex8 string
|
|
546
|
-
// Rarely used, but required for "toFilter()"
|
|
547
|
-
function rgbaToArgbHex(r, g, b, a) {
|
|
548
|
-
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
549
|
-
return hex.join("");
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
// `equals`
|
|
553
|
-
// Can be called with any tinycolor input
|
|
554
|
-
tinycolor.equals = function (color1, color2) {
|
|
555
|
-
if (!color1 || !color2) return false;
|
|
556
|
-
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
557
|
-
};
|
|
558
|
-
tinycolor.random = function () {
|
|
559
|
-
return tinycolor.fromRatio({
|
|
560
|
-
r: Math.random(),
|
|
561
|
-
g: Math.random(),
|
|
562
|
-
b: Math.random()
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
// Modification Functions
|
|
567
|
-
// ----------------------
|
|
568
|
-
// Thanks to less.js for some of the basics here
|
|
569
|
-
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
570
|
-
|
|
571
|
-
function _desaturate(color, amount) {
|
|
572
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
573
|
-
var hsl = tinycolor(color).toHsl();
|
|
574
|
-
hsl.s -= amount / 100;
|
|
575
|
-
hsl.s = clamp01(hsl.s);
|
|
576
|
-
return tinycolor(hsl);
|
|
577
|
-
}
|
|
578
|
-
function _saturate(color, amount) {
|
|
579
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
580
|
-
var hsl = tinycolor(color).toHsl();
|
|
581
|
-
hsl.s += amount / 100;
|
|
582
|
-
hsl.s = clamp01(hsl.s);
|
|
583
|
-
return tinycolor(hsl);
|
|
584
|
-
}
|
|
585
|
-
function _greyscale(color) {
|
|
586
|
-
return tinycolor(color).desaturate(100);
|
|
587
|
-
}
|
|
588
|
-
function _lighten(color, amount) {
|
|
589
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
590
|
-
var hsl = tinycolor(color).toHsl();
|
|
591
|
-
hsl.l += amount / 100;
|
|
592
|
-
hsl.l = clamp01(hsl.l);
|
|
593
|
-
return tinycolor(hsl);
|
|
594
|
-
}
|
|
595
|
-
function _brighten(color, amount) {
|
|
596
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
597
|
-
var rgb = tinycolor(color).toRgb();
|
|
598
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
599
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
600
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
601
|
-
return tinycolor(rgb);
|
|
602
|
-
}
|
|
603
|
-
function _darken(color, amount) {
|
|
604
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
605
|
-
var hsl = tinycolor(color).toHsl();
|
|
606
|
-
hsl.l -= amount / 100;
|
|
607
|
-
hsl.l = clamp01(hsl.l);
|
|
608
|
-
return tinycolor(hsl);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
612
|
-
// Values outside of this range will be wrapped into this range.
|
|
613
|
-
function _spin(color, amount) {
|
|
614
|
-
var hsl = tinycolor(color).toHsl();
|
|
615
|
-
var hue = (hsl.h + amount) % 360;
|
|
616
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
617
|
-
return tinycolor(hsl);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// Combination Functions
|
|
621
|
-
// ---------------------
|
|
622
|
-
// Thanks to jQuery xColor for some of the ideas behind these
|
|
623
|
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
624
|
-
|
|
625
|
-
function _complement(color) {
|
|
626
|
-
var hsl = tinycolor(color).toHsl();
|
|
627
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
628
|
-
return tinycolor(hsl);
|
|
629
|
-
}
|
|
630
|
-
function polyad(color, number) {
|
|
631
|
-
if (isNaN(number) || number <= 0) {
|
|
632
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
633
|
-
}
|
|
634
|
-
var hsl = tinycolor(color).toHsl();
|
|
635
|
-
var result = [tinycolor(color)];
|
|
636
|
-
var step = 360 / number;
|
|
637
|
-
for (var i = 1; i < number; i++) {
|
|
638
|
-
result.push(tinycolor({
|
|
639
|
-
h: (hsl.h + i * step) % 360,
|
|
640
|
-
s: hsl.s,
|
|
641
|
-
l: hsl.l
|
|
642
|
-
}));
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
function _splitcomplement(color) {
|
|
647
|
-
var hsl = tinycolor(color).toHsl();
|
|
648
|
-
var h = hsl.h;
|
|
649
|
-
return [tinycolor(color), tinycolor({
|
|
650
|
-
h: (h + 72) % 360,
|
|
651
|
-
s: hsl.s,
|
|
652
|
-
l: hsl.l
|
|
653
|
-
}), tinycolor({
|
|
654
|
-
h: (h + 216) % 360,
|
|
655
|
-
s: hsl.s,
|
|
656
|
-
l: hsl.l
|
|
657
|
-
})];
|
|
658
|
-
}
|
|
659
|
-
function _analogous(color, results, slices) {
|
|
660
|
-
results = results || 6;
|
|
661
|
-
slices = slices || 30;
|
|
662
|
-
var hsl = tinycolor(color).toHsl();
|
|
663
|
-
var part = 360 / slices;
|
|
664
|
-
var ret = [tinycolor(color)];
|
|
665
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
666
|
-
hsl.h = (hsl.h + part) % 360;
|
|
667
|
-
ret.push(tinycolor(hsl));
|
|
668
|
-
}
|
|
669
|
-
return ret;
|
|
670
|
-
}
|
|
671
|
-
function _monochromatic(color, results) {
|
|
672
|
-
results = results || 6;
|
|
673
|
-
var hsv = tinycolor(color).toHsv();
|
|
674
|
-
var h = hsv.h,
|
|
675
|
-
s = hsv.s,
|
|
676
|
-
v = hsv.v;
|
|
677
|
-
var ret = [];
|
|
678
|
-
var modification = 1 / results;
|
|
679
|
-
while (results--) {
|
|
680
|
-
ret.push(tinycolor({
|
|
681
|
-
h: h,
|
|
682
|
-
s: s,
|
|
683
|
-
v: v
|
|
684
|
-
}));
|
|
685
|
-
v = (v + modification) % 1;
|
|
686
|
-
}
|
|
687
|
-
return ret;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
// Utility Functions
|
|
691
|
-
// ---------------------
|
|
692
|
-
|
|
693
|
-
tinycolor.mix = function (color1, color2, amount) {
|
|
694
|
-
amount = amount === 0 ? 0 : amount || 50;
|
|
695
|
-
var rgb1 = tinycolor(color1).toRgb();
|
|
696
|
-
var rgb2 = tinycolor(color2).toRgb();
|
|
697
|
-
var p = amount / 100;
|
|
698
|
-
var rgba = {
|
|
699
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
700
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
701
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
702
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
703
|
-
};
|
|
704
|
-
return tinycolor(rgba);
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
// Readability Functions
|
|
708
|
-
// ---------------------
|
|
709
|
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
710
|
-
|
|
711
|
-
// `contrast`
|
|
712
|
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
713
|
-
tinycolor.readability = function (color1, color2) {
|
|
714
|
-
var c1 = tinycolor(color1);
|
|
715
|
-
var c2 = tinycolor(color2);
|
|
716
|
-
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
// `isReadable`
|
|
720
|
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
721
|
-
// The third argument is an optional Object.
|
|
722
|
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
723
|
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
724
|
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
725
|
-
|
|
726
|
-
// *Example*
|
|
727
|
-
// tinycolor.isReadable("#000", "#111") => false
|
|
728
|
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
729
|
-
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
730
|
-
var readability = tinycolor.readability(color1, color2);
|
|
731
|
-
var wcag2Parms, out;
|
|
732
|
-
out = false;
|
|
733
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
734
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
735
|
-
case "AAsmall":
|
|
736
|
-
case "AAAlarge":
|
|
737
|
-
out = readability >= 4.5;
|
|
738
|
-
break;
|
|
739
|
-
case "AAlarge":
|
|
740
|
-
out = readability >= 3;
|
|
741
|
-
break;
|
|
742
|
-
case "AAAsmall":
|
|
743
|
-
out = readability >= 7;
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
return out;
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
// `mostReadable`
|
|
750
|
-
// Given a base color and a list of possible foreground or background
|
|
751
|
-
// colors for that base, returns the most readable color.
|
|
752
|
-
// Optionally returns Black or White if the most readable color is unreadable.
|
|
753
|
-
// *Example*
|
|
754
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
755
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
756
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
757
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
758
|
-
tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
759
|
-
var bestColor = null;
|
|
760
|
-
var bestScore = 0;
|
|
761
|
-
var readability;
|
|
762
|
-
var includeFallbackColors, level, size;
|
|
763
|
-
args = args || {};
|
|
764
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
765
|
-
level = args.level;
|
|
766
|
-
size = args.size;
|
|
767
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
768
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
769
|
-
if (readability > bestScore) {
|
|
770
|
-
bestScore = readability;
|
|
771
|
-
bestColor = tinycolor(colorList[i]);
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
775
|
-
level: level,
|
|
776
|
-
size: size
|
|
777
|
-
}) || !includeFallbackColors) {
|
|
778
|
-
return bestColor;
|
|
779
|
-
} else {
|
|
780
|
-
args.includeFallbackColors = false;
|
|
781
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
// Big List of Colors
|
|
786
|
-
// ------------------
|
|
787
|
-
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
788
|
-
var names = tinycolor.names = {
|
|
789
|
-
aliceblue: "f0f8ff",
|
|
790
|
-
antiquewhite: "faebd7",
|
|
791
|
-
aqua: "0ff",
|
|
792
|
-
aquamarine: "7fffd4",
|
|
793
|
-
azure: "f0ffff",
|
|
794
|
-
beige: "f5f5dc",
|
|
795
|
-
bisque: "ffe4c4",
|
|
796
|
-
black: "000",
|
|
797
|
-
blanchedalmond: "ffebcd",
|
|
798
|
-
blue: "00f",
|
|
799
|
-
blueviolet: "8a2be2",
|
|
800
|
-
brown: "a52a2a",
|
|
801
|
-
burlywood: "deb887",
|
|
802
|
-
burntsienna: "ea7e5d",
|
|
803
|
-
cadetblue: "5f9ea0",
|
|
804
|
-
chartreuse: "7fff00",
|
|
805
|
-
chocolate: "d2691e",
|
|
806
|
-
coral: "ff7f50",
|
|
807
|
-
cornflowerblue: "6495ed",
|
|
808
|
-
cornsilk: "fff8dc",
|
|
809
|
-
crimson: "dc143c",
|
|
810
|
-
cyan: "0ff",
|
|
811
|
-
darkblue: "00008b",
|
|
812
|
-
darkcyan: "008b8b",
|
|
813
|
-
darkgoldenrod: "b8860b",
|
|
814
|
-
darkgray: "a9a9a9",
|
|
815
|
-
darkgreen: "006400",
|
|
816
|
-
darkgrey: "a9a9a9",
|
|
817
|
-
darkkhaki: "bdb76b",
|
|
818
|
-
darkmagenta: "8b008b",
|
|
819
|
-
darkolivegreen: "556b2f",
|
|
820
|
-
darkorange: "ff8c00",
|
|
821
|
-
darkorchid: "9932cc",
|
|
822
|
-
darkred: "8b0000",
|
|
823
|
-
darksalmon: "e9967a",
|
|
824
|
-
darkseagreen: "8fbc8f",
|
|
825
|
-
darkslateblue: "483d8b",
|
|
826
|
-
darkslategray: "2f4f4f",
|
|
827
|
-
darkslategrey: "2f4f4f",
|
|
828
|
-
darkturquoise: "00ced1",
|
|
829
|
-
darkviolet: "9400d3",
|
|
830
|
-
deeppink: "ff1493",
|
|
831
|
-
deepskyblue: "00bfff",
|
|
832
|
-
dimgray: "696969",
|
|
833
|
-
dimgrey: "696969",
|
|
834
|
-
dodgerblue: "1e90ff",
|
|
835
|
-
firebrick: "b22222",
|
|
836
|
-
floralwhite: "fffaf0",
|
|
837
|
-
forestgreen: "228b22",
|
|
838
|
-
fuchsia: "f0f",
|
|
839
|
-
gainsboro: "dcdcdc",
|
|
840
|
-
ghostwhite: "f8f8ff",
|
|
841
|
-
gold: "ffd700",
|
|
842
|
-
goldenrod: "daa520",
|
|
843
|
-
gray: "808080",
|
|
844
|
-
green: "008000",
|
|
845
|
-
greenyellow: "adff2f",
|
|
846
|
-
grey: "808080",
|
|
847
|
-
honeydew: "f0fff0",
|
|
848
|
-
hotpink: "ff69b4",
|
|
849
|
-
indianred: "cd5c5c",
|
|
850
|
-
indigo: "4b0082",
|
|
851
|
-
ivory: "fffff0",
|
|
852
|
-
khaki: "f0e68c",
|
|
853
|
-
lavender: "e6e6fa",
|
|
854
|
-
lavenderblush: "fff0f5",
|
|
855
|
-
lawngreen: "7cfc00",
|
|
856
|
-
lemonchiffon: "fffacd",
|
|
857
|
-
lightblue: "add8e6",
|
|
858
|
-
lightcoral: "f08080",
|
|
859
|
-
lightcyan: "e0ffff",
|
|
860
|
-
lightgoldenrodyellow: "fafad2",
|
|
861
|
-
lightgray: "d3d3d3",
|
|
862
|
-
lightgreen: "90ee90",
|
|
863
|
-
lightgrey: "d3d3d3",
|
|
864
|
-
lightpink: "ffb6c1",
|
|
865
|
-
lightsalmon: "ffa07a",
|
|
866
|
-
lightseagreen: "20b2aa",
|
|
867
|
-
lightskyblue: "87cefa",
|
|
868
|
-
lightslategray: "789",
|
|
869
|
-
lightslategrey: "789",
|
|
870
|
-
lightsteelblue: "b0c4de",
|
|
871
|
-
lightyellow: "ffffe0",
|
|
872
|
-
lime: "0f0",
|
|
873
|
-
limegreen: "32cd32",
|
|
874
|
-
linen: "faf0e6",
|
|
875
|
-
magenta: "f0f",
|
|
876
|
-
maroon: "800000",
|
|
877
|
-
mediumaquamarine: "66cdaa",
|
|
878
|
-
mediumblue: "0000cd",
|
|
879
|
-
mediumorchid: "ba55d3",
|
|
880
|
-
mediumpurple: "9370db",
|
|
881
|
-
mediumseagreen: "3cb371",
|
|
882
|
-
mediumslateblue: "7b68ee",
|
|
883
|
-
mediumspringgreen: "00fa9a",
|
|
884
|
-
mediumturquoise: "48d1cc",
|
|
885
|
-
mediumvioletred: "c71585",
|
|
886
|
-
midnightblue: "191970",
|
|
887
|
-
mintcream: "f5fffa",
|
|
888
|
-
mistyrose: "ffe4e1",
|
|
889
|
-
moccasin: "ffe4b5",
|
|
890
|
-
navajowhite: "ffdead",
|
|
891
|
-
navy: "000080",
|
|
892
|
-
oldlace: "fdf5e6",
|
|
893
|
-
olive: "808000",
|
|
894
|
-
olivedrab: "6b8e23",
|
|
895
|
-
orange: "ffa500",
|
|
896
|
-
orangered: "ff4500",
|
|
897
|
-
orchid: "da70d6",
|
|
898
|
-
palegoldenrod: "eee8aa",
|
|
899
|
-
palegreen: "98fb98",
|
|
900
|
-
paleturquoise: "afeeee",
|
|
901
|
-
palevioletred: "db7093",
|
|
902
|
-
papayawhip: "ffefd5",
|
|
903
|
-
peachpuff: "ffdab9",
|
|
904
|
-
peru: "cd853f",
|
|
905
|
-
pink: "ffc0cb",
|
|
906
|
-
plum: "dda0dd",
|
|
907
|
-
powderblue: "b0e0e6",
|
|
908
|
-
purple: "800080",
|
|
909
|
-
rebeccapurple: "663399",
|
|
910
|
-
red: "f00",
|
|
911
|
-
rosybrown: "bc8f8f",
|
|
912
|
-
royalblue: "4169e1",
|
|
913
|
-
saddlebrown: "8b4513",
|
|
914
|
-
salmon: "fa8072",
|
|
915
|
-
sandybrown: "f4a460",
|
|
916
|
-
seagreen: "2e8b57",
|
|
917
|
-
seashell: "fff5ee",
|
|
918
|
-
sienna: "a0522d",
|
|
919
|
-
silver: "c0c0c0",
|
|
920
|
-
skyblue: "87ceeb",
|
|
921
|
-
slateblue: "6a5acd",
|
|
922
|
-
slategray: "708090",
|
|
923
|
-
slategrey: "708090",
|
|
924
|
-
snow: "fffafa",
|
|
925
|
-
springgreen: "00ff7f",
|
|
926
|
-
steelblue: "4682b4",
|
|
927
|
-
tan: "d2b48c",
|
|
928
|
-
teal: "008080",
|
|
929
|
-
thistle: "d8bfd8",
|
|
930
|
-
tomato: "ff6347",
|
|
931
|
-
turquoise: "40e0d0",
|
|
932
|
-
violet: "ee82ee",
|
|
933
|
-
wheat: "f5deb3",
|
|
934
|
-
white: "fff",
|
|
935
|
-
whitesmoke: "f5f5f5",
|
|
936
|
-
yellow: "ff0",
|
|
937
|
-
yellowgreen: "9acd32"
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
// Make it easy to access colors via `hexNames[hex]`
|
|
941
|
-
var hexNames = tinycolor.hexNames = flip(names);
|
|
942
|
-
|
|
943
|
-
// Utilities
|
|
944
|
-
// ---------
|
|
945
|
-
|
|
946
|
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
947
|
-
function flip(o) {
|
|
948
|
-
var flipped = {};
|
|
949
|
-
for (var i in o) {
|
|
950
|
-
if (o.hasOwnProperty(i)) {
|
|
951
|
-
flipped[o[i]] = i;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
return flipped;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
958
|
-
function boundAlpha(a) {
|
|
959
|
-
a = parseFloat(a);
|
|
960
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
961
|
-
a = 1;
|
|
962
|
-
}
|
|
963
|
-
return a;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
967
|
-
function bound01(n, max) {
|
|
968
|
-
if (isOnePointZero(n)) n = "100%";
|
|
969
|
-
var processPercent = isPercentage(n);
|
|
970
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
971
|
-
|
|
972
|
-
// Automatically convert percentage into number
|
|
973
|
-
if (processPercent) {
|
|
974
|
-
n = parseInt(n * max, 10) / 100;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
// Handle floating point rounding errors
|
|
978
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
979
|
-
return 1;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
// Convert into [0, 1] range if it isn't already
|
|
983
|
-
return n % max / parseFloat(max);
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
// Force a number between 0 and 1
|
|
987
|
-
function clamp01(val) {
|
|
988
|
-
return Math.min(1, Math.max(0, val));
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
// Parse a base-16 hex value into a base-10 integer
|
|
992
|
-
function parseIntFromHex(val) {
|
|
993
|
-
return parseInt(val, 16);
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
997
|
-
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
998
|
-
function isOnePointZero(n) {
|
|
999
|
-
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
// Check to see if string passed in is a percentage
|
|
1003
|
-
function isPercentage(n) {
|
|
1004
|
-
return typeof n === "string" && n.indexOf("%") != -1;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
// Force a hex value to have 2 characters
|
|
1008
|
-
function pad2(c) {
|
|
1009
|
-
return c.length == 1 ? "0" + c : "" + c;
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
// Replace a decimal with it's percentage value
|
|
1013
|
-
function convertToPercentage(n) {
|
|
1014
|
-
if (n <= 1) {
|
|
1015
|
-
n = n * 100 + "%";
|
|
1016
|
-
}
|
|
1017
|
-
return n;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
// Converts a decimal to a hex value
|
|
1021
|
-
function convertDecimalToHex(d) {
|
|
1022
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
1023
|
-
}
|
|
1024
|
-
// Converts a hex value to a decimal
|
|
1025
|
-
function convertHexToDecimal(h) {
|
|
1026
|
-
return parseIntFromHex(h) / 255;
|
|
1027
|
-
}
|
|
1028
|
-
var matchers = function () {
|
|
1029
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
1030
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1031
|
-
|
|
1032
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
1033
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
1034
|
-
|
|
1035
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
1036
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
1037
|
-
|
|
1038
|
-
// Actual matching.
|
|
1039
|
-
// Parentheses and commas are optional, but not required.
|
|
1040
|
-
// Whitespace can take the place of commas or opening paren
|
|
1041
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1042
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1043
|
-
return {
|
|
1044
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1045
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
1046
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
1047
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1048
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1049
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1050
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1051
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1052
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1053
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1054
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1055
|
-
};
|
|
1056
|
-
}();
|
|
1057
|
-
|
|
1058
|
-
// `isValidCSSUnit`
|
|
1059
|
-
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
1060
|
-
// (see `matchers` above for definition).
|
|
1061
|
-
function isValidCSSUnit(color) {
|
|
1062
|
-
return !!matchers.CSS_UNIT.exec(color);
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
// `stringInputToObject`
|
|
1066
|
-
// Permissive string parsing. Take in a number of formats, and output an object
|
|
1067
|
-
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
1068
|
-
function stringInputToObject(color) {
|
|
1069
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
1070
|
-
var named = false;
|
|
1071
|
-
if (names[color]) {
|
|
1072
|
-
color = names[color];
|
|
1073
|
-
named = true;
|
|
1074
|
-
} else if (color == "transparent") {
|
|
1075
|
-
return {
|
|
1076
|
-
r: 0,
|
|
1077
|
-
g: 0,
|
|
1078
|
-
b: 0,
|
|
1079
|
-
a: 0,
|
|
1080
|
-
format: "name"
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
// Try to match string input using regular expressions.
|
|
1085
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
1086
|
-
// Just return an object and let the conversion functions handle that.
|
|
1087
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
1088
|
-
var match;
|
|
1089
|
-
if (match = matchers.rgb.exec(color)) {
|
|
1090
|
-
return {
|
|
1091
|
-
r: match[1],
|
|
1092
|
-
g: match[2],
|
|
1093
|
-
b: match[3]
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
if (match = matchers.rgba.exec(color)) {
|
|
1097
|
-
return {
|
|
1098
|
-
r: match[1],
|
|
1099
|
-
g: match[2],
|
|
1100
|
-
b: match[3],
|
|
1101
|
-
a: match[4]
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
if (match = matchers.hsl.exec(color)) {
|
|
1105
|
-
return {
|
|
1106
|
-
h: match[1],
|
|
1107
|
-
s: match[2],
|
|
1108
|
-
l: match[3]
|
|
1109
|
-
};
|
|
1110
|
-
}
|
|
1111
|
-
if (match = matchers.hsla.exec(color)) {
|
|
1112
|
-
return {
|
|
1113
|
-
h: match[1],
|
|
1114
|
-
s: match[2],
|
|
1115
|
-
l: match[3],
|
|
1116
|
-
a: match[4]
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
|
-
if (match = matchers.hsv.exec(color)) {
|
|
1120
|
-
return {
|
|
1121
|
-
h: match[1],
|
|
1122
|
-
s: match[2],
|
|
1123
|
-
v: match[3]
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
if (match = matchers.hsva.exec(color)) {
|
|
1127
|
-
return {
|
|
1128
|
-
h: match[1],
|
|
1129
|
-
s: match[2],
|
|
1130
|
-
v: match[3],
|
|
1131
|
-
a: match[4]
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
if (match = matchers.hex8.exec(color)) {
|
|
1135
|
-
return {
|
|
1136
|
-
r: parseIntFromHex(match[1]),
|
|
1137
|
-
g: parseIntFromHex(match[2]),
|
|
1138
|
-
b: parseIntFromHex(match[3]),
|
|
1139
|
-
a: convertHexToDecimal(match[4]),
|
|
1140
|
-
format: named ? "name" : "hex8"
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
if (match = matchers.hex6.exec(color)) {
|
|
1144
|
-
return {
|
|
1145
|
-
r: parseIntFromHex(match[1]),
|
|
1146
|
-
g: parseIntFromHex(match[2]),
|
|
1147
|
-
b: parseIntFromHex(match[3]),
|
|
1148
|
-
format: named ? "name" : "hex"
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
if (match = matchers.hex4.exec(color)) {
|
|
1152
|
-
return {
|
|
1153
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1154
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1155
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1156
|
-
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
1157
|
-
format: named ? "name" : "hex8"
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
if (match = matchers.hex3.exec(color)) {
|
|
1161
|
-
return {
|
|
1162
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1163
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1164
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1165
|
-
format: named ? "name" : "hex"
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
return false;
|
|
1169
|
-
}
|
|
1170
|
-
function validateWCAG2Parms(parms) {
|
|
1171
|
-
// return valid WCAG2 parms for isReadable.
|
|
1172
|
-
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
1173
|
-
var level, size;
|
|
1174
|
-
parms = parms || {
|
|
1175
|
-
level: "AA",
|
|
1176
|
-
size: "small"
|
|
1177
|
-
};
|
|
1178
|
-
level = (parms.level || "AA").toUpperCase();
|
|
1179
|
-
size = (parms.size || "small").toLowerCase();
|
|
1180
|
-
if (level !== "AA" && level !== "AAA") {
|
|
1181
|
-
level = "AA";
|
|
1182
|
-
}
|
|
1183
|
-
if (size !== "small" && size !== "large") {
|
|
1184
|
-
size = "small";
|
|
1185
|
-
}
|
|
1186
|
-
return {
|
|
1187
|
-
level: level,
|
|
1188
|
-
size: size
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
12
|
+
import '../_chunks/dep-5U9UjDaf.js';
|
|
13
|
+
import 'dayjs';
|
|
1191
14
|
|
|
1192
15
|
var tagDefaultProps = {
|
|
1193
16
|
closable: false,
|