Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nivo/axes

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nivo/axes - npm Package Compare versions

Comparing version 0.70.1 to 0.71.0

131

dist/nivo-axes.cjs.js

@@ -59,2 +59,55 @@ 'use strict';

function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
var centerScale = function centerScale(scale) {

@@ -75,2 +128,20 @@ var bandwidth = scale.bandwidth();

};
var timeDay = d3Time.timeInterval(function (date) {
return date.setHours(0, 0, 0, 0);
}, function (date, step) {
return date.setDate(date.getDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var utcDay = d3Time.timeInterval(function (date) {
return date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
return date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var timeByType = {

@@ -81,3 +152,3 @@ millisecond: [d3Time.timeMillisecond, d3Time.utcMillisecond],

hour: [d3Time.timeHour, d3Time.utcHour],
day: [d3Time.timeDay, d3Time.utcDay],
day: [timeDay, utcDay],
week: [d3Time.timeWeek, d3Time.utcWeek],

@@ -110,32 +181,49 @@ sunday: [d3Time.timeSunday, d3Time.utcSunday],

if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
if (isInteger(spec)) {
return scale.ticks(spec);
}
if (matches) {
var _matches = _slicedToArray(matches, 3),
amount = _matches[1],
type = _matches[2];
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
var timeType = timeByType[type][scale.useUTC ? 1 : 0];
if (matches) {
var timeType = timeByType[matches[2]][scale.useUTC ? 1 : 0];
if (type === 'day') {
var _timeType$every$range, _timeType$every;
if (matches[1] === undefined) {
return scale.ticks(timeType);
}
var _scale$domain = scale.domain(),
_scale$domain2 = _slicedToArray(_scale$domain, 2),
start = _scale$domain2[0],
originalStop = _scale$domain2[1];
var interval = timeType.every(Number(matches[1]));
var stop = new Date(originalStop);
stop.setDate(stop.getDate() + 1);
return (_timeType$every$range = (_timeType$every = timeType.every(Number(amount !== null && amount !== void 0 ? amount : 1))) === null || _timeType$every === void 0 ? void 0 : _timeType$every.range(start, stop)) !== null && _timeType$every$range !== void 0 ? _timeType$every$range : [];
}
if (interval) {
return scale.ticks(interval);
}
if (amount === undefined) {
return scale.ticks(timeType);
}
throw new Error("Invalid tickValues: ".concat(spec));
var interval = timeType.every(Number(amount));
if (interval) {
return scale.ticks(interval);
}
}
throw new Error("Invalid tickValues: ".concat(spec));
}
if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (isInteger(spec)) {
return scale.ticks(spec);
}
}
return scale.domain();

@@ -248,4 +336,3 @@ };

var lineValues = isArray(_values) ? _values : undefined;
var lineCount = isInteger(_values) ? _values : undefined;
var values = lineValues || getScaleTicks(scale, lineCount);
var values = lineValues || getScaleTicks(scale, _values);
var position = 'bandwidth' in scale ? centerScale(scale) : scale;

@@ -252,0 +339,0 @@ var lines = axis === 'x' ? values.map(function (value) {

import React, { memo, useMemo } from 'react';
import { animated, useSpring, useTransition } from '@react-spring/web';
import { textPropsByEngine, useTheme, useMotionConfig, degreesToRadians } from '@nivo/core';
import { timeMillisecond, utcMillisecond, timeSecond, utcSecond, timeMinute, utcMinute, timeHour, utcHour, timeDay, utcDay, timeWeek, utcWeek, timeSunday, utcSunday, timeMonday, utcMonday, timeTuesday, utcTuesday, timeWednesday, utcWednesday, timeThursday, utcThursday, timeFriday, utcFriday, timeSaturday, utcSaturday, timeMonth, utcMonth, timeYear, utcYear } from 'd3-time';
import { timeInterval, timeMillisecond, utcMillisecond, timeSecond, utcSecond, timeMinute, utcMinute, timeHour, utcHour, timeWeek, utcWeek, timeSunday, utcSunday, timeMonday, utcMonday, timeTuesday, utcTuesday, timeWednesday, utcWednesday, timeThursday, utcThursday, timeFriday, utcFriday, timeSaturday, utcSaturday, timeMonth, utcMonth, timeYear, utcYear } from 'd3-time';
import { timeFormat } from 'd3-time-format';

@@ -52,2 +52,55 @@ import { format } from 'd3-format';

function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
var centerScale = function centerScale(scale) {

@@ -68,2 +121,20 @@ var bandwidth = scale.bandwidth();

};
var timeDay = timeInterval(function (date) {
return date.setHours(0, 0, 0, 0);
}, function (date, step) {
return date.setDate(date.getDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var utcDay = timeInterval(function (date) {
return date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
return date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var timeByType = {

@@ -102,32 +173,49 @@ millisecond: [timeMillisecond, utcMillisecond],

if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
if (isInteger(spec)) {
return scale.ticks(spec);
}
if (matches) {
var _matches = _slicedToArray(matches, 3),
amount = _matches[1],
type = _matches[2];
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
var timeType = timeByType[type][scale.useUTC ? 1 : 0];
if (matches) {
var timeType = timeByType[matches[2]][scale.useUTC ? 1 : 0];
if (type === 'day') {
var _timeType$every$range, _timeType$every;
if (matches[1] === undefined) {
return scale.ticks(timeType);
}
var _scale$domain = scale.domain(),
_scale$domain2 = _slicedToArray(_scale$domain, 2),
start = _scale$domain2[0],
originalStop = _scale$domain2[1];
var interval = timeType.every(Number(matches[1]));
var stop = new Date(originalStop);
stop.setDate(stop.getDate() + 1);
return (_timeType$every$range = (_timeType$every = timeType.every(Number(amount !== null && amount !== void 0 ? amount : 1))) === null || _timeType$every === void 0 ? void 0 : _timeType$every.range(start, stop)) !== null && _timeType$every$range !== void 0 ? _timeType$every$range : [];
}
if (interval) {
return scale.ticks(interval);
}
if (amount === undefined) {
return scale.ticks(timeType);
}
throw new Error("Invalid tickValues: ".concat(spec));
var interval = timeType.every(Number(amount));
if (interval) {
return scale.ticks(interval);
}
}
throw new Error("Invalid tickValues: ".concat(spec));
}
if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (isInteger(spec)) {
return scale.ticks(spec);
}
}
return scale.domain();

@@ -240,4 +328,3 @@ };

var lineValues = isArray(_values) ? _values : undefined;
var lineCount = isInteger(_values) ? _values : undefined;
var values = lineValues || getScaleTicks(scale, lineCount);
var values = lineValues || getScaleTicks(scale, _values);
var position = 'bandwidth' in scale ? centerScale(scale) : scale;

@@ -244,0 +331,0 @@ var lines = axis === 'x' ? values.map(function (value) {

@@ -53,2 +53,55 @@ (function (global, factory) {

function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
var centerScale = function centerScale(scale) {

@@ -69,2 +122,20 @@ var bandwidth = scale.bandwidth();

};
var timeDay = d3Time.timeInterval(function (date) {
return date.setHours(0, 0, 0, 0);
}, function (date, step) {
return date.setDate(date.getDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var utcDay = d3Time.timeInterval(function (date) {
return date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
return date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
return (end.getTime() - start.getTime()) / 864e5;
}, function (date) {
return Math.floor(date.getTime() / 864e5);
});
var timeByType = {

@@ -75,3 +146,3 @@ millisecond: [d3Time.timeMillisecond, d3Time.utcMillisecond],

hour: [d3Time.timeHour, d3Time.utcHour],
day: [d3Time.timeDay, d3Time.utcDay],
day: [timeDay, utcDay],
week: [d3Time.timeWeek, d3Time.utcWeek],

@@ -104,32 +175,49 @@ sunday: [d3Time.timeSunday, d3Time.utcSunday],

if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
if (isInteger(spec)) {
return scale.ticks(spec);
}
if (matches) {
var _matches = _slicedToArray(matches, 3),
amount = _matches[1],
type = _matches[2];
if (typeof spec === 'string' && 'useUTC' in scale) {
var matches = spec.match(timeIntervalRegexp);
var timeType = timeByType[type][scale.useUTC ? 1 : 0];
if (matches) {
var timeType = timeByType[matches[2]][scale.useUTC ? 1 : 0];
if (type === 'day') {
var _timeType$every$range, _timeType$every;
if (matches[1] === undefined) {
return scale.ticks(timeType);
}
var _scale$domain = scale.domain(),
_scale$domain2 = _slicedToArray(_scale$domain, 2),
start = _scale$domain2[0],
originalStop = _scale$domain2[1];
var interval = timeType.every(Number(matches[1]));
var stop = new Date(originalStop);
stop.setDate(stop.getDate() + 1);
return (_timeType$every$range = (_timeType$every = timeType.every(Number(amount !== null && amount !== void 0 ? amount : 1))) === null || _timeType$every === void 0 ? void 0 : _timeType$every.range(start, stop)) !== null && _timeType$every$range !== void 0 ? _timeType$every$range : [];
}
if (interval) {
return scale.ticks(interval);
}
if (amount === undefined) {
return scale.ticks(timeType);
}
throw new Error("Invalid tickValues: ".concat(spec));
var interval = timeType.every(Number(amount));
if (interval) {
return scale.ticks(interval);
}
}
throw new Error("Invalid tickValues: ".concat(spec));
}
if ('ticks' in scale) {
if (spec === undefined) {
return scale.ticks();
}
if (isInteger(spec)) {
return scale.ticks(spec);
}
}
return scale.domain();

@@ -242,4 +330,3 @@ };

var lineValues = isArray(_values) ? _values : undefined;
var lineCount = isInteger(_values) ? _values : undefined;
var values = lineValues || getScaleTicks(scale, lineCount);
var values = lineValues || getScaleTicks(scale, _values);
var position = 'bandwidth' in scale ? centerScale(scale) : scale;

@@ -246,0 +333,0 @@ var lines = axis === 'x' ? values.map(function (value) {

8

dist/types/canvas.d.ts

@@ -25,6 +25,6 @@ import { CompleteTheme } from '@nivo/core';

height: number;
top?: CanvasAxisProp<X> | undefined;
right?: CanvasAxisProp<Y> | undefined;
bottom?: CanvasAxisProp<X> | undefined;
left?: CanvasAxisProp<Y> | undefined;
top?: CanvasAxisProp<X> | null | undefined;
right?: CanvasAxisProp<Y> | null | undefined;
bottom?: CanvasAxisProp<X> | null | undefined;
left?: CanvasAxisProp<Y> | null | undefined;
theme: CompleteTheme;

@@ -31,0 +31,0 @@ }) => void;

import React from 'react';
import { AnyScale } from '../types';
import { AnyScale, TicksSpec } from '../types';
export declare const Grid: React.MemoExoticComponent<(<X extends import("@nivo/core").DatumValue, Y extends import("@nivo/core").DatumValue>({ width, height, xScale, yScale, xValues, yValues, }: {

@@ -15,2 +15,3 @@ width: number;

}) | (import("d3-scale").ScaleTime<any, number, never> & {
format: string;
useUTC: boolean;

@@ -22,4 +23,4 @@ type: "time";

type: "log";
}) | undefined;
xValues?: number | X[] | undefined;
}) | null | undefined;
xValues?: string | number | X[] | undefined;
yScale?: (import("d3-scale").ScaleBand<any> & {

@@ -34,2 +35,3 @@ type: "band";

}) | (import("d3-scale").ScaleTime<any, number, never> & {
format: string;
useUTC: boolean;

@@ -41,5 +43,5 @@ type: "time";

type: "log";
}) | undefined;
yValues?: number | Y[] | undefined;
}) | null | undefined;
yValues?: string | number | Y[] | undefined;
}) => JSX.Element)>;
//# sourceMappingURL=Grid.d.ts.map

@@ -21,2 +21,3 @@ import { SpringValues } from '@react-spring/web';

}) | (ScaleTime<any, number> & {
format: string;
useUTC: boolean;

@@ -23,0 +24,0 @@ type: 'time';

{
"name": "@nivo/axes",
"version": "0.70.1",
"version": "0.71.0",
"license": "MIT",

@@ -30,10 +30,10 @@ "author": {

"dependencies": {
"@nivo/scales": "0.70.0",
"@react-spring/web": "9.1.2",
"@nivo/scales": "0.71.0",
"@react-spring/web": "9.2.0",
"d3-format": "^1.4.4",
"d3-time": "^1.0.11",
"d3-time-format": "^2.1.3"
"d3-time-format": "^3.0.0"
},
"devDependencies": {
"@nivo/core": "0.70.1",
"@nivo/core": "0.71.0",
"@types/d3-format": "^1.4.1",

@@ -44,3 +44,3 @@ "@types/d3-time": "^1.1.1",

"peerDependencies": {
"@nivo/core": "0.70.1",
"@nivo/core": "0.71.0",
"prop-types": ">= 15.5.10 < 16.0.0",

@@ -52,3 +52,3 @@ "react": ">= 16.8.4 < 18.0.0"

},
"gitHead": "460d79b04e335bd32a80226da417d41d312b893d"
"gitHead": "232b613bd61d2b8e5c783f4181b2d14580e2fd27"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc