@nivo/arcs
Advanced tools
Comparing version 0.73.0 to 0.74.0
@@ -74,3 +74,20 @@ 'use strict'; | ||
}; | ||
var svgEllipticalArcCommand = function svgEllipticalArcCommand(radius, largeArcFlag, sweepFlag, x, y) { | ||
return ['A', radius, radius, 0, largeArcFlag, sweepFlag, x, y].join(' '); | ||
}; | ||
var generateSvgArc = function generateSvgArc(radius, originalStartAngle, originalEndAngle) { | ||
var startAngle = Math.min(originalStartAngle, originalEndAngle); | ||
var endAngle = Math.max(originalStartAngle, originalEndAngle); | ||
var start = core.positionFromAngle(core.degreesToRadians(endAngle), radius); | ||
var end = core.positionFromAngle(core.degreesToRadians(startAngle), radius); | ||
if (endAngle - startAngle >= 360) { | ||
var mid = core.positionFromAngle(core.degreesToRadians(startAngle + 180), radius); | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 1, mid.x, mid.y), "M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 0, mid.x, mid.y)].join(' '); | ||
} | ||
var largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1; | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, largeArcFlag, 0, end.x, end.y)].join(' '); | ||
}; | ||
var arcTransitionModes = ['startAngle', 'middleAngle', 'endAngle', 'innerRadius', 'centerRadius', 'outerRadius', 'pushIn', 'pushOut']; | ||
@@ -757,2 +774,42 @@ var arcTransitionModeById = { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
var ArcLine = function ArcLine(_ref) { | ||
var animatedProps = _ref.animated, | ||
rest = _objectWithoutProperties(_ref, ["animated"]); | ||
return jsxRuntime.jsx(web.animated.path, _objectSpread2({ | ||
d: web.to([animatedProps.radius, animatedProps.startAngle, animatedProps.endAngle], function (radius, start, end) { | ||
return generateSvgArc(radius, start, end); | ||
}) | ||
}, rest)); | ||
}; | ||
var ArcShape = function ArcShape(_ref) { | ||
@@ -982,3 +1039,3 @@ var datum = _ref.datum, | ||
if (includeCenter === true) { | ||
if (includeCenter) { | ||
points.push([centerX, centerY]); | ||
@@ -1064,2 +1121,3 @@ } | ||
exports.ArcLabelsLayer = ArcLabelsLayer; | ||
exports.ArcLine = ArcLine; | ||
exports.ArcLinkLabelsLayer = ArcLinkLabelsLayer; | ||
@@ -1066,0 +1124,0 @@ exports.ArcShape = ArcShape; |
import { useMemo, createElement, useCallback } from 'react'; | ||
import { radiansToDegrees, midAngle, positionFromAngle, useMotionConfig, useTheme, usePropertyAccessor, textPropsByEngine, degreesToRadians, getDistance, getAngle } from '@nivo/core'; | ||
import { radiansToDegrees, positionFromAngle, degreesToRadians, midAngle, useMotionConfig, useTheme, usePropertyAccessor, textPropsByEngine, getDistance, getAngle } from '@nivo/core'; | ||
import { useInheritedColor } from '@nivo/colors'; | ||
@@ -70,3 +70,20 @@ import { to, useTransition, animated, useSpring } from '@react-spring/web'; | ||
}; | ||
var svgEllipticalArcCommand = function svgEllipticalArcCommand(radius, largeArcFlag, sweepFlag, x, y) { | ||
return ['A', radius, radius, 0, largeArcFlag, sweepFlag, x, y].join(' '); | ||
}; | ||
var generateSvgArc = function generateSvgArc(radius, originalStartAngle, originalEndAngle) { | ||
var startAngle = Math.min(originalStartAngle, originalEndAngle); | ||
var endAngle = Math.max(originalStartAngle, originalEndAngle); | ||
var start = positionFromAngle(degreesToRadians(endAngle), radius); | ||
var end = positionFromAngle(degreesToRadians(startAngle), radius); | ||
if (endAngle - startAngle >= 360) { | ||
var mid = positionFromAngle(degreesToRadians(startAngle + 180), radius); | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 1, mid.x, mid.y), "M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 0, mid.x, mid.y)].join(' '); | ||
} | ||
var largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1; | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, largeArcFlag, 0, end.x, end.y)].join(' '); | ||
}; | ||
var arcTransitionModes = ['startAngle', 'middleAngle', 'endAngle', 'innerRadius', 'centerRadius', 'outerRadius', 'pushIn', 'pushOut']; | ||
@@ -753,2 +770,42 @@ var arcTransitionModeById = { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
var ArcLine = function ArcLine(_ref) { | ||
var animatedProps = _ref.animated, | ||
rest = _objectWithoutProperties(_ref, ["animated"]); | ||
return jsx(animated.path, _objectSpread2({ | ||
d: to([animatedProps.radius, animatedProps.startAngle, animatedProps.endAngle], function (radius, start, end) { | ||
return generateSvgArc(radius, start, end); | ||
}) | ||
}, rest)); | ||
}; | ||
var ArcShape = function ArcShape(_ref) { | ||
@@ -978,3 +1035,3 @@ var datum = _ref.datum, | ||
if (includeCenter === true) { | ||
if (includeCenter) { | ||
points.push([centerX, centerY]); | ||
@@ -1059,3 +1116,3 @@ } | ||
export { ArcLabelsLayer, ArcLinkLabelsLayer, ArcShape, ArcsLayer, arcTransitionModeById, arcTransitionModes, computeArcBoundingBox, computeArcCenter, computeArcLink, computeArcLinkTextAnchor, drawCanvasArcLabels, drawCanvasArcLinkLabels, findArcUnderCursor, interpolateArc, interpolateArcCenter, isCursorInRing, useAnimatedArc, useArcCenters, useArcCentersTransition, useArcGenerator, useArcLabels, useArcLinkLabels, useArcLinkLabelsTransition, useArcLinks, useArcTransitionMode, useArcsTransition }; | ||
export { ArcLabelsLayer, ArcLine, ArcLinkLabelsLayer, ArcShape, ArcsLayer, arcTransitionModeById, arcTransitionModes, computeArcBoundingBox, computeArcCenter, computeArcLink, computeArcLinkTextAnchor, drawCanvasArcLabels, drawCanvasArcLinkLabels, findArcUnderCursor, interpolateArc, interpolateArcCenter, isCursorInRing, useAnimatedArc, useArcCenters, useArcCentersTransition, useArcGenerator, useArcLabels, useArcLinkLabels, useArcLinkLabelsTransition, useArcLinks, useArcTransitionMode, useArcsTransition }; | ||
//# sourceMappingURL=nivo-arcs.es.js.map |
@@ -69,3 +69,20 @@ (function (global, factory) { | ||
}; | ||
var svgEllipticalArcCommand = function svgEllipticalArcCommand(radius, largeArcFlag, sweepFlag, x, y) { | ||
return ['A', radius, radius, 0, largeArcFlag, sweepFlag, x, y].join(' '); | ||
}; | ||
var generateSvgArc = function generateSvgArc(radius, originalStartAngle, originalEndAngle) { | ||
var startAngle = Math.min(originalStartAngle, originalEndAngle); | ||
var endAngle = Math.max(originalStartAngle, originalEndAngle); | ||
var start = core.positionFromAngle(core.degreesToRadians(endAngle), radius); | ||
var end = core.positionFromAngle(core.degreesToRadians(startAngle), radius); | ||
if (endAngle - startAngle >= 360) { | ||
var mid = core.positionFromAngle(core.degreesToRadians(startAngle + 180), radius); | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 1, mid.x, mid.y), "M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, 1, 0, mid.x, mid.y)].join(' '); | ||
} | ||
var largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1; | ||
return ["M ".concat(start.x, " ").concat(start.y), svgEllipticalArcCommand(radius, largeArcFlag, 0, end.x, end.y)].join(' '); | ||
}; | ||
var arcTransitionModes = ['startAngle', 'middleAngle', 'endAngle', 'innerRadius', 'centerRadius', 'outerRadius', 'pushIn', 'pushOut']; | ||
@@ -752,2 +769,42 @@ var arcTransitionModeById = { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
var ArcLine = function ArcLine(_ref) { | ||
var animatedProps = _ref.animated, | ||
rest = _objectWithoutProperties(_ref, ["animated"]); | ||
return jsxRuntime.jsx(web.animated.path, _objectSpread2({ | ||
d: web.to([animatedProps.radius, animatedProps.startAngle, animatedProps.endAngle], function (radius, start, end) { | ||
return generateSvgArc(radius, start, end); | ||
}) | ||
}, rest)); | ||
}; | ||
var ArcShape = function ArcShape(_ref) { | ||
@@ -977,3 +1034,3 @@ var datum = _ref.datum, | ||
if (includeCenter === true) { | ||
if (includeCenter) { | ||
points.push([centerX, centerY]); | ||
@@ -1059,2 +1116,3 @@ } | ||
exports.ArcLabelsLayer = ArcLabelsLayer; | ||
exports.ArcLine = ArcLine; | ||
exports.ArcLinkLabelsLayer = ArcLinkLabelsLayer; | ||
@@ -1061,0 +1119,0 @@ exports.ArcShape = ArcShape; |
@@ -27,3 +27,3 @@ import { SpringValue } from '@react-spring/web'; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -80,3 +80,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -133,3 +133,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -186,3 +186,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -189,0 +189,0 @@ startAngle: number; |
export * from './arc_labels'; | ||
export * from './arc_link_labels'; | ||
export * from './ArcLine'; | ||
export * from './ArcShape'; | ||
@@ -4,0 +5,0 @@ export * from './ArcsLayer'; |
@@ -29,3 +29,3 @@ import { DatumWithArc } from './types'; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -82,3 +82,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -135,3 +135,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -188,3 +188,3 @@ startAngle: number; | ||
from: infer From; | ||
} ? import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
} ? From extends () => any ? ReturnType<From> : import("@react-spring/types").ObjectType<From> : import("@react-spring/web").TransitionKey & ("progress" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | keyof ExtraProps) extends never ? import("@react-spring/core/dist/declarations/src/types/common").RawValues<Omit<import("@react-spring/types").Constrain<{ | ||
progress: number; | ||
@@ -191,0 +191,0 @@ startAngle: number; |
@@ -15,2 +15,4 @@ import { DatumWithArc } from './types'; | ||
export declare const useFilteredDataBySkipAngle: <Datum extends DatumWithArc>(data: Datum[], skipAngle: number) => Datum[]; | ||
export declare const svgEllipticalArcCommand: (radius: number, largeArcFlag: 0 | 1, sweepFlag: 0 | 1, x: number, y: number) => string; | ||
export declare const generateSvgArc: (radius: number, originalStartAngle: number, originalEndAngle: number) => string; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@nivo/arcs", | ||
"version": "0.73.0", | ||
"version": "0.74.0", | ||
"license": "MIT", | ||
@@ -31,12 +31,12 @@ "author": { | ||
"dependencies": { | ||
"@nivo/colors": "0.73.0", | ||
"@react-spring/web": "9.2.4", | ||
"@nivo/colors": "0.74.0", | ||
"@react-spring/web": "9.2.6", | ||
"d3-shape": "^1.3.5" | ||
}, | ||
"devDependencies": { | ||
"@nivo/core": "0.73.0", | ||
"@nivo/core": "0.74.0", | ||
"@types/d3-shape": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@nivo/core": "0.73.0", | ||
"@nivo/core": "0.74.0", | ||
"react": ">= 16.14.0 < 18.0.0" | ||
@@ -47,3 +47,3 @@ }, | ||
}, | ||
"gitHead": "919f213600a08609939198ea743f7dbde9a572e2" | ||
"gitHead": "5d387c6723bb384f276d2b6ce15ca49c0e49948a" | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
512635
69
4178
1
+ Added@nivo/colors@0.74.0(transitive)
+ Added@nivo/core@0.74.0(transitive)
+ Added@nivo/recompose@0.74.0(transitive)
+ Added@nivo/tooltip@0.74.0(transitive)
+ Added@react-spring/web@9.2.6(transitive)
- Removed@nivo/colors@0.73.0(transitive)
- Removed@nivo/core@0.73.0(transitive)
- Removed@nivo/recompose@0.73.0(transitive)
- Removed@nivo/tooltip@0.73.0(transitive)
- Removed@react-spring/web@9.2.4(transitive)
Updated@nivo/colors@0.74.0
Updated@react-spring/web@9.2.6