Comparing version 1.1.0-0 to 1.1.0-1
@@ -1,54 +0,28 @@ | ||
var rand = () => | ||
`${Math.random().toString(36)}00000000000000000` | ||
.replace(/[^a-z]+/g, '') | ||
.slice(0, 5); | ||
var rand = (function () { | ||
return (Math.random().toString(36) + '00000000000000000').replace(/[^a-z]+/g, '').slice(0, 5); | ||
}); | ||
var circles = () => { | ||
let size = 20; | ||
let background = ''; | ||
let radius = 2; | ||
let complement = false; | ||
let fill = '#343434'; | ||
let stroke = '#343434'; | ||
let strokeWidth = 0; | ||
let id = rand(); | ||
var circles = (function () { | ||
var size = 20; | ||
var background = ''; | ||
var radius = 2; | ||
var complement = false; | ||
var fill = '#343434'; | ||
var stroke = '#343434'; | ||
var strokeWidth = 0; | ||
var id = rand(); | ||
const $ = selection => { | ||
const group = selection | ||
.append('defs') | ||
.append('pattern') | ||
.attr('id', id) | ||
.attr('patternUnits', 'userSpaceOnUse') | ||
.attr('width', size) | ||
.attr('height', size); | ||
var $ = function $(selection) { | ||
var group = selection.append('defs').append('pattern').attr('id', id).attr('patternUnits', 'userSpaceOnUse').attr('width', size).attr('height', size); | ||
if (background) { | ||
group | ||
.append('rect') | ||
.attr('width', size) | ||
.attr('height', size) | ||
.attr('fill', background); | ||
group.append('rect').attr('width', size).attr('height', size).attr('fill', background); | ||
} | ||
group | ||
.append('circle') | ||
.attr('cx', size / 2) | ||
.attr('cy', size / 2) | ||
.attr('r', radius) | ||
.attr('fill', fill) | ||
.attr('stroke', stroke) | ||
.attr('stroke-width', strokeWidth); | ||
group.append('circle').attr('cx', size / 2).attr('cy', size / 2).attr('r', radius).attr('fill', fill).attr('stroke', stroke).attr('stroke-width', strokeWidth); | ||
if (complement) { | ||
[[0, 0], [0, size], [size, 0], [size, size]] | ||
.forEach(corner => { | ||
group | ||
.append('circle') | ||
.attr('cx', corner[0]) | ||
.attr('cy', corner[1]) | ||
.attr('r', radius) | ||
.attr('fill', fill) | ||
.attr('stroke', stroke) | ||
.attr('stroke-width', strokeWidth); | ||
}); | ||
[[0, 0], [0, size], [size, 0], [size, size]].forEach(function (corner) { | ||
group.append('circle').attr('cx', corner[0]).attr('cy', corner[1]).attr('r', radius).attr('fill', fill).attr('stroke', stroke).attr('stroke-width', strokeWidth); | ||
}); | ||
} | ||
@@ -141,71 +115,54 @@ }; | ||
$.url = function () { | ||
return `url(#${id})`; | ||
return 'url(#' + id + ')'; | ||
}; | ||
return $; | ||
}; | ||
}); | ||
var lines = () => { | ||
let size = 20; | ||
let stroke = '#343434'; | ||
let strokeWidth = 2; | ||
let background = ''; | ||
let id = rand(); | ||
let orientation = ['diagonal']; | ||
let shapeRendering = 'auto'; | ||
var lines = (function () { | ||
var size = 20; | ||
var stroke = '#343434'; | ||
var strokeWidth = 2; | ||
var background = ''; | ||
var id = rand(); | ||
var orientation = ['diagonal']; | ||
var shapeRendering = 'auto'; | ||
const path = orientation => { | ||
const s = size; | ||
var path = function path(orientation) { | ||
var s = size; | ||
switch (orientation) { | ||
case '0/8': | ||
case 'vertical': | ||
return `M ${s / 2}, 0 l 0, ${s}`; | ||
return 'M ' + s / 2 + ', 0 l 0, ' + s; | ||
case '1/8': | ||
return `M ${s / 4},0 l ${s / 2},${s} M ${-s / 4},0 l ${s / 2},${s} M ${s * 3 / 4},0 l ${s / 2},${s}`; | ||
return 'M ' + s / 4 + ',0 l ' + s / 2 + ',' + s + ' M ' + -s / 4 + ',0 l ' + s / 2 + ',' + s + ' M ' + s * 3 / 4 + ',0 l ' + s / 2 + ',' + s; | ||
case '2/8': | ||
case 'diagonal': | ||
return `M 0,${s} l ${s},${-s} M ${-s / 4},${s / 4} l ${s / 2},${-s / 2} M ${3 / 4 * s},${5 / 4 * s} l ${s / 2},${-s / 2}`; | ||
return 'M 0,' + s + ' l ' + s + ',' + -s + ' M ' + -s / 4 + ',' + s / 4 + ' l ' + s / 2 + ',' + -s / 2 + ' M ' + 3 / 4 * s + ',' + 5 / 4 * s + ' l ' + s / 2 + ',' + -s / 2; | ||
case '3/8': | ||
return `M 0,${3 / 4 * s} l ${s},${-s / 2} M 0,${s / 4} l ${s},${-s / 2} M 0,${s * 5 / 4} l ${s},${-s / 2}`; | ||
return 'M 0,' + 3 / 4 * s + ' l ' + s + ',' + -s / 2 + ' M 0,' + s / 4 + ' l ' + s + ',' + -s / 2 + ' M 0,' + s * 5 / 4 + ' l ' + s + ',' + -s / 2; | ||
case '4/8': | ||
case 'horizontal': | ||
return `M 0,${s / 2} l ${s},0`; | ||
return 'M 0,' + s / 2 + ' l ' + s + ',0'; | ||
case '5/8': | ||
return `M 0,${-s / 4} l ${s},${s / 2}M 0,${s / 4} l ${s},${s / 2} M 0,${s * 3 / 4} l ${s},${s / 2}`; | ||
return 'M 0,' + -s / 4 + ' l ' + s + ',' + s / 2 + 'M 0,' + s / 4 + ' l ' + s + ',' + s / 2 + ' M 0,' + s * 3 / 4 + ' l ' + s + ',' + s / 2; | ||
case '6/8': | ||
return `M 0,0 l ${s},${s} M ${-s / 4},${3 / 4 * s} l ${s / 2},${s / 2} M ${s * 3 / 4},${-s / 4} l ${s / 2},${s / 2}`; | ||
return 'M 0,0 l ' + s + ',' + s + ' M ' + -s / 4 + ',' + 3 / 4 * s + ' l ' + s / 2 + ',' + s / 2 + ' M ' + s * 3 / 4 + ',' + -s / 4 + ' l ' + s / 2 + ',' + s / 2; | ||
case '7/8': | ||
return `M ${-s / 4},0 l ${s / 2},${s} M ${s / 4},0 l ${s / 2},${s} M ${s * 3 / 4},0 l ${s / 2},${s}`; | ||
return 'M ' + -s / 4 + ',0 l ' + s / 2 + ',' + s + ' M ' + s / 4 + ',0 l ' + s / 2 + ',' + s + ' M ' + s * 3 / 4 + ',0 l ' + s / 2 + ',' + s; | ||
default: | ||
return `M ${s / 2}, 0 l 0, ${s}`; | ||
return 'M ' + s / 2 + ', 0 l 0, ' + s; | ||
} | ||
}; | ||
const $ = selection => { | ||
const group = selection | ||
.append('defs') | ||
.append('pattern') | ||
.attr('id', id) | ||
.attr('patternUnits', 'userSpaceOnUse') | ||
.attr('width', size) | ||
.attr('height', size); | ||
var $ = function $(selection) { | ||
var group = selection.append('defs').append('pattern').attr('id', id).attr('patternUnits', 'userSpaceOnUse').attr('width', size).attr('height', size); | ||
if (background) { | ||
group | ||
.append('rect') | ||
.attr('width', size) | ||
.attr('height', size) | ||
.attr('fill', background); | ||
group.append('rect').attr('width', size).attr('height', size).attr('fill', background); | ||
} | ||
orientation | ||
.forEach(o => { | ||
group | ||
.append('path') | ||
.attr('d', path(o)) | ||
.attr('stroke-width', strokeWidth) | ||
.attr('shape-rendering', shapeRendering) | ||
.attr('stroke', stroke) | ||
.attr('stroke-linecap', 'square'); | ||
}); | ||
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'); | ||
}); | ||
}; | ||
@@ -259,3 +216,7 @@ | ||
$.orientation = function (...args) { | ||
$.orientation = function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
if (arguments.length === 0) { | ||
@@ -292,39 +253,41 @@ return $; | ||
$.url = function () { | ||
return `url(#${id})`; | ||
return 'url(#' + id + ')'; | ||
}; | ||
return $; | ||
}; | ||
}); | ||
var paths = () => { | ||
let width = 1; | ||
let height = 1; | ||
let size = 20; | ||
let stroke = '#343434'; | ||
let strokeWidth = 2; | ||
let background = ''; | ||
let d = s => `M ${s / 4},${s * 3 / 4}l${s / 4},${-s / 2}l${s / 4},${s / 2}`; | ||
let id = rand(); | ||
let fill = 'transparent'; | ||
let shapeRendering = 'auto'; | ||
var paths = (function () { | ||
var width = 1; | ||
var height = 1; | ||
var size = 20; | ||
var stroke = '#343434'; | ||
var strokeWidth = 2; | ||
var background = ''; | ||
var d = function d(s) { | ||
return 'M ' + s / 4 + ',' + s * 3 / 4 + 'l' + s / 4 + ',' + -s / 2 + 'l' + s / 4 + ',' + s / 2; | ||
}; | ||
var id = rand(); | ||
var fill = 'transparent'; | ||
var shapeRendering = 'auto'; | ||
const path = _ => { | ||
const s = size; | ||
var path = function path(_) { | ||
var s = size; | ||
switch (_) { | ||
case 'squares': | ||
return `M ${s / 4} ${s / 4} l ${s / 2} 0 l 0 ${s / 2} l ${-s / 2} 0 Z`; | ||
return 'M ' + s / 4 + ' ' + s / 4 + ' l ' + s / 2 + ' 0 l 0 ' + s / 2 + ' l ' + -s / 2 + ' 0 Z'; | ||
case 'nylon': | ||
return `M 0 ${s / 4} l ${s / 4} 0 l 0 ${-s / 4} M ${s * 3 / 4} ${s} l 0 ${-s / 4} l ${s / 4} 0 M ${s / 4} ${s / 2} l 0 ${s / 4} l ${s / 4} 0 M ${s / 2} ${s / 4} l ${s / 4} 0 l 0 ${s / 4}`; | ||
return 'M 0 ' + s / 4 + ' l ' + s / 4 + ' 0 l 0 ' + -s / 4 + ' M ' + s * 3 / 4 + ' ' + s + ' l 0 ' + -s / 4 + ' l ' + s / 4 + ' 0 M ' + s / 4 + ' ' + s / 2 + ' l 0 ' + s / 4 + ' l ' + s / 4 + ' 0 M ' + s / 2 + ' ' + s / 4 + ' l ' + s / 4 + ' 0 l 0 ' + s / 4; | ||
case 'waves': | ||
return `M 0 ${s / 2} c ${s / 8} ${-s / 4} , ${s * 3 / 8} ${-s / 4} , ${s / 2} 0 c ${s / 8} ${s / 4} , ${s * 3 / 8} ${s / 4} , ${s / 2} 0 M ${-s / 2} ${s / 2} c ${s / 8} ${s / 4} , ${s * 3 / 8} ${s / 4} , ${s / 2} 0 M ${s} ${s / 2} c ${s / 8} ${-s / 4} , ${s * 3 / 8} ${-s / 4} , ${s / 2} 0`; | ||
return 'M 0 ' + s / 2 + ' c ' + s / 8 + ' ' + -s / 4 + ' , ' + s * 3 / 8 + ' ' + -s / 4 + ' , ' + s / 2 + ' 0 c ' + s / 8 + ' ' + s / 4 + ' , ' + s * 3 / 8 + ' ' + s / 4 + ' , ' + s / 2 + ' 0 M ' + -s / 2 + ' ' + s / 2 + ' c ' + s / 8 + ' ' + s / 4 + ' , ' + s * 3 / 8 + ' ' + s / 4 + ' , ' + s / 2 + ' 0 M ' + s + ' ' + s / 2 + ' c ' + s / 8 + ' ' + -s / 4 + ' , ' + s * 3 / 8 + ' ' + -s / 4 + ' , ' + s / 2 + ' 0'; | ||
case 'woven': | ||
return `M ${s / 4},${s / 4}l${s / 2},${s / 2}M${s * 3 / 4},${s / 4}l${s / 2},${-s / 2} M${s / 4},${s * 3 / 4}l${-s / 2},${s / 2}M${s * 3 / 4},${s * 5 / 4}l${s / 2},${-s / 2} M${-s / 4},${s / 4}l${s / 2},${-s / 2}`; | ||
return 'M ' + s / 4 + ',' + s / 4 + 'l' + s / 2 + ',' + s / 2 + 'M' + s * 3 / 4 + ',' + s / 4 + 'l' + s / 2 + ',' + -s / 2 + ' M' + s / 4 + ',' + s * 3 / 4 + 'l' + -s / 2 + ',' + s / 2 + 'M' + s * 3 / 4 + ',' + s * 5 / 4 + 'l' + s / 2 + ',' + -s / 2 + ' M' + -s / 4 + ',' + s / 4 + 'l' + s / 2 + ',' + -s / 2; | ||
case 'crosses': | ||
return `M ${s / 4},${s / 4}l${s / 2},${s / 2}M${s / 4},${s * 3 / 4}l${s / 2},${-s / 2}`; | ||
return 'M ' + s / 4 + ',' + s / 4 + 'l' + s / 2 + ',' + s / 2 + 'M' + s / 4 + ',' + s * 3 / 4 + 'l' + s / 2 + ',' + -s / 2; | ||
case 'caps': | ||
return `M ${s / 4},${s * 3 / 4}l${s / 4},${-s / 2}l${s / 4},${s / 2}`; | ||
return 'M ' + s / 4 + ',' + s * 3 / 4 + 'l' + s / 4 + ',' + -s / 2 + 'l' + s / 4 + ',' + s / 2; | ||
case 'hexagons': | ||
width = 3; | ||
height = Math.sqrt(3); | ||
return `M ${s},0 l ${s},0 l ${s / 2},${(s * Math.sqrt(3) / 2)} l ${(-s / 2)},${(s * Math.sqrt(3) / 2)} l ${(-s)},0 l ${(-s / 2)},${(-s * Math.sqrt(3) / 2)} Z M 0,${s * Math.sqrt(3) / 2} l ${s / 2},0 M ${(3 * s)},${s * Math.sqrt(3) / 2} l ${(-s / 2)},0`; | ||
return 'M ' + s + ',0 l ' + s + ',0 l ' + s / 2 + ',' + s * Math.sqrt(3) / 2 + ' l ' + -s / 2 + ',' + s * Math.sqrt(3) / 2 + ' l ' + -s + ',0 l ' + -s / 2 + ',' + -s * Math.sqrt(3) / 2 + ' Z M 0,' + s * Math.sqrt(3) / 2 + ' l ' + s / 2 + ',0 M ' + 3 * s + ',' + s * Math.sqrt(3) / 2 + ' l ' + -s / 2 + ',0'; | ||
default: | ||
@@ -335,28 +298,11 @@ return _(s); | ||
const $ = selection => { | ||
const p = path(d); | ||
const group = selection | ||
.append('defs') | ||
.append('pattern') | ||
.attr('id', id) | ||
.attr('patternUnits', 'userSpaceOnUse') | ||
.attr('width', size * width) | ||
.attr('height', size * height); | ||
var $ = function $(selection) { | ||
var p = path(d); | ||
var group = selection.append('defs').append('pattern').attr('id', id).attr('patternUnits', 'userSpaceOnUse').attr('width', size * width).attr('height', size * height); | ||
if (background) { | ||
group | ||
.append('rect') | ||
.attr('width', size * width) | ||
.attr('height', size * height) | ||
.attr('fill', background); | ||
group.append('rect').attr('width', size * width).attr('height', size * height).attr('fill', background); | ||
} | ||
group | ||
.append('path') | ||
.attr('d', p) | ||
.attr('fill', fill) | ||
.attr('stroke', stroke) | ||
.attr('stroke-width', strokeWidth) | ||
.attr('stroke-linecap', 'square') | ||
.attr('shape-rendering', shapeRendering); | ||
group.append('path').attr('d', p).attr('fill', fill).attr('stroke', stroke).attr('stroke-width', strokeWidth).attr('stroke-linecap', 'square').attr('shape-rendering', shapeRendering); | ||
}; | ||
@@ -444,14 +390,14 @@ | ||
$.url = function () { | ||
return `url(#${id})`; | ||
return 'url(#' + id + ')'; | ||
}; | ||
return $; | ||
}; | ||
}); | ||
var main = { | ||
circles, | ||
lines, | ||
paths | ||
circles: circles, | ||
lines: lines, | ||
paths: paths | ||
}; | ||
export default main; |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t.textures=r()}(this,function(){"use strict";var t=()=>`${Math.random().toString(36)}00000000000000000`.replace(/[^a-z]+/g,"").slice(0,5);return{circles:()=>{let r=20,n="",e=2,$=!1,a="#343434",u="#343434",i=0,l=t();const c=t=>{const c=t.append("defs").append("pattern").attr("id",l).attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r);n&&c.append("rect").attr("width",r).attr("height",r).attr("fill",n),c.append("circle").attr("cx",r/2).attr("cy",r/2).attr("r",e).attr("fill",a).attr("stroke",u).attr("stroke-width",i),$&&[[0,0],[0,r],[r,0],[r,r]].forEach(t=>{c.append("circle").attr("cx",t[0]).attr("cy",t[1]).attr("r",e).attr("fill",a).attr("stroke",u).attr("stroke-width",i)})};return c.heavier=function(t){return 0===arguments.length?e*=2:e*=2*t,c},c.lighter=function(t){return 0===arguments.length?e/=2:e/=2*t,c},c.thinner=function(t){return 0===arguments.length?r*=2:r*=2*t,c},c.thicker=function(t){return 0===arguments.length?r/=2:r/=2*t,c},c.background=function(t){return n=t,c},c.size=function(t){return r=t,c},c.complement=function(t){return $=0===arguments.length||t,c},c.radius=function(t){return e=t,c},c.fill=function(t){return a=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(#${l})`},c},lines:()=>{let r=20,n="#343434",e=2,$="",a=t(),u=["diagonal"],i="auto";const l=t=>{const n=r;switch(t){case"0/8":case"vertical":return`M ${n/2}, 0 l 0, ${n}`;case"1/8":return`M ${n/4},0 l ${n/2},${n} M ${-n/4},0 l ${n/2},${n} M ${3*n/4},0 l ${n/2},${n}`;case"2/8":case"diagonal":return`M 0,${n} l ${n},${-n} M ${-n/4},${n/4} l ${n/2},${-n/2} M ${.75*n},${5/4*n} l ${n/2},${-n/2}`;case"3/8":return`M 0,${.75*n} l ${n},${-n/2} M 0,${n/4} l ${n},${-n/2} M 0,${5*n/4} l ${n},${-n/2}`;case"4/8":case"horizontal":return`M 0,${n/2} l ${n},0`;case"5/8":return`M 0,${-n/4} l ${n},${n/2}M 0,${n/4} l ${n},${n/2} M 0,${3*n/4} l ${n},${n/2}`;case"6/8":return`M 0,0 l ${n},${n} M ${-n/4},${.75*n} l ${n/2},${n/2} M ${3*n/4},${-n/4} l ${n/2},${n/2}`;case"7/8":return`M ${-n/4},0 l ${n/2},${n} M ${n/4},0 l ${n/2},${n} M ${3*n/4},0 l ${n/2},${n}`;default:return`M ${n/2}, 0 l 0, ${n}`}},c=t=>{const c=t.append("defs").append("pattern").attr("id",a).attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r);$&&c.append("rect").attr("width",r).attr("height",r).attr("fill",$),u.forEach(t=>{c.append("path").attr("d",l(t)).attr("stroke-width",e).attr("shape-rendering",i).attr("stroke",n).attr("stroke-linecap","square")})};return c.heavier=function(t){return 0===arguments.length?e*=2:e*=2*t,c},c.lighter=function(t){return 0===arguments.length?e/=2:e/=2*t,c},c.thinner=function(t){return 0===arguments.length?r*=2:r*=2*t,c},c.thicker=function(t){return 0===arguments.length?r/=2:r/=2*t,c},c.background=function(t){return $=t,c},c.size=function(t){return r=t,c},c.orientation=function(...t){return 0===arguments.length?c:(u=t,c)},c.shapeRendering=function(t){return i=t,c},c.stroke=function(t){return n=t,c},c.strokeWidth=function(t){return e=t,c},c.id=function(t){return 0===arguments.length?a:(a=t,c)},c.url=function(){return`url(#${a})`},c},paths:()=>{let r=1,n=1,e=20,$="#343434",a=2,u="",i=t=>`M ${t/4},${3*t/4}l${t/4},${-t/2}l${t/4},${t/2}`,l=t(),c="transparent",o="auto";const s=t=>{const $=e;switch(t){case"squares":return`M ${$/4} ${$/4} l ${$/2} 0 l 0 ${$/2} l ${-$/2} 0 Z`;case"nylon":return`M 0 ${$/4} l ${$/4} 0 l 0 ${-$/4} M ${3*$/4} ${$} l 0 ${-$/4} l ${$/4} 0 M ${$/4} ${$/2} l 0 ${$/4} l ${$/4} 0 M ${$/2} ${$/4} l ${$/4} 0 l 0 ${$/4}`;case"waves":return`M 0 ${$/2} c ${$/8} ${-$/4} , ${3*$/8} ${-$/4} , ${$/2} 0 c ${$/8} ${$/4} , ${3*$/8} ${$/4} , ${$/2} 0 M ${-$/2} ${$/2} c ${$/8} ${$/4} , ${3*$/8} ${$/4} , ${$/2} 0 M ${$} ${$/2} c ${$/8} ${-$/4} , ${3*$/8} ${-$/4} , ${$/2} 0`;case"woven":return`M ${$/4},${$/4}l${$/2},${$/2}M${3*$/4},${$/4}l${$/2},${-$/2} M${$/4},${3*$/4}l${-$/2},${$/2}M${3*$/4},${5*$/4}l${$/2},${-$/2} M${-$/4},${$/4}l${$/2},${-$/2}`;case"crosses":return`M ${$/4},${$/4}l${$/2},${$/2}M${$/4},${3*$/4}l${$/2},${-$/2}`;case"caps":return`M ${$/4},${3*$/4}l${$/4},${-$/2}l${$/4},${$/2}`;case"hexagons":return r=3,n=Math.sqrt(3),`M ${$},0 l ${$},0 l ${$/2},${$*Math.sqrt(3)/2} l ${-$/2},${$*Math.sqrt(3)/2} l ${-$},0 l ${-$/2},${-$*Math.sqrt(3)/2} Z M 0,${$*Math.sqrt(3)/2} l ${$/2},0 M ${3*$},${$*Math.sqrt(3)/2} l ${-$/2},0`;default:return t($)}},h=t=>{const h=s(i),f=t.append("defs").append("pattern").attr("id",l).attr("patternUnits","userSpaceOnUse").attr("width",e*r).attr("height",e*n);u&&f.append("rect").attr("width",e*r).attr("height",e*n).attr("fill",u),f.append("path").attr("d",h).attr("fill",c).attr("stroke",$).attr("stroke-width",a).attr("stroke-linecap","square").attr("shape-rendering",o)};return h.heavier=function(t){return 0===arguments.length?a*=2:a*=2*t,h},h.lighter=function(t){return 0===arguments.length?a/=2:a/=2*t,h},h.thinner=function(t){return 0===arguments.length?e*=2:e*=2*t,h},h.thicker=function(t){return 0===arguments.length?e/=2:e/=2*t,h},h.background=function(t){return u=t,h},h.shapeRendering=function(t){return o=t,h},h.size=function(t){return e=t,h},h.d=function(t){return i=t,h},h.fill=function(t){return c=t,h},h.stroke=function(t){return $=t,h},h.strokeWidth=function(t){return a=t,h},h.id=function(t){return 0===arguments.length?l:(l=t,h)},h.url=function(){return`url(#${l})`},h}}}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t.textures=r()}(this,function(){"use strict";var t=function(){return(Math.random().toString(36)+"00000000000000000").replace(/[^a-z]+/g,"").slice(0,5)};return{circles:function(){var r=20,n="",e=2,a=!1,u="#343434",i="#343434",c=0,l=t(),o=function(t){var o=t.append("defs").append("pattern").attr("id",l).attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r);n&&o.append("rect").attr("width",r).attr("height",r).attr("fill",n),o.append("circle").attr("cx",r/2).attr("cy",r/2).attr("r",e).attr("fill",u).attr("stroke",i).attr("stroke-width",c),a&&[[0,0],[0,r],[r,0],[r,r]].forEach(function(t){o.append("circle").attr("cx",t[0]).attr("cy",t[1]).attr("r",e).attr("fill",u).attr("stroke",i).attr("stroke-width",c)})};return o.heavier=function(t){return 0===arguments.length?e*=2:e*=2*t,o},o.lighter=function(t){return 0===arguments.length?e/=2:e/=2*t,o},o.thinner=function(t){return 0===arguments.length?r*=2:r*=2*t,o},o.thicker=function(t){return 0===arguments.length?r/=2:r/=2*t,o},o.background=function(t){return n=t,o},o.size=function(t){return r=t,o},o.complement=function(t){return a=0===arguments.length||t,o},o.radius=function(t){return e=t,o},o.fill=function(t){return u=t,o},o.stroke=function(t){return i=t,o},o.strokeWidth=function(t){return c=t,o},o.id=function(t){return 0===arguments.length?l:(l=t,o)},o.url=function(){return"url(#"+l+")"},o},lines:function(){var r=20,n="#343434",e=2,a="",u=t(),i=["diagonal"],c="auto",l=function(t){var n=r;switch(t){case"0/8":case"vertical":return"M "+n/2+", 0 l 0, "+n;case"1/8":return"M "+n/4+",0 l "+n/2+","+n+" M "+-n/4+",0 l "+n/2+","+n+" M "+3*n/4+",0 l "+n/2+","+n;case"2/8":case"diagonal":return"M 0,"+n+" l "+n+","+-n+" M "+-n/4+","+n/4+" l "+n/2+","+-n/2+" M "+.75*n+","+5/4*n+" l "+n/2+","+-n/2;case"3/8":return"M 0,"+.75*n+" l "+n+","+-n/2+" M 0,"+n/4+" l "+n+","+-n/2+" M 0,"+5*n/4+" l "+n+","+-n/2;case"4/8":case"horizontal":return"M 0,"+n/2+" l "+n+",0";case"5/8":return"M 0,"+-n/4+" l "+n+","+n/2+"M 0,"+n/4+" l "+n+","+n/2+" M 0,"+3*n/4+" l "+n+","+n/2;case"6/8":return"M 0,0 l "+n+","+n+" M "+-n/4+","+.75*n+" l "+n/2+","+n/2+" M "+3*n/4+","+-n/4+" l "+n/2+","+n/2;case"7/8":return"M "+-n/4+",0 l "+n/2+","+n+" M "+n/4+",0 l "+n/2+","+n+" M "+3*n/4+",0 l "+n/2+","+n;default:return"M "+n/2+", 0 l 0, "+n}},o=function(t){var o=t.append("defs").append("pattern").attr("id",u).attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r);a&&o.append("rect").attr("width",r).attr("height",r).attr("fill",a),i.forEach(function(t){o.append("path").attr("d",l(t)).attr("stroke-width",e).attr("shape-rendering",c).attr("stroke",n).attr("stroke-linecap","square")})};return o.heavier=function(t){return 0===arguments.length?e*=2:e*=2*t,o},o.lighter=function(t){return 0===arguments.length?e/=2:e/=2*t,o},o.thinner=function(t){return 0===arguments.length?r*=2:r*=2*t,o},o.thicker=function(t){return 0===arguments.length?r/=2:r/=2*t,o},o.background=function(t){return a=t,o},o.size=function(t){return r=t,o},o.orientation=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return 0===arguments.length?o:(i=r,o)},o.shapeRendering=function(t){return c=t,o},o.stroke=function(t){return n=t,o},o.strokeWidth=function(t){return e=t,o},o.id=function(t){return 0===arguments.length?u:(u=t,o)},o.url=function(){return"url(#"+u+")"},o},paths:function(){var r=1,n=1,e=20,a="#343434",u=2,i="",c=function(t){return"M "+t/4+","+3*t/4+"l"+t/4+","+-t/2+"l"+t/4+","+t/2},l=t(),o="transparent",s="auto",f=function(t){var a=e;switch(t){case"squares":return"M "+a/4+" "+a/4+" l "+a/2+" 0 l 0 "+a/2+" l "+-a/2+" 0 Z";case"nylon":return"M 0 "+a/4+" l "+a/4+" 0 l 0 "+-a/4+" M "+3*a/4+" "+a+" l 0 "+-a/4+" l "+a/4+" 0 M "+a/4+" "+a/2+" l 0 "+a/4+" l "+a/4+" 0 M "+a/2+" "+a/4+" l "+a/4+" 0 l 0 "+a/4;case"waves":return"M 0 "+a/2+" c "+a/8+" "+-a/4+" , "+3*a/8+" "+-a/4+" , "+a/2+" 0 c "+a/8+" "+a/4+" , "+3*a/8+" "+a/4+" , "+a/2+" 0 M "+-a/2+" "+a/2+" c "+a/8+" "+a/4+" , "+3*a/8+" "+a/4+" , "+a/2+" 0 M "+a+" "+a/2+" c "+a/8+" "+-a/4+" , "+3*a/8+" "+-a/4+" , "+a/2+" 0";case"woven":return"M "+a/4+","+a/4+"l"+a/2+","+a/2+"M"+3*a/4+","+a/4+"l"+a/2+","+-a/2+" M"+a/4+","+3*a/4+"l"+-a/2+","+a/2+"M"+3*a/4+","+5*a/4+"l"+a/2+","+-a/2+" M"+-a/4+","+a/4+"l"+a/2+","+-a/2;case"crosses":return"M "+a/4+","+a/4+"l"+a/2+","+a/2+"M"+a/4+","+3*a/4+"l"+a/2+","+-a/2;case"caps":return"M "+a/4+","+3*a/4+"l"+a/4+","+-a/2+"l"+a/4+","+a/2;case"hexagons":return r=3,n=Math.sqrt(3),"M "+a+",0 l "+a+",0 l "+a/2+","+a*Math.sqrt(3)/2+" l "+-a/2+","+a*Math.sqrt(3)/2+" l "+-a+",0 l "+-a/2+","+-a*Math.sqrt(3)/2+" Z M 0,"+a*Math.sqrt(3)/2+" l "+a/2+",0 M "+3*a+","+a*Math.sqrt(3)/2+" l "+-a/2+",0";default:return t(a)}},h=function(t){var h=f(c),d=t.append("defs").append("pattern").attr("id",l).attr("patternUnits","userSpaceOnUse").attr("width",e*r).attr("height",e*n);i&&d.append("rect").attr("width",e*r).attr("height",e*n).attr("fill",i),d.append("path").attr("d",h).attr("fill",o).attr("stroke",a).attr("stroke-width",u).attr("stroke-linecap","square").attr("shape-rendering",s)};return h.heavier=function(t){return 0===arguments.length?u*=2:u*=2*t,h},h.lighter=function(t){return 0===arguments.length?u/=2:u/=2*t,h},h.thinner=function(t){return 0===arguments.length?e*=2:e*=2*t,h},h.thicker=function(t){return 0===arguments.length?e/=2:e/=2*t,h},h.background=function(t){return i=t,h},h.shapeRendering=function(t){return s=t,h},h.size=function(t){return e=t,h},h.d=function(t){return c=t,h},h.fill=function(t){return o=t,h},h.stroke=function(t){return a=t,h},h.strokeWidth=function(t){return u=t,h},h.id=function(t){return 0===arguments.length?l:(l=t,h)},h.url=function(){return"url(#"+l+")"},h}}}); |
{ | ||
"name": "textures", | ||
"version": "1.1.0-0", | ||
"version": "1.1.0-1", | ||
"description": "SVG patterns for Data Visualization", | ||
@@ -25,5 +25,4 @@ "repository": { | ||
}, | ||
"main": "dist/textures.cjs.js", | ||
"main": "dist/textures.js", | ||
"module": "dist/textures.esm.js", | ||
"browser": "dist/textures.js", | ||
"license": "MIT", | ||
@@ -36,2 +35,4 @@ "bugs": { | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"d3-selection": "^1.1.0", | ||
@@ -41,5 +42,5 @@ "faucet": "^0.0.1", | ||
"rollup": "^0.50.0", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"tape": "^4.8.0", | ||
"uglify-es": "^3.1.5", | ||
"xo": "^0.18.2" | ||
@@ -51,3 +52,4 @@ }, | ||
"test": "xo src/**/*.js && xo tests/**/*.js && tape tests/**/*.js | faucet", | ||
"pretest": "rollup -c" | ||
"pretest": "rollup -c", | ||
"pub": "np" | ||
}, | ||
@@ -54,0 +56,0 @@ "files": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18438
10
5
361