Comparing version 1.2.2 to 1.2.3
@@ -1,6 +0,6 @@ | ||
var rand = (function () { | ||
function random() { | ||
return "".concat(Math.random().toString(36), "00000000000000000").replace(/[^a-z]+/g, '').slice(0, 5); | ||
}); | ||
} | ||
var circles = (function () { | ||
function circles() { | ||
var size = 20; | ||
@@ -13,3 +13,3 @@ var background = ''; | ||
var strokeWidth = 0; | ||
var id = rand(); | ||
var id = random(); | ||
@@ -26,5 +26,6 @@ var $ = function $(selection) { | ||
if (complement) { | ||
[[0, 0], [0, size], [size, 0], [size, size]].forEach(function (corner) { | ||
for (var _i = 0, _arr = [[0, 0], [0, size], [size, 0], [size, size]]; _i < _arr.length; _i++) { | ||
var corner = _arr[_i]; | ||
group.append('circle').attr('cx', corner[0]).attr('cy', corner[1]).attr('r', radius).attr('fill', fill).attr('stroke', stroke).attr('stroke-width', strokeWidth); | ||
}); | ||
} | ||
} | ||
@@ -34,8 +35,3 @@ }; | ||
$.heavier = function (_) { | ||
if (arguments.length === 0) { | ||
radius *= 2; | ||
} else { | ||
radius *= 2 * _; | ||
} | ||
radius *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -45,8 +41,3 @@ }; | ||
$.lighter = function (_) { | ||
if (arguments.length === 0) { | ||
radius /= 2; | ||
} else { | ||
radius /= 2 * _; | ||
} | ||
radius /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -56,8 +47,3 @@ }; | ||
$.thinner = function (_) { | ||
if (arguments.length === 0) { | ||
size *= 2; | ||
} else { | ||
size *= 2 * _; | ||
} | ||
size *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -67,8 +53,3 @@ }; | ||
$.thicker = function (_) { | ||
if (arguments.length === 0) { | ||
size /= 2; | ||
} else { | ||
size /= 2 * _; | ||
} | ||
size /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -88,8 +69,3 @@ }; | ||
$.complement = function (_) { | ||
if (arguments.length === 0) { | ||
complement = true; | ||
} else { | ||
complement = _; | ||
} | ||
complement = arguments.length === 0 ? true : _; | ||
return $; | ||
@@ -132,5 +108,79 @@ }; | ||
return $; | ||
}); | ||
} | ||
var lines = (function () { | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _createForOfIteratorHelper(o, allowArrayLike) { | ||
var it; | ||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
var F = function () {}; | ||
return { | ||
s: F, | ||
n: function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}, | ||
e: function (e) { | ||
throw e; | ||
}, | ||
f: F | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var normalCompletion = true, | ||
didErr = false, | ||
err; | ||
return { | ||
s: function () { | ||
it = o[Symbol.iterator](); | ||
}, | ||
n: function () { | ||
var step = it.next(); | ||
normalCompletion = step.done; | ||
return step; | ||
}, | ||
e: function (e) { | ||
didErr = true; | ||
err = e; | ||
}, | ||
f: function () { | ||
try { | ||
if (!normalCompletion && it.return != null) it.return(); | ||
} finally { | ||
if (didErr) throw err; | ||
} | ||
} | ||
}; | ||
} | ||
function lines() { | ||
var size = 20; | ||
@@ -140,3 +190,3 @@ var stroke = '#343434'; | ||
var background = ''; | ||
var id = rand(); | ||
var id = random(); | ||
var orientation = ['diagonal']; | ||
@@ -154,3 +204,3 @@ var shapeRendering = 'auto'; | ||
case '1/8': | ||
return "M ".concat(s / 4, ",0 l ").concat(s / 2, ",").concat(s, " M ").concat(-s / 4, ",0 l ").concat(s / 2, ",").concat(s, " M ").concat(s * 3 / 4, ",0 l ").concat(s / 2, ",").concat(s); | ||
return "M ".concat(-s / 4, ",").concat(s, " l ").concat(s / 2, ",").concat(-s, " M ").concat(s / 4, ",").concat(s, " l ").concat(s / 2, ",").concat(-s, " M ").concat(s * 3 / 4, ",").concat(s, " l ").concat(s / 2, ",").concat(-s); | ||
@@ -189,14 +239,19 @@ case '2/8': | ||
orientation.forEach(function (o) { | ||
group.append('path').attr('d', path(o)).attr('stroke-width', strokeWidth).attr('shape-rendering', shapeRendering).attr('stroke', stroke).attr('stroke-linecap', 'square'); | ||
}); | ||
var _iterator = _createForOfIteratorHelper(orientation), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var o = _step.value; | ||
group.append('path').attr('d', path(o)).attr('stroke-width', strokeWidth).attr('shape-rendering', shapeRendering).attr('stroke', stroke).attr('stroke-linecap', 'square'); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
}; | ||
$.heavier = function (_) { | ||
if (arguments.length === 0) { | ||
strokeWidth *= 2; | ||
} else { | ||
strokeWidth *= 2 * _; | ||
} | ||
strokeWidth *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -206,8 +261,3 @@ }; | ||
$.lighter = function (_) { | ||
if (arguments.length === 0) { | ||
strokeWidth /= 2; | ||
} else { | ||
strokeWidth /= 2 * _; | ||
} | ||
strokeWidth /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -217,8 +267,3 @@ }; | ||
$.thinner = function (_) { | ||
if (arguments.length === 0) { | ||
size *= 2; | ||
} else { | ||
size *= 2 * _; | ||
} | ||
size *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -228,8 +273,3 @@ }; | ||
$.thicker = function (_) { | ||
if (arguments.length === 0) { | ||
size /= 2; | ||
} else { | ||
size /= 2 * _; | ||
} | ||
size /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -290,5 +330,5 @@ }; | ||
return $; | ||
}); | ||
} | ||
var paths = (function () { | ||
function paths() { | ||
var width = 1; | ||
@@ -305,3 +345,3 @@ var height = 1; | ||
var id = rand(); | ||
var id = random(); | ||
var fill = 'transparent'; | ||
@@ -354,8 +394,3 @@ var shapeRendering = 'auto'; | ||
$.heavier = function (_) { | ||
if (arguments.length === 0) { | ||
strokeWidth *= 2; | ||
} else { | ||
strokeWidth *= 2 * _; | ||
} | ||
strokeWidth *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -365,8 +400,3 @@ }; | ||
$.lighter = function (_) { | ||
if (arguments.length === 0) { | ||
strokeWidth /= 2; | ||
} else { | ||
strokeWidth /= 2 * _; | ||
} | ||
strokeWidth /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -376,8 +406,3 @@ }; | ||
$.thinner = function (_) { | ||
if (arguments.length === 0) { | ||
size *= 2; | ||
} else { | ||
size *= 2 * _; | ||
} | ||
size *= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -387,8 +412,3 @@ }; | ||
$.thicker = function (_) { | ||
if (arguments.length === 0) { | ||
size /= 2; | ||
} else { | ||
size /= 2 * _; | ||
} | ||
size /= arguments.length === 0 ? 2 : 2 * _; | ||
return $; | ||
@@ -446,4 +466,6 @@ }; | ||
return $; | ||
}); | ||
} | ||
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */ | ||
var main = { | ||
@@ -450,0 +472,0 @@ circles: circles, |
@@ -1,1 +0,1 @@ | ||
!function(t,c){"object"==typeof exports&&"undefined"!=typeof module?module.exports=c():"function"==typeof define&&define.amd?define(c):(t=t||self).textures=c()}(this,function(){"use strict";function t(){return"".concat(Math.random().toString(36),"00000000000000000").replace(/[^a-z]+/g,"").slice(0,5)}return{circles:function(){function c(t){var c=t.append("defs").append("pattern").attr("id",l).attr("patternUnits","userSpaceOnUse").attr("width",n).attr("height",n);a&&c.append("rect").attr("width",n).attr("height",n).attr("fill",a),c.append("circle").attr("cx",n/2).attr("cy",n/2).attr("r",o).attr("fill",e).attr("stroke",u).attr("stroke-width",i),r&&[[0,0],[0,n],[n,0],[n,n]].forEach(function(t){c.append("circle").attr("cx",t[0]).attr("cy",t[1]).attr("r",o).attr("fill",e).attr("stroke",u).attr("stroke-width",i)})}var n=20,a="",o=2,r=!1,e="#343434",u="#343434",i=0,l=t();return c.heavier=function(t){return o*=0===arguments.length?2:2*t,c},c.lighter=function(t){return o/=0===arguments.length?2:2*t,c},c.thinner=function(t){return n*=0===arguments.length?2:2*t,c},c.thicker=function(t){return n/=0===arguments.length?2:2*t,c},c.background=function(t){return a=t,c},c.size=function(t){return n=t,c},c.complement=function(t){return r=0===arguments.length||t,c},c.radius=function(t){return o=t,c},c.fill=function(t){return e=t,c},c.stroke=function(t){return u=t,c},c.strokeWidth=function(t){return i=t,c},c.id=function(t){return 0===arguments.length?l:(l=t,c)},c.url=function(){return"url(#".concat(l,")")},c},lines:function(){function a(t){var c=t.append("defs").append("pattern").attr("id",u).attr("patternUnits","userSpaceOnUse").attr("width",n).attr("height",n);e&&c.append("rect").attr("width",n).attr("height",n).attr("fill",e),i.forEach(function(t){c.append("path").attr("d",function(t){var c=n;switch(t){case"0/8":case"vertical":return"M ".concat(c/2,", 0 l 0, ").concat(c);case"1/8":return"M ".concat(c/4,",0 l ").concat(c/2,",").concat(c," M ").concat(-c/4,",0 l ").concat(c/2,",").concat(c," M ").concat(3*c/4,",0 l ").concat(c/2,",").concat(c);case"2/8":case"diagonal":return"M 0,".concat(c," l ").concat(c,",").concat(-c," M ").concat(-c/4,",").concat(c/4," l ").concat(c/2,",").concat(-c/2," M ").concat(.75*c,",").concat(5/4*c," l ").concat(c/2,",").concat(-c/2);case"3/8":return"M 0,".concat(.75*c," l ").concat(c,",").concat(-c/2," M 0,").concat(c/4," l ").concat(c,",").concat(-c/2," M 0,").concat(5*c/4," l ").concat(c,",").concat(-c/2);case"4/8":case"horizontal":return"M 0,".concat(c/2," l ").concat(c,",0");case"5/8":return"M 0,".concat(-c/4," l ").concat(c,",").concat(c/2,"M 0,").concat(c/4," l ").concat(c,",").concat(c/2," M 0,").concat(3*c/4," l ").concat(c,",").concat(c/2);case"6/8":return"M 0,0 l ".concat(c,",").concat(c," M ").concat(-c/4,",").concat(.75*c," l ").concat(c/2,",").concat(c/2," M ").concat(3*c/4,",").concat(-c/4," l ").concat(c/2,",").concat(c/2);case"7/8":return"M ".concat(-c/4,",0 l ").concat(c/2,",").concat(c," M ").concat(c/4,",0 l ").concat(c/2,",").concat(c," M ").concat(3*c/4,",0 l ").concat(c/2,",").concat(c);default:return"M ".concat(c/2,", 0 l 0, ").concat(c)}}(t)).attr("stroke-width",r).attr("shape-rendering",l).attr("stroke",o).attr("stroke-linecap","square")})}var n=20,o="#343434",r=2,e="",u=t(),i=["diagonal"],l="auto";return a.heavier=function(t){return r*=0===arguments.length?2:2*t,a},a.lighter=function(t){return r/=0===arguments.length?2:2*t,a},a.thinner=function(t){return n*=0===arguments.length?2:2*t,a},a.thicker=function(t){return n/=0===arguments.length?2:2*t,a},a.background=function(t){return e=t,a},a.size=function(t){return n=t,a},a.orientation=function(){for(var t=arguments.length,c=new Array(t),n=0;n<t;n++)c[n]=arguments[n];return 0===arguments.length||(i=c),a},a.shapeRendering=function(t){return l=t,a},a.stroke=function(t){return o=t,a},a.strokeWidth=function(t){return r=t,a},a.id=function(t){return 0===arguments.length?u:(u=t,a)},a.url=function(){return"url(#".concat(u,")")},a},paths:function(){function c(t){var c=function(t){var c=r;switch(t){case"squares":return"M ".concat(c/4," ").concat(c/4," l ").concat(c/2," 0 l 0 ").concat(c/2," l ").concat(-c/2," 0 Z");case"nylon":return"M 0 ".concat(c/4," l ").concat(c/4," 0 l 0 ").concat(-c/4," M ").concat(3*c/4," ").concat(c," l 0 ").concat(-c/4," l ").concat(c/4," 0 M ").concat(c/4," ").concat(c/2," l 0 ").concat(c/4," l ").concat(c/4," 0 M ").concat(c/2," ").concat(c/4," l ").concat(c/4," 0 l 0 ").concat(c/4);case"waves":return"M 0 ".concat(c/2," c ").concat(c/8," ").concat(-c/4," , ").concat(3*c/8," ").concat(-c/4," , ").concat(c/2," 0 c ").concat(c/8," ").concat(c/4," , ").concat(3*c/8," ").concat(c/4," , ").concat(c/2," 0 M ").concat(-c/2," ").concat(c/2," c ").concat(c/8," ").concat(c/4," , ").concat(3*c/8," ").concat(c/4," , ").concat(c/2," 0 M ").concat(c," ").concat(c/2," c ").concat(c/8," ").concat(-c/4," , ").concat(3*c/8," ").concat(-c/4," , ").concat(c/2," 0");case"woven":return"M ".concat(c/4,",").concat(c/4,"l").concat(c/2,",").concat(c/2,"M").concat(3*c/4,",").concat(c/4,"l").concat(c/2,",").concat(-c/2," M").concat(c/4,",").concat(3*c/4,"l").concat(-c/2,",").concat(c/2,"M").concat(3*c/4,",").concat(5*c/4,"l").concat(c/2,",").concat(-c/2," M").concat(-c/4,",").concat(c/4,"l").concat(c/2,",").concat(-c/2);case"crosses":return"M ".concat(c/4,",").concat(c/4,"l").concat(c/2,",").concat(c/2,"M").concat(c/4,",").concat(3*c/4,"l").concat(c/2,",").concat(-c/2);case"caps":return"M ".concat(c/4,",").concat(3*c/4,"l").concat(c/4,",").concat(-c/2,"l").concat(c/4,",").concat(c/2);case"hexagons":return a=3,o=Math.sqrt(3),"M ".concat(c,",0 l ").concat(c,",0 l ").concat(c/2,",").concat(c*Math.sqrt(3)/2," l ").concat(-c/2,",").concat(c*Math.sqrt(3)/2," l ").concat(-c,",0 l ").concat(-c/2,",").concat(-c*Math.sqrt(3)/2," Z M 0,").concat(c*Math.sqrt(3)/2," l ").concat(c/2,",0 M ").concat(3*c,",").concat(c*Math.sqrt(3)/2," l ").concat(-c/2,",0");default:return t(c)}}(l),n=t.append("defs").append("pattern").attr("id",s).attr("patternUnits","userSpaceOnUse").attr("width",r*a).attr("height",r*o);i&&n.append("rect").attr("width",r*a).attr("height",r*o).attr("fill",i),n.append("path").attr("d",c).attr("fill",f).attr("stroke",e).attr("stroke-width",u).attr("stroke-linecap","square").attr("shape-rendering",h)}var a=1,o=1,r=20,e="#343434",u=2,i="",l=function(t){return"M ".concat(t/4,",").concat(3*t/4,"l").concat(t/4,",").concat(-t/2,"l").concat(t/4,",").concat(t/2)},s=t(),f="transparent",h="auto";return c.heavier=function(t){return u*=0===arguments.length?2:2*t,c},c.lighter=function(t){return u/=0===arguments.length?2:2*t,c},c.thinner=function(t){return r*=0===arguments.length?2:2*t,c},c.thicker=function(t){return r/=0===arguments.length?2:2*t,c},c.background=function(t){return i=t,c},c.shapeRendering=function(t){return h=t,c},c.size=function(t){return r=t,c},c.d=function(t){return l=t,c},c.fill=function(t){return f=t,c},c.stroke=function(t){return e=t,c},c.strokeWidth=function(t){return u=t,c},c.id=function(t){return 0===arguments.length?s:(s=t,c)},c.url=function(){return"url(#".concat(s,")")},c}}}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).textures=n()}(this,function(){"use strict";function t(){return"".concat(Math.random().toString(36),"00000000000000000").replace(/[^a-z]+/g,"").slice(0,5)}function i(t,n){(null==n||n>t.length)&&(n=t.length);for(var c=0,a=new Array(n);c<n;c++)a[c]=t[c];return a}function d(t,n){var c;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(c=function(t,n){if(t){if("string"==typeof t)return i(t,n);var c=Object.prototype.toString.call(t).slice(8,-1);return"Object"===c&&t.constructor&&(c=t.constructor.name),"Map"===c||"Set"===c?Array.from(t):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?i(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){c&&(t=c);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,e=!0,u=!1;return{s:function(){c=t[Symbol.iterator]()},n:function(){var t=c.next();return e=t.done,t},e:function(t){u=!0,o=t},f:function(){try{e||null==c.return||c.return()}finally{if(u)throw o}}}}return{circles:function(){function n(t){var n=t.append("defs").append("pattern").attr("id",h).attr("patternUnits","userSpaceOnUse").attr("width",o).attr("height",o);if(e&&n.append("rect").attr("width",o).attr("height",o).attr("fill",e),n.append("circle").attr("cx",o/2).attr("cy",o/2).attr("r",u).attr("fill",l).attr("stroke",f).attr("stroke-width",s),i)for(var c=0,a=[[0,0],[0,o],[o,0],[o,o]];c<a.length;c++){var r=a[c];n.append("circle").attr("cx",r[0]).attr("cy",r[1]).attr("r",u).attr("fill",l).attr("stroke",f).attr("stroke-width",s)}}var o=20,e="",u=2,i=!1,l="#343434",f="#343434",s=0,h=t();return n.heavier=function(t){return u*=0===arguments.length?2:2*t,n},n.lighter=function(t){return u/=0===arguments.length?2:2*t,n},n.thinner=function(t){return o*=0===arguments.length?2:2*t,n},n.thicker=function(t){return o/=0===arguments.length?2:2*t,n},n.background=function(t){return e=t,n},n.size=function(t){return o=t,n},n.complement=function(t){return i=0===arguments.length||t,n},n.radius=function(t){return u=t,n},n.fill=function(t){return l=t,n},n.stroke=function(t){return f=t,n},n.strokeWidth=function(t){return s=t,n},n.id=function(t){return 0===arguments.length?h:(h=t,n)},n.url=function(){return"url(#".concat(h,")")},n},lines:function(){function o(t){var n=e;switch(t){case"0/8":case"vertical":return"M ".concat(n/2,", 0 l 0, ").concat(n);case"1/8":return"M ".concat(-n/4,",").concat(n," l ").concat(n/2,",").concat(-n," M ").concat(n/4,",").concat(n," l ").concat(n/2,",").concat(-n," M ").concat(3*n/4,",").concat(n," l ").concat(n/2,",").concat(-n);case"2/8":case"diagonal":return"M 0,".concat(n," l ").concat(n,",").concat(-n," M ").concat(-n/4,",").concat(n/4," l ").concat(n/2,",").concat(-n/2," M ").concat(.75*n,",").concat(5/4*n," l ").concat(n/2,",").concat(-n/2);case"3/8":return"M 0,".concat(.75*n," l ").concat(n,",").concat(-n/2," M 0,").concat(n/4," l ").concat(n,",").concat(-n/2," M 0,").concat(5*n/4," l ").concat(n,",").concat(-n/2);case"4/8":case"horizontal":return"M 0,".concat(n/2," l ").concat(n,",0");case"5/8":return"M 0,".concat(-n/4," l ").concat(n,",").concat(n/2,"M 0,").concat(n/4," l ").concat(n,",").concat(n/2," M 0,").concat(3*n/4," l ").concat(n,",").concat(n/2);case"6/8":return"M 0,0 l ".concat(n,",").concat(n," M ").concat(-n/4,",").concat(.75*n," l ").concat(n/2,",").concat(n/2," M ").concat(3*n/4,",").concat(-n/4," l ").concat(n/2,",").concat(n/2);case"7/8":return"M ".concat(-n/4,",0 l ").concat(n/2,",").concat(n," M ").concat(n/4,",0 l ").concat(n/2,",").concat(n," M ").concat(3*n/4,",0 l ").concat(n/2,",").concat(n);default:return"M ".concat(n/2,", 0 l 0, ").concat(n)}}function a(t){var n=t.append("defs").append("pattern").attr("id",f).attr("patternUnits","userSpaceOnUse").attr("width",e).attr("height",e);l&&n.append("rect").attr("width",e).attr("height",e).attr("fill",l);var c,a=d(s);try{for(a.s();!(c=a.n()).done;){var r=c.value;n.append("path").attr("d",o(r)).attr("stroke-width",i).attr("shape-rendering",h).attr("stroke",u).attr("stroke-linecap","square")}}catch(t){a.e(t)}finally{a.f()}}var e=20,u="#343434",i=2,l="",f=t(),s=["diagonal"],h="auto";return a.heavier=function(t){return i*=0===arguments.length?2:2*t,a},a.lighter=function(t){return i/=0===arguments.length?2:2*t,a},a.thinner=function(t){return e*=0===arguments.length?2:2*t,a},a.thicker=function(t){return e/=0===arguments.length?2:2*t,a},a.background=function(t){return l=t,a},a.size=function(t){return e=t,a},a.orientation=function(){for(var t=arguments.length,n=new Array(t),c=0;c<t;c++)n[c]=arguments[c];return 0===arguments.length||(s=n),a},a.shapeRendering=function(t){return h=t,a},a.stroke=function(t){return u=t,a},a.strokeWidth=function(t){return i=t,a},a.id=function(t){return 0===arguments.length?f:(f=t,a)},a.url=function(){return"url(#".concat(f,")")},a},paths:function(){function n(t){var n=function(t){var n=o;switch(t){case"squares":return"M ".concat(n/4," ").concat(n/4," l ").concat(n/2," 0 l 0 ").concat(n/2," l ").concat(-n/2," 0 Z");case"nylon":return"M 0 ".concat(n/4," l ").concat(n/4," 0 l 0 ").concat(-n/4," M ").concat(3*n/4," ").concat(n," l 0 ").concat(-n/4," l ").concat(n/4," 0 M ").concat(n/4," ").concat(n/2," l 0 ").concat(n/4," l ").concat(n/4," 0 M ").concat(n/2," ").concat(n/4," l ").concat(n/4," 0 l 0 ").concat(n/4);case"waves":return"M 0 ".concat(n/2," c ").concat(n/8," ").concat(-n/4," , ").concat(3*n/8," ").concat(-n/4," , ").concat(n/2," 0 c ").concat(n/8," ").concat(n/4," , ").concat(3*n/8," ").concat(n/4," , ").concat(n/2," 0 M ").concat(-n/2," ").concat(n/2," c ").concat(n/8," ").concat(n/4," , ").concat(3*n/8," ").concat(n/4," , ").concat(n/2," 0 M ").concat(n," ").concat(n/2," c ").concat(n/8," ").concat(-n/4," , ").concat(3*n/8," ").concat(-n/4," , ").concat(n/2," 0");case"woven":return"M ".concat(n/4,",").concat(n/4,"l").concat(n/2,",").concat(n/2,"M").concat(3*n/4,",").concat(n/4,"l").concat(n/2,",").concat(-n/2," M").concat(n/4,",").concat(3*n/4,"l").concat(-n/2,",").concat(n/2,"M").concat(3*n/4,",").concat(5*n/4,"l").concat(n/2,",").concat(-n/2," M").concat(-n/4,",").concat(n/4,"l").concat(n/2,",").concat(-n/2);case"crosses":return"M ".concat(n/4,",").concat(n/4,"l").concat(n/2,",").concat(n/2,"M").concat(n/4,",").concat(3*n/4,"l").concat(n/2,",").concat(-n/2);case"caps":return"M ".concat(n/4,",").concat(3*n/4,"l").concat(n/4,",").concat(-n/2,"l").concat(n/4,",").concat(n/2);case"hexagons":return a=3,r=Math.sqrt(3),"M ".concat(n,",0 l ").concat(n,",0 l ").concat(n/2,",").concat(n*Math.sqrt(3)/2," l ").concat(-n/2,",").concat(n*Math.sqrt(3)/2," l ").concat(-n,",0 l ").concat(-n/2,",").concat(-n*Math.sqrt(3)/2," Z M 0,").concat(n*Math.sqrt(3)/2," l ").concat(n/2,",0 M ").concat(3*n,",").concat(n*Math.sqrt(3)/2," l ").concat(-n/2,",0");default:return t(n)}}(l),c=t.append("defs").append("pattern").attr("id",f).attr("patternUnits","userSpaceOnUse").attr("width",o*a).attr("height",o*r);i&&c.append("rect").attr("width",o*a).attr("height",o*r).attr("fill",i),c.append("path").attr("d",n).attr("fill",s).attr("stroke",e).attr("stroke-width",u).attr("stroke-linecap","square").attr("shape-rendering",h)}var a=1,r=1,o=20,e="#343434",u=2,i="",l=function(t){return"M ".concat(t/4,",").concat(3*t/4,"l").concat(t/4,",").concat(-t/2,"l").concat(t/4,",").concat(t/2)},f=t(),s="transparent",h="auto";return n.heavier=function(t){return u*=0===arguments.length?2:2*t,n},n.lighter=function(t){return u/=0===arguments.length?2:2*t,n},n.thinner=function(t){return o*=0===arguments.length?2:2*t,n},n.thicker=function(t){return o/=0===arguments.length?2:2*t,n},n.background=function(t){return i=t,n},n.shapeRendering=function(t){return h=t,n},n.size=function(t){return o=t,n},n.d=function(t){return l=t,n},n.fill=function(t){return s=t,n},n.stroke=function(t){return e=t,n},n.strokeWidth=function(t){return u=t,n},n.id=function(t){return 0===arguments.length?f:(f=t,n)},n.url=function(){return"url(#".concat(f,")")},n}}}); |
{ | ||
"name": "textures", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "SVG patterns for Data Visualization", | ||
@@ -36,6 +36,6 @@ "repository": { | ||
"@babel/preset-env": "^7.5.5", | ||
"d3-selection": "^1.4.0", | ||
"d3-selection": "^2.0.0", | ||
"faucet": "^0.0.1", | ||
"jsdom": "^15.1.1", | ||
"np": "^5.0.3", | ||
"jsdom": "^16.2.2", | ||
"np": "^7.4.0", | ||
"rollup": "^1.18.0", | ||
@@ -46,4 +46,4 @@ "rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"tape": "^4.8.0", | ||
"xo": "^0.24.0" | ||
"tape": "^5.0.1", | ||
"xo": "^0.38.2" | ||
}, | ||
@@ -50,0 +50,0 @@ "scripts": { |
@@ -1,6 +0,5 @@ | ||
textures.js | ||
======== | ||
# textures.js | ||
Textures.js is a javascript library for creating SVG patterns. | ||
Made on top of **d3.js**, it is designed for data visualization. | ||
Textures.js is a JavaScript library for creating SVG patterns. | ||
Made on top of [**d3.js**](https://d3js.org/), it is designed for data visualization. | ||
@@ -19,21 +18,21 @@ Read more on http://riccardoscalco.github.io/textures/. | ||
``` | ||
```js | ||
import textures from 'textures'; | ||
``` | ||
You can also use`textures.js` in your html page with a `<script>` tag, dowloading `textures.js` in a local folder | ||
You can also use `textures.js` in your HTML page with a `<script>` tag by downloading `textures.js` to a local folder: | ||
``` | ||
```html | ||
<script src="path/to/textures.js"></script> | ||
``` | ||
or using the Unpkg CDN network | ||
or by using the Unpkg CDN network: | ||
``` | ||
```html | ||
<script src="https://unpkg.com/textures@1.2.0/dist/textures.js"></script> | ||
``` | ||
Then `textures.js` can be used alongside with `d3` with: | ||
Then `textures.js` can be used alongside `d3` with: | ||
``` | ||
```js | ||
const svg = d3 | ||
@@ -40,0 +39,0 @@ .select('#example') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24451
397
55