-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.js.map
1 lines (1 loc) · 27.2 KB
/
browser.js.map
1
{"version":3,"file":"browser.js","sources":["index.js"],"sourcesContent":["const tinycolor = require('tinycolor2');\r\n\r\n/**\r\n * @typedef {Object} TinyGradient.StopInput\r\n * @property {ColorInput} color\r\n * @property {number} pos\r\n */\r\n\r\n/**\r\n * @typedef {Object} TinyGradient.StepValue\r\n * @type {number} [r]\r\n * @type {number} [g]\r\n * @type {number} [b]\r\n * @type {number} [h]\r\n * @type {number} [s]\r\n * @type {number} [v]\r\n * @type {number} [a]\r\n */\r\n\r\n/**\r\n * @type {StepValue}\r\n */\r\nconst RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };\r\n\r\n/**\r\n * @type {StepValue}\r\n */\r\nconst HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };\r\n\r\n/**\r\n * Linearly compute the step size between start and end (not normalized)\r\n * @param {StepValue} start\r\n * @param {StepValue} end\r\n * @param {number} steps - number of desired steps\r\n * @return {StepValue}\r\n */\r\nfunction stepize(start, end, steps) {\r\n let step = {};\r\n\r\n for (let k in start) {\r\n if (start.hasOwnProperty(k)) {\r\n step[k] = steps === 0 ? 0 : (end[k] - start[k]) / steps;\r\n }\r\n }\r\n\r\n return step;\r\n}\r\n\r\n/**\r\n * Compute the final step color\r\n * @param {StepValue} step - from `stepize`\r\n * @param {StepValue} start\r\n * @param {number} i - color index\r\n * @param {StepValue} max - rgba or hsva of maximum values for each channel\r\n * @return {StepValue}\r\n */\r\nfunction interpolate(step, start, i, max) {\r\n let color = {};\r\n\r\n for (let k in start) {\r\n if (start.hasOwnProperty(k)) {\r\n color[k] = step[k] * i + start[k];\r\n color[k] = color[k] < 0 ? color[k] + max[k] : (max[k] !== 1 ? color[k] % max[k] : color[k]);\r\n }\r\n }\r\n\r\n return color;\r\n}\r\n\r\n/**\r\n * Generate gradient with RGBa interpolation\r\n * @param {StopInput} stop1\r\n * @param {StopInput} stop2\r\n * @param {number} steps\r\n * @return {tinycolor[]} color1 included, color2 excluded\r\n */\r\nfunction interpolateRgb(stop1, stop2, steps) {\r\n const start = stop1.color.toRgb();\r\n const end = stop2.color.toRgb();\r\n const step = stepize(start, end, steps);\r\n let gradient = [stop1.color];\r\n\r\n for (let i = 1; i < steps; i++) {\r\n const color = interpolate(step, start, i, RGBA_MAX);\r\n gradient.push(tinycolor(color));\r\n }\r\n\r\n return gradient;\r\n}\r\n\r\n/**\r\n * Generate gradient with HSVa interpolation\r\n * @param {StopInput} stop1\r\n * @param {StopInput} stop2\r\n * @param {number} steps\r\n * @param {boolean|'long'|'short'} mode\r\n * @return {tinycolor[]} color1 included, color2 excluded\r\n */\r\nfunction interpolateHsv(stop1, stop2, steps, mode) {\r\n const start = stop1.color.toHsv();\r\n const end = stop2.color.toHsv();\r\n\r\n // rgb interpolation if one of the steps in grayscale\r\n if (start.s === 0 || end.s === 0) {\r\n return interpolateRgb(stop1, stop2, steps);\r\n }\r\n\r\n let trigonometric;\r\n if (typeof mode === 'boolean') {\r\n trigonometric = mode;\r\n }\r\n else {\r\n const trigShortest = (start.h < end.h && end.h - start.h < 180) || (start.h > end.h && start.h - end.h > 180);\r\n trigonometric = (mode === 'long' && trigShortest) || (mode === 'short' && !trigShortest);\r\n }\r\n\r\n const step = stepize(start, end, steps);\r\n let gradient = [stop1.color];\r\n\r\n // recompute hue\r\n let diff;\r\n if ((start.h <= end.h && !trigonometric) || (start.h >= end.h && trigonometric)) {\r\n diff = end.h - start.h;\r\n }\r\n else if (trigonometric) {\r\n diff = 360 - end.h + start.h;\r\n }\r\n else {\r\n diff = 360 - start.h + end.h;\r\n }\r\n step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff) / steps;\r\n\r\n for (let i = 1; i < steps; i++) {\r\n const color = interpolate(step, start, i, HSVA_MAX);\r\n gradient.push(tinycolor(color));\r\n }\r\n\r\n return gradient;\r\n}\r\n\r\n/**\r\n * Compute substeps between each stops\r\n * @param {StopInput[]} stops\r\n * @param {number} steps\r\n * @return {number[]}\r\n */\r\nfunction computeSubsteps(stops, steps) {\r\n const l = stops.length;\r\n\r\n // validation\r\n steps = parseInt(steps, 10);\r\n\r\n if (isNaN(steps) || steps < 2) {\r\n throw new Error('Invalid number of steps (< 2)');\r\n }\r\n if (steps < l) {\r\n throw new Error('Number of steps cannot be inferior to number of stops');\r\n }\r\n\r\n // compute substeps from stop positions\r\n let substeps = [];\r\n\r\n for (let i = 1; i < l; i++) {\r\n const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);\r\n substeps.push(Math.max(1, Math.round(step)));\r\n }\r\n\r\n // adjust number of steps\r\n let totalSubsteps = 1;\r\n for (let n = l - 1; n--;) totalSubsteps += substeps[n];\r\n\r\n while (totalSubsteps !== steps) {\r\n if (totalSubsteps < steps) {\r\n const min = Math.min.apply(null, substeps);\r\n substeps[substeps.indexOf(min)]++;\r\n totalSubsteps++;\r\n }\r\n else {\r\n const max = Math.max.apply(null, substeps);\r\n substeps[substeps.indexOf(max)]--;\r\n totalSubsteps--;\r\n }\r\n }\r\n\r\n return substeps;\r\n}\r\n\r\n/**\r\n * Compute the color at a specific position\r\n * @param {StopInput[]} stops\r\n * @param {number} pos\r\n * @param {string} method\r\n * @param {StepValue} max\r\n * @returns {tinycolor}\r\n */\r\nfunction computeAt(stops, pos, method, max) {\r\n if (pos < 0 || pos > 1) {\r\n throw new Error('Position must be between 0 and 1');\r\n }\r\n\r\n let start, end;\r\n for (let i = 0, l = stops.length; i < l - 1; i++) {\r\n if (pos >= stops[i].pos && pos < stops[i + 1].pos) {\r\n start = stops[i];\r\n end = stops[i + 1];\r\n break;\r\n }\r\n }\r\n\r\n if (!start) {\r\n start = end = stops[stops.length - 1];\r\n }\r\n\r\n const step = stepize(start.color[method](), end.color[method](), (end.pos - start.pos) * 100);\r\n const color = interpolate(step, start.color[method](), (pos - start.pos) * 100, max);\r\n return tinycolor(color);\r\n}\r\n\r\nclass TinyGradient {\r\n /**\r\n * @param {StopInput[]|ColorInput[]} stops\r\n * @returns {TinyGradient}\r\n */\r\n constructor(stops) {\r\n // validation\r\n if (stops.length < 2) {\r\n throw new Error('Invalid number of stops (< 2)');\r\n }\r\n\r\n const havingPositions = stops[0].pos !== undefined;\r\n let l = stops.length;\r\n let p = -1;\r\n let lastColorLess = false;\r\n // create tinycolor objects and clean positions\r\n this.stops = stops.map((stop, i) => {\r\n const hasPosition = stop.pos !== undefined;\r\n if (havingPositions ^ hasPosition) {\r\n throw new Error('Cannot mix positionned and not posionned color stops');\r\n }\r\n\r\n if (hasPosition) {\r\n const hasColor = stop.color !== undefined;\r\n if (!hasColor && (lastColorLess || i === 0 || i === l - 1)) {\r\n throw new Error('Cannot define two consecutive position-only stops');\r\n }\r\n lastColorLess = !hasColor;\r\n\r\n stop = {\r\n color : hasColor ? tinycolor(stop.color) : null,\r\n colorLess: !hasColor,\r\n pos : stop.pos\r\n };\r\n\r\n if (stop.pos < 0 || stop.pos > 1) {\r\n throw new Error('Color stops positions must be between 0 and 1');\r\n }\r\n else if (stop.pos < p) {\r\n throw new Error('Color stops positions are not ordered');\r\n }\r\n p = stop.pos;\r\n }\r\n else {\r\n stop = {\r\n color: tinycolor(stop.color !== undefined ? stop.color : stop),\r\n pos : i / (l - 1)\r\n };\r\n }\r\n\r\n return stop;\r\n });\r\n\r\n if (this.stops[0].pos !== 0) {\r\n this.stops.unshift({\r\n color: this.stops[0].color,\r\n pos : 0\r\n });\r\n l++;\r\n }\r\n if (this.stops[l - 1].pos !== 1) {\r\n this.stops.push({\r\n color: this.stops[l - 1].color,\r\n pos : 1\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Return new instance with reversed stops\r\n * @return {TinyGradient}\r\n */\r\n reverse() {\r\n let stops = [];\r\n\r\n this.stops.forEach(function (stop) {\r\n stops.push({\r\n color: stop.color,\r\n pos : 1 - stop.pos\r\n });\r\n });\r\n\r\n return new TinyGradient(stops.reverse());\r\n }\r\n\r\n /**\r\n * Return new instance with looped stops\r\n * @return {TinyGradient}\r\n */\r\n loop() {\r\n let stops1 = [];\r\n let stops2 = [];\r\n\r\n this.stops.forEach((stop) => {\r\n stops1.push({\r\n color: stop.color,\r\n pos : stop.pos / 2\r\n });\r\n });\r\n\r\n this.stops.slice(0, -1).forEach((stop) => {\r\n stops2.push({\r\n color: stop.color,\r\n pos : 1 - stop.pos / 2\r\n });\r\n });\r\n\r\n return new TinyGradient(stops1.concat(stops2.reverse()));\r\n }\r\n\r\n /**\r\n * Generate gradient with RGBa interpolation\r\n * @param {number} steps\r\n * @return {tinycolor[]}\r\n */\r\n rgb(steps) {\r\n const substeps = computeSubsteps(this.stops, steps);\r\n let gradient = [];\r\n\r\n this.stops.forEach((stop, i) => {\r\n if (stop.colorLess) {\r\n stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];\r\n }\r\n });\r\n\r\n for (let i = 0, l = this.stops.length; i < l - 1; i++) {\r\n const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);\r\n gradient.splice(gradient.length, 0, ...rgb);\r\n }\r\n\r\n gradient.push(this.stops[this.stops.length - 1].color);\r\n\r\n return gradient;\r\n }\r\n\r\n /**\r\n * Generate gradient with HSVa interpolation\r\n * @param {number} steps\r\n * @param {boolean|'long'|'short'} [mode=false]\r\n * - false to step in clockwise\r\n * - true to step in trigonometric order\r\n * - 'short' to use the shortest way\r\n * - 'long' to use the longest way\r\n * @return {tinycolor[]}\r\n */\r\n hsv(steps, mode) {\r\n const substeps = computeSubsteps(this.stops, steps);\r\n let gradient = [];\r\n\r\n this.stops.forEach((stop, i) => {\r\n if (stop.colorLess) {\r\n stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];\r\n }\r\n });\r\n\r\n for (let i = 0, l = this.stops.length; i < l - 1; i++) {\r\n const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);\r\n gradient.splice(gradient.length, 0, ...hsv);\r\n }\r\n\r\n gradient.push(this.stops[this.stops.length - 1].color);\r\n\r\n return gradient;\r\n }\r\n\r\n /**\r\n * Generate CSS3 command (no prefix) for this gradient\r\n * @param {String} [mode=linear] - 'linear' or 'radial'\r\n * @param {String} [direction] - default is 'to right' or 'ellipse at center'\r\n * @return {String}\r\n */\r\n css(mode, direction) {\r\n mode = mode || 'linear';\r\n direction = direction || (mode === 'linear' ? 'to right' : 'ellipse at center');\r\n\r\n let css = mode + '-gradient(' + direction;\r\n this.stops.forEach(function (stop) {\r\n css += ', ' + (stop.colorLess ? '' : stop.color.toRgbString() + ' ') + (stop.pos * 100) + '%';\r\n });\r\n css += ')';\r\n return css;\r\n }\r\n\r\n /**\r\n * Returns the color at specific position with RGBa interpolation\r\n * @param {number} pos, between 0 and 1\r\n * @return {tinycolor}\r\n */\r\n rgbAt(pos) {\r\n return computeAt(this.stops, pos, 'toRgb', RGBA_MAX);\r\n }\r\n\r\n /**\r\n * Returns the color at specific position with HSVa interpolation\r\n * @param {number} pos, between 0 and 1\r\n * @return {tinycolor}\r\n */\r\n hsvAt(pos) {\r\n return computeAt(this.stops, pos, 'toHsv', HSVA_MAX);\r\n }\r\n}\r\n\r\n/**\r\n * @param {StopInput[]|ColorInput[]|StopInput...|ColorInput...} stops\r\n * @returns {TinyGradient}\r\n */\r\nmodule.exports = function (stops) {\r\n // varargs\r\n if (arguments.length === 1) {\r\n if (!Array.isArray(arguments[0])) {\r\n throw new Error('\"stops\" is not an array');\r\n }\r\n stops = arguments[0];\r\n }\r\n else {\r\n stops = Array.prototype.slice.call(arguments);\r\n }\r\n\r\n return new TinyGradient(stops);\r\n};\r\n"],"names":["RGBA_MAX","r","g","b","a","HSVA_MAX","h","s","v","stepize","start","end","steps","step","k","hasOwnProperty","interpolate","i","max","color","interpolateRgb","stop1","stop2","toRgb","gradient","push","tinycolor","interpolateHsv","mode","toHsv","trigonometric","trigShortest","diff","Math","pow","abs","computeSubsteps","stops","l","length","parseInt","isNaN","Error","substeps","pos","round","totalSubsteps","n","min","apply","indexOf","computeAt","method","TinyGradient","havingPositions","undefined","p","lastColorLess","map","stop","hasPosition","hasColor","colorLess","unshift","_proto","prototype","reverse","forEach","loop","stops1","stops2","slice","concat","rgb","_this","splice","hsv","_this2","css","direction","toRgbString","rgbAt","hsvAt","tinygradient","arguments","Array","isArray","call"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMA,QAAQ,GAAG;AAAEC,EAAAA,CAAC,EAAE,GAAG;AAAEC,EAAAA,CAAC,EAAE,GAAG;AAAEC,EAAAA,CAAC,EAAE,GAAG;AAAEC,EAAAA,CAAC,EAAE,CAAA;CAAG,CAAA;;AAEjD;AACA;AACA;AACA,IAAMC,QAAQ,GAAG;AAAEC,EAAAA,CAAC,EAAE,GAAG;AAAEC,EAAAA,CAAC,EAAE,CAAC;AAAEC,EAAAA,CAAC,EAAE,CAAC;AAAEJ,EAAAA,CAAC,EAAE,CAAA;CAAG,CAAA;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,OAAOA,CAACC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAE;EAChC,IAAIC,IAAI,GAAG,EAAE,CAAA;AAEb,EAAA,KAAK,IAAIC,CAAC,IAAIJ,KAAK,EAAE;AACjB,IAAA,IAAIA,KAAK,CAACK,cAAc,CAACD,CAAC,CAAC,EAAE;MACzBD,IAAI,CAACC,CAAC,CAAC,GAAGF,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAACD,GAAG,CAACG,CAAC,CAAC,GAAGJ,KAAK,CAACI,CAAC,CAAC,IAAIF,KAAK,CAAA;AAC1D,KAAA;AACJ,GAAA;AAED,EAAA,OAAOC,IAAI,CAAA;AACf,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,WAAWA,CAACH,IAAI,EAAEH,KAAK,EAAEO,CAAC,EAAEC,GAAG,EAAE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