@choice-ui/react 1.7.6 → 1.7.7
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/dist/components/colors/dist/index.d.ts +878 -0
- package/dist/components/colors/scripts/build-worker.d.ts +1 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.d.ts +14 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.js +403 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.d.ts +12 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.js +285 -0
- package/dist/components/colors/src/check-color-contrast/index.d.ts +2 -0
- package/dist/components/colors/src/color-area/color-area.d.ts +24 -0
- package/dist/components/colors/src/color-area/color-area.js +228 -0
- package/dist/components/colors/src/color-area/index.d.ts +1 -0
- package/dist/components/colors/src/color-area/tv.d.ts +34 -0
- package/dist/components/colors/src/color-area/tv.js +22 -0
- package/dist/components/colors/src/color-channel-field/color-channel-field.d.ts +22 -0
- package/dist/components/colors/src/color-channel-field/color-channel-field.js +110 -0
- package/dist/components/colors/src/color-channel-field/color-channel-input.d.ts +20 -0
- package/dist/components/colors/src/color-channel-field/color-channel-input.js +261 -0
- package/dist/components/colors/src/color-channel-field/index.d.ts +1 -0
- package/dist/components/colors/src/color-channel-field/tv.d.ts +101 -0
- package/dist/components/colors/src/color-channel-field/tv.js +85 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.d.ts +16 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.js +54 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-control.d.ts +18 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-control.js +149 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-list.d.ts +20 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-list.js +111 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.d.ts +18 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.js +281 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.d.ts +17 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.js +162 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.d.ts +10 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.js +62 -0
- package/dist/components/colors/src/color-gradients-paint/index.d.ts +3 -0
- package/dist/components/colors/src/color-image-paint/color-image-paint.d.ts +13 -0
- package/dist/components/colors/src/color-image-paint/color-image-paint.js +236 -0
- package/dist/components/colors/src/color-image-paint/color-image-toolbar.d.ts +9 -0
- package/dist/components/colors/src/color-image-paint/color-image-toolbar.js +52 -0
- package/dist/components/colors/src/color-image-paint/index.d.ts +1 -0
- package/dist/components/colors/src/color-image-paint/tv.d.ts +89 -0
- package/dist/components/colors/src/color-image-paint/tv.js +45 -0
- package/dist/components/colors/src/color-picker-content/color-picker-content.d.ts +18 -0
- package/dist/components/colors/src/color-picker-content/color-picker-content.js +58 -0
- package/dist/components/colors/src/color-picker-content/color-picker-custom-content.d.ts +16 -0
- package/dist/components/colors/src/color-picker-content/color-picker-custom-content.js +75 -0
- package/dist/components/colors/src/color-picker-content/index.d.ts +1 -0
- package/dist/components/colors/src/color-picker-content/paint-type-selector.d.ts +13 -0
- package/dist/components/colors/src/color-picker-content/paint-type-selector.js +50 -0
- package/dist/components/colors/src/color-picker-content/tv.d.ts +31 -0
- package/dist/components/colors/src/color-picker-content/tv.js +13 -0
- package/dist/components/colors/src/color-picker-popover/color-paints-type.d.ts +15 -0
- package/dist/components/colors/src/color-picker-popover/color-paints-type.js +56 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-popover.d.ts +26 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-popover.js +116 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-tabs.d.ts +14 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-tabs.js +47 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-title.d.ts +14 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-title.js +30 -0
- package/dist/components/colors/src/color-picker-popover/index.d.ts +3 -0
- package/dist/components/colors/src/color-picker-popover/tv.d.ts +37 -0
- package/dist/components/colors/src/color-slider/color-slider.d.ts +19 -0
- package/dist/components/colors/src/color-slider/color-slider.js +185 -0
- package/dist/components/colors/src/color-slider/index.d.ts +1 -0
- package/dist/components/colors/src/color-slider/tv.d.ts +31 -0
- package/dist/components/colors/src/color-slider/tv.js +21 -0
- package/dist/components/colors/src/color-solid-paint/color-native-picker.d.ts +8 -0
- package/dist/components/colors/src/color-solid-paint/color-native-picker.js +63 -0
- package/dist/components/colors/src/color-solid-paint/color-solid-paint.d.ts +25 -0
- package/dist/components/colors/src/color-solid-paint/color-solid-paint.js +295 -0
- package/dist/components/colors/src/color-solid-paint/index.d.ts +3 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.d.ts +10 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.js +20 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-area.d.ts +17 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-area.js +131 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.d.ts +20 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.js +147 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.d.ts +14 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.js +46 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-library-item.d.ts +8 -0
- package/dist/components/colors/src/color-solid-paint/tv.d.ts +79 -0
- package/dist/components/colors/src/color-solid-paint/tv.js +39 -0
- package/dist/components/colors/src/color-swatch/color-swatch.d.ts +15 -0
- package/dist/components/colors/src/color-swatch/color-swatch.js +111 -0
- package/dist/components/colors/src/color-swatch/index.d.ts +1 -0
- package/dist/components/colors/src/contents/color-space.d.ts +19 -0
- package/dist/components/colors/src/contents/color-space.js +16 -0
- package/dist/components/colors/src/contents/colors.d.ts +42 -0
- package/dist/components/colors/src/contents/colors.js +24 -0
- package/dist/components/colors/src/contents/index.d.ts +3 -0
- package/dist/components/colors/src/contents/translation.d.ts +100 -0
- package/dist/components/colors/src/contents/translation.js +94 -0
- package/dist/components/colors/src/context/colots-context.d.ts +24 -0
- package/dist/components/colors/src/context/colots-context.js +62 -0
- package/dist/components/colors/src/context/index.d.ts +1 -0
- package/dist/components/colors/src/fill-input/alpha-input.d.ts +12 -0
- package/dist/components/colors/src/fill-input/alpha-input.js +48 -0
- package/dist/components/colors/src/fill-input/color-input.d.ts +31 -0
- package/dist/components/colors/src/fill-input/color-input.js +115 -0
- package/dist/components/colors/src/fill-input/gradient-item.d.ts +25 -0
- package/dist/components/colors/src/fill-input/gradient-item.js +103 -0
- package/dist/components/colors/src/fill-input/image-item.d.ts +25 -0
- package/dist/components/colors/src/fill-input/image-item.js +89 -0
- package/dist/components/colors/src/fill-input/index.d.ts +5 -0
- package/dist/components/colors/src/fill-input/tv.d.ts +221 -0
- package/dist/components/colors/src/fill-input/tv.js +205 -0
- package/dist/components/colors/src/fill-input/variable-item.d.ts +22 -0
- package/dist/components/colors/src/fill-input/variable-item.js +105 -0
- package/dist/components/colors/src/hex-input/hex-input.d.ts +10 -0
- package/dist/components/colors/src/hex-input/hex-input.js +182 -0
- package/dist/components/colors/src/hex-input/index.d.ts +1 -0
- package/dist/components/colors/src/hex-input/tv.d.ts +1 -0
- package/dist/components/colors/src/hex-input/tv.js +12 -0
- package/dist/components/colors/src/hooks/index.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-color-contrast-recommendation.d.ts +36 -0
- package/dist/components/colors/src/hooks/use-color-contrast-recommendation.js +502 -0
- package/dist/components/colors/src/hooks/use-color-parser.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-color-parser.js +146 -0
- package/dist/components/colors/src/hooks/use-color-picker.d.ts +45 -0
- package/dist/components/colors/src/hooks/use-color-picker.js +117 -0
- package/dist/components/colors/src/hooks/use-color-profile.d.ts +2 -0
- package/dist/components/colors/src/hooks/use-color-profile.js +27 -0
- package/dist/components/colors/src/hooks/use-cursor.d.ts +1 -0
- package/dist/components/colors/src/hooks/use-cursor.js +25 -0
- package/dist/components/colors/src/hooks/use-features.d.ts +21 -0
- package/dist/components/colors/src/hooks/use-features.js +73 -0
- package/dist/components/colors/src/hooks/use-image-filter-style.d.ts +9 -0
- package/dist/components/colors/src/hooks/use-image-filter-style.js +25 -0
- package/dist/components/colors/src/hooks/use-image-processor.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-image-processor.js +121 -0
- package/dist/components/colors/src/hooks/use-paint-state.d.ts +16 -0
- package/dist/components/colors/src/hooks/use-paint-state.js +37 -0
- package/dist/components/colors/src/hooks/use-rgb-color-handler.d.ts +21 -0
- package/dist/components/colors/src/hooks/use-rgb-color-handler.js +58 -0
- package/dist/components/colors/src/index.d.ts +38 -0
- package/dist/components/colors/src/libraries/components/virtualized-grid-row.d.ts +36 -0
- package/dist/components/colors/src/libraries/components/virtualized-grid-row.js +53 -0
- package/dist/components/colors/src/libraries/components/virtualized-header.d.ts +9 -0
- package/dist/components/colors/src/libraries/components/virtualized-header.js +30 -0
- package/dist/components/colors/src/libraries/hooks/index.d.ts +2 -0
- package/dist/components/colors/src/libraries/hooks/use-category-options.d.ts +11 -0
- package/dist/components/colors/src/libraries/hooks/use-category-options.js +27 -0
- package/dist/components/colors/src/libraries/hooks/use-palette-color.d.ts +19 -0
- package/dist/components/colors/src/libraries/hooks/use-palette-color.js +41 -0
- package/dist/components/colors/src/libraries/index.d.ts +8 -0
- package/dist/components/colors/src/libraries/libraries-content.d.ts +8 -0
- package/dist/components/colors/src/libraries/libraries-empty-content.d.ts +5 -0
- package/dist/components/colors/src/libraries/libraries-header.d.ts +18 -0
- package/dist/components/colors/src/libraries/libraries-header.js +111 -0
- package/dist/components/colors/src/libraries/libraries-search-empty-content.d.ts +1 -0
- package/dist/components/colors/src/libraries/libraries-search-input.d.ts +6 -0
- package/dist/components/colors/src/libraries/libraries.d.ts +42 -0
- package/dist/components/colors/src/libraries/libraries.js +461 -0
- package/dist/components/colors/src/libraries/library-color-swatch.d.ts +21 -0
- package/dist/components/colors/src/libraries/library-item/index.d.ts +4 -0
- package/dist/components/colors/src/libraries/library-item/library-item.d.ts +21 -0
- package/dist/components/colors/src/libraries/library-item/library-item.js +151 -0
- package/dist/components/colors/src/libraries/library-item/library-list-item.d.ts +6 -0
- package/dist/components/colors/src/libraries/library-item/style-items.d.ts +17 -0
- package/dist/components/colors/src/libraries/library-item/style-items.js +63 -0
- package/dist/components/colors/src/libraries/library-item/variable-items.d.ts +19 -0
- package/dist/components/colors/src/libraries/library-item/variable-items.js +47 -0
- package/dist/components/colors/src/libraries/tv.d.ts +198 -0
- package/dist/components/colors/src/libraries/tv.js +141 -0
- package/dist/components/colors/src/simple-color-picker/index.d.ts +1 -0
- package/dist/components/colors/src/simple-color-picker/simple-color-picker.d.ts +17 -0
- package/dist/components/colors/src/simple-color-picker/simple-color-picker.js +153 -0
- package/dist/components/colors/src/types/base.d.ts +5 -0
- package/dist/components/colors/src/types/colors.d.ts +139 -0
- package/dist/components/colors/src/types/effect.d.ts +18 -0
- package/dist/components/colors/src/types/fill.d.ts +15 -0
- package/dist/components/colors/src/types/fonts.d.ts +38 -0
- package/dist/components/colors/src/types/index.d.ts +7 -0
- package/dist/components/colors/src/types/libraries.d.ts +7 -0
- package/dist/components/colors/src/types/paint.d.ts +139 -0
- package/dist/components/colors/src/types/style.d.ts +51 -0
- package/dist/components/colors/src/types/testing-library.d.ts +0 -0
- package/dist/components/colors/src/types/util.d.ts +26 -0
- package/dist/components/colors/src/types/variable.d.ts +27 -0
- package/dist/components/colors/src/utils/background.d.ts +12 -0
- package/dist/components/colors/src/utils/background.js +216 -0
- package/dist/components/colors/src/utils/color-profile-storage.d.ts +29 -0
- package/dist/components/colors/src/utils/color.d.ts +20 -0
- package/dist/components/colors/src/utils/color.js +45 -0
- package/dist/components/colors/src/utils/colors-convert.d.ts +18 -0
- package/dist/components/colors/src/utils/colors-convert.js +138 -0
- package/dist/components/colors/src/utils/contrast-utils.d.ts +27 -0
- package/dist/components/colors/src/utils/contrast-utils.js +25 -0
- package/dist/components/colors/src/utils/cursor.d.ts +1 -0
- package/dist/components/colors/src/utils/index.d.ts +7 -0
- package/dist/components/colors/src/utils/math.d.ts +9 -0
- package/dist/components/colors/src/utils/position.d.ts +33 -0
- package/dist/components/colors/src/utils/position.js +60 -0
- package/dist/components/colors/src/utils/validate.d.ts +10 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.d.ts +2 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.js +36 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.d.ts +1 -0
- package/dist/components/colors/src/workers/index.d.ts +1 -0
- package/dist/components/colors/tsup.config.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/textarea/src/tv.d.ts +9 -3
- package/dist/components/textarea/src/tv.js +3 -1
- package/dist/components/toggle-button/dist/index.js +602 -0
- package/dist/index.js +69 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/index.js +119 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/Color.js +42 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/chroma.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/colorbrewer.js +57 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/w3cx11.js +159 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/average.js +82 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/bezier.js +68 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/blend.js +43 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/cubehelix.js +81 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/mix.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/random.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/scale.js +325 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/_hsx.js +54 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hcg.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsi.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsl.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsv.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/index.js +4 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lab.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lch.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lrgb.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/num.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklab.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklch.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/rgb.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js +18 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/css2rgb.js +169 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/hsl2css.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lab2css.js +19 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lch2css.js +19 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklab2css.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklch2css.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/rgb2css.js +53 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/gl/index.js +21 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/hcg2rgb.js +48 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/rgb2hcg.js +24 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/hex2rgb.js +37 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/rgb2hex.js +31 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/hsi2rgb.js +36 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/rgb2hsi.js +28 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/hsl2rgb.js +35 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/rgb2hsl.js +29 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/hsv2rgb.js +46 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/rgb2hsv.js +27 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/input.js +7 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/index.js +28 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab-constants.js +106 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab2rgb.js +59 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/rgb2lab.js +51 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/hcl2rgb.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/index.js +35 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lab2lch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2lab.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2rgb.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/rgb2lch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/named/index.js +26 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/num2rgb.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/rgb2num.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/oklab2rgb.js +31 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/rgb2oklab.js +30 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/oklch2rgb.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/rgb2oklch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/rgb/index.js +34 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/index.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/rgb2temperature.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/temperature2rgb.js +18 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/alpha.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/clipped.js +4 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/darken.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/get.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/luminance.js +38 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/mix.js +5 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/premultiply.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/saturate.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/set.js +42 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/shade.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/analyze.js +161 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/clip_rgb.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrast.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrastAPCA.js +43 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/delta-e.js +48 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/distance.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/index.js +24 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/last.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/limit.js +7 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/multiply-matrices.js +29 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/scales.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/type.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/unpack.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/valid.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/version.js +4 -0
- package/dist/node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.js +1317 -0
- package/dist/styles/components.css +40 -0
- package/dist/tailwind.css +1 -0
- package/package.json +32 -20
- package/dist/components/virtual-select/dist/index.d.ts +0 -48
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import tinycolor from "tinycolor2";
|
|
2
|
+
function getColorAreaBackground(type, hue = 0, colorSpace) {
|
|
3
|
+
const { r, g, b } = tinycolor({ h: hue, s: 1, l: 0.5 }).toRgb();
|
|
4
|
+
const backgrounds = {
|
|
5
|
+
"saturation-lightness": {
|
|
6
|
+
background: colorSpace === "srgb" ? `
|
|
7
|
+
linear-gradient(to top,
|
|
8
|
+
rgb(0, 0, 0) 0%,
|
|
9
|
+
rgba(0, 0, 0, 0) 50%,
|
|
10
|
+
rgba(255, 255, 255, 0) 50%,
|
|
11
|
+
rgb(255, 255, 255) 100%),
|
|
12
|
+
linear-gradient(to right,
|
|
13
|
+
rgb(128, 128, 128),
|
|
14
|
+
rgba(128, 128, 128, 0)),
|
|
15
|
+
rgb(${r}, ${g}, ${b})
|
|
16
|
+
` : `
|
|
17
|
+
linear-gradient(to top,
|
|
18
|
+
color(display-p3 0 0 0) 0%,
|
|
19
|
+
color(display-p3 0 0 0/0) 50%,
|
|
20
|
+
color(display-p3 1 1 1/0) 50%,
|
|
21
|
+
color(display-p3 1 1 1) 100%),
|
|
22
|
+
linear-gradient(to right,
|
|
23
|
+
color(display-p3 0.5 0.5 0.5),
|
|
24
|
+
color(display-p3 0.5 0.5 0.5/0)),
|
|
25
|
+
color(display-p3 ${r / 255} ${g / 255} ${b / 255})
|
|
26
|
+
`
|
|
27
|
+
},
|
|
28
|
+
"saturation-brightness": {
|
|
29
|
+
background: colorSpace === "srgb" ? `
|
|
30
|
+
linear-gradient(
|
|
31
|
+
rgba(0, 0, 0, 0) 0%,
|
|
32
|
+
rgb(0, 0, 0) 100%),
|
|
33
|
+
linear-gradient(
|
|
34
|
+
to right, rgb(255, 255, 255) 0%,
|
|
35
|
+
rgb(${r}, ${g}, ${b}) 100%)
|
|
36
|
+
` : `
|
|
37
|
+
linear-gradient(
|
|
38
|
+
color(display-p3 0 0 0 / 0) 0%,
|
|
39
|
+
color(display-p3 0 0 0) 100%),
|
|
40
|
+
linear-gradient(
|
|
41
|
+
to right, color(display-p3 1 1 1) 0%,
|
|
42
|
+
color(display-p3 ${r / 255} ${g / 255} ${b / 255}) 100%)
|
|
43
|
+
`
|
|
44
|
+
},
|
|
45
|
+
"hue-saturation": {
|
|
46
|
+
background: colorSpace === "srgb" ? `
|
|
47
|
+
linear-gradient(to top,
|
|
48
|
+
rgb(128, 128, 128), transparent),
|
|
49
|
+
linear-gradient(to right,
|
|
50
|
+
rgb(255, 0, 0),
|
|
51
|
+
rgb(255, 255, 0),
|
|
52
|
+
rgb(0, 255, 0),
|
|
53
|
+
rgb(0, 255, 255),
|
|
54
|
+
rgb(0, 0, 255),
|
|
55
|
+
rgb(255, 0, 255),
|
|
56
|
+
rgb(255, 0, 0))
|
|
57
|
+
` : `
|
|
58
|
+
linear-gradient(to top,
|
|
59
|
+
color(display-p3 0.5 0.5 0.5), transparent),
|
|
60
|
+
linear-gradient(to right,
|
|
61
|
+
color(display-p3 1 0 0),
|
|
62
|
+
color(display-p3 1 1 0),
|
|
63
|
+
color(display-p3 0 1 0),
|
|
64
|
+
color(display-p3 0 1 1),
|
|
65
|
+
color(display-p3 0 0 1),
|
|
66
|
+
color(display-p3 1 0 1),
|
|
67
|
+
color(display-p3 1 0 0))
|
|
68
|
+
`
|
|
69
|
+
},
|
|
70
|
+
"hue-lightness": {
|
|
71
|
+
background: colorSpace === "srgb" ? `
|
|
72
|
+
linear-gradient(to top,
|
|
73
|
+
rgba(255, 255, 255, 0.93),
|
|
74
|
+
rgba(255, 255, 255, 0)),
|
|
75
|
+
linear-gradient(to right,
|
|
76
|
+
rgba(255, 0, 0, 0.93),
|
|
77
|
+
rgba(255, 255, 0, 0.93),
|
|
78
|
+
rgba(0, 255, 0, 0.93),
|
|
79
|
+
rgba(0, 255, 255, 0.93),
|
|
80
|
+
rgba(0, 0, 255, 0.93),
|
|
81
|
+
rgba(255, 0, 255, 0.93),
|
|
82
|
+
rgba(255, 0, 4, 0.93)),
|
|
83
|
+
rgb(0, 0, 0)
|
|
84
|
+
` : `
|
|
85
|
+
linear-gradient(to top,
|
|
86
|
+
color(display-p3 1 1 1 / 0.93),
|
|
87
|
+
color(display-p3 1 1 1 / 0)),
|
|
88
|
+
linear-gradient(to right,
|
|
89
|
+
color(display-p3 1 0 0 / 0.93),
|
|
90
|
+
color(display-p3 1 1 0 / 0.93),
|
|
91
|
+
color(display-p3 0 1 0 / 0.93),
|
|
92
|
+
color(display-p3 0 1 1 / 0.93),
|
|
93
|
+
color(display-p3 0 0 1 / 0.93),
|
|
94
|
+
color(display-p3 1 0 1 / 0.93),
|
|
95
|
+
color(display-p3 1 0 0.0157 / 0.93)),
|
|
96
|
+
color(display-p3 0 0 0)
|
|
97
|
+
`
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return backgrounds[type];
|
|
101
|
+
}
|
|
102
|
+
function getSliderBackground(type, hue = 0, colorSpace) {
|
|
103
|
+
const {
|
|
104
|
+
r: saturation_1_r,
|
|
105
|
+
g: saturation_1_g,
|
|
106
|
+
b: saturation_1_b
|
|
107
|
+
} = tinycolor({ h: hue, s: 0, l: 0.5 }).toRgb();
|
|
108
|
+
const {
|
|
109
|
+
r: saturation_2_r,
|
|
110
|
+
g: saturation_2_g,
|
|
111
|
+
b: saturation_2_b
|
|
112
|
+
} = tinycolor({ h: hue, s: 1, l: 0.5 }).toRgb();
|
|
113
|
+
const {
|
|
114
|
+
r: lightness_1_r,
|
|
115
|
+
g: lightness_1_g,
|
|
116
|
+
b: lightness_1_b
|
|
117
|
+
} = tinycolor({ h: hue, s: 1, l: 0 }).toRgb();
|
|
118
|
+
const {
|
|
119
|
+
r: lightness_2_r,
|
|
120
|
+
g: lightness_2_g,
|
|
121
|
+
b: lightness_2_b
|
|
122
|
+
} = tinycolor({ h: hue, s: 1, l: 0.5 }).toRgb();
|
|
123
|
+
const {
|
|
124
|
+
r: lightness_3_r,
|
|
125
|
+
g: lightness_3_g,
|
|
126
|
+
b: lightness_3_b
|
|
127
|
+
} = tinycolor({ h: hue, s: 1, l: 1 }).toRgb();
|
|
128
|
+
const { r: alpha_r, g: alpha_g, b: alpha_b } = tinycolor({ h: hue, s: 1, l: 0.5 }).toRgb();
|
|
129
|
+
switch (type) {
|
|
130
|
+
case "hue":
|
|
131
|
+
return {
|
|
132
|
+
background: colorSpace === "srgb" ? `
|
|
133
|
+
linear-gradient(to right,
|
|
134
|
+
rgb(255, 0, 0),
|
|
135
|
+
rgb(255, 255, 0),
|
|
136
|
+
rgb(0, 255, 0),
|
|
137
|
+
rgb(0, 255, 255),
|
|
138
|
+
rgb(0, 0, 255),
|
|
139
|
+
rgb(255, 0, 255),
|
|
140
|
+
rgb(255, 0, 0))
|
|
141
|
+
` : `
|
|
142
|
+
linear-gradient(to right,
|
|
143
|
+
color(display-p3 1 0 0),
|
|
144
|
+
color(display-p3 1 1 0),
|
|
145
|
+
color(display-p3 0 1 0),
|
|
146
|
+
color(display-p3 0 1 1),
|
|
147
|
+
color(display-p3 0 0 1),
|
|
148
|
+
color(display-p3 1 0 1),
|
|
149
|
+
color(display-p3 1 0 0))
|
|
150
|
+
`
|
|
151
|
+
};
|
|
152
|
+
case "saturation":
|
|
153
|
+
return {
|
|
154
|
+
background: colorSpace === "srgb" ? `
|
|
155
|
+
linear-gradient(to right,
|
|
156
|
+
rgb(${saturation_1_r}, ${saturation_1_g}, ${saturation_1_b}),
|
|
157
|
+
rgb(${saturation_2_r}, ${saturation_2_g}, ${saturation_2_b}))
|
|
158
|
+
` : `
|
|
159
|
+
linear-gradient(to right,
|
|
160
|
+
color(display-p3 ${saturation_1_r / 255} ${saturation_1_g / 255} ${saturation_1_b / 255}),
|
|
161
|
+
color(display-p3 ${saturation_2_r / 255} ${saturation_2_g / 255} ${saturation_2_b / 255}))
|
|
162
|
+
`
|
|
163
|
+
};
|
|
164
|
+
case "lightness":
|
|
165
|
+
return {
|
|
166
|
+
background: colorSpace === "srgb" ? `
|
|
167
|
+
linear-gradient(to right,
|
|
168
|
+
rgb(${lightness_1_r}, ${lightness_1_g}, ${lightness_1_b}),
|
|
169
|
+
rgb(${lightness_2_r}, ${lightness_2_g}, ${lightness_2_b}),
|
|
170
|
+
rgb(${lightness_3_r}, ${lightness_3_g}, ${lightness_3_b}))
|
|
171
|
+
` : `
|
|
172
|
+
linear-gradient(to right,
|
|
173
|
+
color(display-p3 ${lightness_1_r / 255} ${lightness_1_g / 255} ${lightness_1_b / 255}),
|
|
174
|
+
color(display-p3 ${lightness_2_r / 255} ${lightness_2_g / 255} ${lightness_2_b / 255}),
|
|
175
|
+
color(display-p3 ${lightness_3_r / 255} ${lightness_3_g / 255} ${lightness_3_b / 255}))
|
|
176
|
+
`
|
|
177
|
+
};
|
|
178
|
+
case "alpha":
|
|
179
|
+
return {
|
|
180
|
+
background: colorSpace === "srgb" ? `
|
|
181
|
+
linear-gradient(to right,
|
|
182
|
+
rgba(${alpha_r}, ${alpha_g}, ${alpha_b}, 0),
|
|
183
|
+
rgba(${alpha_r}, ${alpha_g}, ${alpha_b}, 1)),
|
|
184
|
+
repeating-conic-gradient(
|
|
185
|
+
rgb(204, 204, 204) 0%,
|
|
186
|
+
rgb(204, 204, 204) 25%,
|
|
187
|
+
rgb(255, 255, 255) 0%,
|
|
188
|
+
rgb(255, 255, 255) 50%
|
|
189
|
+
) left top / 11px 11px
|
|
190
|
+
` : `
|
|
191
|
+
linear-gradient(to right,
|
|
192
|
+
color(display-p3 ${alpha_r / 255} ${alpha_g / 255} ${alpha_b / 255} / 0),
|
|
193
|
+
color(display-p3 ${alpha_r / 255} ${alpha_g / 255} ${alpha_b / 255} / 1)),
|
|
194
|
+
repeating-conic-gradient(
|
|
195
|
+
color(display-p3 0.8 0.8 0.8) 0%,
|
|
196
|
+
color(display-p3 0.8 0.8 0.8) 25%,
|
|
197
|
+
color(display-p3 1 1 1) 0%,
|
|
198
|
+
color(display-p3 1 1 1) 50%
|
|
199
|
+
) left top / 11px 11px
|
|
200
|
+
`
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function getColorSwatchBackground(size, scale = 3, colors) {
|
|
205
|
+
return `repeating-conic-gradient(
|
|
206
|
+
${"rgb(204, 204, 204)"} 0%,
|
|
207
|
+
${"rgb(204, 204, 204)"} 25%,
|
|
208
|
+
${"white"} 0%,
|
|
209
|
+
${"white"} 50%
|
|
210
|
+
) left top / ${size / scale}px ${size / scale}px`;
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
getColorAreaBackground,
|
|
214
|
+
getColorSwatchBackground,
|
|
215
|
+
getSliderBackground
|
|
216
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ColorProfile } from '../types/colors';
|
|
2
|
+
/**
|
|
3
|
+
* 颜色配置文件持久化工具
|
|
4
|
+
*
|
|
5
|
+
* 这个工具负责颜色配置文件偏好的读取、存储和清除,
|
|
6
|
+
* 与组件逻辑完全分离,可以在业务代码中单独使用。
|
|
7
|
+
*/
|
|
8
|
+
export declare const colorProfileStorage: {
|
|
9
|
+
/**
|
|
10
|
+
* 获取存储的颜色配置
|
|
11
|
+
* @returns 存储的颜色配置,如果没有则返回 null
|
|
12
|
+
*/
|
|
13
|
+
get: () => ColorProfile | null;
|
|
14
|
+
/**
|
|
15
|
+
* 设置颜色配置
|
|
16
|
+
* @param profile 要存储的颜色配置
|
|
17
|
+
*/
|
|
18
|
+
set: (profile: ColorProfile) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 清除存储的颜色配置
|
|
21
|
+
*/
|
|
22
|
+
clear: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* 监听存储变化
|
|
25
|
+
* @param callback 当存储发生变化时的回调函数
|
|
26
|
+
* @returns 一个清理函数,用于移除事件监听
|
|
27
|
+
*/
|
|
28
|
+
subscribe: (callback: (profile: ColorProfile | null) => void) => (() => void);
|
|
29
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ColorProfile, RGB, RGBA, Transform } from '../types/colors';
|
|
2
|
+
import { GradientPaint } from '../types/paint';
|
|
3
|
+
export declare const getColorArr: (color: RGB | RGBA) => {
|
|
4
|
+
alpha: number;
|
|
5
|
+
color: RGB;
|
|
6
|
+
};
|
|
7
|
+
export declare const getRGBAString: (color: RGB | RGBA, alpha?: number) => string;
|
|
8
|
+
export declare const getGradientString: (gradientStops: GradientPaint["gradientStops"], gradientType: GradientPaint["type"], gradientTransform: GradientPaint["gradientTransform"], colorProfile?: ColorProfile) => string;
|
|
9
|
+
export declare const getLinearGradientAngle: (gradientTransform: Transform) => number;
|
|
10
|
+
export declare const getRadialGradientPosition: (gradientTransform: Transform) => {
|
|
11
|
+
widthFactor: number;
|
|
12
|
+
heightFactor: number;
|
|
13
|
+
centerAnchorX: number;
|
|
14
|
+
centerAnchorY: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const getConicGradientPosition: (gradientTransform: Transform) => {
|
|
17
|
+
angle: number;
|
|
18
|
+
centerAnchorX: number;
|
|
19
|
+
centerAnchorY: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { round } from "es-toolkit";
|
|
2
|
+
import { profileConvertString } from "./colors-convert.js";
|
|
3
|
+
const getColorArr = (color) => {
|
|
4
|
+
if ("a" in color) {
|
|
5
|
+
return {
|
|
6
|
+
color: {
|
|
7
|
+
r: color.r,
|
|
8
|
+
g: color.g,
|
|
9
|
+
b: color.b
|
|
10
|
+
},
|
|
11
|
+
alpha: color.a
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
color: {
|
|
16
|
+
r: color.r,
|
|
17
|
+
g: color.g,
|
|
18
|
+
b: color.b
|
|
19
|
+
},
|
|
20
|
+
alpha: 1
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const getGradientString = (gradientStops, gradientType, gradientTransform, colorProfile) => {
|
|
24
|
+
const getStopString = (stop) => {
|
|
25
|
+
const color = {
|
|
26
|
+
...stop.color,
|
|
27
|
+
a: round(stop.alpha, 2)
|
|
28
|
+
};
|
|
29
|
+
return `${profileConvertString(color, colorProfile ?? "srgb")} ${round(stop.position * 100, 2)}%`;
|
|
30
|
+
};
|
|
31
|
+
const stops = gradientStops.map(getStopString).join(", ");
|
|
32
|
+
const angle = gradientTransform[0][2];
|
|
33
|
+
switch (gradientType) {
|
|
34
|
+
case "GRADIENT_RADIAL":
|
|
35
|
+
return `radial-gradient(circle, ${stops})`;
|
|
36
|
+
case "GRADIENT_ANGULAR":
|
|
37
|
+
return `conic-gradient(from ${angle}deg, ${stops})`;
|
|
38
|
+
default:
|
|
39
|
+
return `linear-gradient(${angle}deg, ${stops})`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
getColorArr,
|
|
44
|
+
getGradientString
|
|
45
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HSB, HSL, RGB, RGBA, ColorProfile, CheckColorContrastLevel, CheckColorContrastCategory } from '../types/colors';
|
|
2
|
+
export declare function rgbToHsl({ r, g, b }: RGB, prevHue?: number): HSL;
|
|
3
|
+
export declare function hslToRgb({ h, s, l }: HSL): RGB;
|
|
4
|
+
export declare function rgbToHsb({ r, g, b }: RGB): HSB;
|
|
5
|
+
export declare function hsbToRgb({ h, s, b }: HSB): RGB;
|
|
6
|
+
export declare function rgbToP3({ r, g, b, a }: RGBA): RGBA;
|
|
7
|
+
export declare function p3ToRgb({ r, g, b, a }: RGBA): RGBA;
|
|
8
|
+
export declare function p3StringToRgbString(color: string): string;
|
|
9
|
+
export declare const profileConvertString: (value: RGB | RGBA, colorProfile: ColorProfile) => string | RGB;
|
|
10
|
+
export declare const rgbaToRgb: (rgba: RGBA) => RGB;
|
|
11
|
+
export declare const stringToRgba: (color: string) => RGBA;
|
|
12
|
+
/**
|
|
13
|
+
* 根据 WCAG 标准计算对比度阈值
|
|
14
|
+
* @param level 对比度级别 (AA / AAA)
|
|
15
|
+
* @param category 内容类别 (文本/图形)
|
|
16
|
+
* @returns 对比度阈值
|
|
17
|
+
*/
|
|
18
|
+
export declare function getContrastThreshold(level?: CheckColorContrastLevel, category?: CheckColorContrastCategory, selectedElementType?: "text" | "graphics"): number;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { round } from "es-toolkit";
|
|
2
|
+
import tinycolor from "tinycolor2";
|
|
3
|
+
function rgbToHsl({ r, g, b }, prevHue) {
|
|
4
|
+
try {
|
|
5
|
+
const color = tinycolor({ r, g, b });
|
|
6
|
+
const hsl = color.toHsl();
|
|
7
|
+
return {
|
|
8
|
+
h: isNaN(hsl.h) ? prevHue ?? 0 : hsl.h,
|
|
9
|
+
s: round(hsl.s, 2),
|
|
10
|
+
l: round(hsl.l, 2)
|
|
11
|
+
};
|
|
12
|
+
} catch {
|
|
13
|
+
return { h: prevHue ?? 0, s: 0, l: 0 };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function hslToRgb({ h, s, l }) {
|
|
17
|
+
try {
|
|
18
|
+
const color = tinycolor({ h, s, l });
|
|
19
|
+
const rgb = color.toRgb();
|
|
20
|
+
return {
|
|
21
|
+
r: round(rgb.r),
|
|
22
|
+
g: round(rgb.g),
|
|
23
|
+
b: round(rgb.b)
|
|
24
|
+
};
|
|
25
|
+
} catch {
|
|
26
|
+
return { r: 0, g: 0, b: 0 };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function rgbToHsb({ r, g, b }) {
|
|
30
|
+
const color = tinycolor({ r, g, b });
|
|
31
|
+
const hsb = color.toHsv();
|
|
32
|
+
return {
|
|
33
|
+
h: hsb.h,
|
|
34
|
+
s: hsb.s,
|
|
35
|
+
b: hsb.v
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function hsbToRgb({ h, s, b }) {
|
|
39
|
+
const color = tinycolor({ h, s, v: b });
|
|
40
|
+
const rgb = color.toRgb();
|
|
41
|
+
return {
|
|
42
|
+
r: rgb.r,
|
|
43
|
+
g: rgb.g,
|
|
44
|
+
b: rgb.b
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function rgbToP3({ r, g, b, a }) {
|
|
48
|
+
return {
|
|
49
|
+
r: r / 255,
|
|
50
|
+
g: g / 255,
|
|
51
|
+
b: b / 255,
|
|
52
|
+
a
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function p3ToRgb({ r, g, b, a }) {
|
|
56
|
+
return {
|
|
57
|
+
r: r * 255,
|
|
58
|
+
g: g * 255,
|
|
59
|
+
b: b * 255,
|
|
60
|
+
a
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function p3StringToRgbString(color) {
|
|
64
|
+
const matches = color.match(/\d+/g) || ["0", "0", "0"];
|
|
65
|
+
const [r, g, b] = matches.map(Number);
|
|
66
|
+
return `rgb(${r * 255}, ${g * 255}, ${b * 255})`;
|
|
67
|
+
}
|
|
68
|
+
const profileConvertString = (value, colorProfile) => {
|
|
69
|
+
try {
|
|
70
|
+
return typeof value === "object" && "a" in value ? colorProfile === "srgb" ? `rgba(${value.r} ${value.g} ${value.b} / ${value.a})` : `color(display-p3 ${round(value.r / 255, 3)} ${round(value.g / 255, 3)} ${round(value.b / 255, 3)} / ${round(value.a, 3)})` : colorProfile === "srgb" ? `rgb(${value.r} ${value.g} ${value.b})` : `color(display-p3 ${round(value.r / 255, 3)} ${round(value.g / 255, 3)} ${round(value.b / 255, 3)})`;
|
|
71
|
+
} catch {
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const rgbaToRgb = (rgba) => {
|
|
76
|
+
return {
|
|
77
|
+
r: rgba.r,
|
|
78
|
+
g: rgba.g,
|
|
79
|
+
b: rgba.b
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const stringToRgba = (color) => {
|
|
83
|
+
const rgbaRegex = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+))?\s*\)$/i;
|
|
84
|
+
const match = color.match(rgbaRegex);
|
|
85
|
+
if (!match) {
|
|
86
|
+
throw new Error("Invalid color format");
|
|
87
|
+
}
|
|
88
|
+
const [, r, g, b, a] = match;
|
|
89
|
+
return {
|
|
90
|
+
r: parseInt(r, 10),
|
|
91
|
+
g: parseInt(g, 10),
|
|
92
|
+
b: parseInt(b, 10),
|
|
93
|
+
a: a ? parseFloat(a) : 1
|
|
94
|
+
// Default alpha to 1 if not provided
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
function getContrastThreshold(level = "AA", category = "auto", selectedElementType = "graphics") {
|
|
98
|
+
if (level === "AAA") {
|
|
99
|
+
switch (category) {
|
|
100
|
+
case "large-text":
|
|
101
|
+
return 4.5;
|
|
102
|
+
case "normal-text":
|
|
103
|
+
return 7;
|
|
104
|
+
case "graphics":
|
|
105
|
+
return 3;
|
|
106
|
+
case "auto":
|
|
107
|
+
return selectedElementType === "text" ? 7 : 3;
|
|
108
|
+
default:
|
|
109
|
+
return selectedElementType === "text" ? 7 : 3;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
switch (category) {
|
|
113
|
+
case "large-text":
|
|
114
|
+
return 3;
|
|
115
|
+
case "normal-text":
|
|
116
|
+
return 4.5;
|
|
117
|
+
case "graphics":
|
|
118
|
+
return 3;
|
|
119
|
+
case "auto":
|
|
120
|
+
return selectedElementType === "text" ? 4.5 : 3;
|
|
121
|
+
default:
|
|
122
|
+
return selectedElementType === "text" ? 4.5 : 3;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
getContrastThreshold,
|
|
128
|
+
hsbToRgb,
|
|
129
|
+
hslToRgb,
|
|
130
|
+
p3StringToRgbString,
|
|
131
|
+
p3ToRgb,
|
|
132
|
+
profileConvertString,
|
|
133
|
+
rgbToHsb,
|
|
134
|
+
rgbToHsl,
|
|
135
|
+
rgbToP3,
|
|
136
|
+
rgbaToRgb,
|
|
137
|
+
stringToRgba
|
|
138
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CheckColorContrastCategory, CheckColorContrastLevel, RGB } from '../types/colors';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate contrast ratio between two colors accounting for alpha blending
|
|
4
|
+
* @param backgroundColor Background color as RGB object or color string
|
|
5
|
+
* @param foregroundColor Foreground color as RGB object or color string
|
|
6
|
+
* @param foregroundAlpha Alpha value of the foreground color (0-1)
|
|
7
|
+
* @returns Contrast ratio as a number
|
|
8
|
+
*/
|
|
9
|
+
export declare const calculateContrastRatio: (backgroundColor: RGB, foregroundColor: RGB, foregroundAlpha?: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Determine if a color combination meets the specified contrast standard
|
|
12
|
+
* @param backgroundColor Background color
|
|
13
|
+
* @param foregroundColor Foreground color
|
|
14
|
+
* @param foregroundAlpha Alpha value of foreground color
|
|
15
|
+
* @param level Accessibility level (AA or AAA)
|
|
16
|
+
* @param category Type of content
|
|
17
|
+
* @param elementType Type of element (text or graphics)
|
|
18
|
+
* @returns Boolean indicating if the contrast meets the standard
|
|
19
|
+
*/
|
|
20
|
+
export declare const meetsContrastStandard: (backgroundColor: RGB, foregroundColor: RGB, foregroundAlpha?: number, level?: CheckColorContrastLevel, category?: CheckColorContrastCategory, elementType?: "text" | "graphics") => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Get the effective element type based on category and selected element type
|
|
23
|
+
* @param category Content category
|
|
24
|
+
* @param selectedElementType Selected element type
|
|
25
|
+
* @returns Effective element type (text or graphics)
|
|
26
|
+
*/
|
|
27
|
+
export declare const getEffectiveElementType: (category?: CheckColorContrastCategory, selectedElementType?: "text" | "graphics") => "text" | "graphics";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import tinycolor from "tinycolor2";
|
|
2
|
+
const calculateContrastRatio = (backgroundColor, foregroundColor, foregroundAlpha = 1) => {
|
|
3
|
+
const bgColor = tinycolor(backgroundColor);
|
|
4
|
+
const fgColor = tinycolor(foregroundColor);
|
|
5
|
+
fgColor.setAlpha(foregroundAlpha);
|
|
6
|
+
let actualFgColor = fgColor;
|
|
7
|
+
if (foregroundAlpha < 1) {
|
|
8
|
+
actualFgColor = tinycolor.mix(
|
|
9
|
+
bgColor.toRgbString(),
|
|
10
|
+
fgColor.toRgbString(),
|
|
11
|
+
foregroundAlpha * 100
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return tinycolor.readability(bgColor, actualFgColor);
|
|
15
|
+
};
|
|
16
|
+
const getEffectiveElementType = (category, selectedElementType) => {
|
|
17
|
+
if (category === "large-text" || category === "normal-text") {
|
|
18
|
+
return "text";
|
|
19
|
+
}
|
|
20
|
+
return selectedElementType ?? "graphics";
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
calculateContrastRatio,
|
|
24
|
+
getEffectiveElementType
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cursorUrl: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PI: number;
|
|
2
|
+
export declare const RAD2DEG: number;
|
|
3
|
+
export declare function wrapAngle(angle: number, benchmark?: number): number;
|
|
4
|
+
/**
|
|
5
|
+
* 将弧度转换为角度
|
|
6
|
+
* @param radians 弧度值
|
|
7
|
+
* @returns 对应的角度值
|
|
8
|
+
*/
|
|
9
|
+
export declare function radToDeg(radians: number): number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HSB, HSL, PickerAreaType, PickerSliderType } from '../types/colors';
|
|
2
|
+
import { Vector } from '../types/base';
|
|
3
|
+
/**
|
|
4
|
+
* Convert position to color values based on color area type
|
|
5
|
+
*/
|
|
6
|
+
export declare function positionToAreaColor(position: Vector, type: PickerAreaType, hue?: number): HSB | HSL;
|
|
7
|
+
/**
|
|
8
|
+
* Convert color values to position based on color area type
|
|
9
|
+
*/
|
|
10
|
+
export declare function colorToAreaPosition(color: HSB | HSL, type: PickerAreaType): Vector;
|
|
11
|
+
/**
|
|
12
|
+
* Convert HSB to HSL
|
|
13
|
+
*/
|
|
14
|
+
export declare function hsbToHsl(hsb: HSB): HSL;
|
|
15
|
+
/**
|
|
16
|
+
* Convert HSL to HSB
|
|
17
|
+
*/
|
|
18
|
+
export declare function hslToHsb(hsl: HSL): HSB;
|
|
19
|
+
/**
|
|
20
|
+
* Color value stabilizer for edge cases
|
|
21
|
+
*/
|
|
22
|
+
export declare class ColorStabilizer {
|
|
23
|
+
private readonly EDGE_THRESHOLD;
|
|
24
|
+
private readonly BRIGHTNESS_THRESHOLD;
|
|
25
|
+
stabilizeHSB(hsb: HSB): HSB;
|
|
26
|
+
stabilizeHSL(hsl: HSL): HSL;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Convert slider position to color value string
|
|
30
|
+
*/
|
|
31
|
+
export declare function positionToSliderValue(position: number, type: PickerSliderType, hue?: number): string;
|
|
32
|
+
export declare const isEdgeValue: (value: number) => boolean;
|
|
33
|
+
export type { HSB, HSL, Vector };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const MAX_HUE = 360;
|
|
2
|
+
const MAX_PERCENTAGE = 100;
|
|
3
|
+
const DEFAULT_LIGHTNESS = 50;
|
|
4
|
+
function positionToAreaColor(position, type, hue = 0) {
|
|
5
|
+
const { x, y } = position;
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "saturation-lightness": {
|
|
8
|
+
return {
|
|
9
|
+
h: hue,
|
|
10
|
+
s: x * MAX_PERCENTAGE,
|
|
11
|
+
l: y * MAX_PERCENTAGE
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
case "saturation-brightness": {
|
|
15
|
+
return {
|
|
16
|
+
h: hue,
|
|
17
|
+
s: x * MAX_PERCENTAGE,
|
|
18
|
+
b: y * MAX_PERCENTAGE
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function colorToAreaPosition(color, type) {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case "saturation-lightness": {
|
|
26
|
+
const hsl = color;
|
|
27
|
+
return {
|
|
28
|
+
x: hsl.s / MAX_PERCENTAGE,
|
|
29
|
+
y: hsl.l / MAX_PERCENTAGE
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
case "saturation-brightness": {
|
|
33
|
+
const hsb = color;
|
|
34
|
+
return {
|
|
35
|
+
x: hsb.s / MAX_PERCENTAGE,
|
|
36
|
+
y: hsb.b / MAX_PERCENTAGE
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function positionToSliderValue(position, type, hue = 0) {
|
|
42
|
+
const value = position * MAX_PERCENTAGE;
|
|
43
|
+
switch (type) {
|
|
44
|
+
case "hue":
|
|
45
|
+
return `hsl(${position * MAX_HUE % MAX_HUE}, ${MAX_PERCENTAGE}%, ${DEFAULT_LIGHTNESS}%)`;
|
|
46
|
+
case "saturation":
|
|
47
|
+
return `hsl(${hue}, ${Math.round(value)}%, ${DEFAULT_LIGHTNESS}%)`;
|
|
48
|
+
case "lightness":
|
|
49
|
+
return `hsl(${hue}, ${MAX_PERCENTAGE}%, ${Math.round(value)}%)`;
|
|
50
|
+
case "alpha":
|
|
51
|
+
return `hsla(${hue}, ${MAX_PERCENTAGE}%, ${DEFAULT_LIGHTNESS}%, ${position})`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const isEdgeValue = (value) => Math.abs(value) < 0.01 || Math.abs(value - 1) < 0.01;
|
|
55
|
+
export {
|
|
56
|
+
colorToAreaPosition,
|
|
57
|
+
isEdgeValue,
|
|
58
|
+
positionToAreaColor,
|
|
59
|
+
positionToSliderValue
|
|
60
|
+
};
|