@jesscss/fns 1.0.8-alpha.8 → 2.0.0-alpha.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/README.md +15 -5
- package/lib/__tests__/color-adjustments.test.d.ts +1 -0
- package/lib/__tests__/color-adjustments.test.js +137 -0
- package/lib/__tests__/color-adjustments.test.js.map +1 -0
- package/lib/__tests__/color-components.test.d.ts +1 -0
- package/lib/__tests__/color-components.test.js +76 -0
- package/lib/__tests__/color-components.test.js.map +1 -0
- package/lib/__tests__/color.test.d.ts +1 -0
- package/lib/__tests__/color.test.js +41 -0
- package/lib/__tests__/color.test.js.map +1 -0
- package/lib/__tests__/floor.test.d.ts +1 -0
- package/lib/__tests__/floor.test.js +38 -0
- package/lib/__tests__/floor.test.js.map +1 -0
- package/lib/__tests__/iif.d.ts +1 -0
- package/lib/__tests__/iif.js +38 -0
- package/lib/__tests__/iif.test.d.ts +1 -0
- package/lib/__tests__/iif.test.js +34 -0
- package/lib/__tests__/iif.test.js.map +1 -0
- package/lib/__tests__/math.d.ts +1 -0
- package/lib/__tests__/math.js +45 -0
- package/lib/__tests__/math.test.d.ts +1 -0
- package/lib/__tests__/math.test.js +46 -0
- package/lib/__tests__/math.test.js.map +1 -0
- package/lib/conversions.d.ts +46 -0
- package/lib/conversions.js +142 -0
- package/lib/conversions.js.map +1 -0
- package/lib/index.d.ts +1 -5
- package/lib/index.js +3 -17
- package/lib/index.js.map +1 -0
- package/lib/less/__tests__/advanced-blend-modes.test.d.ts +1 -0
- package/lib/less/__tests__/advanced-blend-modes.test.js +29 -0
- package/lib/less/__tests__/advanced-blend-modes.test.js.map +1 -0
- package/lib/less/__tests__/alpha-adjustments.test.d.ts +1 -0
- package/lib/less/__tests__/alpha-adjustments.test.js +36 -0
- package/lib/less/__tests__/alpha-adjustments.test.js.map +1 -0
- package/lib/less/__tests__/argb.test.d.ts +1 -0
- package/lib/less/__tests__/argb.test.js +15 -0
- package/lib/less/__tests__/argb.test.js.map +1 -0
- package/lib/less/__tests__/blend-modes.test.d.ts +1 -0
- package/lib/less/__tests__/blend-modes.test.js +27 -0
- package/lib/less/__tests__/blend-modes.test.js.map +1 -0
- package/lib/less/__tests__/contrast.test.d.ts +1 -0
- package/lib/less/__tests__/contrast.test.js +29 -0
- package/lib/less/__tests__/contrast.test.js.map +1 -0
- package/lib/less/__tests__/convert.test.d.ts +1 -0
- package/lib/less/__tests__/convert.test.js +25 -0
- package/lib/less/__tests__/convert.test.js.map +1 -0
- package/lib/less/__tests__/e.test.d.ts +1 -0
- package/lib/less/__tests__/e.test.js +12 -0
- package/lib/less/__tests__/e.test.js.map +1 -0
- package/lib/less/__tests__/extract.test.d.ts +1 -0
- package/lib/less/__tests__/extract.test.js +32 -0
- package/lib/less/__tests__/extract.test.js.map +1 -0
- package/lib/less/__tests__/format.test.d.ts +1 -0
- package/lib/less/__tests__/format.test.js +20 -0
- package/lib/less/__tests__/format.test.js.map +1 -0
- package/lib/less/__tests__/get-unit.test.d.ts +1 -0
- package/lib/less/__tests__/get-unit.test.js +15 -0
- package/lib/less/__tests__/get-unit.test.js.map +1 -0
- package/lib/less/__tests__/hsl-branches.test.d.ts +1 -0
- package/lib/less/__tests__/hsl-branches.test.js +27 -0
- package/lib/less/__tests__/hsl-branches.test.js.map +1 -0
- package/lib/less/__tests__/hsl-relative-errors.test.d.ts +1 -0
- package/lib/less/__tests__/hsl-relative-errors.test.js +97 -0
- package/lib/less/__tests__/hsl-relative-errors.test.js.map +1 -0
- package/lib/less/__tests__/hsla-fallback.test.d.ts +1 -0
- package/lib/less/__tests__/hsla-fallback.test.js +29 -0
- package/lib/less/__tests__/hsla-fallback.test.js.map +1 -0
- package/lib/less/__tests__/hsv-family.test.d.ts +1 -0
- package/lib/less/__tests__/hsv-family.test.js +43 -0
- package/lib/less/__tests__/hsv-family.test.js.map +1 -0
- package/lib/less/__tests__/isdefined.test.d.ts +1 -0
- package/lib/less/__tests__/isdefined.test.js +18 -0
- package/lib/less/__tests__/isdefined.test.js.map +1 -0
- package/lib/less/__tests__/isruleset.test.d.ts +1 -0
- package/lib/less/__tests__/isruleset.test.js +22 -0
- package/lib/less/__tests__/isruleset.test.js.map +1 -0
- package/lib/less/__tests__/length.test.d.ts +1 -0
- package/lib/less/__tests__/length.test.js +16 -0
- package/lib/less/__tests__/length.test.js.map +1 -0
- package/lib/less/__tests__/luma-luminance-hsv-channels.test.d.ts +1 -0
- package/lib/less/__tests__/luma-luminance-hsv-channels.test.js +35 -0
- package/lib/less/__tests__/luma-luminance-hsv-channels.test.js.map +1 -0
- package/lib/less/__tests__/max.test.d.ts +1 -0
- package/lib/less/__tests__/max.test.js +35 -0
- package/lib/less/__tests__/max.test.js.map +1 -0
- package/lib/less/__tests__/min.test.d.ts +1 -0
- package/lib/less/__tests__/min.test.js +37 -0
- package/lib/less/__tests__/min.test.js.map +1 -0
- package/lib/less/__tests__/mix.test.d.ts +1 -0
- package/lib/less/__tests__/mix.test.js +25 -0
- package/lib/less/__tests__/mix.test.js.map +1 -0
- package/lib/less/__tests__/mod.test.d.ts +1 -0
- package/lib/less/__tests__/mod.test.js +11 -0
- package/lib/less/__tests__/mod.test.js.map +1 -0
- package/lib/less/__tests__/percentage.test.d.ts +1 -0
- package/lib/less/__tests__/percentage.test.js +12 -0
- package/lib/less/__tests__/percentage.test.js.map +1 -0
- package/lib/less/__tests__/pow.test.d.ts +1 -0
- package/lib/less/__tests__/pow.test.js +11 -0
- package/lib/less/__tests__/pow.test.js.map +1 -0
- package/lib/less/__tests__/reexports-smoke.test.d.ts +1 -0
- package/lib/less/__tests__/reexports-smoke.test.js +26 -0
- package/lib/less/__tests__/reexports-smoke.test.js.map +1 -0
- package/lib/less/__tests__/replace.test.d.ts +1 -0
- package/lib/less/__tests__/replace.test.js +22 -0
- package/lib/less/__tests__/replace.test.js.map +1 -0
- package/lib/less/__tests__/rgb-relative-errors.test.d.ts +1 -0
- package/lib/less/__tests__/rgb-relative-errors.test.js +98 -0
- package/lib/less/__tests__/rgb-relative-errors.test.js.map +1 -0
- package/lib/less/__tests__/rgb-rgba-branches.test.d.ts +1 -0
- package/lib/less/__tests__/rgb-rgba-branches.test.js +49 -0
- package/lib/less/__tests__/rgb-rgba-branches.test.js.map +1 -0
- package/lib/less/__tests__/rgba-fallback.test.d.ts +1 -0
- package/lib/less/__tests__/rgba-fallback.test.js +29 -0
- package/lib/less/__tests__/rgba-fallback.test.js.map +1 -0
- package/lib/less/__tests__/shade.test.d.ts +1 -0
- package/lib/less/__tests__/shade.test.js +19 -0
- package/lib/less/__tests__/shade.test.js.map +1 -0
- package/lib/less/__tests__/spin.test.d.ts +1 -0
- package/lib/less/__tests__/spin.test.js +26 -0
- package/lib/less/__tests__/spin.test.js.map +1 -0
- package/lib/less/__tests__/tint.test.d.ts +1 -0
- package/lib/less/__tests__/tint.test.js +19 -0
- package/lib/less/__tests__/tint.test.js.map +1 -0
- package/lib/less/__tests__/types.test.d.ts +1 -0
- package/lib/less/__tests__/types.test.js +28 -0
- package/lib/less/__tests__/types.test.js.map +1 -0
- package/lib/less/__tests__/unit.test.d.ts +1 -0
- package/lib/less/__tests__/unit.test.js +17 -0
- package/lib/less/__tests__/unit.test.js.map +1 -0
- package/lib/less/abs.d.ts +7 -0
- package/lib/less/abs.js +8 -0
- package/lib/less/abs.js.map +1 -0
- package/lib/less/acos.d.ts +440 -0
- package/lib/less/acos.js +3 -0
- package/lib/less/acos.js.map +1 -0
- package/lib/less/alpha.d.ts +7 -0
- package/lib/less/alpha.js +8 -0
- package/lib/less/alpha.js.map +1 -0
- package/lib/less/argb.d.ts +441 -0
- package/lib/less/argb.js +17 -0
- package/lib/less/argb.js.map +1 -0
- package/lib/less/asin.d.ts +440 -0
- package/lib/less/asin.js +3 -0
- package/lib/less/asin.js.map +1 -0
- package/lib/less/atan.d.ts +440 -0
- package/lib/less/atan.js +3 -0
- package/lib/less/atan.js.map +1 -0
- package/lib/less/average.d.ts +601 -0
- package/lib/less/average.js +17 -0
- package/lib/less/average.js.map +1 -0
- package/lib/less/blue.d.ts +7 -0
- package/lib/less/blue.js +8 -0
- package/lib/less/blue.js.map +1 -0
- package/lib/less/ceil.d.ts +7 -0
- package/lib/less/ceil.js +8 -0
- package/lib/less/ceil.js.map +1 -0
- package/lib/less/color.d.ts +441 -0
- package/lib/less/color.js +33 -0
- package/lib/less/color.js.map +1 -0
- package/lib/less/contrast.d.ts +1427 -0
- package/lib/less/contrast.js +57 -0
- package/lib/less/contrast.js.map +1 -0
- package/lib/less/convert.d.ts +600 -0
- package/lib/less/convert.js +45 -0
- package/lib/less/convert.js.map +1 -0
- package/lib/less/cos.d.ts +440 -0
- package/lib/less/cos.js +3 -0
- package/lib/less/cos.js.map +1 -0
- package/lib/less/darken.d.ts +980 -0
- package/lib/less/darken.js +29 -0
- package/lib/less/darken.js.map +1 -0
- package/lib/less/desaturate.d.ts +980 -0
- package/lib/less/desaturate.js +29 -0
- package/lib/less/desaturate.js.map +1 -0
- package/lib/less/difference.d.ts +601 -0
- package/lib/less/difference.js +18 -0
- package/lib/less/difference.js.map +1 -0
- package/lib/less/e.d.ts +444 -0
- package/lib/less/e.js +17 -0
- package/lib/less/e.js.map +1 -0
- package/lib/less/each.d.ts +615 -0
- package/lib/less/each.js +64 -0
- package/lib/less/each.js.map +1 -0
- package/lib/less/exclusion.d.ts +601 -0
- package/lib/less/exclusion.js +18 -0
- package/lib/less/exclusion.js.map +1 -0
- package/lib/less/extract.d.ts +625 -0
- package/lib/less/extract.js +43 -0
- package/lib/less/extract.js.map +1 -0
- package/lib/less/fade.d.ts +600 -0
- package/lib/less/fade.js +28 -0
- package/lib/less/fade.js.map +1 -0
- package/lib/less/fadein.d.ts +980 -0
- package/lib/less/fadein.js +37 -0
- package/lib/less/fadein.js.map +1 -0
- package/lib/less/fadeout.d.ts +980 -0
- package/lib/less/fadeout.js +36 -0
- package/lib/less/fadeout.js.map +1 -0
- package/lib/less/floor.d.ts +7 -0
- package/lib/less/floor.js +8 -0
- package/lib/less/floor.js.map +1 -0
- package/lib/less/format.d.ts +1821 -0
- package/lib/less/format.js +44 -0
- package/lib/less/format.js.map +1 -0
- package/lib/less/get-unit.d.ts +441 -0
- package/lib/less/get-unit.js +11 -0
- package/lib/less/get-unit.js.map +1 -0
- package/lib/less/green.d.ts +7 -0
- package/lib/less/green.js +8 -0
- package/lib/less/green.js.map +1 -0
- package/lib/less/greyscale.d.ts +441 -0
- package/lib/less/greyscale.js +18 -0
- package/lib/less/greyscale.js.map +1 -0
- package/lib/less/hardlight.d.ts +601 -0
- package/lib/less/hardlight.js +19 -0
- package/lib/less/hardlight.js.map +1 -0
- package/lib/less/hsl.d.ts +1063 -0
- package/lib/less/hsl.js +257 -0
- package/lib/less/hsl.js.map +1 -0
- package/lib/less/hsla.d.ts +354 -0
- package/lib/less/hsla.js +31 -0
- package/lib/less/hsla.js.map +1 -0
- package/lib/less/hsv.d.ts +723 -0
- package/lib/less/hsv.js +20 -0
- package/lib/less/hsv.js.map +1 -0
- package/lib/less/hsva.d.ts +991 -0
- package/lib/less/hsva.js +53 -0
- package/lib/less/hsva.js.map +1 -0
- package/lib/less/hsvhue.d.ts +441 -0
- package/lib/less/hsvhue.js +11 -0
- package/lib/less/hsvhue.js.map +1 -0
- package/lib/less/hsvsaturation.d.ts +441 -0
- package/lib/less/hsvsaturation.js +12 -0
- package/lib/less/hsvsaturation.js.map +1 -0
- package/lib/less/hsvvalue.d.ts +441 -0
- package/lib/less/hsvvalue.js +11 -0
- package/lib/less/hsvvalue.js.map +1 -0
- package/lib/less/hue.d.ts +441 -0
- package/lib/less/hue.js +11 -0
- package/lib/less/hue.js.map +1 -0
- package/lib/less/iif.d.ts +1033 -0
- package/lib/less/iif.js +30 -0
- package/lib/less/iif.js.map +1 -0
- package/lib/less/index.d.ts +75 -0
- package/lib/less/index.js +76 -0
- package/lib/less/index.js.map +1 -0
- package/lib/less/isdefined.d.ts +466 -0
- package/lib/less/isdefined.js +21 -0
- package/lib/less/isdefined.js.map +1 -0
- package/lib/less/isruleset.d.ts +466 -0
- package/lib/less/isruleset.js +24 -0
- package/lib/less/isruleset.js.map +1 -0
- package/lib/less/length.d.ts +441 -0
- package/lib/less/length.js +21 -0
- package/lib/less/length.js.map +1 -0
- package/lib/less/lighten.d.ts +980 -0
- package/lib/less/lighten.js +29 -0
- package/lib/less/lighten.js.map +1 -0
- package/lib/less/lightness.d.ts +441 -0
- package/lib/less/lightness.js +11 -0
- package/lib/less/lightness.js.map +1 -0
- package/lib/less/luma.d.ts +441 -0
- package/lib/less/luma.js +14 -0
- package/lib/less/luma.js.map +1 -0
- package/lib/less/luminance.d.ts +441 -0
- package/lib/less/luminance.js +16 -0
- package/lib/less/luminance.js.map +1 -0
- package/lib/less/math-factory.d.ts +774 -0
- package/lib/less/math-factory.js +18 -0
- package/lib/less/math-factory.js.map +1 -0
- package/lib/less/mathv1.d.ts +0 -0
- package/lib/less/mathv1.js +209 -0
- package/lib/less/mathv1.js.map +1 -0
- package/lib/less/max.d.ts +466 -0
- package/lib/less/max.js +85 -0
- package/lib/less/max.js.map +1 -0
- package/lib/less/min.d.ts +466 -0
- package/lib/less/min.js +85 -0
- package/lib/less/min.js.map +1 -0
- package/lib/less/mix.d.ts +980 -0
- package/lib/less/mix.js +39 -0
- package/lib/less/mix.js.map +1 -0
- package/lib/less/mod.d.ts +600 -0
- package/lib/less/mod.js +16 -0
- package/lib/less/mod.js.map +1 -0
- package/lib/less/multiply.d.ts +601 -0
- package/lib/less/multiply.js +18 -0
- package/lib/less/multiply.js.map +1 -0
- package/lib/less/negation.d.ts +601 -0
- package/lib/less/negation.js +18 -0
- package/lib/less/negation.js.map +1 -0
- package/lib/less/overlay.d.ts +601 -0
- package/lib/less/overlay.js +23 -0
- package/lib/less/overlay.js.map +1 -0
- package/lib/less/percentage.d.ts +441 -0
- package/lib/less/percentage.js +11 -0
- package/lib/less/percentage.js.map +1 -0
- package/lib/less/pi.d.ts +332 -0
- package/lib/less/pi.js +3 -0
- package/lib/less/pi.js.map +1 -0
- package/lib/less/pow.d.ts +600 -0
- package/lib/less/pow.js +16 -0
- package/lib/less/pow.js.map +1 -0
- package/lib/less/range.d.ts +1038 -0
- package/lib/less/range.js +40 -0
- package/lib/less/range.js.map +1 -0
- package/lib/less/red.d.ts +7 -0
- package/lib/less/red.js +8 -0
- package/lib/less/red.js.map +1 -0
- package/lib/less/replace.d.ts +1264 -0
- package/lib/less/replace.js +32 -0
- package/lib/less/replace.js.map +1 -0
- package/lib/less/rgb.d.ts +1063 -0
- package/lib/less/rgb.js +266 -0
- package/lib/less/rgb.js.map +1 -0
- package/lib/less/rgba.d.ts +354 -0
- package/lib/less/rgba.js +31 -0
- package/lib/less/rgba.js.map +1 -0
- package/lib/less/round.d.ts +7 -0
- package/lib/less/round.js +8 -0
- package/lib/less/round.js.map +1 -0
- package/lib/less/saturate.d.ts +980 -0
- package/lib/less/saturate.js +29 -0
- package/lib/less/saturate.js.map +1 -0
- package/lib/less/saturation.d.ts +441 -0
- package/lib/less/saturation.js +12 -0
- package/lib/less/saturation.js.map +1 -0
- package/lib/less/screen.d.ts +601 -0
- package/lib/less/screen.js +18 -0
- package/lib/less/screen.js.map +1 -0
- package/lib/less/shade.d.ts +600 -0
- package/lib/less/shade.js +26 -0
- package/lib/less/shade.js.map +1 -0
- package/lib/less/sin.d.ts +440 -0
- package/lib/less/sin.js +3 -0
- package/lib/less/sin.js.map +1 -0
- package/lib/less/softlight.d.ts +601 -0
- package/lib/less/softlight.js +25 -0
- package/lib/less/softlight.js.map +1 -0
- package/lib/less/spin.d.ts +600 -0
- package/lib/less/spin.js +22 -0
- package/lib/less/spin.js.map +1 -0
- package/lib/less/sqrt.d.ts +440 -0
- package/lib/less/sqrt.js +3 -0
- package/lib/less/sqrt.js.map +1 -0
- package/lib/less/tan.d.ts +440 -0
- package/lib/less/tan.js +3 -0
- package/lib/less/tan.js.map +1 -0
- package/lib/less/tint.d.ts +600 -0
- package/lib/less/tint.js +26 -0
- package/lib/less/tint.js.map +1 -0
- package/lib/less/types.d.ts +4112 -0
- package/lib/less/types.js +53 -0
- package/lib/less/types.js.map +1 -0
- package/lib/less/unit.d.ts +753 -0
- package/lib/less/unit.js +20 -0
- package/lib/less/unit.js.map +1 -0
- package/lib/sass/__tests__/hsl-channels.test.d.ts +1 -0
- package/lib/sass/__tests__/hsl-channels.test.js +85 -0
- package/lib/sass/__tests__/hsl-channels.test.js.map +1 -0
- package/lib/sass/__tests__/list-advanced.test.d.ts +1 -0
- package/lib/sass/__tests__/list-advanced.test.js +157 -0
- package/lib/sass/__tests__/list-advanced.test.js.map +1 -0
- package/lib/sass/__tests__/list-functions.test.d.ts +1 -0
- package/lib/sass/__tests__/list-functions.test.js +153 -0
- package/lib/sass/__tests__/list-functions.test.js.map +1 -0
- package/lib/sass/__tests__/map-functions.test.d.ts +1 -0
- package/lib/sass/__tests__/map-functions.test.js +208 -0
- package/lib/sass/__tests__/map-functions.test.js.map +1 -0
- package/lib/sass/__tests__/math-functions.test.d.ts +1 -0
- package/lib/sass/__tests__/math-functions.test.js +73 -0
- package/lib/sass/__tests__/math-functions.test.js.map +1 -0
- package/lib/sass/__tests__/math-remaining.test.d.ts +1 -0
- package/lib/sass/__tests__/math-remaining.test.js +113 -0
- package/lib/sass/__tests__/math-remaining.test.js.map +1 -0
- package/lib/sass/__tests__/opacity.test.d.ts +1 -0
- package/lib/sass/__tests__/opacity.test.js +53 -0
- package/lib/sass/__tests__/opacity.test.js.map +1 -0
- package/lib/sass/__tests__/string-functions.test.d.ts +1 -0
- package/lib/sass/__tests__/string-functions.test.js +109 -0
- package/lib/sass/__tests__/string-functions.test.js.map +1 -0
- package/lib/sass/__tests__/string-remaining.test.d.ts +1 -0
- package/lib/sass/__tests__/string-remaining.test.js +131 -0
- package/lib/sass/__tests__/string-remaining.test.js.map +1 -0
- package/lib/sass/adjust-hue.d.ts +10 -0
- package/lib/sass/adjust-hue.js +11 -0
- package/lib/sass/adjust-hue.js.map +1 -0
- package/lib/sass/color/index.d.ts +22 -0
- package/lib/sass/color/index.js +43 -0
- package/lib/sass/color/index.js.map +1 -0
- package/lib/sass/color/red.d.ts +7 -0
- package/lib/sass/color/red.js +8 -0
- package/lib/sass/color/red.js.map +1 -0
- package/lib/sass/compatible.d.ts +610 -0
- package/lib/sass/compatible.js +62 -0
- package/lib/sass/compatible.js.map +1 -0
- package/lib/sass/complement.d.ts +450 -0
- package/lib/sass/complement.js +28 -0
- package/lib/sass/complement.js.map +1 -0
- package/lib/sass/fade-in.d.ts +10 -0
- package/lib/sass/fade-in.js +11 -0
- package/lib/sass/fade-in.js.map +1 -0
- package/lib/sass/fade-out.d.ts +10 -0
- package/lib/sass/fade-out.js +11 -0
- package/lib/sass/fade-out.js.map +1 -0
- package/lib/sass/grayscale.d.ts +10 -0
- package/lib/sass/grayscale.js +11 -0
- package/lib/sass/grayscale.js.map +1 -0
- package/lib/sass/hue.d.ts +450 -0
- package/lib/sass/hue.js +24 -0
- package/lib/sass/hue.js.map +1 -0
- package/lib/sass/ie-hex-str.d.ts +10 -0
- package/lib/sass/ie-hex-str.js +11 -0
- package/lib/sass/ie-hex-str.js.map +1 -0
- package/lib/sass/index.d.ts +64 -0
- package/lib/sass/index.js +90 -0
- package/lib/sass/index.js.map +1 -0
- package/lib/sass/invert.d.ts +813 -0
- package/lib/sass/invert.js +36 -0
- package/lib/sass/invert.js.map +1 -0
- package/lib/sass/lightness.d.ts +450 -0
- package/lib/sass/lightness.js +24 -0
- package/lib/sass/lightness.js.map +1 -0
- package/lib/sass/list/append.d.ts +989 -0
- package/lib/sass/list/append.js +54 -0
- package/lib/sass/list/append.js.map +1 -0
- package/lib/sass/list/index.d.ts +21 -0
- package/lib/sass/list/index.js +24 -0
- package/lib/sass/list/index.js.map +1 -0
- package/lib/sass/list/is-bracketed.d.ts +450 -0
- package/lib/sass/list/is-bracketed.js +30 -0
- package/lib/sass/list/is-bracketed.js.map +1 -0
- package/lib/sass/list/join.d.ts +1354 -0
- package/lib/sass/list/join.js +66 -0
- package/lib/sass/list/join.js.map +1 -0
- package/lib/sass/list/length.d.ts +450 -0
- package/lib/sass/list/length.js +22 -0
- package/lib/sass/list/length.js.map +1 -0
- package/lib/sass/list/list-index.d.ts +609 -0
- package/lib/sass/list/list-index.js +49 -0
- package/lib/sass/list/list-index.js.map +1 -0
- package/lib/sass/list/nth.d.ts +634 -0
- package/lib/sass/list/nth.js +36 -0
- package/lib/sass/list/nth.js.map +1 -0
- package/lib/sass/list/separator.d.ts +451 -0
- package/lib/sass/list/separator.js +36 -0
- package/lib/sass/list/separator.js.map +1 -0
- package/lib/sass/list/set-nth.d.ts +756 -0
- package/lib/sass/list/set-nth.js +42 -0
- package/lib/sass/list/set-nth.js.map +1 -0
- package/lib/sass/list/zip.d.ts +474 -0
- package/lib/sass/list/zip.js +46 -0
- package/lib/sass/list/zip.js.map +1 -0
- package/lib/sass/map/get.d.ts +757 -0
- package/lib/sass/map/get.js +79 -0
- package/lib/sass/map/get.js.map +1 -0
- package/lib/sass/map/has-key.d.ts +757 -0
- package/lib/sass/map/has-key.js +76 -0
- package/lib/sass/map/has-key.js.map +1 -0
- package/lib/sass/map/index.d.ts +19 -0
- package/lib/sass/map/index.js +23 -0
- package/lib/sass/map/index.js.map +1 -0
- package/lib/sass/map/keys.d.ts +449 -0
- package/lib/sass/map/keys.js +39 -0
- package/lib/sass/map/keys.js.map +1 -0
- package/lib/sass/map/merge.d.ts +608 -0
- package/lib/sass/map/merge.js +54 -0
- package/lib/sass/map/merge.js.map +1 -0
- package/lib/sass/map/remove.d.ts +633 -0
- package/lib/sass/map/remove.js +41 -0
- package/lib/sass/map/remove.js.map +1 -0
- package/lib/sass/map/set.d.ts +731 -0
- package/lib/sass/map/set.js +72 -0
- package/lib/sass/map/set.js.map +1 -0
- package/lib/sass/map/values.d.ts +449 -0
- package/lib/sass/map/values.js +30 -0
- package/lib/sass/map/values.js.map +1 -0
- package/lib/sass/math/abs.d.ts +7 -0
- package/lib/sass/math/abs.js +8 -0
- package/lib/sass/math/abs.js.map +1 -0
- package/lib/sass/math/index.d.ts +18 -0
- package/lib/sass/math/index.js +43 -0
- package/lib/sass/math/index.js.map +1 -0
- package/lib/sass/opacify.d.ts +11 -0
- package/lib/sass/opacify.js +12 -0
- package/lib/sass/opacify.js.map +1 -0
- package/lib/sass/opacity.d.ts +451 -0
- package/lib/sass/opacity.js +33 -0
- package/lib/sass/opacity.js.map +1 -0
- package/lib/sass/percentage.d.ts +449 -0
- package/lib/sass/percentage.js +26 -0
- package/lib/sass/percentage.js.map +1 -0
- package/lib/sass/quote.d.ts +449 -0
- package/lib/sass/quote.js +27 -0
- package/lib/sass/quote.js.map +1 -0
- package/lib/sass/random.d.ts +534 -0
- package/lib/sass/random.js +37 -0
- package/lib/sass/random.js.map +1 -0
- package/lib/sass/saturation.d.ts +450 -0
- package/lib/sass/saturation.js +24 -0
- package/lib/sass/saturation.js.map +1 -0
- package/lib/sass/str-index.d.ts +609 -0
- package/lib/sass/str-index.js +34 -0
- package/lib/sass/str-index.js.map +1 -0
- package/lib/sass/str-insert.d.ts +756 -0
- package/lib/sass/str-insert.js +61 -0
- package/lib/sass/str-insert.js.map +1 -0
- package/lib/sass/str-slice.d.ts +1039 -0
- package/lib/sass/str-slice.js +95 -0
- package/lib/sass/str-slice.js.map +1 -0
- package/lib/sass/string/index.d.ts +18 -0
- package/lib/sass/string/index.js +25 -0
- package/lib/sass/string/index.js.map +1 -0
- package/lib/sass/string/length.d.ts +450 -0
- package/lib/sass/string/length.js +32 -0
- package/lib/sass/string/length.js.map +1 -0
- package/lib/sass/to-lower-case.d.ts +449 -0
- package/lib/sass/to-lower-case.js +23 -0
- package/lib/sass/to-lower-case.js.map +1 -0
- package/lib/sass/to-upper-case.d.ts +449 -0
- package/lib/sass/to-upper-case.js +23 -0
- package/lib/sass/to-upper-case.js.map +1 -0
- package/lib/sass/transparentize.d.ts +11 -0
- package/lib/sass/transparentize.js +12 -0
- package/lib/sass/transparentize.js.map +1 -0
- package/lib/sass/unique-id.d.ts +341 -0
- package/lib/sass/unique-id.js +23 -0
- package/lib/sass/unique-id.js.map +1 -0
- package/lib/sass/unit.d.ts +762 -0
- package/lib/sass/unit.js +37 -0
- package/lib/sass/unit.js.map +1 -0
- package/lib/sass/unitless.d.ts +450 -0
- package/lib/sass/unitless.js +23 -0
- package/lib/sass/unitless.js.map +1 -0
- package/lib/sass/unquote.d.ts +449 -0
- package/lib/sass/unquote.js +27 -0
- package/lib/sass/unquote.js.map +1 -0
- package/lib/shared/color/alpha.d.ts +441 -0
- package/lib/shared/color/alpha.js +10 -0
- package/lib/shared/color/alpha.js.map +1 -0
- package/lib/shared/color/blue.d.ts +441 -0
- package/lib/shared/color/blue.js +10 -0
- package/lib/shared/color/blue.js.map +1 -0
- package/lib/shared/color/green.d.ts +441 -0
- package/lib/shared/color/green.js +10 -0
- package/lib/shared/color/green.js.map +1 -0
- package/lib/shared/color/red.d.ts +441 -0
- package/lib/shared/color/red.js +10 -0
- package/lib/shared/color/red.js.map +1 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +19 -0
- package/lib/shared/index.js.map +1 -0
- package/lib/shared/math/__tests__/max.test.d.ts +1 -0
- package/lib/shared/math/__tests__/max.test.js +12 -0
- package/lib/shared/math/__tests__/max.test.js.map +1 -0
- package/lib/shared/math/__tests__/min.test.d.ts +1 -0
- package/lib/shared/math/__tests__/min.test.js +12 -0
- package/lib/shared/math/__tests__/min.test.js.map +1 -0
- package/lib/shared/math/__tests__/round.test.d.ts +1 -0
- package/lib/shared/math/__tests__/round.test.js +10 -0
- package/lib/shared/math/__tests__/round.test.js.map +1 -0
- package/lib/shared/math/abs.d.ts +441 -0
- package/lib/shared/math/abs.js +11 -0
- package/lib/shared/math/abs.js.map +1 -0
- package/lib/shared/math/ceil.d.ts +441 -0
- package/lib/shared/math/ceil.js +11 -0
- package/lib/shared/math/ceil.js.map +1 -0
- package/lib/shared/math/floor.d.ts +441 -0
- package/lib/shared/math/floor.js +11 -0
- package/lib/shared/math/floor.js.map +1 -0
- package/lib/shared/math/max.d.ts +469 -0
- package/lib/shared/math/max.js +22 -0
- package/lib/shared/math/max.js.map +1 -0
- package/lib/shared/math/min.d.ts +469 -0
- package/lib/shared/math/min.js +22 -0
- package/lib/shared/math/min.js.map +1 -0
- package/lib/shared/math/round.d.ts +778 -0
- package/lib/shared/math/round.js +17 -0
- package/lib/shared/math/round.js.map +1 -0
- package/lib/util/colorHelper.d.ts +2 -0
- package/lib/util/colorHelper.js +32 -0
- package/lib/util/colorHelper.js.map +1 -0
- package/lib/util/get-color-func-values.d.ts +5 -0
- package/lib/util/get-color-func-values.js +28 -0
- package/lib/util/get-color-func-values.js.map +1 -0
- package/lib/util/get-hsla.d.ts +10 -0
- package/lib/util/get-hsla.js +38 -0
- package/lib/util/get-hsla.js.map +1 -0
- package/lib/util/get-luma.d.ts +2 -0
- package/lib/util/get-luma.js +10 -0
- package/lib/util/get-luma.js.map +1 -0
- package/lib/util/index.d.ts +5 -0
- package/lib/util/index.js +17 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/mathHelper.d.ts +4 -0
- package/lib/util/mathHelper.js +45 -0
- package/lib/util/mathHelper.js.map +1 -0
- package/lib/util/number.d.ts +4 -0
- package/lib/util/number.js +23 -0
- package/lib/util/number.js.map +1 -0
- package/lib/util/relative-color.d.ts +54 -0
- package/lib/util/relative-color.js +268 -0
- package/lib/util/relative-color.js.map +1 -0
- package/lib/util/serialize-node.d.ts +2 -0
- package/lib/util/serialize-node.js +8 -0
- package/lib/util/serialize-node.js.map +1 -0
- package/lib/util/to-hsl.d.ts +7 -0
- package/lib/util/to-hsl.js +6 -0
- package/lib/util/to-hsl.js.map +1 -0
- package/lib/util/to-hsv.d.ts +7 -0
- package/lib/util/to-hsv.js +73 -0
- package/lib/util/to-hsv.js.map +1 -0
- package/package.json +39 -16
- package/lib/color-blending.d.ts +0 -9
- package/lib/color-blending.js +0 -83
- package/lib/color.d.ts +0 -42
- package/lib/color.js +0 -407
- package/lib/each.d.ts +0 -14
- package/lib/each.js +0 -35
- package/lib/iif.d.ts +0 -4
- package/lib/iif.js +0 -10
- package/lib/math.d.ts +0 -13
- package/lib/math.js +0 -199
package/lib/color.js
DELETED
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shade = exports.tint = exports.contrast = exports.greyscale = exports.mix = exports.spin = exports.fade = exports.fadeout = exports.fadein = exports.darken = exports.lighten = exports.desaturate = exports.saturate = exports.luminance = exports.luma = exports.alpha = exports.blue = exports.green = exports.red = exports.hsvvalue = exports.hsvsaturation = exports.hsvhue = exports.lightness = exports.saturation = exports.hue = exports.hsv = exports.hsva = exports.hsl = exports.hsla = exports.rgb = exports.rgba = void 0;
|
|
4
|
-
const jess_1 = require("jess");
|
|
5
|
-
/**
|
|
6
|
-
* Color functions, imported from Less
|
|
7
|
-
*/
|
|
8
|
-
function rgba(...values) {
|
|
9
|
-
const rgba = values.map(v => Number(v));
|
|
10
|
-
return new jess_1.Color({ value: 'rgba', rgba });
|
|
11
|
-
}
|
|
12
|
-
exports.rgba = rgba;
|
|
13
|
-
function rgb(...values) {
|
|
14
|
-
const rgb = values.map(v => Number(v));
|
|
15
|
-
rgb.push(1);
|
|
16
|
-
const color = rgba(rgb[0], rgb[1], rgb[2], rgb[3]);
|
|
17
|
-
color.value = 'rgb';
|
|
18
|
-
return color;
|
|
19
|
-
}
|
|
20
|
-
exports.rgb = rgb;
|
|
21
|
-
function getHue(h, m1, m2) {
|
|
22
|
-
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
|
|
23
|
-
if (h * 6 < 1) {
|
|
24
|
-
return m1 + (m2 - m1) * h * 6;
|
|
25
|
-
}
|
|
26
|
-
else if (h * 2 < 1) {
|
|
27
|
-
return m2;
|
|
28
|
-
}
|
|
29
|
-
else if (h * 3 < 2) {
|
|
30
|
-
return m1 + (m2 - m1) * (2 / 3 - h) * 6;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return m1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function clamp(val) {
|
|
37
|
-
return Math.min(1, Math.max(0, val));
|
|
38
|
-
}
|
|
39
|
-
function number(n) {
|
|
40
|
-
if (n instanceof jess_1.Dimension) {
|
|
41
|
-
return n.unit === '%' ? n.value / 100 : n.value;
|
|
42
|
-
}
|
|
43
|
-
else if (n.constructor === Number) {
|
|
44
|
-
return n;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
throw {
|
|
48
|
-
type: 'Argument',
|
|
49
|
-
message: 'color functions take numbers as parameters'
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function toHSL(color) {
|
|
54
|
-
if (color instanceof jess_1.Color) {
|
|
55
|
-
return color.toHSL();
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
throw new Error('Argument cannot be evaluated to a color');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
|
62
|
-
function toHSV(color) {
|
|
63
|
-
if (!(color instanceof jess_1.Color)) {
|
|
64
|
-
throw new Error('Argument cannot be evaluated to a color');
|
|
65
|
-
}
|
|
66
|
-
const r = color.rgb[0] / 255;
|
|
67
|
-
const g = color.rgb[1] / 255;
|
|
68
|
-
const b = color.rgb[2] / 255;
|
|
69
|
-
const a = color.alpha;
|
|
70
|
-
const max = Math.max(r, g, b);
|
|
71
|
-
const min = Math.min(r, g, b);
|
|
72
|
-
let h;
|
|
73
|
-
let s;
|
|
74
|
-
const v = max;
|
|
75
|
-
const d = max - min;
|
|
76
|
-
if (max === 0) {
|
|
77
|
-
s = 0;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
s = d / max;
|
|
81
|
-
}
|
|
82
|
-
if (max === min) {
|
|
83
|
-
h = 0;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
switch (max) {
|
|
87
|
-
case r:
|
|
88
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
89
|
-
break;
|
|
90
|
-
case g:
|
|
91
|
-
h = (b - r) / d + 2;
|
|
92
|
-
break;
|
|
93
|
-
case b:
|
|
94
|
-
h = (r - g) / d + 4;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
h /= 6;
|
|
98
|
-
}
|
|
99
|
-
return { h: h * 360, s, v, a };
|
|
100
|
-
}
|
|
101
|
-
function hsla(h, s, l, a) {
|
|
102
|
-
let m1;
|
|
103
|
-
let m2;
|
|
104
|
-
const value = `hsla`;
|
|
105
|
-
h = (number(h) % 360) / 360;
|
|
106
|
-
s = clamp(number(s));
|
|
107
|
-
l = clamp(number(l));
|
|
108
|
-
a = clamp(number(a));
|
|
109
|
-
m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
|
|
110
|
-
m1 = l * 2 - m2;
|
|
111
|
-
const rgba = [
|
|
112
|
-
getHue(h + 1 / 3, m1, m2) * 255,
|
|
113
|
-
getHue(h, m1, m2) * 255,
|
|
114
|
-
getHue(h - 1 / 3, m1, m2) * 255,
|
|
115
|
-
a
|
|
116
|
-
];
|
|
117
|
-
return new jess_1.Color({
|
|
118
|
-
value,
|
|
119
|
-
rgba
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
exports.hsla = hsla;
|
|
123
|
-
function hsl(h, s, l) {
|
|
124
|
-
const value = `hsl`;
|
|
125
|
-
h = number(h);
|
|
126
|
-
s = number(s);
|
|
127
|
-
l = number(l);
|
|
128
|
-
const color = hsla(h, s, l, 1);
|
|
129
|
-
color.value = value;
|
|
130
|
-
return color;
|
|
131
|
-
}
|
|
132
|
-
exports.hsl = hsl;
|
|
133
|
-
function hsva(h, s, v, a) {
|
|
134
|
-
h = ((number(h) % 360) / 360) * 360;
|
|
135
|
-
s = number(s);
|
|
136
|
-
v = number(v);
|
|
137
|
-
a = number(a);
|
|
138
|
-
let i = Math.floor((h / 60) % 6);
|
|
139
|
-
let f = (h / 60) - i;
|
|
140
|
-
const vs = [
|
|
141
|
-
v,
|
|
142
|
-
v * (1 - s),
|
|
143
|
-
v * (1 - f * s),
|
|
144
|
-
v * (1 - (1 - f) * s)
|
|
145
|
-
];
|
|
146
|
-
const perm = [
|
|
147
|
-
[0, 3, 1],
|
|
148
|
-
[2, 0, 1],
|
|
149
|
-
[1, 0, 3],
|
|
150
|
-
[1, 2, 0],
|
|
151
|
-
[3, 1, 0],
|
|
152
|
-
[0, 1, 2]
|
|
153
|
-
];
|
|
154
|
-
return rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a);
|
|
155
|
-
}
|
|
156
|
-
exports.hsva = hsva;
|
|
157
|
-
function hsv(h, s, v) {
|
|
158
|
-
return hsva(h, s, v, 1.0);
|
|
159
|
-
}
|
|
160
|
-
exports.hsv = hsv;
|
|
161
|
-
function hue(color) {
|
|
162
|
-
return new jess_1.Dimension(toHSL(color).h);
|
|
163
|
-
}
|
|
164
|
-
exports.hue = hue;
|
|
165
|
-
function saturation(color) {
|
|
166
|
-
return new jess_1.Dimension({
|
|
167
|
-
value: toHSL(color).s * 100,
|
|
168
|
-
unit: '%'
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
exports.saturation = saturation;
|
|
172
|
-
function lightness(color) {
|
|
173
|
-
return new jess_1.Dimension({
|
|
174
|
-
value: toHSL(color).l * 100,
|
|
175
|
-
unit: '%'
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
exports.lightness = lightness;
|
|
179
|
-
function hsvhue(color) {
|
|
180
|
-
return new jess_1.Dimension(toHSV(color).h);
|
|
181
|
-
}
|
|
182
|
-
exports.hsvhue = hsvhue;
|
|
183
|
-
function hsvsaturation(color) {
|
|
184
|
-
return new jess_1.Dimension({
|
|
185
|
-
value: toHSV(color).s * 100,
|
|
186
|
-
unit: '%'
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
exports.hsvsaturation = hsvsaturation;
|
|
190
|
-
function hsvvalue(color) {
|
|
191
|
-
return new jess_1.Dimension({
|
|
192
|
-
value: toHSV(color).v * 100,
|
|
193
|
-
unit: '%'
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
exports.hsvvalue = hsvvalue;
|
|
197
|
-
function red(color) {
|
|
198
|
-
return new jess_1.Dimension(color.rgb[0]);
|
|
199
|
-
}
|
|
200
|
-
exports.red = red;
|
|
201
|
-
function green(color) {
|
|
202
|
-
return new jess_1.Dimension(color.rgb[1]);
|
|
203
|
-
}
|
|
204
|
-
exports.green = green;
|
|
205
|
-
function blue(color) {
|
|
206
|
-
return new jess_1.Dimension(color.rgb[2]);
|
|
207
|
-
}
|
|
208
|
-
exports.blue = blue;
|
|
209
|
-
function alpha(color) {
|
|
210
|
-
return new jess_1.Dimension(toHSL(color).a);
|
|
211
|
-
}
|
|
212
|
-
exports.alpha = alpha;
|
|
213
|
-
function getLuma(color) {
|
|
214
|
-
let r = color.rgb[0] / 255;
|
|
215
|
-
let g = color.rgb[1] / 255;
|
|
216
|
-
let b = color.rgb[2] / 255;
|
|
217
|
-
r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);
|
|
218
|
-
g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);
|
|
219
|
-
b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);
|
|
220
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
221
|
-
}
|
|
222
|
-
function luma(color) {
|
|
223
|
-
return new jess_1.Dimension({
|
|
224
|
-
value: getLuma(color) * color.alpha * 100,
|
|
225
|
-
unit: '%'
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
exports.luma = luma;
|
|
229
|
-
function luminance(color) {
|
|
230
|
-
const luminance = (0.2126 * color.rgb[0] / 255) +
|
|
231
|
-
(0.7152 * color.rgb[1] / 255) +
|
|
232
|
-
(0.0722 * color.rgb[2] / 255);
|
|
233
|
-
return new jess_1.Dimension({
|
|
234
|
-
value: luminance * color.alpha * 100,
|
|
235
|
-
unit: '%'
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
exports.luminance = luminance;
|
|
239
|
-
function getHsla(origColor, hsl) {
|
|
240
|
-
const color = hsla(hsl.h, hsl.s, hsl.l, hsl.a);
|
|
241
|
-
if (color) {
|
|
242
|
-
if (origColor.value &&
|
|
243
|
-
/^(rgb|hsl)/.test(origColor.value)) {
|
|
244
|
-
color.value = origColor.value;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
color.value = 'rgb';
|
|
248
|
-
}
|
|
249
|
-
return color;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* @note
|
|
254
|
-
* There's a lot of boilerplate code in the following functions. Could
|
|
255
|
-
* they be abstracted / have a generator function?
|
|
256
|
-
*/
|
|
257
|
-
function saturate(color, amount, method) {
|
|
258
|
-
const hsl = toHSL(color);
|
|
259
|
-
if (method && method.value === 'relative') {
|
|
260
|
-
hsl.s += hsl.s * amount.value / 100;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
hsl.s += amount.value / 100;
|
|
264
|
-
}
|
|
265
|
-
hsl.s = clamp(hsl.s);
|
|
266
|
-
return getHsla(color, hsl);
|
|
267
|
-
}
|
|
268
|
-
exports.saturate = saturate;
|
|
269
|
-
function desaturate(color, amount, method) {
|
|
270
|
-
const hsl = toHSL(color);
|
|
271
|
-
if (method && method.value === 'relative') {
|
|
272
|
-
hsl.s -= hsl.s * amount.value / 100;
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
hsl.s -= amount.value / 100;
|
|
276
|
-
}
|
|
277
|
-
hsl.s = clamp(hsl.s);
|
|
278
|
-
return getHsla(color, hsl);
|
|
279
|
-
}
|
|
280
|
-
exports.desaturate = desaturate;
|
|
281
|
-
function lighten(color, amount, method) {
|
|
282
|
-
const hsl = toHSL(color);
|
|
283
|
-
if (method && method.value === 'relative') {
|
|
284
|
-
hsl.l += hsl.l * amount.value / 100;
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
hsl.l += amount.value / 100;
|
|
288
|
-
}
|
|
289
|
-
hsl.l = clamp(hsl.l);
|
|
290
|
-
return getHsla(color, hsl);
|
|
291
|
-
}
|
|
292
|
-
exports.lighten = lighten;
|
|
293
|
-
function darken(color, amount, method) {
|
|
294
|
-
const hsl = toHSL(color);
|
|
295
|
-
if (method && method.value === 'relative') {
|
|
296
|
-
hsl.l -= hsl.l * amount.value / 100;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
hsl.l -= amount.value / 100;
|
|
300
|
-
}
|
|
301
|
-
hsl.l = clamp(hsl.l);
|
|
302
|
-
return getHsla(color, hsl);
|
|
303
|
-
}
|
|
304
|
-
exports.darken = darken;
|
|
305
|
-
function fadein(color, amount, method) {
|
|
306
|
-
const hsl = toHSL(color);
|
|
307
|
-
if (method && method.value === 'relative') {
|
|
308
|
-
hsl.a += hsl.a * amount.value / 100;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
hsl.a += amount.value / 100;
|
|
312
|
-
}
|
|
313
|
-
hsl.a = clamp(hsl.a);
|
|
314
|
-
return getHsla(color, hsl);
|
|
315
|
-
}
|
|
316
|
-
exports.fadein = fadein;
|
|
317
|
-
function fadeout(color, amount, method) {
|
|
318
|
-
const hsl = toHSL(color);
|
|
319
|
-
if (method && method.value === 'relative') {
|
|
320
|
-
hsl.a -= hsl.a * amount.value / 100;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
hsl.a -= amount.value / 100;
|
|
324
|
-
}
|
|
325
|
-
hsl.a = clamp(hsl.a);
|
|
326
|
-
return getHsla(color, hsl);
|
|
327
|
-
}
|
|
328
|
-
exports.fadeout = fadeout;
|
|
329
|
-
function fade(color, amount) {
|
|
330
|
-
const hsl = toHSL(color);
|
|
331
|
-
hsl.a = amount.value / 100;
|
|
332
|
-
hsl.a = clamp(hsl.a);
|
|
333
|
-
return getHsla(color, hsl);
|
|
334
|
-
}
|
|
335
|
-
exports.fade = fade;
|
|
336
|
-
function spin(color, amount) {
|
|
337
|
-
const hsl = toHSL(color);
|
|
338
|
-
const hue = (hsl.h + amount.value) % 360;
|
|
339
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
340
|
-
return getHsla(color, hsl);
|
|
341
|
-
}
|
|
342
|
-
exports.spin = spin;
|
|
343
|
-
//
|
|
344
|
-
// Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein
|
|
345
|
-
// http://sass-lang.com
|
|
346
|
-
//
|
|
347
|
-
function mix(color1, color2, weight) {
|
|
348
|
-
if (!weight) {
|
|
349
|
-
weight = new jess_1.Dimension(50);
|
|
350
|
-
}
|
|
351
|
-
const p = weight.value / 100.0;
|
|
352
|
-
const w = p * 2 - 1;
|
|
353
|
-
const a = toHSL(color1).a - toHSL(color2).a;
|
|
354
|
-
const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
|
|
355
|
-
const w2 = 1 - w1;
|
|
356
|
-
const rgba = [
|
|
357
|
-
color1.rgb[0] * w1 + color2.rgb[0] * w2,
|
|
358
|
-
color1.rgb[1] * w1 + color2.rgb[1] * w2,
|
|
359
|
-
color1.rgb[2] * w1 + color2.rgb[2] * w2,
|
|
360
|
-
color1.alpha * p + color2.alpha * (1 - p)
|
|
361
|
-
];
|
|
362
|
-
return new jess_1.Color({
|
|
363
|
-
value: '',
|
|
364
|
-
rgba
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
exports.mix = mix;
|
|
368
|
-
function greyscale(color) {
|
|
369
|
-
return desaturate(color, new jess_1.Dimension(100));
|
|
370
|
-
}
|
|
371
|
-
exports.greyscale = greyscale;
|
|
372
|
-
function contrast(color, dark, light, threshold) {
|
|
373
|
-
if (!light) {
|
|
374
|
-
light = rgba(255, 255, 255, 1.0);
|
|
375
|
-
}
|
|
376
|
-
if (!dark) {
|
|
377
|
-
dark = rgba(0, 0, 0, 1.0);
|
|
378
|
-
}
|
|
379
|
-
// Figure out which is actually light and dark:
|
|
380
|
-
if (getLuma(dark) > getLuma(light)) {
|
|
381
|
-
const t = light;
|
|
382
|
-
light = dark;
|
|
383
|
-
dark = t;
|
|
384
|
-
}
|
|
385
|
-
let thresholdNum;
|
|
386
|
-
if (!threshold) {
|
|
387
|
-
thresholdNum = 0.43;
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
thresholdNum = number(threshold);
|
|
391
|
-
}
|
|
392
|
-
if (getLuma(color) < thresholdNum) {
|
|
393
|
-
return light;
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
return dark;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
exports.contrast = contrast;
|
|
400
|
-
function tint(color, amount) {
|
|
401
|
-
return mix(rgb(255, 255, 255), color, amount);
|
|
402
|
-
}
|
|
403
|
-
exports.tint = tint;
|
|
404
|
-
function shade(color, amount) {
|
|
405
|
-
return mix(rgb(0, 0, 0), color, amount);
|
|
406
|
-
}
|
|
407
|
-
exports.shade = shade;
|
package/lib/each.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { List, Expression, Ruleset } from 'jess';
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* @import { each } from '@jesscss/fns';
|
|
5
|
-
* @let list: 1, 2, 3;
|
|
6
|
-
* @mixin iterate (value, key) {
|
|
7
|
-
* .icon-$(value) {
|
|
8
|
-
* width: $value;
|
|
9
|
-
* height: $key;
|
|
10
|
-
* }
|
|
11
|
-
* }
|
|
12
|
-
* @include $each(list, iterate);
|
|
13
|
-
*/
|
|
14
|
-
export declare function each(list: List | Expression | unknown, mixin: Function): Ruleset;
|
package/lib/each.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.each = void 0;
|
|
7
|
-
const jess_1 = require("jess");
|
|
8
|
-
const forEach_1 = __importDefault(require("lodash/forEach"));
|
|
9
|
-
/**
|
|
10
|
-
* @example
|
|
11
|
-
* @import { each } from '@jesscss/fns';
|
|
12
|
-
* @let list: 1, 2, 3;
|
|
13
|
-
* @mixin iterate (value, key) {
|
|
14
|
-
* .icon-$(value) {
|
|
15
|
-
* width: $value;
|
|
16
|
-
* height: $key;
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* @include $each(list, iterate);
|
|
20
|
-
*/
|
|
21
|
-
function each(list, mixin) {
|
|
22
|
-
let collection;
|
|
23
|
-
let rules = new jess_1.Ruleset([]);
|
|
24
|
-
if (list instanceof jess_1.List || list instanceof jess_1.Expression) {
|
|
25
|
-
collection = list.toArray();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
collection = list;
|
|
29
|
-
}
|
|
30
|
-
forEach_1.default(collection, (value, key) => {
|
|
31
|
-
rules.value.push(mixin(value, key));
|
|
32
|
-
});
|
|
33
|
-
return rules;
|
|
34
|
-
}
|
|
35
|
-
exports.each = each;
|
package/lib/iif.d.ts
DELETED
package/lib/iif.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.iif = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* if condition, return ifValue, else return elseValue
|
|
6
|
-
*/
|
|
7
|
-
function iif(condition, ifValue, elseValue) {
|
|
8
|
-
return condition ? ifValue : elseValue;
|
|
9
|
-
}
|
|
10
|
-
exports.iif = iif;
|
package/lib/math.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Dimension, Color, Expression } from 'jess';
|
|
2
|
-
/**
|
|
3
|
-
* This mimics Less's operations, preserving units and types
|
|
4
|
-
* as output.
|
|
5
|
-
*
|
|
6
|
-
* The only export here is the `op` function
|
|
7
|
-
*/
|
|
8
|
-
declare type NumericNode = Dimension | Color;
|
|
9
|
-
/**
|
|
10
|
-
* An operation like `2px * (3 + 1)`
|
|
11
|
-
*/
|
|
12
|
-
export declare function op(expr: NumericNode | Expression | any[]): NumericNode;
|
|
13
|
-
export {};
|
package/lib/math.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.op = void 0;
|
|
4
|
-
const jess_1 = require("jess");
|
|
5
|
-
/** Turn a value into a Numeric Node */
|
|
6
|
-
function normalize(val) {
|
|
7
|
-
return val.constructor === Number ? new jess_1.Dimension(val) : val;
|
|
8
|
-
}
|
|
9
|
-
function doMath(op, left, right) {
|
|
10
|
-
switch (op) {
|
|
11
|
-
case '*':
|
|
12
|
-
return left * right;
|
|
13
|
-
case '/':
|
|
14
|
-
return left / right;
|
|
15
|
-
case '+':
|
|
16
|
-
return left + right;
|
|
17
|
-
case '-':
|
|
18
|
-
return left - right;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function toColor(node) {
|
|
22
|
-
if (node instanceof jess_1.Color) {
|
|
23
|
-
return node;
|
|
24
|
-
}
|
|
25
|
-
const value = node.value;
|
|
26
|
-
return new jess_1.Color({
|
|
27
|
-
value: '',
|
|
28
|
-
rgba: [value, value, value, 1]
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function colorOp(op, a, b) {
|
|
32
|
-
let left = toColor(a).rgba;
|
|
33
|
-
let right = toColor(b).rgba;
|
|
34
|
-
const rgba = new Array(4);
|
|
35
|
-
for (let i = 0; i < 3; i++) {
|
|
36
|
-
rgba[i] = doMath(op, left[i], right[i]);
|
|
37
|
-
}
|
|
38
|
-
rgba[3] = left[3] * (1 - right[3]) + right[3];
|
|
39
|
-
return new jess_1.Color({
|
|
40
|
-
value: '',
|
|
41
|
-
rgba
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Math multiply
|
|
46
|
-
*/
|
|
47
|
-
function multiply(left, right) {
|
|
48
|
-
if (left.unit && right.unit) {
|
|
49
|
-
throw { message: 'Can\'t multiply a unit by a unit.' };
|
|
50
|
-
}
|
|
51
|
-
for (let i = 0; i < 2; i++) {
|
|
52
|
-
const a = i === 0 ? left : right;
|
|
53
|
-
const b = i === 0 ? right : left;
|
|
54
|
-
if (a instanceof jess_1.Color) {
|
|
55
|
-
if (b instanceof jess_1.Color) {
|
|
56
|
-
throw { message: 'Can\'t multiply colors. Use a color blending function.' };
|
|
57
|
-
}
|
|
58
|
-
if (b.unit) {
|
|
59
|
-
throw { message: 'Can\'t multiply a unit and a color.' };
|
|
60
|
-
}
|
|
61
|
-
return colorOp('*', a, b);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const aDim = left;
|
|
65
|
-
const bDim = right;
|
|
66
|
-
return new jess_1.Dimension({
|
|
67
|
-
value: aDim.value * bDim.value,
|
|
68
|
-
unit: aDim.unit || bDim.unit
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Math divide
|
|
73
|
-
*/
|
|
74
|
-
function divide(left, right) {
|
|
75
|
-
if (left instanceof jess_1.Color) {
|
|
76
|
-
if (right instanceof jess_1.Color) {
|
|
77
|
-
throw { message: 'Can\'t divide colors. Use a color blending function.' };
|
|
78
|
-
}
|
|
79
|
-
if (right.unit) {
|
|
80
|
-
throw { message: 'Can\'t divide a color by a unit.' };
|
|
81
|
-
}
|
|
82
|
-
return colorOp('/', left, right);
|
|
83
|
-
}
|
|
84
|
-
if (right instanceof jess_1.Color) {
|
|
85
|
-
throw { message: 'Can\'t divide a dimension by a color.' };
|
|
86
|
-
}
|
|
87
|
-
if (right.unit && left.unit !== right.unit) {
|
|
88
|
-
throw { message: 'Can\'t divide mixed units.' };
|
|
89
|
-
}
|
|
90
|
-
const value = left.value / right.value;
|
|
91
|
-
if (left.unit && left.unit === right.unit) {
|
|
92
|
-
/** Cancel units */
|
|
93
|
-
return new jess_1.Dimension({ value });
|
|
94
|
-
}
|
|
95
|
-
return new jess_1.Dimension({
|
|
96
|
-
value,
|
|
97
|
-
unit: left.unit
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Math add & subtract
|
|
102
|
-
*/
|
|
103
|
-
function add(op, left, right) {
|
|
104
|
-
if (left instanceof jess_1.Color || right instanceof jess_1.Color) {
|
|
105
|
-
return colorOp(op, left, right);
|
|
106
|
-
}
|
|
107
|
-
return new jess_1.Dimension({
|
|
108
|
-
value: doMath(op, left.value, right.value),
|
|
109
|
-
unit: left.unit || right.unit
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function operate(operator, a, b) {
|
|
113
|
-
const getValue = (node) => {
|
|
114
|
-
const value = node.value;
|
|
115
|
-
if (!(value instanceof jess_1.Expression) &&
|
|
116
|
-
!(value instanceof jess_1.Dimension) &&
|
|
117
|
-
!(value instanceof jess_1.Color)) {
|
|
118
|
-
throw { message: 'Not a valid math expression.' };
|
|
119
|
-
}
|
|
120
|
-
return op(value);
|
|
121
|
-
};
|
|
122
|
-
if (a instanceof jess_1.Paren) {
|
|
123
|
-
a = getValue(a);
|
|
124
|
-
}
|
|
125
|
-
if (b instanceof jess_1.Paren) {
|
|
126
|
-
b = getValue(b);
|
|
127
|
-
}
|
|
128
|
-
switch (operator) {
|
|
129
|
-
case '*':
|
|
130
|
-
return multiply(a, b);
|
|
131
|
-
case '/':
|
|
132
|
-
return divide(a, b);
|
|
133
|
-
case '+':
|
|
134
|
-
case '-':
|
|
135
|
-
return add(operator, a, b);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* An operation like `2px * (3 + 1)`
|
|
140
|
-
*/
|
|
141
|
-
function op(expr) {
|
|
142
|
-
let values;
|
|
143
|
-
if (expr instanceof jess_1.Expression) {
|
|
144
|
-
values = expr.toArray();
|
|
145
|
-
}
|
|
146
|
-
else if (expr instanceof jess_1.Node) {
|
|
147
|
-
return expr;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
values = expr;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Convert values to Nodes w/ string operators
|
|
154
|
-
*/
|
|
155
|
-
values = values.map((v, i) => {
|
|
156
|
-
if (i % 2 === 0) {
|
|
157
|
-
return normalize(v);
|
|
158
|
-
}
|
|
159
|
-
let op;
|
|
160
|
-
if (v instanceof jess_1.Anonymous) {
|
|
161
|
-
op = v.value;
|
|
162
|
-
}
|
|
163
|
-
else if (v.constructor === String) {
|
|
164
|
-
op = v;
|
|
165
|
-
}
|
|
166
|
-
if (!op || !/[+\-*\/]/.test(op)) {
|
|
167
|
-
throw { message: 'Not a valid math expression.' };
|
|
168
|
-
}
|
|
169
|
-
return op;
|
|
170
|
-
});
|
|
171
|
-
if (values.length === 1) {
|
|
172
|
-
return values[0];
|
|
173
|
-
}
|
|
174
|
-
let a = values[0];
|
|
175
|
-
let additionValues = [];
|
|
176
|
-
/** Order of operations */
|
|
177
|
-
for (let i = 1; i < values.length; i += 2) {
|
|
178
|
-
let op = values[i];
|
|
179
|
-
let b = values[i + 1];
|
|
180
|
-
if (op === '*' || op === '/') {
|
|
181
|
-
a = operate(op, a, b);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
additionValues.push(a, op);
|
|
185
|
-
a = b;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (additionValues.length) {
|
|
189
|
-
additionValues.push(a);
|
|
190
|
-
a = values[0];
|
|
191
|
-
for (let i = 1; i < values.length; i += 2) {
|
|
192
|
-
let op = values[i];
|
|
193
|
-
let b = values[i + 1];
|
|
194
|
-
a = operate(op, a, b);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return a;
|
|
198
|
-
}
|
|
199
|
-
exports.op = op;
|