You've already forked wakapi-readme-stats
Bar graph added.
This commit is contained in:
27
node_modules/vega-format/LICENSE
generated
vendored
Normal file
27
node_modules/vega-format/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2015-2018, University of Washington Interactive Data Lab
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
139
node_modules/vega-format/README.md
generated
vendored
Normal file
139
node_modules/vega-format/README.md
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
# vega-format
|
||||
|
||||
String formatting utilities for number and date values.
|
||||
|
||||
## API Reference
|
||||
|
||||
- [Number Format Locale](#number-format-locale)
|
||||
- [Time Format Locale](#time-format-locale)
|
||||
- [Combined Locale](#combined-locale)
|
||||
|
||||
### Number Format Locale
|
||||
|
||||
<a name="numberFormatLocale" href="#numberFormatLocale">#</a>
|
||||
vega.<b>numberFormatLocale</b>(<i>definition</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Returns a locale object with methods for number formatting, based on the provided *definition*. The *definition* argument must match the format expected by [d3-format](https://github.com/d3/d3-format#formatLocale). For examples of definition files for a variety of languages, see the [d3-format locale collection](https://github.com/d3/d3-format/tree/master/locale).
|
||||
|
||||
<a name="format" href="#format">#</a>
|
||||
locale.<b>format</b>([<i>specifier</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Returns a function that takes a number as input and returns a formatted string. If a string-valued format _specifier_ is provided, it must follow the [d3-format](https://github.com/d3/d3-format/#locale_format) syntax. The returned function is akin to d3-format's [format](https://github.com/d3/d3-format/#format) method.
|
||||
|
||||
<a name="formatPrefix" href="#formatPrefix">#</a>
|
||||
locale.<b>formatPrefix</b>(<i>specifier</i>, <i>value</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Returns a function that takes a number as input and returns a formatted string, with a fixed SI prefix anchored at the provided value. The string-valued format _specifier_ must follow the [d3-format](https://github.com/d3/d3-format/#locale_format) syntax. The returned function is akin to d3-format's [formatPrefix](https://github.com/d3/d3-format/#formatPrefix) method.
|
||||
|
||||
<a name="formatFloat" href="#formatFloat">#</a>
|
||||
locale.<b>formatFloat</b>([<i>specifier</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Returns a function that takes a number as input and returns a formatted string. This method is similar to the [format](#format) method, except that if the specifier does not provide a precision, the returned formatter will use a variable (floating) precision depending on the number of significant digits. Vega uses this method to provide improved formatting for values plotted on a logarithmic scale.
|
||||
|
||||
<a name="formatSpan" href="#formatSpan">#</a>
|
||||
locale.<b>formatSpan</b>(<i>start</i>, <i>stop</i>, <i>count</i>[, <i>specifier</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Returns a function that takes a number as input and returns a formatted string appropriate for a specified span of numbers defined by *start* and *stop* values and a *count* of values in the range. Based on these values, the method will attempt to find an appropriate precision. For example, to format 20 numbers on the range [0, 10], a precision of 0.1 (`'0.1f'`) will be used. An optional *specifier* can be used to further customize the format; if the *specifier* includes a numeric precision that value will override the span-based precision.
|
||||
|
||||
<a name="numberFormatDefaultLocale" href="#numberFormatDefaultLocale">#</a>
|
||||
vega.<b>numberFormatDefaultLocale</b>([<i>definition</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Get or set the default locale for number formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locale based on the provided *definition*, and returns the resulting locale object. The input definitions should be of the same type accepted by the [numberFormatLocale](#numberFormatLocale) method.
|
||||
|
||||
<a name="resetNumberFormatDefaultLocale" href="#resetNumberFormatDefaultLocale">#</a>
|
||||
vega.<b>resetNumberFormatDefaultLocale</b>()
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/number.js "Source")
|
||||
|
||||
Resets the default locale for number formatting and returns the resulting locale object. The new default number locale for Vega will match the current default locale for the underlying d3-format library.
|
||||
|
||||
### Time Format Locale
|
||||
|
||||
<a name="timeFormatLocale" href="#timeFormatLocale">#</a>
|
||||
vega.<b>timeFormatLocale</b>(<i>definition</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Returns a locale object with methods for time formatting, based on the provided *definition*. The *definition* argument must match the format expected by [d3-time-format](https://github.com/d3/d3-time-format#timeFormatLocale). For examples of definition files for a variety of languages, see the [d3-time-format locale collection](https://github.com/d3/d3-time-format/tree/master/locale).
|
||||
|
||||
<a name="timeFormat" href="#timeFormat">#</a>
|
||||
locale.<b>timeFormat</b>([<i>specifier</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Returns a function that takes a date or timestamp as input and returns a formatted string in the local timezone. If a string-valued format _specifier_ is provided, it must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [timeFormat](https://github.com/d3/d3-time-format/#timeFormat) method.
|
||||
|
||||
If an object-valued _specifier_ is provided, a multi-format function will be generated, which selects among different format specifiers based on the granularity of the input date value (that is, values residing on a year, month, date, _etc._, boundary can all be formatted differently). The input object should use proper time unit strings for keys. If no time format _specifier_ is provided, a default multi-format function is returned, equivalent to using the following _specifier_:
|
||||
|
||||
```json
|
||||
{
|
||||
"year": "%Y",
|
||||
"quarter": "%B",
|
||||
"month": "%B",
|
||||
"week": "%b %d",
|
||||
"date": "%a %d",
|
||||
"hours": "%I %p",
|
||||
"minutes": "%I:%M",
|
||||
"seconds": ":%S",
|
||||
"milliseconds": ".%L"
|
||||
}
|
||||
```
|
||||
|
||||
If an input _specifier_ object omits any of these key values, a default value will be used. Note that for this method the `"date"` and `"day"` units are interchangeable; if both are defined the `"date"` entry take precedence.
|
||||
|
||||
<a name="utcFormat" href="#utcFormat">#</a>
|
||||
locale.<b>utcFormat</b>([<i>specifier</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Returns a function that takes a date or timestamp as input and returns a formatted string in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). If a string-valued format _specifier_ is provided, it must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [utcFormat](https://github.com/d3/d3-time-format/#utcFormat) method.
|
||||
|
||||
This method also accepts object-valued _specifiers_ for creating multi-format functions. If no argumennts are provided, a defualt multi-format function will be returned. For more details, see the [timeFormat](#timeFormat) method documentation.
|
||||
|
||||
<a name="timeParse" href="#timeParse">#</a>
|
||||
locale.<b>timeParse</b>(<i>specifier</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Returns a function that takes a string as input and returns a date. The string-valued format _specifier_ must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [timeParse](https://github.com/d3/d3-time-format/#timeParse) method.
|
||||
|
||||
<a name="utcParse" href="#utcParse">#</a>
|
||||
locale.<b>utcParse</b>(<i>specifier</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Returns a function that takes a string as input and returns a date in [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) (UTC). The string-valued format _specifier_ must follow the [d3-time-format](https://github.com/d3/d3-time-format/#locale_format) syntax. The returned function is akin to d3-time-format's [utcParse](https://github.com/d3/d3-time-format/#utcParse) method.
|
||||
|
||||
<a name="timeFormatDefaultLocale" href="#timeFormatDefaultLocale">#</a>
|
||||
vega.<b>timeFormatDefaultLocale</b>([<i>definition</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Get or set the default locale for time formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locale based on the provided *definition*, and returns the resulting locale object. The input definitions should be of the same type accepted by the [timeFormatLocale](#timeFormatLocale) method.
|
||||
|
||||
<a name="resetTimeFormatDefaultLocale" href="#resetTimeFormatDefaultLocale">#</a>
|
||||
vega.<b>resetTimeFormatDefaultLocale</b>()
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/time.js "Source")
|
||||
|
||||
Resets the default locale for time formatting and returns the resulting locale object. The new default time locale for Vega will match the current default locale for the underlying d3-time-format library.
|
||||
|
||||
### Combined Locale
|
||||
|
||||
Combined locale objects provide a convenient abstraction for both number and time formatting methods defined on a single object. A combined locale object contains the methods of both a number format locale object and a time format locale object.
|
||||
|
||||
<a name="locale" href="#locale">#</a>
|
||||
vega.<b>locale</b>(<i>numberDefinition</i>, <i>timeDefinition</i>)
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source")
|
||||
|
||||
Returns a combined locale object with methods for both number and time formatting, based on the provided *numberDefinition* and *timeDefinition*. The definition arguments must match the format expected by [d3-format](https://github.com/d3/d3-format#formatLocale) and [d3-time-format](https://github.com/d3/d3-time-format#timeFormatLocale). If either argument is null or unspecified, the corresponding default locale is used instead. For examples of definition files for a variety of languages, see the [d3-format locale collection](https://github.com/d3/d3-format/tree/master/locale) and [d3-time-format locale collection](https://github.com/d3/d3-time-format/tree/master/locale).
|
||||
|
||||
<a name="defaultLocale" href="#defaultLocale">#</a>
|
||||
vega.<b>defaultLocale</b>([<i>numberDefinition</i>, <i>timeDefinition</i>])
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source")
|
||||
|
||||
Get or set the default locale for both number and time formatting. If no arguments are provided, returns the current default locale. Otherwise, sets the default locales based on the provided *numberDefinition* and *timeDefinition*, and returns the resulting combined locale object. The input definitions should be of the same type accepted by the [locale](#locale) method.
|
||||
|
||||
<a name="resetDefaultLocale" href="#resetDefaultLocale">#</a>
|
||||
vega.<b>resetDefaultLocale</b>()
|
||||
[<>](https://github.com/vega/vega/blob/master/packages/vega-format/src/locale.js "Source")
|
||||
|
||||
Resets the default locale for both number and time formatting and returns the resulting comgined locale object. The new default locales for Vega will match the current default locales for the underlying d3-format and d3-time-format libraries.
|
||||
239
node_modules/vega-format/build/vega-format.js
generated
vendored
Normal file
239
node_modules/vega-format/build/vega-format.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-format'), require('vega-time'), require('vega-util'), require('d3-time-format')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-format', 'vega-time', 'vega-util', 'd3-time-format'], factory) :
|
||||
(global = global || self, factory(global.vega = {}, global.d3, global.d3, global.vega, global.vega, global.d3));
|
||||
}(this, (function (exports, d3Array, d3Format, vegaTime, vegaUtil, d3TimeFormat) { 'use strict';
|
||||
|
||||
function memoize(method) {
|
||||
const cache = {};
|
||||
return spec => cache[spec] || (cache[spec] = method(spec));
|
||||
}
|
||||
|
||||
function trimZeroes(numberFormat, decimalChar) {
|
||||
return x => {
|
||||
var str = numberFormat(x),
|
||||
dec = str.indexOf(decimalChar),
|
||||
idx, end;
|
||||
|
||||
if (dec < 0) return str;
|
||||
|
||||
idx = rightmostDigit(str, dec);
|
||||
end = idx < str.length ? str.slice(idx) : '';
|
||||
while (--idx > dec) if (str[idx] !== '0') { ++idx; break; }
|
||||
|
||||
return str.slice(0, idx) + end;
|
||||
};
|
||||
}
|
||||
|
||||
function rightmostDigit(str, dec) {
|
||||
var i = str.lastIndexOf('e'), c;
|
||||
if (i > 0) return i;
|
||||
for (i=str.length; --i > dec;) {
|
||||
c = str.charCodeAt(i);
|
||||
if (c >= 48 && c <= 57) return i + 1; // is digit
|
||||
}
|
||||
}
|
||||
|
||||
function numberLocale(locale) {
|
||||
const format = memoize(locale.format),
|
||||
formatPrefix = locale.formatPrefix;
|
||||
|
||||
return {
|
||||
format,
|
||||
formatPrefix,
|
||||
formatFloat(spec) {
|
||||
var s = d3Format.formatSpecifier(spec || ',');
|
||||
if (s.precision == null) {
|
||||
s.precision = 12;
|
||||
switch (s.type) {
|
||||
case '%': s.precision -= 2; break;
|
||||
case 'e': s.precision -= 1; break;
|
||||
}
|
||||
return trimZeroes(
|
||||
format(s), // number format
|
||||
format('.1f')(1)[1] // decimal point character
|
||||
);
|
||||
} else {
|
||||
return format(s);
|
||||
}
|
||||
},
|
||||
formatSpan(start, stop, count, specifier) {
|
||||
specifier = d3Format.formatSpecifier(specifier == null ? ',f' : specifier);
|
||||
const step = d3Array.tickStep(start, stop, count),
|
||||
value = Math.max(Math.abs(start), Math.abs(stop));
|
||||
let precision;
|
||||
|
||||
if (specifier.precision == null) {
|
||||
switch (specifier.type) {
|
||||
case 's': {
|
||||
if (!isNaN(precision = d3Format.precisionPrefix(step, value))) {
|
||||
specifier.precision = precision;
|
||||
}
|
||||
return formatPrefix(specifier, value);
|
||||
}
|
||||
case '':
|
||||
case 'e':
|
||||
case 'g':
|
||||
case 'p':
|
||||
case 'r': {
|
||||
if (!isNaN(precision = d3Format.precisionRound(step, value))) {
|
||||
specifier.precision = precision - (specifier.type === 'e');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
case '%': {
|
||||
if (!isNaN(precision = d3Format.precisionFixed(step))) {
|
||||
specifier.precision = precision - (specifier.type === '%') * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return format(specifier);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let defaultNumberLocale;
|
||||
resetNumberFormatDefaultLocale();
|
||||
|
||||
function resetNumberFormatDefaultLocale() {
|
||||
return defaultNumberLocale = numberLocale({
|
||||
format: d3Format.format,
|
||||
formatPrefix: d3Format.formatPrefix
|
||||
});
|
||||
}
|
||||
|
||||
function numberFormatLocale(definition) {
|
||||
return numberLocale(d3Format.formatLocale(definition));
|
||||
}
|
||||
|
||||
function numberFormatDefaultLocale(definition) {
|
||||
return arguments.length
|
||||
? (defaultNumberLocale = numberFormatLocale(definition))
|
||||
: defaultNumberLocale;
|
||||
}
|
||||
|
||||
function timeMultiFormat(format, interval, spec) {
|
||||
spec = spec || {};
|
||||
if (!vegaUtil.isObject(spec)) {
|
||||
vegaUtil.error(`Invalid time multi-format specifier: ${spec}`);
|
||||
}
|
||||
|
||||
const second = interval(vegaTime.SECONDS),
|
||||
minute = interval(vegaTime.MINUTES),
|
||||
hour = interval(vegaTime.HOURS),
|
||||
day = interval(vegaTime.DATE),
|
||||
week = interval(vegaTime.WEEK),
|
||||
month = interval(vegaTime.MONTH),
|
||||
quarter = interval(vegaTime.QUARTER),
|
||||
year = interval(vegaTime.YEAR),
|
||||
L = format(spec[vegaTime.MILLISECONDS] || '.%L'),
|
||||
S = format(spec[vegaTime.SECONDS] || ':%S'),
|
||||
M = format(spec[vegaTime.MINUTES] || '%I:%M'),
|
||||
H = format(spec[vegaTime.HOURS] || '%I %p'),
|
||||
d = format(spec[vegaTime.DATE] || spec[vegaTime.DAY] || '%a %d'),
|
||||
w = format(spec[vegaTime.WEEK] || '%b %d'),
|
||||
m = format(spec[vegaTime.MONTH] || '%B'),
|
||||
q = format(spec[vegaTime.QUARTER] || '%B'),
|
||||
y = format(spec[vegaTime.YEAR] || '%Y');
|
||||
|
||||
return date => (
|
||||
second(date) < date ? L :
|
||||
minute(date) < date ? S :
|
||||
hour(date) < date ? M :
|
||||
day(date) < date ? H :
|
||||
month(date) < date ? (week(date) < date ? d : w) :
|
||||
year(date) < date ? (quarter(date) < date ? m : q) :
|
||||
y)(date);
|
||||
}
|
||||
|
||||
function timeLocale(locale) {
|
||||
const timeFormat = memoize(locale.format),
|
||||
utcFormat = memoize(locale.utcFormat);
|
||||
|
||||
return {
|
||||
timeFormat: spec => vegaUtil.isString(spec)
|
||||
? timeFormat(spec)
|
||||
: timeMultiFormat(timeFormat, vegaTime.timeInterval, spec),
|
||||
utcFormat: spec => vegaUtil.isString(spec)
|
||||
? utcFormat(spec)
|
||||
: timeMultiFormat(utcFormat, vegaTime.utcInterval, spec),
|
||||
timeParse: memoize(locale.parse),
|
||||
utcParse: memoize(locale.utcParse)
|
||||
};
|
||||
}
|
||||
|
||||
let defaultTimeLocale;
|
||||
resetTimeFormatDefaultLocale();
|
||||
|
||||
function resetTimeFormatDefaultLocale() {
|
||||
return defaultTimeLocale = timeLocale({
|
||||
format: d3TimeFormat.timeFormat,
|
||||
parse: d3TimeFormat.timeParse,
|
||||
utcFormat: d3TimeFormat.utcFormat,
|
||||
utcParse: d3TimeFormat.utcParse
|
||||
});
|
||||
}
|
||||
|
||||
function timeFormatLocale(definition) {
|
||||
return timeLocale(d3TimeFormat.timeFormatLocale(definition));
|
||||
}
|
||||
|
||||
function timeFormatDefaultLocale(definition) {
|
||||
return arguments.length
|
||||
? (defaultTimeLocale = timeFormatLocale(definition))
|
||||
: defaultTimeLocale;
|
||||
}
|
||||
|
||||
const createLocale = (number, time) => vegaUtil.extend({}, number, time);
|
||||
|
||||
function locale(numberSpec, timeSpec) {
|
||||
const number = numberSpec
|
||||
? numberFormatLocale(numberSpec)
|
||||
: numberFormatDefaultLocale();
|
||||
|
||||
const time = timeSpec
|
||||
? timeFormatLocale(timeSpec)
|
||||
: timeFormatDefaultLocale();
|
||||
|
||||
return createLocale(number, time);
|
||||
}
|
||||
|
||||
function defaultLocale(numberSpec, timeSpec) {
|
||||
const args = arguments.length;
|
||||
if (args && args !== 2) {
|
||||
vegaUtil.error('defaultLocale expects either zero or two arguments.');
|
||||
}
|
||||
|
||||
return args
|
||||
? createLocale(
|
||||
numberFormatDefaultLocale(numberSpec),
|
||||
timeFormatDefaultLocale(timeSpec)
|
||||
)
|
||||
: createLocale(
|
||||
numberFormatDefaultLocale(),
|
||||
timeFormatDefaultLocale()
|
||||
);
|
||||
}
|
||||
|
||||
function resetDefaultLocale() {
|
||||
resetNumberFormatDefaultLocale();
|
||||
resetTimeFormatDefaultLocale();
|
||||
return defaultLocale();
|
||||
}
|
||||
|
||||
exports.defaultLocale = defaultLocale;
|
||||
exports.locale = locale;
|
||||
exports.numberFormatDefaultLocale = numberFormatDefaultLocale;
|
||||
exports.numberFormatLocale = numberFormatLocale;
|
||||
exports.resetDefaultLocale = resetDefaultLocale;
|
||||
exports.resetNumberFormatDefaultLocale = resetNumberFormatDefaultLocale;
|
||||
exports.resetTimeFormatDefaultLocale = resetTimeFormatDefaultLocale;
|
||||
exports.timeFormatDefaultLocale = timeFormatDefaultLocale;
|
||||
exports.timeFormatLocale = timeFormatLocale;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
1
node_modules/vega-format/build/vega-format.min.js
generated
vendored
Normal file
1
node_modules/vega-format/build/vega-format.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-format"),require("vega-time"),require("vega-util"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-format","vega-time","vega-util","d3-time-format"],t):t((e=e||self).vega={},e.d3,e.d3,e.vega,e.vega,e.d3)}(this,(function(e,t,r,a,i,n){"use strict";function o(e){const t={};return r=>t[r]||(t[r]=e(r))}function c(e){const a=o(e.format),i=e.formatPrefix;return{format:a,formatPrefix:i,formatFloat(e){var t,i,n=r.formatSpecifier(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return t=a(n),i=a(".1f")(1)[1],e=>{var r,a,n=t(e),o=n.indexOf(i);if(o<0)return n;for(a=(r=function(e,t){var r,a=e.lastIndexOf("e");if(a>0)return a;for(a=e.length;--a>t;)if((r=e.charCodeAt(a))>=48&&r<=57)return a+1}(n,o))<n.length?n.slice(r):"";--r>o;)if("0"!==n[r]){++r;break}return n.slice(0,r)+a}}return a(n)},formatSpan(e,n,o,c){c=r.formatSpecifier(null==c?",f":c);const u=t.tickStep(e,n,o),f=Math.max(Math.abs(e),Math.abs(n));let s;if(null==c.precision)switch(c.type){case"s":return isNaN(s=r.precisionPrefix(u,f))||(c.precision=s),i(c,f);case"":case"e":case"g":case"p":case"r":isNaN(s=r.precisionRound(u,f))||(c.precision=s-("e"===c.type));break;case"f":case"%":isNaN(s=r.precisionFixed(u))||(c.precision=s-2*("%"===c.type))}return a(c)}}}let u,f;function s(){return u=c({format:r.format,formatPrefix:r.formatPrefix})}function m(e){return c(r.formatLocale(e))}function l(e){return arguments.length?u=m(e):u}function p(e,t,r){r=r||{},i.isObject(r)||i.error("Invalid time multi-format specifier: "+r);const n=t(a.SECONDS),o=t(a.MINUTES),c=t(a.HOURS),u=t(a.DATE),f=t(a.WEEK),s=t(a.MONTH),m=t(a.QUARTER),l=t(a.YEAR),p=e(r[a.MILLISECONDS]||".%L"),d=e(r[a.SECONDS]||":%S"),S=e(r[a.MINUTES]||"%I:%M"),g=e(r[a.HOURS]||"%I %p"),E=e(r[a.DATE]||r[a.DAY]||"%a %d"),F=e(r[a.WEEK]||"%b %d"),v=e(r[a.MONTH]||"%B"),x=e(r[a.QUARTER]||"%B"),L=e(r[a.YEAR]||"%Y");return e=>(n(e)<e?p:o(e)<e?d:c(e)<e?S:u(e)<e?g:s(e)<e?f(e)<e?E:F:l(e)<e?m(e)<e?v:x:L)(e)}function d(e){const t=o(e.format),r=o(e.utcFormat);return{timeFormat:e=>i.isString(e)?t(e):p(t,a.timeInterval,e),utcFormat:e=>i.isString(e)?r(e):p(r,a.utcInterval,e),timeParse:o(e.parse),utcParse:o(e.utcParse)}}function S(){return f=d({format:n.timeFormat,parse:n.timeParse,utcFormat:n.utcFormat,utcParse:n.utcParse})}function g(e){return d(n.timeFormatLocale(e))}function E(e){return arguments.length?f=g(e):f}s(),S();const F=(e,t)=>i.extend({},e,t);function v(e,t){const r=arguments.length;return r&&2!==r&&i.error("defaultLocale expects either zero or two arguments."),r?F(l(e),E(t)):F(l(),E())}e.defaultLocale=v,e.locale=function(e,t){const r=e?m(e):l(),a=t?g(t):E();return F(r,a)},e.numberFormatDefaultLocale=l,e.numberFormatLocale=m,e.resetDefaultLocale=function(){return s(),S(),v()},e.resetNumberFormatDefaultLocale=s,e.resetTimeFormatDefaultLocale=S,e.timeFormatDefaultLocale=E,e.timeFormatLocale=g,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
17
node_modules/vega-format/index.js
generated
vendored
Normal file
17
node_modules/vega-format/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export {
|
||||
numberFormatDefaultLocale,
|
||||
numberFormatLocale,
|
||||
resetNumberFormatDefaultLocale
|
||||
} from './src/number';
|
||||
|
||||
export {
|
||||
timeFormatDefaultLocale,
|
||||
timeFormatLocale,
|
||||
resetTimeFormatDefaultLocale
|
||||
} from './src/time';
|
||||
|
||||
export {
|
||||
locale,
|
||||
defaultLocale,
|
||||
resetDefaultLocale
|
||||
} from './src/locale';
|
||||
73
node_modules/vega-format/package.json
generated
vendored
Normal file
73
node_modules/vega-format/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "vega-format@~1.0.1",
|
||||
"_id": "vega-format@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-f9IZ+SDHVFFneDDc+d8RfeJhXXvUgquAuM+1MZ2Rjf4xqpg+E8FSNQkh8wjeo82mc6G3KVa9hynSdfN/a0AktQ==",
|
||||
"_location": "/vega-format",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "vega-format@~1.0.1",
|
||||
"name": "vega-format",
|
||||
"escapedName": "vega-format",
|
||||
"rawSpec": "~1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/vega",
|
||||
"/vega-dataflow",
|
||||
"/vega-loader",
|
||||
"/vega-view"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/vega-format/-/vega-format-1.0.1.tgz",
|
||||
"_shasum": "94b5be9eb3d6a8b315fcf3d523ed6a1bb2ea4d71",
|
||||
"_spec": "vega-format@~1.0.1",
|
||||
"_where": "/home/prabhatdev/Documents/opensource/gitHubStats/waka-readme-stats/node_modules/vega",
|
||||
"author": {
|
||||
"name": "Jeffrey Heer",
|
||||
"url": "http://idl.cs.washington.edu"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vega/vega/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"d3-array": "^2.4.0",
|
||||
"d3-format": "^1.4.4",
|
||||
"d3-time-format": "^2.2.3",
|
||||
"vega-time": "^2.0.0",
|
||||
"vega-util": "^1.14.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "JavaScript string formatting utilities for Vega.",
|
||||
"gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0",
|
||||
"homepage": "https://github.com/vega/vega#readme",
|
||||
"keywords": [
|
||||
"vega",
|
||||
"format",
|
||||
"number",
|
||||
"date",
|
||||
"time"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "build/vega-format.js",
|
||||
"module": "index",
|
||||
"name": "vega-format",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vega/vega.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn rollup",
|
||||
"postbuild": "terser build/vega-format.js -c -m -o build/vega-format.min.js",
|
||||
"postpublish": "git push && git push --tags",
|
||||
"prebuild": "rimraf build && mkdir build",
|
||||
"prepublishOnly": "yarn test && yarn build",
|
||||
"pretest": "yarn prebuild && yarn rollup",
|
||||
"rollup": "rollup -g d3-array:d3,d3-format:d3,d3-time-format:d3,vega-time:vega,vega-util:vega -f umd -n vega -o build/vega-format.js -- index.js",
|
||||
"test": "tape 'test/**/*-test.js'"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
50
node_modules/vega-format/src/locale.js
generated
vendored
Normal file
50
node_modules/vega-format/src/locale.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import {
|
||||
numberFormatDefaultLocale,
|
||||
numberFormatLocale,
|
||||
resetNumberFormatDefaultLocale
|
||||
} from './number';
|
||||
|
||||
import {
|
||||
resetTimeFormatDefaultLocale,
|
||||
timeFormatDefaultLocale,
|
||||
timeFormatLocale
|
||||
} from './time';
|
||||
|
||||
import {error, extend} from 'vega-util';
|
||||
|
||||
const createLocale = (number, time) => extend({}, number, time);
|
||||
|
||||
export function locale(numberSpec, timeSpec) {
|
||||
const number = numberSpec
|
||||
? numberFormatLocale(numberSpec)
|
||||
: numberFormatDefaultLocale();
|
||||
|
||||
const time = timeSpec
|
||||
? timeFormatLocale(timeSpec)
|
||||
: timeFormatDefaultLocale();
|
||||
|
||||
return createLocale(number, time);
|
||||
}
|
||||
|
||||
export function defaultLocale(numberSpec, timeSpec) {
|
||||
const args = arguments.length;
|
||||
if (args && args !== 2) {
|
||||
error('defaultLocale expects either zero or two arguments.');
|
||||
}
|
||||
|
||||
return args
|
||||
? createLocale(
|
||||
numberFormatDefaultLocale(numberSpec),
|
||||
timeFormatDefaultLocale(timeSpec)
|
||||
)
|
||||
: createLocale(
|
||||
numberFormatDefaultLocale(),
|
||||
timeFormatDefaultLocale()
|
||||
);
|
||||
}
|
||||
|
||||
export function resetDefaultLocale() {
|
||||
resetNumberFormatDefaultLocale();
|
||||
resetTimeFormatDefaultLocale();
|
||||
return defaultLocale();
|
||||
}
|
||||
4
node_modules/vega-format/src/memoize.js
generated
vendored
Normal file
4
node_modules/vega-format/src/memoize.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function(method) {
|
||||
const cache = {};
|
||||
return spec => cache[spec] || (cache[spec] = method(spec));
|
||||
}
|
||||
117
node_modules/vega-format/src/number.js
generated
vendored
Normal file
117
node_modules/vega-format/src/number.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import memoize from './memoize';
|
||||
import {tickStep} from 'd3-array';
|
||||
import {
|
||||
format as d3_format,
|
||||
formatLocale as d3_formatLocale,
|
||||
formatPrefix as d3_formatPrefix,
|
||||
formatSpecifier,
|
||||
precisionFixed,
|
||||
precisionPrefix,
|
||||
precisionRound
|
||||
} from 'd3-format';
|
||||
|
||||
function trimZeroes(numberFormat, decimalChar) {
|
||||
return x => {
|
||||
var str = numberFormat(x),
|
||||
dec = str.indexOf(decimalChar),
|
||||
idx, end;
|
||||
|
||||
if (dec < 0) return str;
|
||||
|
||||
idx = rightmostDigit(str, dec);
|
||||
end = idx < str.length ? str.slice(idx) : '';
|
||||
while (--idx > dec) if (str[idx] !== '0') { ++idx; break; }
|
||||
|
||||
return str.slice(0, idx) + end;
|
||||
};
|
||||
}
|
||||
|
||||
function rightmostDigit(str, dec) {
|
||||
var i = str.lastIndexOf('e'), c;
|
||||
if (i > 0) return i;
|
||||
for (i=str.length; --i > dec;) {
|
||||
c = str.charCodeAt(i);
|
||||
if (c >= 48 && c <= 57) return i + 1; // is digit
|
||||
}
|
||||
}
|
||||
|
||||
function numberLocale(locale) {
|
||||
const format = memoize(locale.format),
|
||||
formatPrefix = locale.formatPrefix;
|
||||
|
||||
return {
|
||||
format,
|
||||
formatPrefix,
|
||||
formatFloat(spec) {
|
||||
var s = formatSpecifier(spec || ',');
|
||||
if (s.precision == null) {
|
||||
s.precision = 12;
|
||||
switch (s.type) {
|
||||
case '%': s.precision -= 2; break;
|
||||
case 'e': s.precision -= 1; break;
|
||||
}
|
||||
return trimZeroes(
|
||||
format(s), // number format
|
||||
format('.1f')(1)[1] // decimal point character
|
||||
);
|
||||
} else {
|
||||
return format(s);
|
||||
}
|
||||
},
|
||||
formatSpan(start, stop, count, specifier) {
|
||||
specifier = formatSpecifier(specifier == null ? ',f' : specifier);
|
||||
const step = tickStep(start, stop, count),
|
||||
value = Math.max(Math.abs(start), Math.abs(stop));
|
||||
let precision;
|
||||
|
||||
if (specifier.precision == null) {
|
||||
switch (specifier.type) {
|
||||
case 's': {
|
||||
if (!isNaN(precision = precisionPrefix(step, value))) {
|
||||
specifier.precision = precision;
|
||||
}
|
||||
return formatPrefix(specifier, value);
|
||||
}
|
||||
case '':
|
||||
case 'e':
|
||||
case 'g':
|
||||
case 'p':
|
||||
case 'r': {
|
||||
if (!isNaN(precision = precisionRound(step, value))) {
|
||||
specifier.precision = precision - (specifier.type === 'e');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'f':
|
||||
case '%': {
|
||||
if (!isNaN(precision = precisionFixed(step))) {
|
||||
specifier.precision = precision - (specifier.type === '%') * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return format(specifier);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let defaultNumberLocale;
|
||||
resetNumberFormatDefaultLocale();
|
||||
|
||||
export function resetNumberFormatDefaultLocale() {
|
||||
return defaultNumberLocale = numberLocale({
|
||||
format: d3_format,
|
||||
formatPrefix: d3_formatPrefix
|
||||
});
|
||||
}
|
||||
|
||||
export function numberFormatLocale(definition) {
|
||||
return numberLocale(d3_formatLocale(definition));
|
||||
}
|
||||
|
||||
export function numberFormatDefaultLocale(definition) {
|
||||
return arguments.length
|
||||
? (defaultNumberLocale = numberFormatLocale(definition))
|
||||
: defaultNumberLocale;
|
||||
}
|
||||
86
node_modules/vega-format/src/time.js
generated
vendored
Normal file
86
node_modules/vega-format/src/time.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import memoize from './memoize';
|
||||
import {
|
||||
DATE, DAY, HOURS, MILLISECONDS, MINUTES, MONTH, QUARTER,
|
||||
SECONDS, WEEK, YEAR, timeInterval, utcInterval
|
||||
} from 'vega-time';
|
||||
import {error, isObject, isString} from 'vega-util';
|
||||
|
||||
import {
|
||||
timeFormat as d3_timeFormat,
|
||||
timeFormatLocale as d3_timeFormatLocale,
|
||||
timeParse as d3_timeParse,
|
||||
utcFormat as d3_utcFormat,
|
||||
utcParse as d3_utcParse
|
||||
} from 'd3-time-format';
|
||||
|
||||
function timeMultiFormat(format, interval, spec) {
|
||||
spec = spec || {};
|
||||
if (!isObject(spec)) {
|
||||
error(`Invalid time multi-format specifier: ${spec}`);
|
||||
}
|
||||
|
||||
const second = interval(SECONDS),
|
||||
minute = interval(MINUTES),
|
||||
hour = interval(HOURS),
|
||||
day = interval(DATE),
|
||||
week = interval(WEEK),
|
||||
month = interval(MONTH),
|
||||
quarter = interval(QUARTER),
|
||||
year = interval(YEAR),
|
||||
L = format(spec[MILLISECONDS] || '.%L'),
|
||||
S = format(spec[SECONDS] || ':%S'),
|
||||
M = format(spec[MINUTES] || '%I:%M'),
|
||||
H = format(spec[HOURS] || '%I %p'),
|
||||
d = format(spec[DATE] || spec[DAY] || '%a %d'),
|
||||
w = format(spec[WEEK] || '%b %d'),
|
||||
m = format(spec[MONTH] || '%B'),
|
||||
q = format(spec[QUARTER] || '%B'),
|
||||
y = format(spec[YEAR] || '%Y');
|
||||
|
||||
return date => (
|
||||
second(date) < date ? L :
|
||||
minute(date) < date ? S :
|
||||
hour(date) < date ? M :
|
||||
day(date) < date ? H :
|
||||
month(date) < date ? (week(date) < date ? d : w) :
|
||||
year(date) < date ? (quarter(date) < date ? m : q) :
|
||||
y)(date);
|
||||
}
|
||||
|
||||
function timeLocale(locale) {
|
||||
const timeFormat = memoize(locale.format),
|
||||
utcFormat = memoize(locale.utcFormat);
|
||||
|
||||
return {
|
||||
timeFormat: spec => isString(spec)
|
||||
? timeFormat(spec)
|
||||
: timeMultiFormat(timeFormat, timeInterval, spec),
|
||||
utcFormat: spec => isString(spec)
|
||||
? utcFormat(spec)
|
||||
: timeMultiFormat(utcFormat, utcInterval, spec),
|
||||
timeParse: memoize(locale.parse),
|
||||
utcParse: memoize(locale.utcParse)
|
||||
};
|
||||
}
|
||||
|
||||
let defaultTimeLocale;
|
||||
resetTimeFormatDefaultLocale();
|
||||
|
||||
export function resetTimeFormatDefaultLocale() {
|
||||
return defaultTimeLocale = timeLocale({
|
||||
format: d3_timeFormat,
|
||||
parse: d3_timeParse,
|
||||
utcFormat: d3_utcFormat,
|
||||
utcParse: d3_utcParse
|
||||
});
|
||||
}
|
||||
|
||||
export function timeFormatLocale(definition) {
|
||||
return timeLocale(d3_timeFormatLocale(definition));
|
||||
}
|
||||
|
||||
export function timeFormatDefaultLocale(definition) {
|
||||
return arguments.length
|
||||
? (defaultTimeLocale = timeFormatLocale(definition))
|
||||
: defaultTimeLocale;
|
||||
}
|
||||
Reference in New Issue
Block a user