Comparing version 2.1.0 to 2.1.1
@@ -1,11 +0,11 @@ | ||
// https://d3js.org/d3-scale/ Version 2.1.0. Copyright 2018 Mike Bostock. | ||
// https://d3js.org/d3-scale/ v2.1.1 Copyright 2018 Mike Bostock | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) : | ||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3)); | ||
}(this, (function (exports,d3Array,d3Collection,d3Interpolate,d3Format,d3Time,d3TimeFormat) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-collection'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-collection', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) : | ||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3)); | ||
}(this, (function (exports,d3Collection,d3Array,d3Interpolate,d3Format,d3Time,d3TimeFormat) { 'use strict'; | ||
var array = Array.prototype; | ||
var map$1 = array.map; | ||
var map = array.map; | ||
var slice = array.slice; | ||
@@ -15,3 +15,3 @@ | ||
function ordinal(range$$1) { | ||
function ordinal(range) { | ||
var index = d3Collection.map(), | ||
@@ -21,3 +21,3 @@ domain = [], | ||
range$$1 = range$$1 == null ? [] : slice.call(range$$1); | ||
range = range == null ? [] : slice.call(range); | ||
@@ -30,3 +30,3 @@ function scale(d) { | ||
} | ||
return range$$1[(i - 1) % range$$1.length]; | ||
return range[(i - 1) % range.length]; | ||
} | ||
@@ -43,3 +43,3 @@ | ||
scale.range = function(_) { | ||
return arguments.length ? (range$$1 = slice.call(_), scale) : range$$1.slice(); | ||
return arguments.length ? (range = slice.call(_), scale) : range.slice(); | ||
}; | ||
@@ -54,3 +54,3 @@ | ||
.domain(domain) | ||
.range(range$$1) | ||
.range(range) | ||
.unknown(unknown); | ||
@@ -66,3 +66,3 @@ }; | ||
ordinalRange = scale.range, | ||
range$$1 = [0, 1], | ||
range = [0, 1], | ||
step, | ||
@@ -79,5 +79,5 @@ bandwidth, | ||
var n = domain().length, | ||
reverse = range$$1[1] < range$$1[0], | ||
start = range$$1[reverse - 0], | ||
stop = range$$1[1 - reverse]; | ||
reverse = range[1] < range[0], | ||
start = range[reverse - 0], | ||
stop = range[1 - reverse]; | ||
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); | ||
@@ -97,7 +97,7 @@ if (round) step = Math.floor(step); | ||
scale.range = function(_) { | ||
return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice(); | ||
return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice(); | ||
}; | ||
scale.rangeRound = function(_) { | ||
return range$$1 = [+_[0], +_[1]], round = true, rescale(); | ||
return range = [+_[0], +_[1]], round = true, rescale(); | ||
}; | ||
@@ -136,3 +136,3 @@ | ||
.domain(domain()) | ||
.range(range$$1) | ||
.range(range) | ||
.round(round) | ||
@@ -197,4 +197,4 @@ .paddingInner(paddingInner) | ||
function bimap(domain, range$$1, deinterpolate, reinterpolate) { | ||
var d0 = domain[0], d1 = domain[1], r0 = range$$1[0], r1 = range$$1[1]; | ||
function bimap(domain, range, deinterpolate, reinterpolate) { | ||
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; | ||
if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0); | ||
@@ -205,4 +205,4 @@ else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1); | ||
function polymap(domain, range$$1, deinterpolate, reinterpolate) { | ||
var j = Math.min(domain.length, range$$1.length) - 1, | ||
function polymap(domain, range, deinterpolate, reinterpolate) { | ||
var j = Math.min(domain.length, range.length) - 1, | ||
d = new Array(j), | ||
@@ -215,3 +215,3 @@ r = new Array(j), | ||
domain = domain.slice().reverse(); | ||
range$$1 = range$$1.slice().reverse(); | ||
range = range.slice().reverse(); | ||
} | ||
@@ -221,3 +221,3 @@ | ||
d[i] = deinterpolate(domain[i], domain[i + 1]); | ||
r[i] = reinterpolate(range$$1[i], range$$1[i + 1]); | ||
r[i] = reinterpolate(range[i], range[i + 1]); | ||
} | ||
@@ -243,4 +243,4 @@ | ||
var domain = unit, | ||
range$$1 = unit, | ||
interpolate$$1 = d3Interpolate.interpolate, | ||
range = unit, | ||
interpolate = d3Interpolate.interpolate, | ||
clamp = false, | ||
@@ -252,3 +252,3 @@ piecewise, | ||
function rescale() { | ||
piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap; | ||
piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap; | ||
output = input = null; | ||
@@ -259,19 +259,19 @@ return scale; | ||
function scale(x) { | ||
return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x); | ||
return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate)))(+x); | ||
} | ||
scale.invert = function(y) { | ||
return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); | ||
return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); | ||
}; | ||
scale.domain = function(_) { | ||
return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice(); | ||
return arguments.length ? (domain = map.call(_, number), rescale()) : domain.slice(); | ||
}; | ||
scale.range = function(_) { | ||
return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice(); | ||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice(); | ||
}; | ||
scale.rangeRound = function(_) { | ||
return range$$1 = slice.call(_), interpolate$$1 = d3Interpolate.interpolateRound, rescale(); | ||
return range = slice.call(_), interpolate = d3Interpolate.interpolateRound, rescale(); | ||
}; | ||
@@ -284,3 +284,3 @@ | ||
scale.interpolate = function(_) { | ||
return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1; | ||
return arguments.length ? (interpolate = _, rescale()) : interpolate; | ||
}; | ||
@@ -395,3 +395,3 @@ | ||
scale.domain = scale.range = function(_) { | ||
return arguments.length ? (domain = map$1.call(_, number), scale) : domain.slice(); | ||
return arguments.length ? (domain = map.call(_, number), scale) : domain.slice(); | ||
}; | ||
@@ -583,9 +583,9 @@ | ||
function quantile$1() { | ||
function quantile() { | ||
var domain = [], | ||
range$$1 = [], | ||
range = [], | ||
thresholds = []; | ||
function rescale() { | ||
var i = 0, n = Math.max(1, range$$1.length); | ||
var i = 0, n = Math.max(1, range.length); | ||
thresholds = new Array(n - 1); | ||
@@ -597,7 +597,7 @@ while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n); | ||
function scale(x) { | ||
if (!isNaN(x = +x)) return range$$1[d3Array.bisect(thresholds, x)]; | ||
if (!isNaN(x = +x)) return range[d3Array.bisect(thresholds, x)]; | ||
} | ||
scale.invertExtent = function(y) { | ||
var i = range$$1.indexOf(y); | ||
var i = range.indexOf(y); | ||
return i < 0 ? [NaN, NaN] : [ | ||
@@ -618,3 +618,3 @@ i > 0 ? thresholds[i - 1] : domain[0], | ||
scale.range = function(_) { | ||
return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice(); | ||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice(); | ||
}; | ||
@@ -627,5 +627,5 @@ | ||
scale.copy = function() { | ||
return quantile$1() | ||
return quantile() | ||
.domain(domain) | ||
.range(range$$1); | ||
.range(range); | ||
}; | ||
@@ -641,6 +641,6 @@ | ||
domain = [0.5], | ||
range$$1 = [0, 1]; | ||
range = [0, 1]; | ||
function scale(x) { | ||
if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)]; | ||
if (x <= x) return range[d3Array.bisect(domain, x, 0, n)]; | ||
} | ||
@@ -660,7 +660,7 @@ | ||
scale.range = function(_) { | ||
return arguments.length ? (n = (range$$1 = slice.call(_)).length - 1, rescale()) : range$$1.slice(); | ||
return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice(); | ||
}; | ||
scale.invertExtent = function(y) { | ||
var i = range$$1.indexOf(y); | ||
var i = range.indexOf(y); | ||
return i < 0 ? [NaN, NaN] | ||
@@ -675,3 +675,3 @@ : i < 1 ? [x0, domain[0]] | ||
.domain([x0, x1]) | ||
.range(range$$1); | ||
.range(range); | ||
}; | ||
@@ -684,19 +684,19 @@ | ||
var domain = [0.5], | ||
range$$1 = [0, 1], | ||
range = [0, 1], | ||
n = 1; | ||
function scale(x) { | ||
if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)]; | ||
if (x <= x) return range[d3Array.bisect(domain, x, 0, n)]; | ||
} | ||
scale.domain = function(_) { | ||
return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : domain.slice(); | ||
return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); | ||
}; | ||
scale.range = function(_) { | ||
return arguments.length ? (range$$1 = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : range$$1.slice(); | ||
return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); | ||
}; | ||
scale.invertExtent = function(y) { | ||
var i = range$$1.indexOf(y); | ||
var i = range.indexOf(y); | ||
return [domain[i - 1], domain[i]]; | ||
@@ -708,3 +708,3 @@ }; | ||
.domain(domain) | ||
.range(range$$1); | ||
.range(range); | ||
}; | ||
@@ -715,9 +715,9 @@ | ||
var durationSecond = 1000; | ||
var durationMinute = durationSecond * 60; | ||
var durationHour = durationMinute * 60; | ||
var durationDay = durationHour * 24; | ||
var durationWeek = durationDay * 7; | ||
var durationMonth = durationDay * 30; | ||
var durationYear = durationDay * 365; | ||
var durationSecond = 1000, | ||
durationMinute = durationSecond * 60, | ||
durationHour = durationMinute * 60, | ||
durationDay = durationHour * 24, | ||
durationWeek = durationDay * 7, | ||
durationMonth = durationDay * 30, | ||
durationYear = durationDay * 365; | ||
@@ -732,3 +732,3 @@ function date(t) { | ||
function calendar(year, month, week, day, hour, minute, second, millisecond, format$$1) { | ||
function calendar(year, month, week, day, hour, minute, second, millisecond, format) { | ||
var scale = continuous(deinterpolateLinear, d3Interpolate.interpolateNumber), | ||
@@ -738,10 +738,10 @@ invert = scale.invert, | ||
var formatMillisecond = format$$1(".%L"), | ||
formatSecond = format$$1(":%S"), | ||
formatMinute = format$$1("%I:%M"), | ||
formatHour = format$$1("%I %p"), | ||
formatDay = format$$1("%a %d"), | ||
formatWeek = format$$1("%b %d"), | ||
formatMonth = format$$1("%B"), | ||
formatYear = format$$1("%Y"); | ||
var formatMillisecond = format(".%L"), | ||
formatSecond = format(":%S"), | ||
formatMinute = format("%I:%M"), | ||
formatHour = format("%I %p"), | ||
formatDay = format("%a %d"), | ||
formatWeek = format("%b %d"), | ||
formatMonth = format("%B"), | ||
formatYear = format("%Y"); | ||
@@ -809,3 +809,3 @@ var tickIntervals = [ | ||
scale.domain = function(_) { | ||
return arguments.length ? domain(map$1.call(_, number$1)) : domain().map(date); | ||
return arguments.length ? domain(map.call(_, number$1)) : domain().map(date); | ||
}; | ||
@@ -826,3 +826,3 @@ | ||
scale.tickFormat = function(count, specifier) { | ||
return specifier == null ? tickFormat : format$$1(specifier); | ||
return specifier == null ? tickFormat : format(specifier); | ||
}; | ||
@@ -838,3 +838,3 @@ | ||
scale.copy = function() { | ||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format$$1)); | ||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); | ||
}; | ||
@@ -924,3 +924,3 @@ | ||
exports.scaleSqrt = sqrt; | ||
exports.scaleQuantile = quantile$1; | ||
exports.scaleQuantile = quantile; | ||
exports.scaleQuantize = quantize; | ||
@@ -927,0 +927,0 @@ exports.scaleThreshold = threshold; |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-scale/ Version 2.1.0. Copyright 2018 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-collection"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,i,u,o){"use strict";function a(n){function t(t){var e=t+"",o=r.get(e);if(!o){if(u!==C)return u;r.set(e,o=i.push(t))}return n[(o-1)%n.length]}var r=e.map(),i=[],u=C;return n=null==n?[]:B.call(n),t.domain=function(n){if(!arguments.length)return i.slice();i=[],r=e.map();for(var u,o,a=-1,c=n.length;++a<c;)r.has(o=(u=n[a])+"")||r.set(o,i.push(u));return t},t.range=function(e){return arguments.length?(n=B.call(e),t):n.slice()},t.unknown=function(n){return arguments.length?(u=n,t):u},t.copy=function(){return a().domain(i).range(n).unknown(u)},t}function c(){function n(){var n=u().length,i=l[1]<l[0],a=l[i-0],c=l[1-i];e=(c-a)/Math.max(1,n-h+2*d),f&&(e=Math.floor(e)),a+=(c-a-e*(n-h))*s,r=e*(1-h),f&&(a=Math.round(a),r=Math.round(r));var m=t.range(n).map(function(n){return a+e*n});return o(i?m.reverse():m)}var e,r,i=a().unknown(void 0),u=i.domain,o=i.range,l=[0,1],f=!1,h=0,d=0,s=.5;return delete i.unknown,i.domain=function(t){return arguments.length?(u(t),n()):u()},i.range=function(t){return arguments.length?(l=[+t[0],+t[1]],n()):l.slice()},i.rangeRound=function(t){return l=[+t[0],+t[1]],f=!0,n()},i.bandwidth=function(){return r},i.step=function(){return e},i.round=function(t){return arguments.length?(f=!!t,n()):f},i.padding=function(t){return arguments.length?(h=d=Math.max(0,Math.min(1,t)),n()):h},i.paddingInner=function(t){return arguments.length?(h=Math.max(0,Math.min(1,t)),n()):h},i.paddingOuter=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),n()):d},i.align=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),n()):s},i.copy=function(){return c().domain(u()).range(l).round(f).paddingInner(h).paddingOuter(d).align(s)},n()}function l(n){var t=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return l(t())},n}function f(n){return function(){return n}}function h(n){return+n}function d(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:f(t)}function s(n,t,e,r){var i=n[0],u=n[1],o=t[0],a=t[1];return u<i?(i=e(u,i),o=r(a,o)):(i=e(i,u),o=r(o,a)),function(n){return o(i(n))}}function m(n,e,r,i){var u=Math.min(n.length,e.length)-1,o=new Array(u),a=new Array(u),c=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++c<u;)o[c]=r(n[c],n[c+1]),a[c]=i(e[c],e[c+1]);return function(e){var r=t.bisect(n,e,1,u)-1;return a[r](o[r](e))}}function g(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp())}function p(n,t){function e(){return u=Math.min(c.length,l.length)>2?m:s,o=a=null,i}function i(t){return(o||(o=u(c,l,g?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=t?0:n>=e?1:r(n)}}}(n):n,f)))(+t)}var u,o,a,c=H,l=H,f=r.interpolate,g=!1;return i.invert=function(n){return(a||(a=u(l,c,d,g?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=0?t:n>=1?e:r(n)}}}(t):t)))(+n)},i.domain=function(n){return arguments.length?(c=j.call(n,h),e()):c.slice()},i.range=function(n){return arguments.length?(l=B.call(n),e()):l.slice()},i.rangeRound=function(n){return l=B.call(n),f=r.interpolateRound,e()},i.clamp=function(n){return arguments.length?(g=!!n,e()):g},i.interpolate=function(n){return arguments.length?(f=n,e()):f},e()}function M(n){var e=n.domain;return n.ticks=function(n){var r=e();return t.ticks(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,r){return function(n,e,r){var u,o=n[0],a=n[n.length-1],c=t.tickStep(o,a,null==e?10:e);switch((r=i.formatSpecifier(null==r?",f":r)).type){case"s":var l=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(u=i.precisionPrefix(c,l))||(r.precision=u),i.formatPrefix(r,l);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(u=i.precisionRound(c,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=u-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(u=i.precisionFixed(c))||(r.precision=u-2*("%"===r.type))}return i.format(r)}(e(),n,r)},n.nice=function(r){null==r&&(r=10);var i,u=e(),o=0,a=u.length-1,c=u[o],l=u[a];return l<c&&(i=c,c=l,l=i,i=o,o=a,a=i),(i=t.tickIncrement(c,l,r))>0?(c=Math.floor(c/i)*i,l=Math.ceil(l/i)*i,i=t.tickIncrement(c,l,r)):i<0&&(c=Math.ceil(c*i)/i,l=Math.floor(l*i)/i,i=t.tickIncrement(c,l,r)),i>0?(u[o]=Math.floor(c/i)*i,u[a]=Math.ceil(l/i)*i,e(u)):i<0&&(u[o]=Math.ceil(c*i)/i,u[a]=Math.floor(l*i)/i,e(u)),n},n}function v(){var n=p(d,r.interpolateNumber);return n.copy=function(){return g(n,v())},M(n)}function y(){function n(n){return+n}var t=[0,1];return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=j.call(e,h),n):t.slice()},n.copy=function(){return y().domain(t)},M(n)}function x(n,t){var e,r=0,i=(n=n.slice()).length-1,u=n[r],o=n[i];return o<u&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function k(n,t){return(t=Math.log(t/n))?function(e){return Math.log(e/n)/t}:f(t)}function w(n,t){return n<0?function(e){return-Math.pow(-t,e)*Math.pow(-n,1-e)}:function(e){return Math.pow(t,e)*Math.pow(n,1-e)}}function b(n){return isFinite(n)?+("1e"+n):n<0?0:n}function N(n){return 10===n?b:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}function D(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),function(t){return Math.log(t)/n})}function I(n){return function(t){return-n(-t)}}function q(){function n(){return o=D(u),a=N(u),r()[0]<0&&(o=I(o),a=I(a)),e}var e=p(k,w).domain([1,10]),r=e.domain,u=10,o=D(10),a=N(10);return e.base=function(t){return arguments.length?(u=+t,n()):u},e.domain=function(t){return arguments.length?(r(t),n()):r()},e.ticks=function(n){var e,i=r(),c=i[0],l=i[i.length-1];(e=l<c)&&(s=c,c=l,l=s);var f,h,d,s=o(c),m=o(l),g=null==n?10:+n,p=[];if(!(u%1)&&m-s<g){if(s=Math.round(s)-1,m=Math.round(m)+1,c>0){for(;s<m;++s)for(h=1,f=a(s);h<u;++h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else for(;s<m;++s)for(h=u-1,f=a(s);h>=1;--h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else p=t.ticks(s,m,Math.min(m-s,g)).map(a);return e?p.reverse():p},e.tickFormat=function(n,t){if(null==t&&(t=10===u?".0e":","),"function"!=typeof t&&(t=i.format(t)),n===1/0)return t;null==n&&(n=10);var r=Math.max(1,u*n/e.ticks().length);return function(n){var e=n/a(Math.round(o(n)));return e*u<u-.5&&(e*=u),e<=r?t(n):""}},e.nice=function(){return r(x(r(),{floor:function(n){return a(Math.floor(o(n)))},ceil:function(n){return a(Math.ceil(o(n)))}}))},e.copy=function(){return g(e,q().base(u))},e}function O(n,t){return n<0?-Math.pow(-n,t):Math.pow(n,t)}function S(){var n=1,t=p(function(t,e){return(e=O(e,n)-(t=O(t,n)))?function(r){return(O(r,n)-t)/e}:f(e)},function(t,e){return e=O(e,n)-(t=O(t,n)),function(r){return O(t+e*r,1/n)}}),e=t.domain;return t.exponent=function(t){return arguments.length?(n=+t,e(e())):n},t.copy=function(){return g(t,S().exponent(n))},M(t)}function F(){function n(){var n=0,o=Math.max(1,i.length);for(u=new Array(o-1);++n<o;)u[n-1]=t.quantile(r,n/o);return e}function e(n){if(!isNaN(n=+n))return i[t.bisect(u,n)]}var r=[],i=[],u=[];return e.invertExtent=function(n){var t=i.indexOf(n);return t<0?[NaN,NaN]:[t>0?u[t-1]:r[0],t<u.length?u[t]:r[r.length-1]]},e.domain=function(e){if(!arguments.length)return r.slice();r=[];for(var i,u=0,o=e.length;u<o;++u)null==(i=e[u])||isNaN(i=+i)||r.push(i);return r.sort(t.ascending),n()},e.range=function(t){return arguments.length?(i=B.call(t),n()):i.slice()},e.quantiles=function(){return u.slice()},e.copy=function(){return F().domain(r).range(i)},e}function A(){function n(n){if(n<=n)return a[t.bisect(o,n,0,u)]}function e(){var t=-1;for(o=new Array(u);++t<u;)o[t]=((t+1)*i-(t-u)*r)/(u+1);return n}var r=0,i=1,u=1,o=[.5],a=[0,1];return n.domain=function(n){return arguments.length?(r=+n[0],i=+n[1],e()):[r,i]},n.range=function(n){return arguments.length?(u=(a=B.call(n)).length-1,e()):a.slice()},n.invertExtent=function(n){var t=a.indexOf(n);return t<0?[NaN,NaN]:t<1?[r,o[0]]:t>=u?[o[u-1],i]:[o[t-1],o[t]]},n.copy=function(){return A().domain([r,i]).range(a)},M(n)}function E(){function n(n){if(n<=n)return r[t.bisect(e,n,0,i)]}var e=[.5],r=[0,1],i=1;return n.domain=function(t){return arguments.length?(e=B.call(t),i=Math.min(e.length,r.length-1),n):e.slice()},n.range=function(t){return arguments.length?(r=B.call(t),i=Math.min(e.length,r.length-1),n):r.slice()},n.invertExtent=function(n){var t=r.indexOf(n);return[e[t-1],e[t]]},n.copy=function(){return E().domain(e).range(r)},n}function P(n){return new Date(n)}function R(n){return n instanceof Date?+n:+new Date(+n)}function T(n,e,i,u,o,a,c,l,f){function h(t){return(c(t)<t?y:a(t)<t?k:o(t)<t?w:u(t)<t?b:e(t)<t?i(t)<t?N:D:n(t)<t?I:q)(t)}function s(e,r,i,u){if(null==e&&(e=10),"number"==typeof e){var o=Math.abs(i-r)/e,a=t.bisector(function(n){return n[2]}).right(O,o);a===O.length?(u=t.tickStep(r/K,i/K,e),e=n):a?(u=(a=O[o/O[a-1][2]<O[a][2]/o?a-1:a])[1],e=a[0]):(u=Math.max(t.tickStep(r,i,e),1),e=l)}return null==u?e:e.every(u)}var m=p(d,r.interpolateNumber),M=m.invert,v=m.domain,y=f(".%L"),k=f(":%S"),w=f("%I:%M"),b=f("%I %p"),N=f("%a %d"),D=f("%b %d"),I=f("%B"),q=f("%Y"),O=[[c,1,Q],[c,5,5*Q],[c,15,15*Q],[c,30,30*Q],[a,1,W],[a,5,5*W],[a,15,15*W],[a,30,30*W],[o,1,_],[o,3,3*_],[o,6,6*_],[o,12,12*_],[u,1,z],[u,2,2*z],[i,1,G],[e,1,J],[e,3,3*J],[n,1,K]];return m.invert=function(n){return new Date(M(n))},m.domain=function(n){return arguments.length?v(j.call(n,R)):v().map(P)},m.ticks=function(n,t){var e,r=v(),i=r[0],u=r[r.length-1],o=u<i;return o&&(e=i,i=u,u=e),e=s(n,i,u,t),e=e?e.range(i,u+1):[],o?e.reverse():e},m.tickFormat=function(n,t){return null==t?h:f(t)},m.nice=function(n,t){var e=v();return(n=s(n,e[0],e[e.length-1],t))?v(x(e,n)):m},m.copy=function(){return g(m,T(n,e,i,u,o,a,c,l,f))},m}function L(n){function t(t){var r=(t-e)*i;return n(u?Math.max(0,Math.min(1,r)):r)}var e=0,r=1,i=1,u=!1;return t.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=e===r?0:1/(r-e),t):[e,r]},t.clamp=function(n){return arguments.length?(u=!!n,t):u},t.interpolator=function(e){return arguments.length?(n=e,t):n},t.copy=function(){return L(n).domain([e,r]).clamp(u)},M(t)}function U(n){function t(t){var e=.5+((t=+t)-r)*(t<r?u:o);return n(a?Math.max(0,Math.min(1,e)):e)}var e=0,r=.5,i=1,u=1,o=1,a=!1;return t.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=+n[2],u=e===r?0:.5/(r-e),o=r===i?0:.5/(i-r),t):[e,r,i]},t.clamp=function(n){return arguments.length?(a=!!n,t):a},t.interpolator=function(e){return arguments.length?(n=e,t):n},t.copy=function(){return U(n).domain([e,r,i]).clamp(a)},M(t)}var Y=Array.prototype,j=Y.map,B=Y.slice,C={name:"implicit"},H=[0,1],Q=1e3,W=60*Q,_=60*W,z=24*_,G=7*z,J=30*z,K=365*z;n.scaleBand=c,n.scalePoint=function(){return l(c().paddingInner(1))},n.scaleIdentity=y,n.scaleLinear=v,n.scaleLog=q,n.scaleOrdinal=a,n.scaleImplicit=C,n.scalePow=S,n.scaleSqrt=function(){return S().exponent(.5)},n.scaleQuantile=F,n.scaleQuantize=A,n.scaleThreshold=E,n.scaleTime=function(){return T(u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,u.timeMillisecond,o.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},n.scaleUtc=function(){return T(u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,u.utcMillisecond,o.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},n.scaleSequential=L,n.scaleDiverging=U,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-scale/ v2.1.1 Copyright 2018 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-collection"),require("d3-array"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-collection","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,i,u,o){"use strict";var a=Array.prototype,c=a.map,l=a.slice,f={name:"implicit"};function h(n){var e=t.map(),r=[],i=f;function u(t){var u=t+"",o=e.get(u);if(!o){if(i!==f)return i;e.set(u,o=r.push(t))}return n[(o-1)%n.length]}return n=null==n?[]:l.call(n),u.domain=function(n){if(!arguments.length)return r.slice();r=[],e=t.map();for(var i,o,a=-1,c=n.length;++a<c;)e.has(o=(i=n[a])+"")||e.set(o,r.push(i));return u},u.range=function(t){return arguments.length?(n=l.call(t),u):n.slice()},u.unknown=function(n){return arguments.length?(i=n,u):i},u.copy=function(){return h().domain(r).range(n).unknown(i)},u}function d(){var n,t,r=h().unknown(void 0),i=r.domain,u=r.range,o=[0,1],a=!1,c=0,l=0,f=.5;function s(){var r=i().length,h=o[1]<o[0],d=o[h-0],s=o[1-h];n=(s-d)/Math.max(1,r-c+2*l),a&&(n=Math.floor(n)),d+=(s-d-n*(r-c))*f,t=n*(1-c),a&&(d=Math.round(d),t=Math.round(t));var m=e.range(r).map(function(t){return d+n*t});return u(h?m.reverse():m)}return delete r.unknown,r.domain=function(n){return arguments.length?(i(n),s()):i()},r.range=function(n){return arguments.length?(o=[+n[0],+n[1]],s()):o.slice()},r.rangeRound=function(n){return o=[+n[0],+n[1]],a=!0,s()},r.bandwidth=function(){return t},r.step=function(){return n},r.round=function(n){return arguments.length?(a=!!n,s()):a},r.padding=function(n){return arguments.length?(c=l=Math.max(0,Math.min(1,n)),s()):c},r.paddingInner=function(n){return arguments.length?(c=Math.max(0,Math.min(1,n)),s()):c},r.paddingOuter=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),s()):l},r.align=function(n){return arguments.length?(f=Math.max(0,Math.min(1,n)),s()):f},r.copy=function(){return d().domain(i()).range(o).round(a).paddingInner(c).paddingOuter(l).align(f)},s()}function s(n){return function(){return n}}function m(n){return+n}var g=[0,1];function p(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:s(t)}function M(n,t,e,r){var i=n[0],u=n[1],o=t[0],a=t[1];return u<i?(i=e(u,i),o=r(a,o)):(i=e(i,u),o=r(o,a)),function(n){return o(i(n))}}function v(n,t,r,i){var u=Math.min(n.length,t.length)-1,o=new Array(u),a=new Array(u),c=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++c<u;)o[c]=r(n[c],n[c+1]),a[c]=i(t[c],t[c+1]);return function(t){var r=e.bisect(n,t,1,u)-1;return a[r](o[r](t))}}function y(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp())}function x(n,t){var e,i,u,o=g,a=g,f=r.interpolate,h=!1;function d(){return e=Math.min(o.length,a.length)>2?v:M,i=u=null,s}function s(t){return(i||(i=e(o,a,h?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=t?0:n>=e?1:r(n)}}}(n):n,f)))(+t)}return s.invert=function(n){return(u||(u=e(a,o,p,h?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=0?t:n>=1?e:r(n)}}}(t):t)))(+n)},s.domain=function(n){return arguments.length?(o=c.call(n,m),d()):o.slice()},s.range=function(n){return arguments.length?(a=l.call(n),d()):a.slice()},s.rangeRound=function(n){return a=l.call(n),f=r.interpolateRound,d()},s.clamp=function(n){return arguments.length?(h=!!n,d()):h},s.interpolate=function(n){return arguments.length?(f=n,d()):f},d()}function k(n){var t=n.domain;return n.ticks=function(n){var r=t();return e.ticks(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,r){return function(n,t,r){var u,o=n[0],a=n[n.length-1],c=e.tickStep(o,a,null==t?10:t);switch((r=i.formatSpecifier(null==r?",f":r)).type){case"s":var l=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(u=i.precisionPrefix(c,l))||(r.precision=u),i.formatPrefix(r,l);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(u=i.precisionRound(c,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=u-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(u=i.precisionFixed(c))||(r.precision=u-2*("%"===r.type))}return i.format(r)}(t(),n,r)},n.nice=function(r){null==r&&(r=10);var i,u=t(),o=0,a=u.length-1,c=u[o],l=u[a];return l<c&&(i=c,c=l,l=i,i=o,o=a,a=i),(i=e.tickIncrement(c,l,r))>0?(c=Math.floor(c/i)*i,l=Math.ceil(l/i)*i,i=e.tickIncrement(c,l,r)):i<0&&(c=Math.ceil(c*i)/i,l=Math.floor(l*i)/i,i=e.tickIncrement(c,l,r)),i>0?(u[o]=Math.floor(c/i)*i,u[a]=Math.ceil(l/i)*i,t(u)):i<0&&(u[o]=Math.ceil(c*i)/i,u[a]=Math.floor(l*i)/i,t(u)),n},n}function w(n,t){var e,r=0,i=(n=n.slice()).length-1,u=n[r],o=n[i];return o<u&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function b(n,t){return(t=Math.log(t/n))?function(e){return Math.log(e/n)/t}:s(t)}function N(n,t){return n<0?function(e){return-Math.pow(-t,e)*Math.pow(-n,1-e)}:function(e){return Math.pow(t,e)*Math.pow(n,1-e)}}function D(n){return isFinite(n)?+("1e"+n):n<0?0:n}function I(n){return 10===n?D:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}function q(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),function(t){return Math.log(t)/n})}function O(n){return function(t){return-n(-t)}}function S(n,t){return n<0?-Math.pow(-n,t):Math.pow(n,t)}function F(){var n=1,t=x(function(t,e){return(e=S(e,n)-(t=S(t,n)))?function(r){return(S(r,n)-t)/e}:s(e)},function(t,e){return e=S(e,n)-(t=S(t,n)),function(r){return S(t+e*r,1/n)}}),e=t.domain;return t.exponent=function(t){return arguments.length?(n=+t,e(e())):n},t.copy=function(){return y(t,F().exponent(n))},k(t)}var A=1e3,E=60*A,P=60*E,R=24*P,T=7*R,L=30*R,U=365*R;function Y(n){return new Date(n)}function j(n){return n instanceof Date?+n:+new Date(+n)}function B(n,t,i,u,o,a,l,f,h){var d=x(p,r.interpolateNumber),s=d.invert,m=d.domain,g=h(".%L"),M=h(":%S"),v=h("%I:%M"),k=h("%I %p"),b=h("%a %d"),N=h("%b %d"),D=h("%B"),I=h("%Y"),q=[[l,1,A],[l,5,5*A],[l,15,15*A],[l,30,30*A],[a,1,E],[a,5,5*E],[a,15,15*E],[a,30,30*E],[o,1,P],[o,3,3*P],[o,6,6*P],[o,12,12*P],[u,1,R],[u,2,2*R],[i,1,T],[t,1,L],[t,3,3*L],[n,1,U]];function O(e){return(l(e)<e?g:a(e)<e?M:o(e)<e?v:u(e)<e?k:t(e)<e?i(e)<e?b:N:n(e)<e?D:I)(e)}function S(t,r,i,u){if(null==t&&(t=10),"number"==typeof t){var o=Math.abs(i-r)/t,a=e.bisector(function(n){return n[2]}).right(q,o);a===q.length?(u=e.tickStep(r/U,i/U,t),t=n):a?(u=(a=q[o/q[a-1][2]<q[a][2]/o?a-1:a])[1],t=a[0]):(u=Math.max(e.tickStep(r,i,t),1),t=f)}return null==u?t:t.every(u)}return d.invert=function(n){return new Date(s(n))},d.domain=function(n){return arguments.length?m(c.call(n,j)):m().map(Y)},d.ticks=function(n,t){var e,r=m(),i=r[0],u=r[r.length-1],o=u<i;return o&&(e=i,i=u,u=e),e=(e=S(n,i,u,t))?e.range(i,u+1):[],o?e.reverse():e},d.tickFormat=function(n,t){return null==t?O:h(t)},d.nice=function(n,t){var e=m();return(n=S(n,e[0],e[e.length-1],t))?m(w(e,n)):d},d.copy=function(){return y(d,B(n,t,i,u,o,a,l,f,h))},d}n.scaleBand=d,n.scalePoint=function(){return function n(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t}(d().paddingInner(1))},n.scaleIdentity=function n(){var t=[0,1];function e(n){return+n}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=c.call(n,m),e):t.slice()},e.copy=function(){return n().domain(t)},k(e)},n.scaleLinear=function n(){var t=x(p,r.interpolateNumber);return t.copy=function(){return y(t,n())},k(t)},n.scaleLog=function n(){var t=x(b,N).domain([1,10]),r=t.domain,u=10,o=q(10),a=I(10);function c(){return o=q(u),a=I(u),r()[0]<0&&(o=O(o),a=O(a)),t}return t.base=function(n){return arguments.length?(u=+n,c()):u},t.domain=function(n){return arguments.length?(r(n),c()):r()},t.ticks=function(n){var t,i=r(),c=i[0],l=i[i.length-1];(t=l<c)&&(s=c,c=l,l=s);var f,h,d,s=o(c),m=o(l),g=null==n?10:+n,p=[];if(!(u%1)&&m-s<g){if(s=Math.round(s)-1,m=Math.round(m)+1,c>0){for(;s<m;++s)for(h=1,f=a(s);h<u;++h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else for(;s<m;++s)for(h=u-1,f=a(s);h>=1;--h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else p=e.ticks(s,m,Math.min(m-s,g)).map(a);return t?p.reverse():p},t.tickFormat=function(n,e){if(null==e&&(e=10===u?".0e":","),"function"!=typeof e&&(e=i.format(e)),n===1/0)return e;null==n&&(n=10);var r=Math.max(1,u*n/t.ticks().length);return function(n){var t=n/a(Math.round(o(n)));return t*u<u-.5&&(t*=u),t<=r?e(n):""}},t.nice=function(){return r(w(r(),{floor:function(n){return a(Math.floor(o(n)))},ceil:function(n){return a(Math.ceil(o(n)))}}))},t.copy=function(){return y(t,n().base(u))},t},n.scaleOrdinal=h,n.scaleImplicit=f,n.scalePow=F,n.scaleSqrt=function(){return F().exponent(.5)},n.scaleQuantile=function n(){var t=[],r=[],i=[];function u(){var n=0,u=Math.max(1,r.length);for(i=new Array(u-1);++n<u;)i[n-1]=e.quantile(t,n/u);return o}function o(n){if(!isNaN(n=+n))return r[e.bisect(i,n)]}return o.invertExtent=function(n){var e=r.indexOf(n);return e<0?[NaN,NaN]:[e>0?i[e-1]:t[0],e<i.length?i[e]:t[t.length-1]]},o.domain=function(n){if(!arguments.length)return t.slice();t=[];for(var r,i=0,o=n.length;i<o;++i)null==(r=n[i])||isNaN(r=+r)||t.push(r);return t.sort(e.ascending),u()},o.range=function(n){return arguments.length?(r=l.call(n),u()):r.slice()},o.quantiles=function(){return i.slice()},o.copy=function(){return n().domain(t).range(r)},o},n.scaleQuantize=function n(){var t=0,r=1,i=1,u=[.5],o=[0,1];function a(n){if(n<=n)return o[e.bisect(u,n,0,i)]}function c(){var n=-1;for(u=new Array(i);++n<i;)u[n]=((n+1)*r-(n-i)*t)/(i+1);return a}return a.domain=function(n){return arguments.length?(t=+n[0],r=+n[1],c()):[t,r]},a.range=function(n){return arguments.length?(i=(o=l.call(n)).length-1,c()):o.slice()},a.invertExtent=function(n){var e=o.indexOf(n);return e<0?[NaN,NaN]:e<1?[t,u[0]]:e>=i?[u[i-1],r]:[u[e-1],u[e]]},a.copy=function(){return n().domain([t,r]).range(o)},k(a)},n.scaleThreshold=function n(){var t=[.5],r=[0,1],i=1;function u(n){if(n<=n)return r[e.bisect(t,n,0,i)]}return u.domain=function(n){return arguments.length?(t=l.call(n),i=Math.min(t.length,r.length-1),u):t.slice()},u.range=function(n){return arguments.length?(r=l.call(n),i=Math.min(t.length,r.length-1),u):r.slice()},u.invertExtent=function(n){var e=r.indexOf(n);return[t[e-1],t[e]]},u.copy=function(){return n().domain(t).range(r)},u},n.scaleTime=function(){return B(u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,u.timeMillisecond,o.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},n.scaleUtc=function(){return B(u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,u.utcMillisecond,o.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},n.scaleSequential=function n(t){var e=0,r=1,i=1,u=!1;function o(n){var r=(n-e)*i;return t(u?Math.max(0,Math.min(1,r)):r)}return o.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=e===r?0:1/(r-e),o):[e,r]},o.clamp=function(n){return arguments.length?(u=!!n,o):u},o.interpolator=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return n(t).domain([e,r]).clamp(u)},k(o)},n.scaleDiverging=function n(t){var e=0,r=.5,i=1,u=1,o=1,a=!1;function c(n){var e=.5+((n=+n)-r)*(n<r?u:o);return t(a?Math.max(0,Math.min(1,e)):e)}return c.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=+n[2],u=e===r?0:.5/(r-e),o=r===i?0:.5/(i-r),c):[e,r,i]},c.clamp=function(n){return arguments.length?(a=!!n,c):a},c.interpolator=function(n){return arguments.length?(t=n,c):t},c.copy=function(){return n(t).domain([e,r,i]).clamp(a)},k(c)},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-scale", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Encodings that map abstract data to visual representation.", | ||
@@ -17,3 +17,3 @@ "keywords": [ | ||
}, | ||
"main": "dist/d3-scale.js", | ||
"main": "dist/d3-scale.min.js", | ||
"module": "index", | ||
@@ -26,6 +26,6 @@ "jsnext:main": "index", | ||
"scripts": { | ||
"pretest": "rm -rf dist && mkdir dist && rollup -c --banner \"$(preamble)\"", | ||
"test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js src test", | ||
"prepublishOnly": "npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" dist/d3-scale.js -c -m -o dist/d3-scale.min.js", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-scale/dist/d3-scale.js d3-scale.v2.js && cp ../d3-scale/dist/d3-scale.min.js d3-scale.v2.min.js && git add d3-scale.v2.js d3-scale.v2.min.js && git commit -m \"d3-scale ${npm_package_version}\" && git push && cd - && zip -j dist/d3-scale.zip -- LICENSE README.md dist/d3-scale.js dist/d3-scale.min.js" | ||
"pretest": "rollup -c", | ||
"test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js src", | ||
"prepublishOnly": "rm -rf dist && yarn test", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js" | ||
}, | ||
@@ -42,8 +42,7 @@ "dependencies": { | ||
"d3-color": "1", | ||
"eslint": "4", | ||
"package-preamble": "0.1", | ||
"rollup": "0.52", | ||
"tape": "4", | ||
"uglify-js": "3.2" | ||
"eslint": "5", | ||
"rollup": "0.64", | ||
"rollup-plugin-terser": "1", | ||
"tape": "4" | ||
} | ||
} |
@@ -1,14 +0,36 @@ | ||
const definition = require("./package.json"); | ||
const dependencies = Object.keys(definition.dependencies || {}); | ||
import {terser} from "rollup-plugin-terser"; | ||
import * as meta from "./package.json"; | ||
export default { | ||
input: "index", | ||
external: dependencies, | ||
const config = { | ||
input: "index.js", | ||
external: Object.keys(meta.dependencies || {}), | ||
output: { | ||
file: `dist/${meta.name}.js`, | ||
name: "d3", | ||
format: "umd", | ||
indent: false, | ||
extend: true, | ||
file: `dist/${definition.name}.js`, | ||
format: "umd", | ||
globals: dependencies.reduce((p, v) => (p[v] = "d3", p), {}), | ||
name: "d3" | ||
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, | ||
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).map(key => ({[key]: "d3"}))) | ||
}, | ||
plugins: [] | ||
}; | ||
export default [ | ||
config, | ||
{ | ||
...config, | ||
output: { | ||
...config.output, | ||
file: `dist/${meta.name}.min.js` | ||
}, | ||
plugins: [ | ||
...config.plugins, | ||
terser({ | ||
output: { | ||
preamble: config.output.banner | ||
} | ||
}) | ||
] | ||
} | ||
}; | ||
]; |
Sorry, the diff of this file is too big to display
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
169727
5
1635
29