@palett/util-fluo
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,5 +5,6 @@ 'use strict'; | ||
var typen = require('typen'); | ||
var comparer = require('@aryth/comparer'); | ||
var convert = require('@palett/convert'); | ||
var dye = require('@palett/dye'); | ||
var numStrict = require('@typen/num-strict'); | ||
@@ -15,6 +16,2 @@ const STAT_BOUND_CONFIG = { | ||
const { | ||
isNumeric | ||
} = typen.Num; | ||
/** | ||
@@ -34,3 +31,3 @@ * Create a dye from a hsl array | ||
const amp = (x, min, lever, base) => (x - min) * lever + base; | ||
const scale = (x, min, lever, base, ceil) => comparer.min((comparer.max(x, min) - min) * lever + base, ceil); | ||
const dyeBlender = function (x) { | ||
@@ -44,3 +41,3 @@ var _ref; | ||
} = this; | ||
return _ref = [amp(x, m, rH, mH), amp(x, m, rS, mS), amp(x, m, rL, mL)], hslToDye(_ref); | ||
return _ref = [scale(x, m, rH, mH, 360), scale(x, m, rS, mS, 100), scale(x, m, rL, mL, 100)], hslToDye(_ref); | ||
}; | ||
@@ -61,6 +58,9 @@ /** | ||
// let protoType = function (it) { | ||
const STRING = 'string'; | ||
const parseHsl = color => { | ||
var _color; | ||
return typeof color === typen.STRING ? (_color = color, convert.hexToHsl(_color)) : color; | ||
return typeof color === STRING ? (_color = color, convert.hexToHsl(_color)) : color; | ||
}; | ||
@@ -119,10 +119,10 @@ | ||
let blendDye; | ||
return valueLeap.dif && colorLeap.dif.some(n => !!n) ? (blendDye = BlendDye(valueLeap, colorLeap), colorant ? mapper(vec, x => isNumeric(x) ? blendDye(x) : primeDye) : mapper(vec, x => { | ||
return valueLeap.dif && colorLeap.dif.some(n => !!n) ? (blendDye = BlendDye(valueLeap, colorLeap), colorant ? mapper(vec, x => numStrict.isNumeric(x) ? blendDye(x) : primeDye) : mapper(vec, x => { | ||
var _x, _x2; | ||
return isNumeric(x) ? (_x = x, blendDye(x)(_x)) : (_x2 = x, primeDye(_x2)); | ||
})) : (blendDye = (_colorLeap$min = colorLeap.min, hslToDye(_colorLeap$min)), colorant ? mapper(vec, x => isNumeric(x) ? blendDye : primeDye) : mapper(vec, x => { | ||
return numStrict.isNumeric(x) ? (_x = x, blendDye(x)(_x)) : (_x2 = x, primeDye(_x2)); | ||
})) : (blendDye = (_colorLeap$min = colorLeap.min, hslToDye(_colorLeap$min)), colorant ? mapper(vec, x => numStrict.isNumeric(x) ? blendDye : primeDye) : mapper(vec, x => { | ||
var _x3, _x4; | ||
return isNumeric(x) ? (_x3 = x, blendDye(_x3)) : (_x4 = x, primeDye(_x4)); | ||
return numStrict.isNumeric(x) ? (_x3 = x, blendDye(_x3)) : (_x4 = x, primeDye(_x4)); | ||
})); | ||
@@ -163,10 +163,10 @@ }; | ||
let blendDye; | ||
const fn = valueLeap.dif && colorLeap.dif.some(n => !!n) ? (blendDye = BlendDye(valueLeap, colorLeap), colorant ? (x, v) => isNumeric(v) ? blendDye(v) : primeDye : (x, v) => { | ||
const fn = valueLeap.dif && colorLeap.dif.some(n => !!n) ? (blendDye = BlendDye(valueLeap, colorLeap), colorant ? (x, v) => numStrict.isNumeric(v) ? blendDye(v) : primeDye : (x, v) => { | ||
var _x, _x2; | ||
return isNumeric(v) ? (_x = x, blendDye(v)(_x)) : (_x2 = x, primeDye(_x2)); | ||
}) : (blendDye = (_colorLeap$min = colorLeap.min, hslToDye(_colorLeap$min)), colorant ? (x, v) => isNumeric(v) ? blendDye : primeDye : (x, v) => { | ||
return numStrict.isNumeric(v) ? (_x = x, blendDye(v)(_x)) : (_x2 = x, primeDye(_x2)); | ||
}) : (blendDye = (_colorLeap$min = colorLeap.min, hslToDye(_colorLeap$min)), colorant ? (x, v) => numStrict.isNumeric(v) ? blendDye : primeDye : (x, v) => { | ||
var _x3, _x4; | ||
return isNumeric(v) ? (_x3 = x, blendDye(_x3)) : (_x4 = x, primeDye(_x4)); | ||
return numStrict.isNumeric(v) ? (_x3 = x, blendDye(_x3)) : (_x4 = x, primeDye(_x4)); | ||
}); | ||
@@ -215,5 +215,4 @@ return zipper(keys, values, fn); | ||
exports.hslToDye = hslToDye; | ||
exports.isNumeric = isNumeric; | ||
exports.leverage = leverage; | ||
exports.presetToFlatDye = presetToFlatDye; | ||
exports.presetToLeap = presetToLeap; |
@@ -1,4 +0,5 @@ | ||
import { Num, STRING } from 'typen'; | ||
import { min, max } from '@aryth/comparer'; | ||
import { hslToRgb, hexToHsl } from '@palett/convert'; | ||
import { Dye } from '@palett/dye'; | ||
import { isNumeric } from '@typen/num-strict'; | ||
@@ -10,6 +11,2 @@ const STAT_BOUND_CONFIG = { | ||
const { | ||
isNumeric | ||
} = Num; | ||
/** | ||
@@ -29,3 +26,3 @@ * Create a dye from a hsl array | ||
const amp = (x, min, lever, base) => (x - min) * lever + base; | ||
const scale = (x, min$1, lever, base, ceil) => min((max(x, min$1) - min$1) * lever + base, ceil); | ||
const dyeBlender = function (x) { | ||
@@ -39,3 +36,3 @@ var _ref; | ||
} = this; | ||
return _ref = [amp(x, m, rH, mH), amp(x, m, rS, mS), amp(x, m, rL, mL)], hslToDye(_ref); | ||
return _ref = [scale(x, m, rH, mH, 360), scale(x, m, rS, mS, 100), scale(x, m, rL, mL, 100)], hslToDye(_ref); | ||
}; | ||
@@ -56,2 +53,5 @@ /** | ||
// let protoType = function (it) { | ||
const STRING = 'string'; | ||
const parseHsl = color => { | ||
@@ -202,2 +202,2 @@ var _color; | ||
export { BlendDye, STAT_BOUND_CONFIG, dyeMap, dyeZip, fluoZip, hslToDye, isNumeric, leverage, presetToFlatDye, presetToLeap }; | ||
export { BlendDye, STAT_BOUND_CONFIG, dyeMap, dyeZip, fluoZip, hslToDye, leverage, presetToFlatDye, presetToLeap }; |
{ | ||
"name": "@palett/util-fluo", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A colorant to string", | ||
@@ -15,9 +15,9 @@ "main": "dist/index.cjs.js", | ||
"pub": "npm publish", | ||
"test": "node -r @babel/register test/test.index.js", | ||
"test-jest": "jest" | ||
"test": "node -r @babel/register test/test.index.js" | ||
}, | ||
"dependencies": { | ||
"@palett/convert": "^0.1.0", | ||
"@palett/dye": "^0.1.0", | ||
"typen": "^0.1.9" | ||
"@aryth/comparer": "^0.1.0", | ||
"@palett/convert": "^0.1.1", | ||
"@palett/dye": "^0.1.1", | ||
"@typen/num-strict": "^0.0.4" | ||
}, | ||
@@ -42,3 +42,3 @@ "repository": { | ||
"homepage": "https://github.com/hoyeungw/palett/util-fluo#readme", | ||
"gitHead": "7ba647a8d09b2faf8cf20de17f087707a709159e" | ||
"gitHead": "74285697ae29dd9cb77b8543aee9aae974c7ca37" | ||
} |
13704
4
344
+ Added@aryth/comparer@^0.1.0
+ Added@typen/num-strict@^0.0.4
+ Added@aryth/comparer@0.1.14(transitive)
+ Added@typen/enum-data-types@0.0.4(transitive)
+ Added@typen/num-strict@0.0.4(transitive)
+ Added@typen/typ@0.0.4(transitive)
- Removedtypen@^0.1.9
Updated@palett/convert@^0.1.1
Updated@palett/dye@^0.1.1