@nivo/annotations
Advanced tools
@@ -1,2 +0,2 @@ | ||
| "use strict";var t=require("react"),n=require("lodash/filter.js"),e=require("lodash/isNumber.js"),i=require("lodash/omit.js"),o=require("@nivo/core"),a=require("@react-spring/web"),s=require("react/jsx-runtime");function r(){return r=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},r.apply(null,arguments)}var u={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},l=function(n){var e=typeof n;return t.isValidElement(n)||"string"===e||"function"===e||"object"===e},h=function(t){var n=typeof t;return"string"===n||"function"===n},d=function(t){return"circle"===t.type},c=function(t){return"dot"===t.type},x=function(t){return"rect"===t.type},f=function(t){var e=t.data,o=t.annotations,a=t.getPosition,s=t.getDimensions;return o.reduce((function(t,o){var u=o.offset||0;return[].concat(t,n(e,o.match).map((function(t){var n=a(t),e=s(t);return(d(o)||x(o))&&(e.size=e.size+2*u,e.width=e.width+2*u,e.height=e.height+2*u),r({},i(o,["match","offset"]),n,e,{size:o.size||e.size,datum:t})})))}),[])},y=function(t,n,e,i){var a=Math.atan2(i-n,e-t);return o.absoluteAngleDegrees(o.radiansToDegrees(a))},m=function(t){var n,i,a=t.x,s=t.y,r=t.noteX,l=t.noteY,h=t.noteWidth,c=void 0===h?u.noteWidth:h,f=t.noteTextOffset,m=void 0===f?u.noteTextOffset:f;if(e(r))n=a+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(l))i=s+l;else{if(void 0===l.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=l.abs}var g=a,p=s,k=y(a,s,n,i);if(d(t)){var W=o.positionFromAngle(o.degreesToRadians(k),t.size/2);g+=W.x,p+=W.y}if(x(t)){var v=Math.round((k+90)/45)%8;0===v&&(p-=t.height/2),1===v&&(g+=t.width/2,p-=t.height/2),2===v&&(g+=t.width/2),3===v&&(g+=t.width/2,p+=t.height/2),4===v&&(p+=t.height/2),5===v&&(g-=t.width/2,p+=t.height/2),6===v&&(g-=t.width/2),7===v&&(g-=t.width/2,p-=t.height/2)}var b=n,j=n;return(k+90)%360>180?(b-=c,j-=c):j+=c,{points:[[g,p],[n,i],[j,i]],text:[b,i-m],angle:k+90}},g=function(n){return t.useMemo((function(){return m(n)}),[n])},p=function(n){var e=n.datum,u=n.x,l=n.y,h=n.note,d=o.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,y=a.useSpring({x:u,y:l,config:f,immediate:!x});return"function"==typeof h?t.createElement(h,{x:u,y:l,datum:e}):s.jsxs(s.Fragment,{children:[d.annotations.text.outlineWidth>0&&s.jsx(a.animated.text,{x:y.x,y:y.y,style:r({},d.annotations.text,{strokeLinejoin:"round",strokeWidth:2*d.annotations.text.outlineWidth,stroke:d.annotations.text.outlineColor}),children:h}),s.jsx(a.animated.text,{x:y.x,y:y.y,style:i(d.annotations.text,["outlineWidth","outlineColor"]),children:h})]})},k=function(n){var e=n.points,i=n.isOutline,u=void 0!==i&&i,l=o.useTheme(),h=t.useMemo((function(){var t=e[0];return e.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[e]),d=o.useAnimatedPath(h);if(u&&l.annotations.link.outlineWidth<=0)return null;var c=r({},l.annotations.link);return u&&(c.strokeLinecap="square",c.strokeWidth=l.annotations.link.strokeWidth+2*l.annotations.link.outlineWidth,c.stroke=l.annotations.link.outlineColor,c.opacity=l.annotations.link.outlineOpacity),s.jsx(a.animated.path,{fill:"none",d:d,style:c})},W=function(t){var n=t.x,e=t.y,i=t.size,u=o.useTheme(),l=o.useMotionConfig(),h=l.animate,d=l.config,c=a.useSpring({x:n,y:e,radius:i/2,config:d,immediate:!h});return s.jsxs(s.Fragment,{children:[u.annotations.outline.outlineWidth>0&&s.jsx(a.animated.circle,{cx:c.x,cy:c.y,r:c.radius,style:r({},u.annotations.outline,{fill:"none",strokeWidth:u.annotations.outline.strokeWidth+2*u.annotations.outline.outlineWidth,stroke:u.annotations.outline.outlineColor,opacity:u.annotations.outline.outlineOpacity})}),s.jsx(a.animated.circle,{cx:c.x,cy:c.y,r:c.radius,style:u.annotations.outline})]})},v=function(t){var n=t.x,e=t.y,i=t.size,l=void 0===i?u.dotSize:i,h=o.useTheme(),d=o.useMotionConfig(),c=d.animate,x=d.config,f=a.useSpring({x:n,y:e,radius:l/2,config:x,immediate:!c});return s.jsxs(s.Fragment,{children:[h.annotations.outline.outlineWidth>0&&s.jsx(a.animated.circle,{cx:f.x,cy:f.y,r:f.radius,style:r({},h.annotations.outline,{fill:"none",strokeWidth:2*h.annotations.outline.outlineWidth,stroke:h.annotations.outline.outlineColor,opacity:h.annotations.outline.outlineOpacity})}),s.jsx(a.animated.circle,{cx:f.x,cy:f.y,r:f.radius,style:h.annotations.symbol})]})},b=function(t){var n=t.x,e=t.y,i=t.width,u=t.height,l=t.borderRadius,h=void 0===l?6:l,d=o.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,y=a.useSpring({x:n-i/2,y:e-u/2,width:i,height:u,config:f,immediate:!x});return s.jsxs(s.Fragment,{children:[d.annotations.outline.outlineWidth>0&&s.jsx(a.animated.rect,{x:y.x,y:y.y,rx:h,ry:h,width:y.width,height:y.height,style:r({},d.annotations.outline,{fill:"none",strokeWidth:d.annotations.outline.strokeWidth+2*d.annotations.outline.outlineWidth,stroke:d.annotations.outline.outlineColor,opacity:d.annotations.outline.outlineOpacity})}),s.jsx(a.animated.rect,{x:y.x,y:y.y,rx:h,ry:h,width:y.width,height:y.height,style:d.annotations.outline})]})},j=function(t,n){n.forEach((function(n,e){var i=n[0],o=n[1];0===e?t.moveTo(i,o):t.lineTo(i,o)}))};exports.Annotation=function(t){var n=t.datum,e=t.x,i=t.y,o=t.note,a=g(t);if(!l(o))throw new Error("note should be a valid react element");return s.jsxs(s.Fragment,{children:[s.jsx(k,{points:a.points,isOutline:!0}),d(t)&&s.jsx(W,{x:e,y:i,size:t.size}),c(t)&&s.jsx(v,{x:e,y:i,size:t.size}),x(t)&&s.jsx(b,{x:e,y:i,width:t.width,height:t.height,borderRadius:t.borderRadius}),s.jsx(k,{points:a.points}),s.jsx(p,{datum:n,x:a.text[0],y:a.text[1],note:o})]})},exports.bindAnnotations=f,exports.computeAnnotation=m,exports.defaultProps=u,exports.getLinkAngle=y,exports.isCanvasNote=h,exports.isCircleAnnotation=d,exports.isDotAnnotation=c,exports.isRectAnnotation=x,exports.isSvgNote=l,exports.renderAnnotationsToCanvas=function(t,n){var e=n.annotations,i=n.theme;0!==e.length&&(t.save(),e.forEach((function(n){if(!h(n.note))throw new Error("note is invalid for canvas implementation");i.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=i.annotations.link.outlineColor,t.lineWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,t.beginPath(),j(t,n.computed.points),t.stroke(),t.lineCap="butt"),d(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),c(n)&&i.annotations.symbol.outlineWidth>0&&(t.strokeStyle=i.annotations.symbol.outlineColor,t.lineWidth=2*i.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=i.annotations.link.stroke,t.lineWidth=i.annotations.link.strokeWidth,t.beginPath(),j(t,n.computed.points),t.stroke(),d(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),c(n)&&(t.fillStyle=i.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),x(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:i}):(t.font=i.annotations.text.fontSize+"px "+i.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=i.annotations.text.fill,t.strokeStyle=i.annotations.text.outlineColor,t.lineWidth=2*i.annotations.text.outlineWidth,i.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())},exports.useAnnotations=function(n){var e=n.data,i=n.annotations,o=n.getPosition,a=n.getDimensions;return t.useMemo((function(){return f({data:e,annotations:i,getPosition:o,getDimensions:a})}),[e,i,o,a])},exports.useComputedAnnotation=g,exports.useComputedAnnotations=function(n){var e=n.annotations;return t.useMemo((function(){return e.map((function(t){return r({},t,{computed:m(r({},t))})}))}),[e])}; | ||
| "use strict";var t=require("react"),n=require("lodash/filter.js"),e=require("lodash/isNumber.js"),i=require("lodash/omit.js"),o=require("@nivo/core"),a=require("@react-spring/web"),s=require("@nivo/theming"),r=require("react/jsx-runtime");function u(){return u=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},u.apply(null,arguments)}var l={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},h=function(n){var e=typeof n;return t.isValidElement(n)||"string"===e||"function"===e||"object"===e},d=function(t){var n=typeof t;return"string"===n||"function"===n},c=function(t){return"circle"===t.type},x=function(t){return"dot"===t.type},f=function(t){return"rect"===t.type},m=function(t){var e=t.data,o=t.annotations,a=t.getPosition,s=t.getDimensions;return o.reduce((function(t,o){var r=o.offset||0;return[].concat(t,n(e,o.match).map((function(t){var n=a(t),e=s(t);return(c(o)||f(o))&&(e.size=e.size+2*r,e.width=e.width+2*r,e.height=e.height+2*r),u({},i(o,["match","offset"]),n,e,{size:o.size||e.size,datum:t})})))}),[])},y=function(t,n,e,i){var a=Math.atan2(i-n,e-t);return o.absoluteAngleDegrees(o.radiansToDegrees(a))},g=function(t){var n,i,a=t.x,s=t.y,r=t.noteX,u=t.noteY,h=t.noteWidth,d=void 0===h?l.noteWidth:h,x=t.noteTextOffset,m=void 0===x?l.noteTextOffset:x;if(e(r))n=a+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(u))i=s+u;else{if(void 0===u.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=u.abs}var g=a,p=s,k=y(a,s,n,i);if(c(t)){var W=o.positionFromAngle(o.degreesToRadians(k),t.size/2);g+=W.x,p+=W.y}if(f(t)){var v=Math.round((k+90)/45)%8;0===v&&(p-=t.height/2),1===v&&(g+=t.width/2,p-=t.height/2),2===v&&(g+=t.width/2),3===v&&(g+=t.width/2,p+=t.height/2),4===v&&(p+=t.height/2),5===v&&(g-=t.width/2,p+=t.height/2),6===v&&(g-=t.width/2),7===v&&(g-=t.width/2,p-=t.height/2)}var b=n,j=n;return(k+90)%360>180?(b-=d,j-=d):j+=d,{points:[[g,p],[n,i],[j,i]],text:[b,i-m],angle:k+90}},p=function(n){return t.useMemo((function(){return g(n)}),[n])},k=function(n){var e=n.datum,l=n.x,h=n.y,d=n.note,c=s.useTheme(),x=o.useMotionConfig(),f=x.animate,m=x.config,y=a.useSpring({x:l,y:h,config:m,immediate:!f});return"function"==typeof d?t.createElement(d,{x:l,y:h,datum:e}):r.jsxs(r.Fragment,{children:[c.annotations.text.outlineWidth>0&&r.jsx(a.animated.text,{x:y.x,y:y.y,style:u({},c.annotations.text,{strokeLinejoin:"round",strokeWidth:2*c.annotations.text.outlineWidth,stroke:c.annotations.text.outlineColor}),children:d}),r.jsx(a.animated.text,{x:y.x,y:y.y,style:i(c.annotations.text,["outlineWidth","outlineColor"]),children:d})]})},W=function(n){var e=n.points,i=n.isOutline,l=void 0!==i&&i,h=s.useTheme(),d=t.useMemo((function(){var t=e[0];return e.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[e]),c=o.useAnimatedPath(d);if(l&&h.annotations.link.outlineWidth<=0)return null;var x=u({},h.annotations.link);return l&&(x.strokeLinecap="square",x.strokeWidth=h.annotations.link.strokeWidth+2*h.annotations.link.outlineWidth,x.stroke=h.annotations.link.outlineColor,x.opacity=h.annotations.link.outlineOpacity),r.jsx(a.animated.path,{fill:"none",d:c,style:x})},v=function(t){var n=t.x,e=t.y,i=t.size,l=s.useTheme(),h=o.useMotionConfig(),d=h.animate,c=h.config,x=a.useSpring({x:n,y:e,radius:i/2,config:c,immediate:!d});return r.jsxs(r.Fragment,{children:[l.annotations.outline.outlineWidth>0&&r.jsx(a.animated.circle,{cx:x.x,cy:x.y,r:x.radius,style:u({},l.annotations.outline,{fill:"none",strokeWidth:l.annotations.outline.strokeWidth+2*l.annotations.outline.outlineWidth,stroke:l.annotations.outline.outlineColor,opacity:l.annotations.outline.outlineOpacity})}),r.jsx(a.animated.circle,{cx:x.x,cy:x.y,r:x.radius,style:l.annotations.outline})]})},b=function(t){var n=t.x,e=t.y,i=t.size,h=void 0===i?l.dotSize:i,d=s.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,m=a.useSpring({x:n,y:e,radius:h/2,config:f,immediate:!x});return r.jsxs(r.Fragment,{children:[d.annotations.outline.outlineWidth>0&&r.jsx(a.animated.circle,{cx:m.x,cy:m.y,r:m.radius,style:u({},d.annotations.outline,{fill:"none",strokeWidth:2*d.annotations.outline.outlineWidth,stroke:d.annotations.outline.outlineColor,opacity:d.annotations.outline.outlineOpacity})}),r.jsx(a.animated.circle,{cx:m.x,cy:m.y,r:m.radius,style:d.annotations.symbol})]})},j=function(t){var n=t.x,e=t.y,i=t.width,l=t.height,h=t.borderRadius,d=void 0===h?6:h,c=s.useTheme(),x=o.useMotionConfig(),f=x.animate,m=x.config,y=a.useSpring({x:n-i/2,y:e-l/2,width:i,height:l,config:m,immediate:!f});return r.jsxs(r.Fragment,{children:[c.annotations.outline.outlineWidth>0&&r.jsx(a.animated.rect,{x:y.x,y:y.y,rx:d,ry:d,width:y.width,height:y.height,style:u({},c.annotations.outline,{fill:"none",strokeWidth:c.annotations.outline.strokeWidth+2*c.annotations.outline.outlineWidth,stroke:c.annotations.outline.outlineColor,opacity:c.annotations.outline.outlineOpacity})}),r.jsx(a.animated.rect,{x:y.x,y:y.y,rx:d,ry:d,width:y.width,height:y.height,style:c.annotations.outline})]})},w=function(t,n){n.forEach((function(n,e){var i=n[0],o=n[1];0===e?t.moveTo(i,o):t.lineTo(i,o)}))};exports.Annotation=function(t){var n=t.datum,e=t.x,i=t.y,o=t.note,a=p(t);if(!h(o))throw new Error("note should be a valid react element");return r.jsxs(r.Fragment,{children:[r.jsx(W,{points:a.points,isOutline:!0}),c(t)&&r.jsx(v,{x:e,y:i,size:t.size}),x(t)&&r.jsx(b,{x:e,y:i,size:t.size}),f(t)&&r.jsx(j,{x:e,y:i,width:t.width,height:t.height,borderRadius:t.borderRadius}),r.jsx(W,{points:a.points}),r.jsx(k,{datum:n,x:a.text[0],y:a.text[1],note:o})]})},exports.bindAnnotations=m,exports.computeAnnotation=g,exports.defaultProps=l,exports.getLinkAngle=y,exports.isCanvasNote=d,exports.isCircleAnnotation=c,exports.isDotAnnotation=x,exports.isRectAnnotation=f,exports.isSvgNote=h,exports.renderAnnotationsToCanvas=function(t,n){var e=n.annotations,i=n.theme;0!==e.length&&(t.save(),e.forEach((function(n){if(!d(n.note))throw new Error("note is invalid for canvas implementation");i.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=i.annotations.link.outlineColor,t.lineWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,t.beginPath(),w(t,n.computed.points),t.stroke(),t.lineCap="butt"),c(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&i.annotations.symbol.outlineWidth>0&&(t.strokeStyle=i.annotations.symbol.outlineColor,t.lineWidth=2*i.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),f(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=i.annotations.link.stroke,t.lineWidth=i.annotations.link.strokeWidth,t.beginPath(),w(t,n.computed.points),t.stroke(),c(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&(t.fillStyle=i.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),f(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:i}):(t.font=i.annotations.text.fontSize+"px "+i.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=i.annotations.text.fill,t.strokeStyle=i.annotations.text.outlineColor,t.lineWidth=2*i.annotations.text.outlineWidth,i.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())},exports.useAnnotations=function(n){var e=n.data,i=n.annotations,o=n.getPosition,a=n.getDimensions;return t.useMemo((function(){return m({data:e,annotations:i,getPosition:o,getDimensions:a})}),[e,i,o,a])},exports.useComputedAnnotation=p,exports.useComputedAnnotations=function(n){var e=n.annotations;return t.useMemo((function(){return e.map((function(t){return u({},t,{computed:g(u({},t))})}))}),[e])}; | ||
| //# sourceMappingURL=nivo-annotations.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
| "use strict";var t=require("react"),n=require("lodash/filter.js"),e=require("lodash/isNumber.js"),i=require("lodash/omit.js"),o=require("@nivo/core"),a=require("@react-spring/web"),s=require("react/jsx-runtime");function r(){return r=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},r.apply(null,arguments)}var u={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},l=function(n){var e=typeof n;return t.isValidElement(n)||"string"===e||"function"===e||"object"===e},h=function(t){var n=typeof t;return"string"===n||"function"===n},d=function(t){return"circle"===t.type},c=function(t){return"dot"===t.type},x=function(t){return"rect"===t.type},f=function(t){var e=t.data,o=t.annotations,a=t.getPosition,s=t.getDimensions;return o.reduce((function(t,o){var u=o.offset||0;return[].concat(t,n(e,o.match).map((function(t){var n=a(t),e=s(t);return(d(o)||x(o))&&(e.size=e.size+2*u,e.width=e.width+2*u,e.height=e.height+2*u),r({},i(o,["match","offset"]),n,e,{size:o.size||e.size,datum:t})})))}),[])},y=function(t,n,e,i){var a=Math.atan2(i-n,e-t);return o.absoluteAngleDegrees(o.radiansToDegrees(a))},m=function(t){var n,i,a=t.x,s=t.y,r=t.noteX,l=t.noteY,h=t.noteWidth,c=void 0===h?u.noteWidth:h,f=t.noteTextOffset,m=void 0===f?u.noteTextOffset:f;if(e(r))n=a+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(l))i=s+l;else{if(void 0===l.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=l.abs}var g=a,p=s,k=y(a,s,n,i);if(d(t)){var W=o.positionFromAngle(o.degreesToRadians(k),t.size/2);g+=W.x,p+=W.y}if(x(t)){var v=Math.round((k+90)/45)%8;0===v&&(p-=t.height/2),1===v&&(g+=t.width/2,p-=t.height/2),2===v&&(g+=t.width/2),3===v&&(g+=t.width/2,p+=t.height/2),4===v&&(p+=t.height/2),5===v&&(g-=t.width/2,p+=t.height/2),6===v&&(g-=t.width/2),7===v&&(g-=t.width/2,p-=t.height/2)}var b=n,j=n;return(k+90)%360>180?(b-=c,j-=c):j+=c,{points:[[g,p],[n,i],[j,i]],text:[b,i-m],angle:k+90}},g=function(n){return t.useMemo((function(){return m(n)}),[n])},p=function(n){var e=n.datum,u=n.x,l=n.y,h=n.note,d=o.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,y=a.useSpring({x:u,y:l,config:f,immediate:!x});return"function"==typeof h?t.createElement(h,{x:u,y:l,datum:e}):s.jsxs(s.Fragment,{children:[d.annotations.text.outlineWidth>0&&s.jsx(a.animated.text,{x:y.x,y:y.y,style:r({},d.annotations.text,{strokeLinejoin:"round",strokeWidth:2*d.annotations.text.outlineWidth,stroke:d.annotations.text.outlineColor}),children:h}),s.jsx(a.animated.text,{x:y.x,y:y.y,style:i(d.annotations.text,["outlineWidth","outlineColor"]),children:h})]})},k=function(n){var e=n.points,i=n.isOutline,u=void 0!==i&&i,l=o.useTheme(),h=t.useMemo((function(){var t=e[0];return e.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[e]),d=o.useAnimatedPath(h);if(u&&l.annotations.link.outlineWidth<=0)return null;var c=r({},l.annotations.link);return u&&(c.strokeLinecap="square",c.strokeWidth=l.annotations.link.strokeWidth+2*l.annotations.link.outlineWidth,c.stroke=l.annotations.link.outlineColor,c.opacity=l.annotations.link.outlineOpacity),s.jsx(a.animated.path,{fill:"none",d:d,style:c})},W=function(t){var n=t.x,e=t.y,i=t.size,u=o.useTheme(),l=o.useMotionConfig(),h=l.animate,d=l.config,c=a.useSpring({x:n,y:e,radius:i/2,config:d,immediate:!h});return s.jsxs(s.Fragment,{children:[u.annotations.outline.outlineWidth>0&&s.jsx(a.animated.circle,{cx:c.x,cy:c.y,r:c.radius,style:r({},u.annotations.outline,{fill:"none",strokeWidth:u.annotations.outline.strokeWidth+2*u.annotations.outline.outlineWidth,stroke:u.annotations.outline.outlineColor,opacity:u.annotations.outline.outlineOpacity})}),s.jsx(a.animated.circle,{cx:c.x,cy:c.y,r:c.radius,style:u.annotations.outline})]})},v=function(t){var n=t.x,e=t.y,i=t.size,l=void 0===i?u.dotSize:i,h=o.useTheme(),d=o.useMotionConfig(),c=d.animate,x=d.config,f=a.useSpring({x:n,y:e,radius:l/2,config:x,immediate:!c});return s.jsxs(s.Fragment,{children:[h.annotations.outline.outlineWidth>0&&s.jsx(a.animated.circle,{cx:f.x,cy:f.y,r:f.radius,style:r({},h.annotations.outline,{fill:"none",strokeWidth:2*h.annotations.outline.outlineWidth,stroke:h.annotations.outline.outlineColor,opacity:h.annotations.outline.outlineOpacity})}),s.jsx(a.animated.circle,{cx:f.x,cy:f.y,r:f.radius,style:h.annotations.symbol})]})},b=function(t){var n=t.x,e=t.y,i=t.width,u=t.height,l=t.borderRadius,h=void 0===l?6:l,d=o.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,y=a.useSpring({x:n-i/2,y:e-u/2,width:i,height:u,config:f,immediate:!x});return s.jsxs(s.Fragment,{children:[d.annotations.outline.outlineWidth>0&&s.jsx(a.animated.rect,{x:y.x,y:y.y,rx:h,ry:h,width:y.width,height:y.height,style:r({},d.annotations.outline,{fill:"none",strokeWidth:d.annotations.outline.strokeWidth+2*d.annotations.outline.outlineWidth,stroke:d.annotations.outline.outlineColor,opacity:d.annotations.outline.outlineOpacity})}),s.jsx(a.animated.rect,{x:y.x,y:y.y,rx:h,ry:h,width:y.width,height:y.height,style:d.annotations.outline})]})},j=function(t,n){n.forEach((function(n,e){var i=n[0],o=n[1];0===e?t.moveTo(i,o):t.lineTo(i,o)}))};exports.Annotation=function(t){var n=t.datum,e=t.x,i=t.y,o=t.note,a=g(t);if(!l(o))throw new Error("note should be a valid react element");return s.jsxs(s.Fragment,{children:[s.jsx(k,{points:a.points,isOutline:!0}),d(t)&&s.jsx(W,{x:e,y:i,size:t.size}),c(t)&&s.jsx(v,{x:e,y:i,size:t.size}),x(t)&&s.jsx(b,{x:e,y:i,width:t.width,height:t.height,borderRadius:t.borderRadius}),s.jsx(k,{points:a.points}),s.jsx(p,{datum:n,x:a.text[0],y:a.text[1],note:o})]})},exports.bindAnnotations=f,exports.computeAnnotation=m,exports.defaultProps=u,exports.getLinkAngle=y,exports.isCanvasNote=h,exports.isCircleAnnotation=d,exports.isDotAnnotation=c,exports.isRectAnnotation=x,exports.isSvgNote=l,exports.renderAnnotationsToCanvas=function(t,n){var e=n.annotations,i=n.theme;0!==e.length&&(t.save(),e.forEach((function(n){if(!h(n.note))throw new Error("note is invalid for canvas implementation");i.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=i.annotations.link.outlineColor,t.lineWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,t.beginPath(),j(t,n.computed.points),t.stroke(),t.lineCap="butt"),d(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),c(n)&&i.annotations.symbol.outlineWidth>0&&(t.strokeStyle=i.annotations.symbol.outlineColor,t.lineWidth=2*i.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=i.annotations.link.stroke,t.lineWidth=i.annotations.link.strokeWidth,t.beginPath(),j(t,n.computed.points),t.stroke(),d(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),c(n)&&(t.fillStyle=i.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),x(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:i}):(t.font=i.annotations.text.fontSize+"px "+i.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=i.annotations.text.fill,t.strokeStyle=i.annotations.text.outlineColor,t.lineWidth=2*i.annotations.text.outlineWidth,i.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())},exports.useAnnotations=function(n){var e=n.data,i=n.annotations,o=n.getPosition,a=n.getDimensions;return t.useMemo((function(){return f({data:e,annotations:i,getPosition:o,getDimensions:a})}),[e,i,o,a])},exports.useComputedAnnotation=g,exports.useComputedAnnotations=function(n){var e=n.annotations;return t.useMemo((function(){return e.map((function(t){return r({},t,{computed:m(r({},t))})}))}),[e])}; | ||
| "use strict";var t=require("react"),n=require("lodash/filter.js"),e=require("lodash/isNumber.js"),i=require("lodash/omit.js"),o=require("@nivo/core"),a=require("@react-spring/web"),s=require("@nivo/theming"),r=require("react/jsx-runtime");function u(){return u=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},u.apply(null,arguments)}var l={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},h=function(n){var e=typeof n;return t.isValidElement(n)||"string"===e||"function"===e||"object"===e},d=function(t){var n=typeof t;return"string"===n||"function"===n},c=function(t){return"circle"===t.type},x=function(t){return"dot"===t.type},f=function(t){return"rect"===t.type},m=function(t){var e=t.data,o=t.annotations,a=t.getPosition,s=t.getDimensions;return o.reduce((function(t,o){var r=o.offset||0;return[].concat(t,n(e,o.match).map((function(t){var n=a(t),e=s(t);return(c(o)||f(o))&&(e.size=e.size+2*r,e.width=e.width+2*r,e.height=e.height+2*r),u({},i(o,["match","offset"]),n,e,{size:o.size||e.size,datum:t})})))}),[])},y=function(t,n,e,i){var a=Math.atan2(i-n,e-t);return o.absoluteAngleDegrees(o.radiansToDegrees(a))},g=function(t){var n,i,a=t.x,s=t.y,r=t.noteX,u=t.noteY,h=t.noteWidth,d=void 0===h?l.noteWidth:h,x=t.noteTextOffset,m=void 0===x?l.noteTextOffset:x;if(e(r))n=a+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(u))i=s+u;else{if(void 0===u.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=u.abs}var g=a,p=s,k=y(a,s,n,i);if(c(t)){var W=o.positionFromAngle(o.degreesToRadians(k),t.size/2);g+=W.x,p+=W.y}if(f(t)){var v=Math.round((k+90)/45)%8;0===v&&(p-=t.height/2),1===v&&(g+=t.width/2,p-=t.height/2),2===v&&(g+=t.width/2),3===v&&(g+=t.width/2,p+=t.height/2),4===v&&(p+=t.height/2),5===v&&(g-=t.width/2,p+=t.height/2),6===v&&(g-=t.width/2),7===v&&(g-=t.width/2,p-=t.height/2)}var b=n,j=n;return(k+90)%360>180?(b-=d,j-=d):j+=d,{points:[[g,p],[n,i],[j,i]],text:[b,i-m],angle:k+90}},p=function(n){return t.useMemo((function(){return g(n)}),[n])},k=function(n){var e=n.datum,l=n.x,h=n.y,d=n.note,c=s.useTheme(),x=o.useMotionConfig(),f=x.animate,m=x.config,y=a.useSpring({x:l,y:h,config:m,immediate:!f});return"function"==typeof d?t.createElement(d,{x:l,y:h,datum:e}):r.jsxs(r.Fragment,{children:[c.annotations.text.outlineWidth>0&&r.jsx(a.animated.text,{x:y.x,y:y.y,style:u({},c.annotations.text,{strokeLinejoin:"round",strokeWidth:2*c.annotations.text.outlineWidth,stroke:c.annotations.text.outlineColor}),children:d}),r.jsx(a.animated.text,{x:y.x,y:y.y,style:i(c.annotations.text,["outlineWidth","outlineColor"]),children:d})]})},W=function(n){var e=n.points,i=n.isOutline,l=void 0!==i&&i,h=s.useTheme(),d=t.useMemo((function(){var t=e[0];return e.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[e]),c=o.useAnimatedPath(d);if(l&&h.annotations.link.outlineWidth<=0)return null;var x=u({},h.annotations.link);return l&&(x.strokeLinecap="square",x.strokeWidth=h.annotations.link.strokeWidth+2*h.annotations.link.outlineWidth,x.stroke=h.annotations.link.outlineColor,x.opacity=h.annotations.link.outlineOpacity),r.jsx(a.animated.path,{fill:"none",d:c,style:x})},v=function(t){var n=t.x,e=t.y,i=t.size,l=s.useTheme(),h=o.useMotionConfig(),d=h.animate,c=h.config,x=a.useSpring({x:n,y:e,radius:i/2,config:c,immediate:!d});return r.jsxs(r.Fragment,{children:[l.annotations.outline.outlineWidth>0&&r.jsx(a.animated.circle,{cx:x.x,cy:x.y,r:x.radius,style:u({},l.annotations.outline,{fill:"none",strokeWidth:l.annotations.outline.strokeWidth+2*l.annotations.outline.outlineWidth,stroke:l.annotations.outline.outlineColor,opacity:l.annotations.outline.outlineOpacity})}),r.jsx(a.animated.circle,{cx:x.x,cy:x.y,r:x.radius,style:l.annotations.outline})]})},b=function(t){var n=t.x,e=t.y,i=t.size,h=void 0===i?l.dotSize:i,d=s.useTheme(),c=o.useMotionConfig(),x=c.animate,f=c.config,m=a.useSpring({x:n,y:e,radius:h/2,config:f,immediate:!x});return r.jsxs(r.Fragment,{children:[d.annotations.outline.outlineWidth>0&&r.jsx(a.animated.circle,{cx:m.x,cy:m.y,r:m.radius,style:u({},d.annotations.outline,{fill:"none",strokeWidth:2*d.annotations.outline.outlineWidth,stroke:d.annotations.outline.outlineColor,opacity:d.annotations.outline.outlineOpacity})}),r.jsx(a.animated.circle,{cx:m.x,cy:m.y,r:m.radius,style:d.annotations.symbol})]})},j=function(t){var n=t.x,e=t.y,i=t.width,l=t.height,h=t.borderRadius,d=void 0===h?6:h,c=s.useTheme(),x=o.useMotionConfig(),f=x.animate,m=x.config,y=a.useSpring({x:n-i/2,y:e-l/2,width:i,height:l,config:m,immediate:!f});return r.jsxs(r.Fragment,{children:[c.annotations.outline.outlineWidth>0&&r.jsx(a.animated.rect,{x:y.x,y:y.y,rx:d,ry:d,width:y.width,height:y.height,style:u({},c.annotations.outline,{fill:"none",strokeWidth:c.annotations.outline.strokeWidth+2*c.annotations.outline.outlineWidth,stroke:c.annotations.outline.outlineColor,opacity:c.annotations.outline.outlineOpacity})}),r.jsx(a.animated.rect,{x:y.x,y:y.y,rx:d,ry:d,width:y.width,height:y.height,style:c.annotations.outline})]})},w=function(t,n){n.forEach((function(n,e){var i=n[0],o=n[1];0===e?t.moveTo(i,o):t.lineTo(i,o)}))};exports.Annotation=function(t){var n=t.datum,e=t.x,i=t.y,o=t.note,a=p(t);if(!h(o))throw new Error("note should be a valid react element");return r.jsxs(r.Fragment,{children:[r.jsx(W,{points:a.points,isOutline:!0}),c(t)&&r.jsx(v,{x:e,y:i,size:t.size}),x(t)&&r.jsx(b,{x:e,y:i,size:t.size}),f(t)&&r.jsx(j,{x:e,y:i,width:t.width,height:t.height,borderRadius:t.borderRadius}),r.jsx(W,{points:a.points}),r.jsx(k,{datum:n,x:a.text[0],y:a.text[1],note:o})]})},exports.bindAnnotations=m,exports.computeAnnotation=g,exports.defaultProps=l,exports.getLinkAngle=y,exports.isCanvasNote=d,exports.isCircleAnnotation=c,exports.isDotAnnotation=x,exports.isRectAnnotation=f,exports.isSvgNote=h,exports.renderAnnotationsToCanvas=function(t,n){var e=n.annotations,i=n.theme;0!==e.length&&(t.save(),e.forEach((function(n){if(!d(n.note))throw new Error("note is invalid for canvas implementation");i.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=i.annotations.link.outlineColor,t.lineWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,t.beginPath(),w(t,n.computed.points),t.stroke(),t.lineCap="butt"),c(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&i.annotations.symbol.outlineWidth>0&&(t.strokeStyle=i.annotations.symbol.outlineColor,t.lineWidth=2*i.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),f(n)&&i.annotations.outline.outlineWidth>0&&(t.strokeStyle=i.annotations.outline.outlineColor,t.lineWidth=i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=i.annotations.link.stroke,t.lineWidth=i.annotations.link.strokeWidth,t.beginPath(),w(t,n.computed.points),t.stroke(),c(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),x(n)&&(t.fillStyle=i.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),f(n)&&(t.strokeStyle=i.annotations.outline.stroke,t.lineWidth=i.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:i}):(t.font=i.annotations.text.fontSize+"px "+i.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=i.annotations.text.fill,t.strokeStyle=i.annotations.text.outlineColor,t.lineWidth=2*i.annotations.text.outlineWidth,i.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())},exports.useAnnotations=function(n){var e=n.data,i=n.annotations,o=n.getPosition,a=n.getDimensions;return t.useMemo((function(){return m({data:e,annotations:i,getPosition:o,getDimensions:a})}),[e,i,o,a])},exports.useComputedAnnotation=p,exports.useComputedAnnotations=function(n){var e=n.annotations;return t.useMemo((function(){return e.map((function(t){return u({},t,{computed:g(u({},t))})}))}),[e])}; | ||
| //# sourceMappingURL=nivo-annotations.cjs.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"nivo-annotations.cjs.js","sources":["../src/props.ts","../src/utils.ts","../src/compute.ts","../src/hooks.ts","../src/AnnotationNote.tsx","../src/AnnotationLink.tsx","../src/CircleAnnotationOutline.tsx","../src/DotAnnotationOutline.tsx","../src/RectAnnotationOutline.tsx","../src/canvas.ts","../src/Annotation.tsx"],"sourcesContent":["export const defaultProps = {\n dotSize: 4,\n noteWidth: 120,\n noteTextOffset: 8,\n animate: true,\n}\n","import {\n AnnotationSpec,\n CircleAnnotationSpec,\n DotAnnotationSpec,\n Note,\n NoteCanvas,\n NoteSvg,\n RectAnnotationSpec,\n} from './types'\nimport { isValidElement } from 'react'\n\nexport const isSvgNote = <Datum>(note: Note<Datum>): note is NoteSvg<Datum> => {\n const noteType = typeof note\n\n return (\n isValidElement(note) ||\n noteType === 'string' ||\n noteType === 'function' ||\n noteType === 'object'\n )\n}\n\nexport const isCanvasNote = <Datum>(note: Note<Datum>): note is NoteCanvas<Datum> => {\n const noteType = typeof note\n\n return noteType === 'string' || noteType === 'function'\n}\n\nexport const isCircleAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is CircleAnnotationSpec<Datum> => annotationSpec.type === 'circle'\n\nexport const isDotAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is DotAnnotationSpec<Datum> => annotationSpec.type === 'dot'\n\nexport const isRectAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is RectAnnotationSpec<Datum> => annotationSpec.type === 'rect'\n","import filter from 'lodash/filter.js'\nimport isNumber from 'lodash/isNumber.js'\nimport omit from 'lodash/omit.js'\nimport {\n radiansToDegrees,\n absoluteAngleDegrees,\n degreesToRadians,\n positionFromAngle,\n} from '@nivo/core'\nimport { defaultProps } from './props'\nimport {\n AnnotationPositionGetter,\n AnnotationDimensionsGetter,\n BoundAnnotation,\n AnnotationMatcher,\n AnnotationInstructions,\n} from './types'\nimport { isCircleAnnotation, isRectAnnotation } from './utils'\n\nexport const bindAnnotations = <\n Datum = {\n x: number\n y: number\n }\n>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}): BoundAnnotation<Datum>[] =>\n annotations.reduce((acc: BoundAnnotation<Datum>[], annotation) => {\n const offset = annotation.offset || 0\n\n return [\n ...acc,\n ...filter<Datum>(data, annotation.match).map(datum => {\n const position = getPosition(datum)\n const dimensions = getDimensions(datum)\n\n if (isCircleAnnotation(annotation) || isRectAnnotation(annotation)) {\n dimensions.size = dimensions.size + offset * 2\n dimensions.width = dimensions.width + offset * 2\n dimensions.height = dimensions.height + offset * 2\n }\n\n // acc.push({\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // } as any)\n // return [\n // ...acc,\n // {\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // },\n // ]\n return {\n ...omit(annotation, ['match', 'offset']),\n ...position,\n ...dimensions,\n size: annotation.size || dimensions.size,\n datum,\n } as Required<BoundAnnotation<Datum>>\n }),\n ]\n\n // return acc\n }, [])\n\nexport const getLinkAngle = (\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number\n) => {\n const angle = Math.atan2(targetY - sourceY, targetX - sourceX)\n\n return absoluteAngleDegrees(radiansToDegrees(angle))\n}\n\nexport const computeAnnotation = <Datum>(\n annotation: BoundAnnotation<Datum>\n): AnnotationInstructions => {\n const {\n x,\n y,\n noteX,\n noteY,\n noteWidth = defaultProps.noteWidth,\n noteTextOffset = defaultProps.noteTextOffset,\n } = annotation\n\n let computedNoteX: number\n let computedNoteY: number\n\n if (isNumber(noteX)) {\n computedNoteX = x + noteX\n } else if (noteX.abs !== undefined) {\n computedNoteX = noteX.abs\n } else {\n throw new Error(`noteX should be either a number or an object containing an 'abs' property`)\n }\n\n if (isNumber(noteY)) {\n computedNoteY = y + noteY\n } else if (noteY.abs !== undefined) {\n computedNoteY = noteY.abs\n } else {\n throw new Error(`noteY should be either a number or an object containing an 'abs' property`)\n }\n\n let computedX = x\n let computedY = y\n\n const angle = getLinkAngle(x, y, computedNoteX, computedNoteY)\n\n if (isCircleAnnotation<Datum>(annotation)) {\n const position = positionFromAngle(degreesToRadians(angle), annotation.size / 2)\n computedX += position.x\n computedY += position.y\n }\n\n if (isRectAnnotation<Datum>(annotation)) {\n const eighth = Math.round((angle + 90) / 45) % 8\n if (eighth === 0) {\n computedY -= annotation.height / 2\n }\n if (eighth === 1) {\n computedX += annotation.width / 2\n computedY -= annotation.height / 2\n }\n if (eighth === 2) {\n computedX += annotation.width / 2\n }\n if (eighth === 3) {\n computedX += annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 4) {\n computedY += annotation.height / 2\n }\n if (eighth === 5) {\n computedX -= annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 6) {\n computedX -= annotation.width / 2\n }\n if (eighth === 7) {\n computedX -= annotation.width / 2\n computedY -= annotation.height / 2\n }\n }\n\n let textX = computedNoteX\n const textY = computedNoteY - noteTextOffset\n\n let noteLineX = computedNoteX\n const noteLineY = computedNoteY\n\n if ((angle + 90) % 360 > 180) {\n textX -= noteWidth\n noteLineX -= noteWidth\n } else {\n noteLineX += noteWidth\n }\n\n return {\n points: [\n [computedX, computedY],\n [computedNoteX, computedNoteY],\n [noteLineX, noteLineY],\n ] as [number, number][],\n text: [textX, textY],\n angle: angle + 90,\n }\n}\n","import { useMemo } from 'react'\nimport { bindAnnotations, computeAnnotation } from './compute'\nimport {\n AnnotationDimensionsGetter,\n AnnotationMatcher,\n AnnotationPositionGetter,\n BoundAnnotation,\n} from './types'\n\n/**\n * Bind annotations to a dataset.\n */\nexport const useAnnotations = <Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}) =>\n useMemo(\n () =>\n bindAnnotations<Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n }),\n [data, annotations, getPosition, getDimensions]\n )\n\nexport const useComputedAnnotations = <Datum>({\n annotations,\n}: {\n annotations: readonly BoundAnnotation<Datum>[]\n}) =>\n useMemo(\n () =>\n annotations.map(annotation => ({\n ...annotation,\n computed: computeAnnotation<Datum>({\n ...annotation,\n }),\n })),\n [annotations]\n )\n\nexport const useComputedAnnotation = <Datum>(annotation: BoundAnnotation<Datum>) =>\n useMemo(() => computeAnnotation<Datum>(annotation), [annotation])\n","import { createElement } from 'react'\nimport omit from 'lodash/omit.js'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useTheme, useMotionConfig } from '@nivo/core'\nimport { NoteSvg } from './types'\n\nexport const AnnotationNote = <Datum,>({\n datum,\n x,\n y,\n note,\n}: {\n datum: Datum\n x: number\n y: number\n note: NoteSvg<Datum>\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n config: springConfig,\n immediate: !animate,\n })\n\n if (typeof note === 'function') {\n return createElement(note, { x, y, datum })\n }\n\n return (\n <>\n {theme.annotations.text.outlineWidth > 0 && (\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={{\n ...theme.annotations.text,\n strokeLinejoin: 'round',\n strokeWidth: theme.annotations.text.outlineWidth * 2,\n stroke: theme.annotations.text.outlineColor,\n }}\n >\n {note}\n </animated.text>\n )}\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={omit(theme.annotations.text, ['outlineWidth', 'outlineColor'])}\n >\n {note}\n </animated.text>\n </>\n )\n}\n","import { useMemo } from 'react'\nimport { animated } from '@react-spring/web'\nimport { useAnimatedPath, useTheme } from '@nivo/core'\n\nexport const AnnotationLink = ({\n points,\n isOutline = false,\n}: {\n points: [number, number][]\n isOutline?: boolean\n}) => {\n const theme = useTheme()\n\n const path = useMemo(() => {\n const [firstPoint, ...otherPoints] = points\n\n return otherPoints.reduce(\n (acc, [x, y]) => `${acc} L${x},${y}`,\n `M${firstPoint[0]},${firstPoint[1]}`\n )\n }, [points])\n\n const animatedPath = useAnimatedPath(path)\n\n if (isOutline && theme.annotations.link.outlineWidth <= 0) {\n return null\n }\n\n const style = { ...theme.annotations.link }\n if (isOutline) {\n style.strokeLinecap = 'square'\n style.strokeWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n style.stroke = theme.annotations.link.outlineColor\n style.opacity = theme.annotations.link.outlineOpacity\n }\n\n return <animated.path fill=\"none\" d={animatedPath} style={style} />\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const CircleAnnotationOutline = ({ x, y, size }: { x: number; y: number; size: number }) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\nimport { defaultProps } from './props'\n\nexport const DotAnnotationOutline = ({\n x,\n y,\n size = defaultProps.dotSize,\n}: {\n x: number\n y: number\n size?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth: theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.symbol}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const RectAnnotationOutline = ({\n x,\n y,\n width,\n height,\n borderRadius = 6,\n}: {\n x: number\n y: number\n width: number\n height: number\n borderRadius?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x: x - width / 2,\n y: y - height / 2,\n width,\n height,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { CompleteTheme } from '@nivo/core'\nimport { ComputedAnnotation } from './types'\nimport { isCanvasNote, isCircleAnnotation, isDotAnnotation, isRectAnnotation } from './utils'\n\nconst drawPoints = (ctx: CanvasRenderingContext2D, points: [number, number][]) => {\n points.forEach(([x, y], index) => {\n if (index === 0) {\n ctx.moveTo(x, y)\n } else {\n ctx.lineTo(x, y)\n }\n })\n}\n\nexport const renderAnnotationsToCanvas = <Datum>(\n ctx: CanvasRenderingContext2D,\n {\n annotations,\n theme,\n }: {\n annotations: ComputedAnnotation<Datum>[]\n theme: CompleteTheme\n }\n) => {\n if (annotations.length === 0) return\n\n ctx.save()\n annotations.forEach(annotation => {\n if (!isCanvasNote(annotation.note)) {\n throw new Error('note is invalid for canvas implementation')\n }\n\n if (theme.annotations.link.outlineWidth > 0) {\n ctx.lineCap = 'square'\n ctx.strokeStyle = theme.annotations.link.outlineColor\n ctx.lineWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n ctx.lineCap = 'butt'\n }\n\n if (isCircleAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation) && theme.annotations.symbol.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.symbol.outlineColor\n ctx.lineWidth = theme.annotations.symbol.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isRectAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n ctx.strokeStyle = theme.annotations.link.stroke\n ctx.lineWidth = theme.annotations.link.strokeWidth\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n\n if (isCircleAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation)) {\n ctx.fillStyle = theme.annotations.symbol.fill\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.fill()\n }\n\n if (isRectAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n if (typeof annotation.note === 'function') {\n annotation.note(ctx, {\n datum: annotation.datum,\n x: annotation.computed.text[0],\n y: annotation.computed.text[1],\n theme,\n })\n } else {\n ctx.font = `${theme.annotations.text.fontSize}px ${theme.annotations.text.fontFamily}`\n ctx.textAlign = 'left'\n ctx.textBaseline = 'alphabetic'\n\n ctx.fillStyle = theme.annotations.text.fill\n ctx.strokeStyle = theme.annotations.text.outlineColor\n ctx.lineWidth = theme.annotations.text.outlineWidth * 2\n\n if (theme.annotations.text.outlineWidth > 0) {\n ctx.lineJoin = 'round'\n ctx.strokeText(\n annotation.note,\n annotation.computed.text[0],\n annotation.computed.text[1]\n )\n ctx.lineJoin = 'miter'\n }\n ctx.fillText(annotation.note, annotation.computed.text[0], annotation.computed.text[1])\n }\n })\n ctx.restore()\n}\n","import { useComputedAnnotation } from './hooks'\nimport { AnnotationNote } from './AnnotationNote'\nimport { AnnotationLink } from './AnnotationLink'\nimport { CircleAnnotationOutline } from './CircleAnnotationOutline'\nimport { DotAnnotationOutline } from './DotAnnotationOutline'\nimport { RectAnnotationOutline } from './RectAnnotationOutline'\nimport { BoundAnnotation } from './types'\nimport { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils'\n\nexport const Annotation = <Datum,>(annotation: BoundAnnotation<Datum>) => {\n const { datum, x, y, note } = annotation\n const computed = useComputedAnnotation(annotation)\n\n if (!isSvgNote(note)) {\n throw new Error('note should be a valid react element')\n }\n\n return (\n <>\n <AnnotationLink points={computed.points} isOutline={true} />\n {isCircleAnnotation(annotation) && (\n <CircleAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isDotAnnotation(annotation) && (\n <DotAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isRectAnnotation(annotation) && (\n <RectAnnotationOutline\n x={x}\n y={y}\n width={annotation.width}\n height={annotation.height}\n borderRadius={annotation.borderRadius}\n />\n )}\n <AnnotationLink points={computed.points} />\n <AnnotationNote datum={datum} x={computed.text[0]} y={computed.text[1]} note={note} />\n </>\n )\n}\n"],"names":["defaultProps","dotSize","noteWidth","noteTextOffset","animate","isSvgNote","note","noteType","isValidElement","isCanvasNote","isCircleAnnotation","annotationSpec","type","isDotAnnotation","isRectAnnotation","bindAnnotations","_ref","data","annotations","getPosition","getDimensions","reduce","acc","annotation","offset","concat","filter","match","map","datum","position","dimensions","size","width","height","_extends","omit","getLinkAngle","sourceX","sourceY","targetX","targetY","angle","Math","atan2","absoluteAngleDegrees","radiansToDegrees","computeAnnotation","computedNoteX","computedNoteY","x","y","noteX","noteY","_annotation$noteWidth","_annotation$noteTextO","isNumber","undefined","abs","Error","computedX","computedY","positionFromAngle","degreesToRadians","eighth","round","textX","noteLineX","points","text","useComputedAnnotation","useMemo","AnnotationNote","theme","useTheme","_useMotionConfig","useMotionConfig","springConfig","config","animatedProps","useSpring","immediate","createElement","_jsxs","_Fragment","children","outlineWidth","_jsx","animated","style","strokeLinejoin","strokeWidth","stroke","outlineColor","AnnotationLink","_ref$isOutline","isOutline","path","firstPoint","slice","_ref2","animatedPath","useAnimatedPath","link","strokeLinecap","opacity","outlineOpacity","jsx","fill","d","CircleAnnotationOutline","radius","outline","circle","cx","cy","r","DotAnnotationOutline","_ref$size","symbol","RectAnnotationOutline","_ref$borderRadius","borderRadius","rect","rx","ry","drawPoints","ctx","forEach","index","moveTo","lineTo","computed","length","save","lineCap","strokeStyle","lineWidth","beginPath","arc","PI","fillStyle","font","fontSize","fontFamily","textAlign","textBaseline","lineJoin","strokeText","fillText","restore"],"mappings":"4aAAO,IAAMA,EAAe,CACxBC,QAAS,EACTC,UAAW,IACXC,eAAgB,EAChBC,SAAS,GCOA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AAUrE,EAAMvD,YAAYmD,KAAK0E,eAActE,EAAMvD,YAAYmD,KAAK2E,WAC1EjB,EAAIkB,UAAY,OAChBlB,EAAImB,aAAe,aAEnBnB,EAAIc,UAAYpE,EAAMvD,YAAYmD,KAAKuC,KACvCmB,EAAIS,YAAc/D,EAAMvD,YAAYmD,KAAKwB,aACzCkC,EAAIU,UAAkD,EAAtChE,EAAMvD,YAAYmD,KAAKiB,aAEnCb,EAAMvD,YAAYmD,KAAKiB,aAAe,IACtCyC,EAAIoB,SAAW,QACfpB,EAAIqB,WACA7H,EAAWjB,KACXiB,EAAW6G,SAAS/D,KAAK,GACzB9C,EAAW6G,SAAS/D,KAAK,IAE7B0D,EAAIoB,SAAW,SAEnBpB,EAAIsB,SAAS9H,EAAWjB,KAAMiB,EAAW6G,SAAS/D,KAAK,GAAI9C,EAAW6G,SAAS/D,KAAK,IAE5F,IACA0D,EAAIuB,UACR,yBN7H8B,SAAHtI,GAAA,IACvBC,EAAID,EAAJC,KACAC,EAAWF,EAAXE,YACAC,EAAWH,EAAXG,YACAC,EAAaJ,EAAbI,cAAa,OAObmD,EAAOA,SACH,WAAA,OACIxD,EAAuB,CACnBE,KAAAA,EACAC,YAAAA,EACAC,YAAAA,EACAC,cAAAA,GAER,GAAA,CAACH,EAAMC,EAAaC,EAAaC,GACpC,iEAEiC,SAAHgF,GAAA,IAC/BlF,EAAWkF,EAAXlF,YAAW,OAIXqD,EAAOA,SACH,WAAA,OACIrD,EAAYU,KAAI,SAAAL,GAAU,OAAAY,KACnBZ,EAAU,CACb6G,SAAUrF,EAAiBZ,EAAA,CAAA,EACpBZ,KACL,MAEV,CAACL,GACJ"} | ||
| {"version":3,"file":"nivo-annotations.cjs.js","sources":["../src/props.ts","../src/utils.ts","../src/compute.ts","../src/hooks.ts","../src/AnnotationNote.tsx","../src/AnnotationLink.tsx","../src/CircleAnnotationOutline.tsx","../src/DotAnnotationOutline.tsx","../src/RectAnnotationOutline.tsx","../src/canvas.ts","../src/Annotation.tsx"],"sourcesContent":["export const defaultProps = {\n dotSize: 4,\n noteWidth: 120,\n noteTextOffset: 8,\n animate: true,\n}\n","import {\n AnnotationSpec,\n CircleAnnotationSpec,\n DotAnnotationSpec,\n Note,\n NoteCanvas,\n NoteSvg,\n RectAnnotationSpec,\n} from './types'\nimport { isValidElement } from 'react'\n\nexport const isSvgNote = <Datum>(note: Note<Datum>): note is NoteSvg<Datum> => {\n const noteType = typeof note\n\n return (\n isValidElement(note) ||\n noteType === 'string' ||\n noteType === 'function' ||\n noteType === 'object'\n )\n}\n\nexport const isCanvasNote = <Datum>(note: Note<Datum>): note is NoteCanvas<Datum> => {\n const noteType = typeof note\n\n return noteType === 'string' || noteType === 'function'\n}\n\nexport const isCircleAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is CircleAnnotationSpec<Datum> => annotationSpec.type === 'circle'\n\nexport const isDotAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is DotAnnotationSpec<Datum> => annotationSpec.type === 'dot'\n\nexport const isRectAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is RectAnnotationSpec<Datum> => annotationSpec.type === 'rect'\n","import filter from 'lodash/filter.js'\nimport isNumber from 'lodash/isNumber.js'\nimport omit from 'lodash/omit.js'\nimport {\n radiansToDegrees,\n absoluteAngleDegrees,\n degreesToRadians,\n positionFromAngle,\n} from '@nivo/core'\nimport { defaultProps } from './props'\nimport {\n AnnotationPositionGetter,\n AnnotationDimensionsGetter,\n BoundAnnotation,\n AnnotationMatcher,\n AnnotationInstructions,\n} from './types'\nimport { isCircleAnnotation, isRectAnnotation } from './utils'\n\nexport const bindAnnotations = <\n Datum = {\n x: number\n y: number\n }\n>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}): BoundAnnotation<Datum>[] =>\n annotations.reduce((acc: BoundAnnotation<Datum>[], annotation) => {\n const offset = annotation.offset || 0\n\n return [\n ...acc,\n ...filter<Datum>(data, annotation.match).map(datum => {\n const position = getPosition(datum)\n const dimensions = getDimensions(datum)\n\n if (isCircleAnnotation(annotation) || isRectAnnotation(annotation)) {\n dimensions.size = dimensions.size + offset * 2\n dimensions.width = dimensions.width + offset * 2\n dimensions.height = dimensions.height + offset * 2\n }\n\n // acc.push({\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // } as any)\n // return [\n // ...acc,\n // {\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // },\n // ]\n return {\n ...omit(annotation, ['match', 'offset']),\n ...position,\n ...dimensions,\n size: annotation.size || dimensions.size,\n datum,\n } as Required<BoundAnnotation<Datum>>\n }),\n ]\n\n // return acc\n }, [])\n\nexport const getLinkAngle = (\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number\n) => {\n const angle = Math.atan2(targetY - sourceY, targetX - sourceX)\n\n return absoluteAngleDegrees(radiansToDegrees(angle))\n}\n\nexport const computeAnnotation = <Datum>(\n annotation: BoundAnnotation<Datum>\n): AnnotationInstructions => {\n const {\n x,\n y,\n noteX,\n noteY,\n noteWidth = defaultProps.noteWidth,\n noteTextOffset = defaultProps.noteTextOffset,\n } = annotation\n\n let computedNoteX: number\n let computedNoteY: number\n\n if (isNumber(noteX)) {\n computedNoteX = x + noteX\n } else if (noteX.abs !== undefined) {\n computedNoteX = noteX.abs\n } else {\n throw new Error(`noteX should be either a number or an object containing an 'abs' property`)\n }\n\n if (isNumber(noteY)) {\n computedNoteY = y + noteY\n } else if (noteY.abs !== undefined) {\n computedNoteY = noteY.abs\n } else {\n throw new Error(`noteY should be either a number or an object containing an 'abs' property`)\n }\n\n let computedX = x\n let computedY = y\n\n const angle = getLinkAngle(x, y, computedNoteX, computedNoteY)\n\n if (isCircleAnnotation<Datum>(annotation)) {\n const position = positionFromAngle(degreesToRadians(angle), annotation.size / 2)\n computedX += position.x\n computedY += position.y\n }\n\n if (isRectAnnotation<Datum>(annotation)) {\n const eighth = Math.round((angle + 90) / 45) % 8\n if (eighth === 0) {\n computedY -= annotation.height / 2\n }\n if (eighth === 1) {\n computedX += annotation.width / 2\n computedY -= annotation.height / 2\n }\n if (eighth === 2) {\n computedX += annotation.width / 2\n }\n if (eighth === 3) {\n computedX += annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 4) {\n computedY += annotation.height / 2\n }\n if (eighth === 5) {\n computedX -= annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 6) {\n computedX -= annotation.width / 2\n }\n if (eighth === 7) {\n computedX -= annotation.width / 2\n computedY -= annotation.height / 2\n }\n }\n\n let textX = computedNoteX\n const textY = computedNoteY - noteTextOffset\n\n let noteLineX = computedNoteX\n const noteLineY = computedNoteY\n\n if ((angle + 90) % 360 > 180) {\n textX -= noteWidth\n noteLineX -= noteWidth\n } else {\n noteLineX += noteWidth\n }\n\n return {\n points: [\n [computedX, computedY],\n [computedNoteX, computedNoteY],\n [noteLineX, noteLineY],\n ] as [number, number][],\n text: [textX, textY],\n angle: angle + 90,\n }\n}\n","import { useMemo } from 'react'\nimport { bindAnnotations, computeAnnotation } from './compute'\nimport {\n AnnotationDimensionsGetter,\n AnnotationMatcher,\n AnnotationPositionGetter,\n BoundAnnotation,\n} from './types'\n\n/**\n * Bind annotations to a dataset.\n */\nexport const useAnnotations = <Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}) =>\n useMemo(\n () =>\n bindAnnotations<Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n }),\n [data, annotations, getPosition, getDimensions]\n )\n\nexport const useComputedAnnotations = <Datum>({\n annotations,\n}: {\n annotations: readonly BoundAnnotation<Datum>[]\n}) =>\n useMemo(\n () =>\n annotations.map(annotation => ({\n ...annotation,\n computed: computeAnnotation<Datum>({\n ...annotation,\n }),\n })),\n [annotations]\n )\n\nexport const useComputedAnnotation = <Datum>(annotation: BoundAnnotation<Datum>) =>\n useMemo(() => computeAnnotation<Datum>(annotation), [annotation])\n","import { createElement } from 'react'\nimport omit from 'lodash/omit.js'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\nimport { NoteSvg } from './types'\n\nexport const AnnotationNote = <Datum,>({\n datum,\n x,\n y,\n note,\n}: {\n datum: Datum\n x: number\n y: number\n note: NoteSvg<Datum>\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n config: springConfig,\n immediate: !animate,\n })\n\n if (typeof note === 'function') {\n return createElement(note, { x, y, datum })\n }\n\n return (\n <>\n {theme.annotations.text.outlineWidth > 0 && (\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={{\n ...theme.annotations.text,\n strokeLinejoin: 'round',\n strokeWidth: theme.annotations.text.outlineWidth * 2,\n stroke: theme.annotations.text.outlineColor,\n }}\n >\n {note}\n </animated.text>\n )}\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={omit(theme.annotations.text, ['outlineWidth', 'outlineColor'])}\n >\n {note}\n </animated.text>\n </>\n )\n}\n","import { useMemo } from 'react'\nimport { animated } from '@react-spring/web'\nimport { useAnimatedPath } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const AnnotationLink = ({\n points,\n isOutline = false,\n}: {\n points: [number, number][]\n isOutline?: boolean\n}) => {\n const theme = useTheme()\n\n const path = useMemo(() => {\n const [firstPoint, ...otherPoints] = points\n\n return otherPoints.reduce(\n (acc, [x, y]) => `${acc} L${x},${y}`,\n `M${firstPoint[0]},${firstPoint[1]}`\n )\n }, [points])\n\n const animatedPath = useAnimatedPath(path)\n\n if (isOutline && theme.annotations.link.outlineWidth <= 0) {\n return null\n }\n\n const style = { ...theme.annotations.link }\n if (isOutline) {\n style.strokeLinecap = 'square'\n style.strokeWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n style.stroke = theme.annotations.link.outlineColor\n style.opacity = theme.annotations.link.outlineOpacity\n }\n\n return <animated.path fill=\"none\" d={animatedPath} style={style} />\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const CircleAnnotationOutline = ({ x, y, size }: { x: number; y: number; size: number }) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\nimport { defaultProps } from './props'\n\nexport const DotAnnotationOutline = ({\n x,\n y,\n size = defaultProps.dotSize,\n}: {\n x: number\n y: number\n size?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth: theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.symbol}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const RectAnnotationOutline = ({\n x,\n y,\n width,\n height,\n borderRadius = 6,\n}: {\n x: number\n y: number\n width: number\n height: number\n borderRadius?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x: x - width / 2,\n y: y - height / 2,\n width,\n height,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { Theme } from '@nivo/theming'\nimport { ComputedAnnotation } from './types'\nimport { isCanvasNote, isCircleAnnotation, isDotAnnotation, isRectAnnotation } from './utils'\n\nconst drawPoints = (ctx: CanvasRenderingContext2D, points: [number, number][]) => {\n points.forEach(([x, y], index) => {\n if (index === 0) {\n ctx.moveTo(x, y)\n } else {\n ctx.lineTo(x, y)\n }\n })\n}\n\nexport const renderAnnotationsToCanvas = <Datum>(\n ctx: CanvasRenderingContext2D,\n {\n annotations,\n theme,\n }: {\n annotations: ComputedAnnotation<Datum>[]\n theme: Theme\n }\n) => {\n if (annotations.length === 0) return\n\n ctx.save()\n annotations.forEach(annotation => {\n if (!isCanvasNote(annotation.note)) {\n throw new Error('note is invalid for canvas implementation')\n }\n\n if (theme.annotations.link.outlineWidth > 0) {\n ctx.lineCap = 'square'\n ctx.strokeStyle = theme.annotations.link.outlineColor\n ctx.lineWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n ctx.lineCap = 'butt'\n }\n\n if (isCircleAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation) && theme.annotations.symbol.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.symbol.outlineColor\n ctx.lineWidth = theme.annotations.symbol.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isRectAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n ctx.strokeStyle = theme.annotations.link.stroke\n ctx.lineWidth = theme.annotations.link.strokeWidth\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n\n if (isCircleAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation)) {\n ctx.fillStyle = theme.annotations.symbol.fill\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.fill()\n }\n\n if (isRectAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n if (typeof annotation.note === 'function') {\n annotation.note(ctx, {\n datum: annotation.datum,\n x: annotation.computed.text[0],\n y: annotation.computed.text[1],\n theme,\n })\n } else {\n ctx.font = `${theme.annotations.text.fontSize}px ${theme.annotations.text.fontFamily}`\n ctx.textAlign = 'left'\n ctx.textBaseline = 'alphabetic'\n\n ctx.fillStyle = theme.annotations.text.fill\n ctx.strokeStyle = theme.annotations.text.outlineColor\n ctx.lineWidth = theme.annotations.text.outlineWidth * 2\n\n if (theme.annotations.text.outlineWidth > 0) {\n ctx.lineJoin = 'round'\n ctx.strokeText(\n annotation.note,\n annotation.computed.text[0],\n annotation.computed.text[1]\n )\n ctx.lineJoin = 'miter'\n }\n ctx.fillText(annotation.note, annotation.computed.text[0], annotation.computed.text[1])\n }\n })\n ctx.restore()\n}\n","import { useComputedAnnotation } from './hooks'\nimport { AnnotationNote } from './AnnotationNote'\nimport { AnnotationLink } from './AnnotationLink'\nimport { CircleAnnotationOutline } from './CircleAnnotationOutline'\nimport { DotAnnotationOutline } from './DotAnnotationOutline'\nimport { RectAnnotationOutline } from './RectAnnotationOutline'\nimport { BoundAnnotation } from './types'\nimport { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils'\n\nexport const Annotation = <Datum,>(annotation: BoundAnnotation<Datum>) => {\n const { datum, x, y, note } = annotation\n const computed = useComputedAnnotation(annotation)\n\n if (!isSvgNote(note)) {\n throw new Error('note should be a valid react element')\n }\n\n return (\n <>\n <AnnotationLink points={computed.points} isOutline={true} />\n {isCircleAnnotation(annotation) && (\n <CircleAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isDotAnnotation(annotation) && (\n <DotAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isRectAnnotation(annotation) && (\n <RectAnnotationOutline\n x={x}\n y={y}\n width={annotation.width}\n height={annotation.height}\n borderRadius={annotation.borderRadius}\n />\n )}\n <AnnotationLink points={computed.points} />\n <AnnotationNote datum={datum} x={computed.text[0]} y={computed.text[1]} note={note} />\n </>\n )\n}\n"],"names":["defaultProps","dotSize","noteWidth","noteTextOffset","animate","isSvgNote","note","noteType","isValidElement","isCanvasNote","isCircleAnnotation","annotationSpec","type","isDotAnnotation","isRectAnnotation","bindAnnotations","_ref","data","annotations","getPosition","getDimensions","reduce","acc","annotation","offset","concat","filter","match","map","datum","position","dimensions","size","width","height","_extends","omit","getLinkAngle","sourceX","sourceY","targetX","targetY","angle","Math","atan2","absoluteAngleDegrees","radiansToDegrees","computeAnnotation","computedNoteX","computedNoteY","x","y","noteX","noteY","_annotation$noteWidth","_annotation$noteTextO","isNumber","undefined","abs","Error","computedX","computedY","positionFromAngle","degreesToRadians","eighth","round","textX","noteLineX","points","text","useComputedAnnotation","useMemo","AnnotationNote","theme","useTheme","_useMotionConfig","useMotionConfig","springConfig","config","animatedProps","useSpring","immediate","createElement","_jsxs","_Fragment","children","outlineWidth","_jsx","animated","style","strokeLinejoin","strokeWidth","stroke","outlineColor","AnnotationLink","_ref$isOutline","isOutline","path","firstPoint","slice","_ref2","animatedPath","useAnimatedPath","link","strokeLinecap","opacity","outlineOpacity","jsx","fill","d","CircleAnnotationOutline","radius","outline","circle","cx","cy","r","DotAnnotationOutline","_ref$size","symbol","RectAnnotationOutline","_ref$borderRadius","borderRadius","rect","rx","ry","drawPoints","ctx","forEach","index","moveTo","lineTo","computed","length","save","lineCap","strokeStyle","lineWidth","beginPath","arc","PI","fillStyle","font","fontSize","fontFamily","textAlign","textBaseline","lineJoin","strokeText","fillText","restore"],"mappings":"ucAAO,IAAMA,EAAe,CACxBC,QAAS,EACTC,UAAW,IACXC,eAAgB,EAChBC,SAAS,GCOAC,EAAY,SAAQC,GAC7B,IAAMC,SAAkBD,EAExB,OACIE,EAAcA,eAACF,IACF,WAAbC,GACa,aAAbA,GACa,WAAbA,CAER,EAEaE,EAAe,SAAQH,GAChC,IAAMC,SAAkBD,EAExB,MAAoB,WAAbC,GAAsC,aAAbA,CACpC,EAEaG,EAAqB,SAC9BC,GAAqC,MACmC,WAAxBA,EAAeC,IAAiB,EAEvEC,EAAkB,SAC3BF,GAAqC,MACgC,QAAxBA,EAAeC,IAAc,EAEjEE,EAAmB,SAC5BH,GAAqC,MACiC,SAAxBA,EAAeC,IAAe,ECnBnEG,EAAkB,SAAHC,GAAA,IAMxBC,EAAID,EAAJC,KACAC,EAAWF,EAAXE,YACAC,EAAWH,EAAXG,YACAC,EAAaJ,EAAbI,cAAa,OAObF,EAAYG,QAAO,SAACC,EAA+BC,GAC/C,IAAMC,EAASD,EAAWC,QAAU,EAEpC,MAAA,GAAAC,OACOH,EACAI,EAAcT,EAAMM,EAAWI,OAAOC,KAAI,SAAAC,GACzC,IAAMC,EAAWX,EAAYU,GACvBE,EAAaX,EAAcS,GAyBjC,OAvBInB,EAAmBa,IAAeT,EAAiBS,MACnDQ,EAAWC,KAAOD,EAAWC,KAAgB,EAATR,EACpCO,EAAWE,MAAQF,EAAWE,MAAiB,EAATT,EACtCO,EAAWG,OAASH,EAAWG,OAAkB,EAATV,GAoB5CW,EAAA,GACOC,EAAKb,EAAY,CAAC,QAAS,WAC3BO,EACAC,EAAU,CACbC,KAA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AI,SAAAL,GAAU,OAAAY,KACnBZ,EAAU,CACb6G,SAAUrF,EAAiBZ,EAAA,CAAA,EACpBZ,KACL,MAEV,CAACL,GACJ"} |
@@ -1,2 +0,2 @@ | ||
| import{isValidElement as t,useMemo as n,createElement as i}from"react";import o from"lodash/filter.js";import e from"lodash/isNumber.js";import a from"lodash/omit.js";import{absoluteAngleDegrees as r,radiansToDegrees as s,positionFromAngle as l,degreesToRadians as u,useTheme as h,useMotionConfig as d,useAnimatedPath as c}from"@nivo/core";import{useSpring as f,animated as y}from"@react-spring/web";import{jsxs as x,Fragment as m,jsx as p}from"react/jsx-runtime";function g(){return g=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var o in i)({}).hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},g.apply(null,arguments)}var k={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},W=function(n){var i=typeof n;return t(n)||"string"===i||"function"===i||"object"===i},v=function(t){var n=typeof t;return"string"===n||"function"===n},b=function(t){return"circle"===t.type},w=function(t){return"dot"===t.type},z=function(t){return"rect"===t.type},P=function(t){var n=t.data,i=t.annotations,e=t.getPosition,r=t.getDimensions;return i.reduce((function(t,i){var s=i.offset||0;return[].concat(t,o(n,i.match).map((function(t){var n=e(t),o=r(t);return(b(i)||z(i))&&(o.size=o.size+2*s,o.width=o.width+2*s,o.height=o.height+2*s),g({},a(i,["match","offset"]),n,o,{size:i.size||o.size,datum:t})})))}),[])},C=function(t,n,i,o){var e=Math.atan2(o-n,i-t);return r(s(e))},S=function(t){var n,i,o=t.x,a=t.y,r=t.noteX,s=t.noteY,h=t.noteWidth,d=void 0===h?k.noteWidth:h,c=t.noteTextOffset,f=void 0===c?k.noteTextOffset:c;if(e(r))n=o+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(s))i=a+s;else{if(void 0===s.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=s.abs}var y=o,x=a,m=C(o,a,n,i);if(b(t)){var p=l(u(m),t.size/2);y+=p.x,x+=p.y}if(z(t)){var g=Math.round((m+90)/45)%8;0===g&&(x-=t.height/2),1===g&&(y+=t.width/2,x-=t.height/2),2===g&&(y+=t.width/2),3===g&&(y+=t.width/2,x+=t.height/2),4===g&&(x+=t.height/2),5===g&&(y-=t.width/2,x+=t.height/2),6===g&&(y-=t.width/2),7===g&&(y-=t.width/2,x-=t.height/2)}var W=n,v=n;return(m+90)%360>180?(W-=d,v-=d):v+=d,{points:[[y,x],[n,i],[v,i]],text:[W,i-f],angle:m+90}},O=function(t){var i=t.data,o=t.annotations,e=t.getPosition,a=t.getDimensions;return n((function(){return P({data:i,annotations:o,getPosition:e,getDimensions:a})}),[i,o,e,a])},j=function(t){var i=t.annotations;return n((function(){return i.map((function(t){return g({},t,{computed:S(g({},t))})}))}),[i])},M=function(t){return n((function(){return S(t)}),[t])},T=function(t){var n=t.datum,o=t.x,e=t.y,r=t.note,s=h(),l=d(),u=l.animate,c=l.config,k=f({x:o,y:e,config:c,immediate:!u});return"function"==typeof r?i(r,{x:o,y:e,datum:n}):x(m,{children:[s.annotations.text.outlineWidth>0&&p(y.text,{x:k.x,y:k.y,style:g({},s.annotations.text,{strokeLinejoin:"round",strokeWidth:2*s.annotations.text.outlineWidth,stroke:s.annotations.text.outlineColor}),children:r}),p(y.text,{x:k.x,y:k.y,style:a(s.annotations.text,["outlineWidth","outlineColor"]),children:r})]})},E=function(t){var i=t.points,o=t.isOutline,e=void 0!==o&&o,a=h(),r=n((function(){var t=i[0];return i.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[i]),s=c(r);if(e&&a.annotations.link.outlineWidth<=0)return null;var l=g({},a.annotations.link);return e&&(l.strokeLinecap="square",l.strokeWidth=a.annotations.link.strokeWidth+2*a.annotations.link.outlineWidth,l.stroke=a.annotations.link.outlineColor,l.opacity=a.annotations.link.outlineOpacity),p(y.path,{fill:"none",d:s,style:l})},I=function(t){var n=t.x,i=t.y,o=t.size,e=h(),a=d(),r=a.animate,s=a.config,l=f({x:n,y:i,radius:o/2,config:s,immediate:!r});return x(m,{children:[e.annotations.outline.outlineWidth>0&&p(y.circle,{cx:l.x,cy:l.y,r:l.radius,style:g({},e.annotations.outline,{fill:"none",strokeWidth:e.annotations.outline.strokeWidth+2*e.annotations.outline.outlineWidth,stroke:e.annotations.outline.outlineColor,opacity:e.annotations.outline.outlineOpacity})}),p(y.circle,{cx:l.x,cy:l.y,r:l.radius,style:e.annotations.outline})]})},D=function(t){var n=t.x,i=t.y,o=t.size,e=void 0===o?k.dotSize:o,a=h(),r=d(),s=r.animate,l=r.config,u=f({x:n,y:i,radius:e/2,config:l,immediate:!s});return x(m,{children:[a.annotations.outline.outlineWidth>0&&p(y.circle,{cx:u.x,cy:u.y,r:u.radius,style:g({},a.annotations.outline,{fill:"none",strokeWidth:2*a.annotations.outline.outlineWidth,stroke:a.annotations.outline.outlineColor,opacity:a.annotations.outline.outlineOpacity})}),p(y.circle,{cx:u.x,cy:u.y,r:u.radius,style:a.annotations.symbol})]})},L=function(t){var n=t.x,i=t.y,o=t.width,e=t.height,a=t.borderRadius,r=void 0===a?6:a,s=h(),l=d(),u=l.animate,c=l.config,k=f({x:n-o/2,y:i-e/2,width:o,height:e,config:c,immediate:!u});return x(m,{children:[s.annotations.outline.outlineWidth>0&&p(y.rect,{x:k.x,y:k.y,rx:r,ry:r,width:k.width,height:k.height,style:g({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),p(y.rect,{x:k.x,y:k.y,rx:r,ry:r,width:k.width,height:k.height,style:s.annotations.outline})]})},R=function(t){var n=t.datum,i=t.x,o=t.y,e=t.note,a=M(t);if(!W(e))throw new Error("note should be a valid react element");return x(m,{children:[p(E,{points:a.points,isOutline:!0}),b(t)&&p(I,{x:i,y:o,size:t.size}),w(t)&&p(D,{x:i,y:o,size:t.size}),z(t)&&p(L,{x:i,y:o,width:t.width,height:t.height,borderRadius:t.borderRadius}),p(E,{points:a.points}),p(T,{datum:n,x:a.text[0],y:a.text[1],note:e})]})},q=function(t,n){n.forEach((function(n,i){var o=n[0],e=n[1];0===i?t.moveTo(o,e):t.lineTo(o,e)}))},J=function(t,n){var i=n.annotations,o=n.theme;0!==i.length&&(t.save(),i.forEach((function(n){if(!v(n.note))throw new Error("note is invalid for canvas implementation");o.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=o.annotations.link.outlineColor,t.lineWidth=o.annotations.link.strokeWidth+2*o.annotations.link.outlineWidth,t.beginPath(),q(t,n.computed.points),t.stroke(),t.lineCap="butt"),b(n)&&o.annotations.outline.outlineWidth>0&&(t.strokeStyle=o.annotations.outline.outlineColor,t.lineWidth=o.annotations.outline.strokeWidth+2*o.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),w(n)&&o.annotations.symbol.outlineWidth>0&&(t.strokeStyle=o.annotations.symbol.outlineColor,t.lineWidth=2*o.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),z(n)&&o.annotations.outline.outlineWidth>0&&(t.strokeStyle=o.annotations.outline.outlineColor,t.lineWidth=o.annotations.outline.strokeWidth+2*o.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=o.annotations.link.stroke,t.lineWidth=o.annotations.link.strokeWidth,t.beginPath(),q(t,n.computed.points),t.stroke(),b(n)&&(t.strokeStyle=o.annotations.outline.stroke,t.lineWidth=o.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),w(n)&&(t.fillStyle=o.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),z(n)&&(t.strokeStyle=o.annotations.outline.stroke,t.lineWidth=o.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:o}):(t.font=o.annotations.text.fontSize+"px "+o.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=o.annotations.text.fill,t.strokeStyle=o.annotations.text.outlineColor,t.lineWidth=2*o.annotations.text.outlineWidth,o.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())};export{R as Annotation,P as bindAnnotations,S as computeAnnotation,k as defaultProps,C as getLinkAngle,v as isCanvasNote,b as isCircleAnnotation,w as isDotAnnotation,z as isRectAnnotation,W as isSvgNote,J as renderAnnotationsToCanvas,O as useAnnotations,M as useComputedAnnotation,j as useComputedAnnotations}; | ||
| import{isValidElement as t,useMemo as n,createElement as i}from"react";import o from"lodash/filter.js";import e from"lodash/isNumber.js";import a from"lodash/omit.js";import{absoluteAngleDegrees as r,radiansToDegrees as s,positionFromAngle as l,degreesToRadians as u,useMotionConfig as h,useAnimatedPath as d}from"@nivo/core";import{useSpring as c,animated as f}from"@react-spring/web";import{useTheme as y}from"@nivo/theming";import{jsxs as x,Fragment as m,jsx as p}from"react/jsx-runtime";function g(){return g=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var o in i)({}).hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},g.apply(null,arguments)}var k={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},W=function(n){var i=typeof n;return t(n)||"string"===i||"function"===i||"object"===i},v=function(t){var n=typeof t;return"string"===n||"function"===n},b=function(t){return"circle"===t.type},w=function(t){return"dot"===t.type},z=function(t){return"rect"===t.type},P=function(t){var n=t.data,i=t.annotations,e=t.getPosition,r=t.getDimensions;return i.reduce((function(t,i){var s=i.offset||0;return[].concat(t,o(n,i.match).map((function(t){var n=e(t),o=r(t);return(b(i)||z(i))&&(o.size=o.size+2*s,o.width=o.width+2*s,o.height=o.height+2*s),g({},a(i,["match","offset"]),n,o,{size:i.size||o.size,datum:t})})))}),[])},C=function(t,n,i,o){var e=Math.atan2(o-n,i-t);return r(s(e))},S=function(t){var n,i,o=t.x,a=t.y,r=t.noteX,s=t.noteY,h=t.noteWidth,d=void 0===h?k.noteWidth:h,c=t.noteTextOffset,f=void 0===c?k.noteTextOffset:c;if(e(r))n=o+r;else{if(void 0===r.abs)throw new Error("noteX should be either a number or an object containing an 'abs' property");n=r.abs}if(e(s))i=a+s;else{if(void 0===s.abs)throw new Error("noteY should be either a number or an object containing an 'abs' property");i=s.abs}var y=o,x=a,m=C(o,a,n,i);if(b(t)){var p=l(u(m),t.size/2);y+=p.x,x+=p.y}if(z(t)){var g=Math.round((m+90)/45)%8;0===g&&(x-=t.height/2),1===g&&(y+=t.width/2,x-=t.height/2),2===g&&(y+=t.width/2),3===g&&(y+=t.width/2,x+=t.height/2),4===g&&(x+=t.height/2),5===g&&(y-=t.width/2,x+=t.height/2),6===g&&(y-=t.width/2),7===g&&(y-=t.width/2,x-=t.height/2)}var W=n,v=n;return(m+90)%360>180?(W-=d,v-=d):v+=d,{points:[[y,x],[n,i],[v,i]],text:[W,i-f],angle:m+90}},O=function(t){var i=t.data,o=t.annotations,e=t.getPosition,a=t.getDimensions;return n((function(){return P({data:i,annotations:o,getPosition:e,getDimensions:a})}),[i,o,e,a])},j=function(t){var i=t.annotations;return n((function(){return i.map((function(t){return g({},t,{computed:S(g({},t))})}))}),[i])},M=function(t){return n((function(){return S(t)}),[t])},T=function(t){var n=t.datum,o=t.x,e=t.y,r=t.note,s=y(),l=h(),u=l.animate,d=l.config,k=c({x:o,y:e,config:d,immediate:!u});return"function"==typeof r?i(r,{x:o,y:e,datum:n}):x(m,{children:[s.annotations.text.outlineWidth>0&&p(f.text,{x:k.x,y:k.y,style:g({},s.annotations.text,{strokeLinejoin:"round",strokeWidth:2*s.annotations.text.outlineWidth,stroke:s.annotations.text.outlineColor}),children:r}),p(f.text,{x:k.x,y:k.y,style:a(s.annotations.text,["outlineWidth","outlineColor"]),children:r})]})},E=function(t){var i=t.points,o=t.isOutline,e=void 0!==o&&o,a=y(),r=n((function(){var t=i[0];return i.slice(1).reduce((function(t,n){return t+" L"+n[0]+","+n[1]}),"M"+t[0]+","+t[1])}),[i]),s=d(r);if(e&&a.annotations.link.outlineWidth<=0)return null;var l=g({},a.annotations.link);return e&&(l.strokeLinecap="square",l.strokeWidth=a.annotations.link.strokeWidth+2*a.annotations.link.outlineWidth,l.stroke=a.annotations.link.outlineColor,l.opacity=a.annotations.link.outlineOpacity),p(f.path,{fill:"none",d:s,style:l})},I=function(t){var n=t.x,i=t.y,o=t.size,e=y(),a=h(),r=a.animate,s=a.config,l=c({x:n,y:i,radius:o/2,config:s,immediate:!r});return x(m,{children:[e.annotations.outline.outlineWidth>0&&p(f.circle,{cx:l.x,cy:l.y,r:l.radius,style:g({},e.annotations.outline,{fill:"none",strokeWidth:e.annotations.outline.strokeWidth+2*e.annotations.outline.outlineWidth,stroke:e.annotations.outline.outlineColor,opacity:e.annotations.outline.outlineOpacity})}),p(f.circle,{cx:l.x,cy:l.y,r:l.radius,style:e.annotations.outline})]})},D=function(t){var n=t.x,i=t.y,o=t.size,e=void 0===o?k.dotSize:o,a=y(),r=h(),s=r.animate,l=r.config,u=c({x:n,y:i,radius:e/2,config:l,immediate:!s});return x(m,{children:[a.annotations.outline.outlineWidth>0&&p(f.circle,{cx:u.x,cy:u.y,r:u.radius,style:g({},a.annotations.outline,{fill:"none",strokeWidth:2*a.annotations.outline.outlineWidth,stroke:a.annotations.outline.outlineColor,opacity:a.annotations.outline.outlineOpacity})}),p(f.circle,{cx:u.x,cy:u.y,r:u.radius,style:a.annotations.symbol})]})},L=function(t){var n=t.x,i=t.y,o=t.width,e=t.height,a=t.borderRadius,r=void 0===a?6:a,s=y(),l=h(),u=l.animate,d=l.config,k=c({x:n-o/2,y:i-e/2,width:o,height:e,config:d,immediate:!u});return x(m,{children:[s.annotations.outline.outlineWidth>0&&p(f.rect,{x:k.x,y:k.y,rx:r,ry:r,width:k.width,height:k.height,style:g({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),p(f.rect,{x:k.x,y:k.y,rx:r,ry:r,width:k.width,height:k.height,style:s.annotations.outline})]})},R=function(t){var n=t.datum,i=t.x,o=t.y,e=t.note,a=M(t);if(!W(e))throw new Error("note should be a valid react element");return x(m,{children:[p(E,{points:a.points,isOutline:!0}),b(t)&&p(I,{x:i,y:o,size:t.size}),w(t)&&p(D,{x:i,y:o,size:t.size}),z(t)&&p(L,{x:i,y:o,width:t.width,height:t.height,borderRadius:t.borderRadius}),p(E,{points:a.points}),p(T,{datum:n,x:a.text[0],y:a.text[1],note:e})]})},q=function(t,n){n.forEach((function(n,i){var o=n[0],e=n[1];0===i?t.moveTo(o,e):t.lineTo(o,e)}))},J=function(t,n){var i=n.annotations,o=n.theme;0!==i.length&&(t.save(),i.forEach((function(n){if(!v(n.note))throw new Error("note is invalid for canvas implementation");o.annotations.link.outlineWidth>0&&(t.lineCap="square",t.strokeStyle=o.annotations.link.outlineColor,t.lineWidth=o.annotations.link.strokeWidth+2*o.annotations.link.outlineWidth,t.beginPath(),q(t,n.computed.points),t.stroke(),t.lineCap="butt"),b(n)&&o.annotations.outline.outlineWidth>0&&(t.strokeStyle=o.annotations.outline.outlineColor,t.lineWidth=o.annotations.outline.strokeWidth+2*o.annotations.outline.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),w(n)&&o.annotations.symbol.outlineWidth>0&&(t.strokeStyle=o.annotations.symbol.outlineColor,t.lineWidth=2*o.annotations.symbol.outlineWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),z(n)&&o.annotations.outline.outlineWidth>0&&(t.strokeStyle=o.annotations.outline.outlineColor,t.lineWidth=o.annotations.outline.strokeWidth+2*o.annotations.outline.outlineWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),t.strokeStyle=o.annotations.link.stroke,t.lineWidth=o.annotations.link.strokeWidth,t.beginPath(),q(t,n.computed.points),t.stroke(),b(n)&&(t.strokeStyle=o.annotations.outline.stroke,t.lineWidth=o.annotations.outline.strokeWidth,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.stroke()),w(n)&&(t.fillStyle=o.annotations.symbol.fill,t.beginPath(),t.arc(n.x,n.y,n.size/2,0,2*Math.PI),t.fill()),z(n)&&(t.strokeStyle=o.annotations.outline.stroke,t.lineWidth=o.annotations.outline.strokeWidth,t.beginPath(),t.rect(n.x-n.width/2,n.y-n.height/2,n.width,n.height),t.stroke()),"function"==typeof n.note?n.note(t,{datum:n.datum,x:n.computed.text[0],y:n.computed.text[1],theme:o}):(t.font=o.annotations.text.fontSize+"px "+o.annotations.text.fontFamily,t.textAlign="left",t.textBaseline="alphabetic",t.fillStyle=o.annotations.text.fill,t.strokeStyle=o.annotations.text.outlineColor,t.lineWidth=2*o.annotations.text.outlineWidth,o.annotations.text.outlineWidth>0&&(t.lineJoin="round",t.strokeText(n.note,n.computed.text[0],n.computed.text[1]),t.lineJoin="miter"),t.fillText(n.note,n.computed.text[0],n.computed.text[1]))})),t.restore())};export{R as Annotation,P as bindAnnotations,S as computeAnnotation,k as defaultProps,C as getLinkAngle,v as isCanvasNote,b as isCircleAnnotation,w as isDotAnnotation,z as isRectAnnotation,W as isSvgNote,J as renderAnnotationsToCanvas,O as useAnnotations,M as useComputedAnnotation,j as useComputedAnnotations}; | ||
| //# sourceMappingURL=nivo-annotations.mjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"nivo-annotations.mjs","sources":["../src/props.ts","../src/utils.ts","../src/compute.ts","../src/hooks.ts","../src/AnnotationNote.tsx","../src/AnnotationLink.tsx","../src/CircleAnnotationOutline.tsx","../src/DotAnnotationOutline.tsx","../src/RectAnnotationOutline.tsx","../src/Annotation.tsx","../src/canvas.ts"],"sourcesContent":["export const defaultProps = {\n dotSize: 4,\n noteWidth: 120,\n noteTextOffset: 8,\n animate: true,\n}\n","import {\n AnnotationSpec,\n CircleAnnotationSpec,\n DotAnnotationSpec,\n Note,\n NoteCanvas,\n NoteSvg,\n RectAnnotationSpec,\n} from './types'\nimport { isValidElement } from 'react'\n\nexport const isSvgNote = <Datum>(note: Note<Datum>): note is NoteSvg<Datum> => {\n const noteType = typeof note\n\n return (\n isValidElement(note) ||\n noteType === 'string' ||\n noteType === 'function' ||\n noteType === 'object'\n )\n}\n\nexport const isCanvasNote = <Datum>(note: Note<Datum>): note is NoteCanvas<Datum> => {\n const noteType = typeof note\n\n return noteType === 'string' || noteType === 'function'\n}\n\nexport const isCircleAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is CircleAnnotationSpec<Datum> => annotationSpec.type === 'circle'\n\nexport const isDotAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is DotAnnotationSpec<Datum> => annotationSpec.type === 'dot'\n\nexport const isRectAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is RectAnnotationSpec<Datum> => annotationSpec.type === 'rect'\n","import filter from 'lodash/filter.js'\nimport isNumber from 'lodash/isNumber.js'\nimport omit from 'lodash/omit.js'\nimport {\n radiansToDegrees,\n absoluteAngleDegrees,\n degreesToRadians,\n positionFromAngle,\n} from '@nivo/core'\nimport { defaultProps } from './props'\nimport {\n AnnotationPositionGetter,\n AnnotationDimensionsGetter,\n BoundAnnotation,\n AnnotationMatcher,\n AnnotationInstructions,\n} from './types'\nimport { isCircleAnnotation, isRectAnnotation } from './utils'\n\nexport const bindAnnotations = <\n Datum = {\n x: number\n y: number\n }\n>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}): BoundAnnotation<Datum>[] =>\n annotations.reduce((acc: BoundAnnotation<Datum>[], annotation) => {\n const offset = annotation.offset || 0\n\n return [\n ...acc,\n ...filter<Datum>(data, annotation.match).map(datum => {\n const position = getPosition(datum)\n const dimensions = getDimensions(datum)\n\n if (isCircleAnnotation(annotation) || isRectAnnotation(annotation)) {\n dimensions.size = dimensions.size + offset * 2\n dimensions.width = dimensions.width + offset * 2\n dimensions.height = dimensions.height + offset * 2\n }\n\n // acc.push({\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // } as any)\n // return [\n // ...acc,\n // {\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // },\n // ]\n return {\n ...omit(annotation, ['match', 'offset']),\n ...position,\n ...dimensions,\n size: annotation.size || dimensions.size,\n datum,\n } as Required<BoundAnnotation<Datum>>\n }),\n ]\n\n // return acc\n }, [])\n\nexport const getLinkAngle = (\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number\n) => {\n const angle = Math.atan2(targetY - sourceY, targetX - sourceX)\n\n return absoluteAngleDegrees(radiansToDegrees(angle))\n}\n\nexport const computeAnnotation = <Datum>(\n annotation: BoundAnnotation<Datum>\n): AnnotationInstructions => {\n const {\n x,\n y,\n noteX,\n noteY,\n noteWidth = defaultProps.noteWidth,\n noteTextOffset = defaultProps.noteTextOffset,\n } = annotation\n\n let computedNoteX: number\n let computedNoteY: number\n\n if (isNumber(noteX)) {\n computedNoteX = x + noteX\n } else if (noteX.abs !== undefined) {\n computedNoteX = noteX.abs\n } else {\n throw new Error(`noteX should be either a number or an object containing an 'abs' property`)\n }\n\n if (isNumber(noteY)) {\n computedNoteY = y + noteY\n } else if (noteY.abs !== undefined) {\n computedNoteY = noteY.abs\n } else {\n throw new Error(`noteY should be either a number or an object containing an 'abs' property`)\n }\n\n let computedX = x\n let computedY = y\n\n const angle = getLinkAngle(x, y, computedNoteX, computedNoteY)\n\n if (isCircleAnnotation<Datum>(annotation)) {\n const position = positionFromAngle(degreesToRadians(angle), annotation.size / 2)\n computedX += position.x\n computedY += position.y\n }\n\n if (isRectAnnotation<Datum>(annotation)) {\n const eighth = Math.round((angle + 90) / 45) % 8\n if (eighth === 0) {\n computedY -= annotation.height / 2\n }\n if (eighth === 1) {\n computedX += annotation.width / 2\n computedY -= annotation.height / 2\n }\n if (eighth === 2) {\n computedX += annotation.width / 2\n }\n if (eighth === 3) {\n computedX += annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 4) {\n computedY += annotation.height / 2\n }\n if (eighth === 5) {\n computedX -= annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 6) {\n computedX -= annotation.width / 2\n }\n if (eighth === 7) {\n computedX -= annotation.width / 2\n computedY -= annotation.height / 2\n }\n }\n\n let textX = computedNoteX\n const textY = computedNoteY - noteTextOffset\n\n let noteLineX = computedNoteX\n const noteLineY = computedNoteY\n\n if ((angle + 90) % 360 > 180) {\n textX -= noteWidth\n noteLineX -= noteWidth\n } else {\n noteLineX += noteWidth\n }\n\n return {\n points: [\n [computedX, computedY],\n [computedNoteX, computedNoteY],\n [noteLineX, noteLineY],\n ] as [number, number][],\n text: [textX, textY],\n angle: angle + 90,\n }\n}\n","import { useMemo } from 'react'\nimport { bindAnnotations, computeAnnotation } from './compute'\nimport {\n AnnotationDimensionsGetter,\n AnnotationMatcher,\n AnnotationPositionGetter,\n BoundAnnotation,\n} from './types'\n\n/**\n * Bind annotations to a dataset.\n */\nexport const useAnnotations = <Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}) =>\n useMemo(\n () =>\n bindAnnotations<Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n }),\n [data, annotations, getPosition, getDimensions]\n )\n\nexport const useComputedAnnotations = <Datum>({\n annotations,\n}: {\n annotations: readonly BoundAnnotation<Datum>[]\n}) =>\n useMemo(\n () =>\n annotations.map(annotation => ({\n ...annotation,\n computed: computeAnnotation<Datum>({\n ...annotation,\n }),\n })),\n [annotations]\n )\n\nexport const useComputedAnnotation = <Datum>(annotation: BoundAnnotation<Datum>) =>\n useMemo(() => computeAnnotation<Datum>(annotation), [annotation])\n","import { createElement } from 'react'\nimport omit from 'lodash/omit.js'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useTheme, useMotionConfig } from '@nivo/core'\nimport { NoteSvg } from './types'\n\nexport const AnnotationNote = <Datum,>({\n datum,\n x,\n y,\n note,\n}: {\n datum: Datum\n x: number\n y: number\n note: NoteSvg<Datum>\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n config: springConfig,\n immediate: !animate,\n })\n\n if (typeof note === 'function') {\n return createElement(note, { x, y, datum })\n }\n\n return (\n <>\n {theme.annotations.text.outlineWidth > 0 && (\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={{\n ...theme.annotations.text,\n strokeLinejoin: 'round',\n strokeWidth: theme.annotations.text.outlineWidth * 2,\n stroke: theme.annotations.text.outlineColor,\n }}\n >\n {note}\n </animated.text>\n )}\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={omit(theme.annotations.text, ['outlineWidth', 'outlineColor'])}\n >\n {note}\n </animated.text>\n </>\n )\n}\n","import { useMemo } from 'react'\nimport { animated } from '@react-spring/web'\nimport { useAnimatedPath, useTheme } from '@nivo/core'\n\nexport const AnnotationLink = ({\n points,\n isOutline = false,\n}: {\n points: [number, number][]\n isOutline?: boolean\n}) => {\n const theme = useTheme()\n\n const path = useMemo(() => {\n const [firstPoint, ...otherPoints] = points\n\n return otherPoints.reduce(\n (acc, [x, y]) => `${acc} L${x},${y}`,\n `M${firstPoint[0]},${firstPoint[1]}`\n )\n }, [points])\n\n const animatedPath = useAnimatedPath(path)\n\n if (isOutline && theme.annotations.link.outlineWidth <= 0) {\n return null\n }\n\n const style = { ...theme.annotations.link }\n if (isOutline) {\n style.strokeLinecap = 'square'\n style.strokeWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n style.stroke = theme.annotations.link.outlineColor\n style.opacity = theme.annotations.link.outlineOpacity\n }\n\n return <animated.path fill=\"none\" d={animatedPath} style={style} />\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const CircleAnnotationOutline = ({ x, y, size }: { x: number; y: number; size: number }) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\nimport { defaultProps } from './props'\n\nexport const DotAnnotationOutline = ({\n x,\n y,\n size = defaultProps.dotSize,\n}: {\n x: number\n y: number\n size?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth: theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.symbol}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const RectAnnotationOutline = ({\n x,\n y,\n width,\n height,\n borderRadius = 6,\n}: {\n x: number\n y: number\n width: number\n height: number\n borderRadius?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x: x - width / 2,\n y: y - height / 2,\n width,\n height,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useComputedAnnotation } from './hooks'\nimport { AnnotationNote } from './AnnotationNote'\nimport { AnnotationLink } from './AnnotationLink'\nimport { CircleAnnotationOutline } from './CircleAnnotationOutline'\nimport { DotAnnotationOutline } from './DotAnnotationOutline'\nimport { RectAnnotationOutline } from './RectAnnotationOutline'\nimport { BoundAnnotation } from './types'\nimport { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils'\n\nexport const Annotation = <Datum,>(annotation: BoundAnnotation<Datum>) => {\n const { datum, x, y, note } = annotation\n const computed = useComputedAnnotation(annotation)\n\n if (!isSvgNote(note)) {\n throw new Error('note should be a valid react element')\n }\n\n return (\n <>\n <AnnotationLink points={computed.points} isOutline={true} />\n {isCircleAnnotation(annotation) && (\n <CircleAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isDotAnnotation(annotation) && (\n <DotAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isRectAnnotation(annotation) && (\n <RectAnnotationOutline\n x={x}\n y={y}\n width={annotation.width}\n height={annotation.height}\n borderRadius={annotation.borderRadius}\n />\n )}\n <AnnotationLink points={computed.points} />\n <AnnotationNote datum={datum} x={computed.text[0]} y={computed.text[1]} note={note} />\n </>\n )\n}\n","import { CompleteTheme } from '@nivo/core'\nimport { ComputedAnnotation } from './types'\nimport { isCanvasNote, isCircleAnnotation, isDotAnnotation, isRectAnnotation } from './utils'\n\nconst drawPoints = (ctx: CanvasRenderingContext2D, points: [number, number][]) => {\n points.forEach(([x, y], index) => {\n if (index === 0) {\n ctx.moveTo(x, y)\n } else {\n ctx.lineTo(x, y)\n }\n })\n}\n\nexport const renderAnnotationsToCanvas = <Datum>(\n ctx: CanvasRenderingContext2D,\n {\n annotations,\n theme,\n }: {\n annotations: ComputedAnnotation<Datum>[]\n theme: CompleteTheme\n }\n) => {\n if (annotations.length === 0) return\n\n ctx.save()\n annotations.forEach(annotation => {\n if (!isCanvasNote(annotation.note)) {\n throw new Error('note is invalid for canvas implementation')\n }\n\n if (theme.annotations.link.outlineWidth > 0) {\n ctx.lineCap = 'square'\n ctx.strokeStyle = theme.annotations.link.outlineColor\n ctx.lineWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n ctx.lineCap = 'butt'\n }\n\n if (isCircleAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation) && theme.annotations.symbol.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.symbol.outlineColor\n ctx.lineWidth = theme.annotations.symbol.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isRectAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n ctx.strokeStyle = theme.annotations.link.stroke\n ctx.lineWidth = theme.annotations.link.strokeWidth\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n\n if (isCircleAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation)) {\n ctx.fillStyle = theme.annotations.symbol.fill\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.fill()\n }\n\n if (isRectAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n if (typeof annotation.note === 'function') {\n annotation.note(ctx, {\n datum: annotation.datum,\n x: annotation.computed.text[0],\n y: annotation.computed.text[1],\n theme,\n })\n } else {\n ctx.font = `${theme.annotations.text.fontSize}px ${theme.annotations.text.fontFamily}`\n ctx.textAlign = 'left'\n ctx.textBaseline = 'alphabetic'\n\n ctx.fillStyle = theme.annotations.text.fill\n ctx.strokeStyle = theme.annotations.text.outlineColor\n ctx.lineWidth = theme.annotations.text.outlineWidth * 2\n\n if (theme.annotations.text.outlineWidth > 0) {\n ctx.lineJoin = 'round'\n ctx.strokeText(\n annotation.note,\n annotation.computed.text[0],\n annotation.computed.text[1]\n )\n ctx.lineJoin = 'miter'\n }\n ctx.fillText(annotation.note, annotation.computed.text[0], annotation.computed.text[1])\n }\n })\n ctx.restore()\n}\n"],"names":["defaultProps","dotSize","noteWidth","noteTextOffset","animate","isSvgNote","note","noteType","isValidElement","isCanvasNote","isCircleAnnotation","annotationSpec","type","isDotAnnotation","isRectAnnotation","bindAnnotations","_ref","data","annotations","getPosition","getDimensions","reduce","acc","annotation","offset","concat","filter","match","map","datum","position","dimensions","size","width","height","_extends","omit","getLinkAngle","sourceX","sourceY","targetX","targetY","angle","Math","atan2","absoluteAngleDegrees","radiansToDegrees","computeAnnotation","computedNoteX","computedNoteY","x","y","noteX","noteY","_annotation$noteWidth","_annotation$noteTextO","isNumber","undefined","abs","Error","computedX","computedY","positionFromAngle","degreesToRadians","eighth","round","textX","noteLineX","points","text","useAnnotations","useMemo","useComputedAnnotations","_ref2","computed","useComputedAnnotation","AnnotationNote","theme","useTheme","_useMotionConfig","useMotionConfig","springConfig","config","animatedProps","useSpring","immediate","createElement","_jsxs","_Fragment","children","outlineWidth","_jsx","animated","style","strokeLinejoin","strokeWidth","stroke","outlineColor","AnnotationLink","_ref$isOutline","isOutline","path","firstPoint","slice","animatedPath","useAnimatedPath","link","strokeLinecap","opacity","outlineOpacity","fill","d","CircleAnnotationOutline","radius","outline","circle","cx","cy","r","DotAnnotationOutline","_ref$size","symbol","RectAnnotationOutline","_ref$borderRadius","borderRadius","rect","rx","ry","Annotation","drawPoints","ctx","forEach","index","moveTo","lineTo","renderAnnotationsToCanvas","length","save","lineCap","strokeStyle","lineWidth","beginPath","arc","PI","fillStyle","font","fontSize","fontFamily","textAlign","textBaseline","lineJoin","strokeText","fillText","restore"],"mappings":"wqBAAO,IAAMA,EAAe,CACxBC,QAAS,EACTC,UAAW,IACXC,eAAgB,EAChBC,SAAS,GCOAC,EAAY,SAAQC,GAC7B,IAAMC,SAAkBD,EAExB,OACIE,EAAeF,IACF,WAAbC,GACa,aAAbA,GACa,WAAbA,CAER,EAEaE,EAAe,SAAQH,GAChC,IAAMC,SAAkBD,EAExB,MAAoB,WAAbC,GAAsC,aAAbA,CACpC,EAEaG,EAAqB,SAC9BC,GAAqC,MACmC,WAAxBA,EAAeC,IAAiB,EAEvEC,EAAkB,SAC3BF,GAAqC,MACgC,QAAxBA,EAAeC,IAAc,EAEjEE,EAAmB,SAC5BH,GAAqC,MACiC,SAAxBA,EAAeC,IAAe,ECnBnEG,EAAkB,SAAHC,GAAA,IAMxBC,EAAID,EAAJC,KACAC,EAAWF,EAAXE,YACAC,EAAWH,EAAXG,YACAC,EAAaJ,EAAbI,cAAa,OAObF,EAAYG,QAAO,SAACC,EAA+BC,GAC/C,IAAMC,EAASD,EAAWC,QAAU,EAEpC,MAAA,GAAAC,OACOH,EACAI,EAAcT,EAAMM,EAAWI,OAAOC,KAAI,SAAAC,GACzC,IAAMC,EAAWX,EAAYU,GACvBE,EAAaX,EAAcS,GAyBjC,OAvBInB,EAAmBa,IAAeT,EAAiBS,MACnDQ,EAAWC,KAAOD,EA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AAW4B,EAAG5B,EAAWS,KAAO,EAAG,EAAG,EAAIW,KAAKoG,IACrEb,EAAIpB,QAGJhG,EAAiBS,KACjB2G,EAAIS,YAAc9D,EAAM3D,YAAYgG,QAAQlB,OAC5CkC,EAAIU,UAAY/D,EAAM3D,YAAYgG,QAAQnB,YAC1CmC,EAAIW,YACJX,EAAIL,KACAtG,EAAW2B,EAAI3B,EAAWU,MAAQ,EAClCV,EAAW4B,EAAI5B,EAAWW,OAAS,EACnCX,EAAWU,MACXV,EAAWW,QAEfgG,EAAIlC,UAGuB,mBAApBzE,EAAWjB,KAClBiB,EAAWjB,KAAK4H,EAAK,CACjBrG,MAAON,EAAWM,MAClBqB,EAAG3B,EAAWmD,SAASL,KAAK,GAC5BlB,EAAG5B,EAAWmD,SAASL,KAAK,GAC5BQ,MAAAA,KAGJqD,EAAIe,KAAUpE,EAAM3D,YAAYmD,KAAK6E,eAAcrE,EAAM3D,YAAYmD,KAAK8E,WAC1EjB,EAAIkB,UAAY,OAChBlB,EAAImB,aAAe,aAEnBnB,EAAIc,UAAYnE,EAAM3D,YAAYmD,KAAKyC,KACvCoB,EAAIS,YAAc9D,EAAM3D,YAAYmD,KAAK4B,aACzCiC,EAAIU,UAAkD,EAAtC/D,EAAM3D,YAAYmD,KAAKqB,aAEnCb,EAAM3D,YAAYmD,KAAKqB,aAAe,IACtCwC,EAAIoB,SAAW,QACfpB,EAAIqB,WACAhI,EAAWjB,KACXiB,EAAWmD,SAASL,KAAK,GACzB9C,EAAWmD,SAASL,KAAK,IAE7B6D,EAAIoB,SAAW,SAEnBpB,EAAIsB,SAASjI,EAAWjB,KAAMiB,EAAWmD,SAASL,KAAK,GAAI9C,EAAWmD,SAASL,KAAK,IAE5F,IACA6D,EAAIuB,UACR"} | ||
| {"version":3,"file":"nivo-annotations.mjs","sources":["../src/props.ts","../src/utils.ts","../src/compute.ts","../src/hooks.ts","../src/AnnotationNote.tsx","../src/AnnotationLink.tsx","../src/CircleAnnotationOutline.tsx","../src/DotAnnotationOutline.tsx","../src/RectAnnotationOutline.tsx","../src/Annotation.tsx","../src/canvas.ts"],"sourcesContent":["export const defaultProps = {\n dotSize: 4,\n noteWidth: 120,\n noteTextOffset: 8,\n animate: true,\n}\n","import {\n AnnotationSpec,\n CircleAnnotationSpec,\n DotAnnotationSpec,\n Note,\n NoteCanvas,\n NoteSvg,\n RectAnnotationSpec,\n} from './types'\nimport { isValidElement } from 'react'\n\nexport const isSvgNote = <Datum>(note: Note<Datum>): note is NoteSvg<Datum> => {\n const noteType = typeof note\n\n return (\n isValidElement(note) ||\n noteType === 'string' ||\n noteType === 'function' ||\n noteType === 'object'\n )\n}\n\nexport const isCanvasNote = <Datum>(note: Note<Datum>): note is NoteCanvas<Datum> => {\n const noteType = typeof note\n\n return noteType === 'string' || noteType === 'function'\n}\n\nexport const isCircleAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is CircleAnnotationSpec<Datum> => annotationSpec.type === 'circle'\n\nexport const isDotAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is DotAnnotationSpec<Datum> => annotationSpec.type === 'dot'\n\nexport const isRectAnnotation = <Datum>(\n annotationSpec: AnnotationSpec<Datum>\n): annotationSpec is RectAnnotationSpec<Datum> => annotationSpec.type === 'rect'\n","import filter from 'lodash/filter.js'\nimport isNumber from 'lodash/isNumber.js'\nimport omit from 'lodash/omit.js'\nimport {\n radiansToDegrees,\n absoluteAngleDegrees,\n degreesToRadians,\n positionFromAngle,\n} from '@nivo/core'\nimport { defaultProps } from './props'\nimport {\n AnnotationPositionGetter,\n AnnotationDimensionsGetter,\n BoundAnnotation,\n AnnotationMatcher,\n AnnotationInstructions,\n} from './types'\nimport { isCircleAnnotation, isRectAnnotation } from './utils'\n\nexport const bindAnnotations = <\n Datum = {\n x: number\n y: number\n }\n>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}): BoundAnnotation<Datum>[] =>\n annotations.reduce((acc: BoundAnnotation<Datum>[], annotation) => {\n const offset = annotation.offset || 0\n\n return [\n ...acc,\n ...filter<Datum>(data, annotation.match).map(datum => {\n const position = getPosition(datum)\n const dimensions = getDimensions(datum)\n\n if (isCircleAnnotation(annotation) || isRectAnnotation(annotation)) {\n dimensions.size = dimensions.size + offset * 2\n dimensions.width = dimensions.width + offset * 2\n dimensions.height = dimensions.height + offset * 2\n }\n\n // acc.push({\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // } as any)\n // return [\n // ...acc,\n // {\n // ...omit(annotation, ['match', 'offset']),\n // ...position,\n // ...dimensions,\n // size: annotation.size || dimensions.size,\n // datum,\n // },\n // ]\n return {\n ...omit(annotation, ['match', 'offset']),\n ...position,\n ...dimensions,\n size: annotation.size || dimensions.size,\n datum,\n } as Required<BoundAnnotation<Datum>>\n }),\n ]\n\n // return acc\n }, [])\n\nexport const getLinkAngle = (\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number\n) => {\n const angle = Math.atan2(targetY - sourceY, targetX - sourceX)\n\n return absoluteAngleDegrees(radiansToDegrees(angle))\n}\n\nexport const computeAnnotation = <Datum>(\n annotation: BoundAnnotation<Datum>\n): AnnotationInstructions => {\n const {\n x,\n y,\n noteX,\n noteY,\n noteWidth = defaultProps.noteWidth,\n noteTextOffset = defaultProps.noteTextOffset,\n } = annotation\n\n let computedNoteX: number\n let computedNoteY: number\n\n if (isNumber(noteX)) {\n computedNoteX = x + noteX\n } else if (noteX.abs !== undefined) {\n computedNoteX = noteX.abs\n } else {\n throw new Error(`noteX should be either a number or an object containing an 'abs' property`)\n }\n\n if (isNumber(noteY)) {\n computedNoteY = y + noteY\n } else if (noteY.abs !== undefined) {\n computedNoteY = noteY.abs\n } else {\n throw new Error(`noteY should be either a number or an object containing an 'abs' property`)\n }\n\n let computedX = x\n let computedY = y\n\n const angle = getLinkAngle(x, y, computedNoteX, computedNoteY)\n\n if (isCircleAnnotation<Datum>(annotation)) {\n const position = positionFromAngle(degreesToRadians(angle), annotation.size / 2)\n computedX += position.x\n computedY += position.y\n }\n\n if (isRectAnnotation<Datum>(annotation)) {\n const eighth = Math.round((angle + 90) / 45) % 8\n if (eighth === 0) {\n computedY -= annotation.height / 2\n }\n if (eighth === 1) {\n computedX += annotation.width / 2\n computedY -= annotation.height / 2\n }\n if (eighth === 2) {\n computedX += annotation.width / 2\n }\n if (eighth === 3) {\n computedX += annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 4) {\n computedY += annotation.height / 2\n }\n if (eighth === 5) {\n computedX -= annotation.width / 2\n computedY += annotation.height / 2\n }\n if (eighth === 6) {\n computedX -= annotation.width / 2\n }\n if (eighth === 7) {\n computedX -= annotation.width / 2\n computedY -= annotation.height / 2\n }\n }\n\n let textX = computedNoteX\n const textY = computedNoteY - noteTextOffset\n\n let noteLineX = computedNoteX\n const noteLineY = computedNoteY\n\n if ((angle + 90) % 360 > 180) {\n textX -= noteWidth\n noteLineX -= noteWidth\n } else {\n noteLineX += noteWidth\n }\n\n return {\n points: [\n [computedX, computedY],\n [computedNoteX, computedNoteY],\n [noteLineX, noteLineY],\n ] as [number, number][],\n text: [textX, textY],\n angle: angle + 90,\n }\n}\n","import { useMemo } from 'react'\nimport { bindAnnotations, computeAnnotation } from './compute'\nimport {\n AnnotationDimensionsGetter,\n AnnotationMatcher,\n AnnotationPositionGetter,\n BoundAnnotation,\n} from './types'\n\n/**\n * Bind annotations to a dataset.\n */\nexport const useAnnotations = <Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n}: {\n data: readonly Datum[]\n annotations: readonly AnnotationMatcher<Datum>[]\n getPosition: AnnotationPositionGetter<Datum>\n getDimensions: AnnotationDimensionsGetter<Datum>\n}) =>\n useMemo(\n () =>\n bindAnnotations<Datum>({\n data,\n annotations,\n getPosition,\n getDimensions,\n }),\n [data, annotations, getPosition, getDimensions]\n )\n\nexport const useComputedAnnotations = <Datum>({\n annotations,\n}: {\n annotations: readonly BoundAnnotation<Datum>[]\n}) =>\n useMemo(\n () =>\n annotations.map(annotation => ({\n ...annotation,\n computed: computeAnnotation<Datum>({\n ...annotation,\n }),\n })),\n [annotations]\n )\n\nexport const useComputedAnnotation = <Datum>(annotation: BoundAnnotation<Datum>) =>\n useMemo(() => computeAnnotation<Datum>(annotation), [annotation])\n","import { createElement } from 'react'\nimport omit from 'lodash/omit.js'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\nimport { NoteSvg } from './types'\n\nexport const AnnotationNote = <Datum,>({\n datum,\n x,\n y,\n note,\n}: {\n datum: Datum\n x: number\n y: number\n note: NoteSvg<Datum>\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n config: springConfig,\n immediate: !animate,\n })\n\n if (typeof note === 'function') {\n return createElement(note, { x, y, datum })\n }\n\n return (\n <>\n {theme.annotations.text.outlineWidth > 0 && (\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={{\n ...theme.annotations.text,\n strokeLinejoin: 'round',\n strokeWidth: theme.annotations.text.outlineWidth * 2,\n stroke: theme.annotations.text.outlineColor,\n }}\n >\n {note}\n </animated.text>\n )}\n <animated.text\n x={animatedProps.x}\n y={animatedProps.y}\n style={omit(theme.annotations.text, ['outlineWidth', 'outlineColor'])}\n >\n {note}\n </animated.text>\n </>\n )\n}\n","import { useMemo } from 'react'\nimport { animated } from '@react-spring/web'\nimport { useAnimatedPath } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const AnnotationLink = ({\n points,\n isOutline = false,\n}: {\n points: [number, number][]\n isOutline?: boolean\n}) => {\n const theme = useTheme()\n\n const path = useMemo(() => {\n const [firstPoint, ...otherPoints] = points\n\n return otherPoints.reduce(\n (acc, [x, y]) => `${acc} L${x},${y}`,\n `M${firstPoint[0]},${firstPoint[1]}`\n )\n }, [points])\n\n const animatedPath = useAnimatedPath(path)\n\n if (isOutline && theme.annotations.link.outlineWidth <= 0) {\n return null\n }\n\n const style = { ...theme.annotations.link }\n if (isOutline) {\n style.strokeLinecap = 'square'\n style.strokeWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n style.stroke = theme.annotations.link.outlineColor\n style.opacity = theme.annotations.link.outlineOpacity\n }\n\n return <animated.path fill=\"none\" d={animatedPath} style={style} />\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const CircleAnnotationOutline = ({ x, y, size }: { x: number; y: number; size: number }) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\nimport { defaultProps } from './props'\n\nexport const DotAnnotationOutline = ({\n x,\n y,\n size = defaultProps.dotSize,\n}: {\n x: number\n y: number\n size?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth: theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.circle\n cx={animatedProps.x}\n cy={animatedProps.y}\n r={animatedProps.radius}\n style={theme.annotations.symbol}\n />\n </>\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { useTheme } from '@nivo/theming'\n\nexport const RectAnnotationOutline = ({\n x,\n y,\n width,\n height,\n borderRadius = 6,\n}: {\n x: number\n y: number\n width: number\n height: number\n borderRadius?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x: x - width / 2,\n y: y - height / 2,\n width,\n height,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={{\n ...theme.annotations.outline,\n fill: 'none',\n strokeWidth:\n theme.annotations.outline.strokeWidth +\n theme.annotations.outline.outlineWidth * 2,\n stroke: theme.annotations.outline.outlineColor,\n opacity: theme.annotations.outline.outlineOpacity,\n }}\n />\n )}\n <animated.rect\n x={animatedProps.x}\n y={animatedProps.y}\n rx={borderRadius}\n ry={borderRadius}\n width={animatedProps.width}\n height={animatedProps.height}\n style={theme.annotations.outline}\n />\n </>\n )\n}\n","import { useComputedAnnotation } from './hooks'\nimport { AnnotationNote } from './AnnotationNote'\nimport { AnnotationLink } from './AnnotationLink'\nimport { CircleAnnotationOutline } from './CircleAnnotationOutline'\nimport { DotAnnotationOutline } from './DotAnnotationOutline'\nimport { RectAnnotationOutline } from './RectAnnotationOutline'\nimport { BoundAnnotation } from './types'\nimport { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils'\n\nexport const Annotation = <Datum,>(annotation: BoundAnnotation<Datum>) => {\n const { datum, x, y, note } = annotation\n const computed = useComputedAnnotation(annotation)\n\n if (!isSvgNote(note)) {\n throw new Error('note should be a valid react element')\n }\n\n return (\n <>\n <AnnotationLink points={computed.points} isOutline={true} />\n {isCircleAnnotation(annotation) && (\n <CircleAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isDotAnnotation(annotation) && (\n <DotAnnotationOutline x={x} y={y} size={annotation.size} />\n )}\n {isRectAnnotation(annotation) && (\n <RectAnnotationOutline\n x={x}\n y={y}\n width={annotation.width}\n height={annotation.height}\n borderRadius={annotation.borderRadius}\n />\n )}\n <AnnotationLink points={computed.points} />\n <AnnotationNote datum={datum} x={computed.text[0]} y={computed.text[1]} note={note} />\n </>\n )\n}\n","import { Theme } from '@nivo/theming'\nimport { ComputedAnnotation } from './types'\nimport { isCanvasNote, isCircleAnnotation, isDotAnnotation, isRectAnnotation } from './utils'\n\nconst drawPoints = (ctx: CanvasRenderingContext2D, points: [number, number][]) => {\n points.forEach(([x, y], index) => {\n if (index === 0) {\n ctx.moveTo(x, y)\n } else {\n ctx.lineTo(x, y)\n }\n })\n}\n\nexport const renderAnnotationsToCanvas = <Datum>(\n ctx: CanvasRenderingContext2D,\n {\n annotations,\n theme,\n }: {\n annotations: ComputedAnnotation<Datum>[]\n theme: Theme\n }\n) => {\n if (annotations.length === 0) return\n\n ctx.save()\n annotations.forEach(annotation => {\n if (!isCanvasNote(annotation.note)) {\n throw new Error('note is invalid for canvas implementation')\n }\n\n if (theme.annotations.link.outlineWidth > 0) {\n ctx.lineCap = 'square'\n ctx.strokeStyle = theme.annotations.link.outlineColor\n ctx.lineWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n ctx.lineCap = 'butt'\n }\n\n if (isCircleAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation) && theme.annotations.symbol.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.symbol.outlineColor\n ctx.lineWidth = theme.annotations.symbol.outlineWidth * 2\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isRectAnnotation(annotation) && theme.annotations.outline.outlineWidth > 0) {\n ctx.strokeStyle = theme.annotations.outline.outlineColor\n ctx.lineWidth =\n theme.annotations.outline.strokeWidth + theme.annotations.outline.outlineWidth * 2\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n ctx.strokeStyle = theme.annotations.link.stroke\n ctx.lineWidth = theme.annotations.link.strokeWidth\n ctx.beginPath()\n drawPoints(ctx, annotation.computed.points)\n ctx.stroke()\n\n if (isCircleAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.stroke()\n }\n\n if (isDotAnnotation(annotation)) {\n ctx.fillStyle = theme.annotations.symbol.fill\n ctx.beginPath()\n ctx.arc(annotation.x, annotation.y, annotation.size / 2, 0, 2 * Math.PI)\n ctx.fill()\n }\n\n if (isRectAnnotation(annotation)) {\n ctx.strokeStyle = theme.annotations.outline.stroke\n ctx.lineWidth = theme.annotations.outline.strokeWidth\n ctx.beginPath()\n ctx.rect(\n annotation.x - annotation.width / 2,\n annotation.y - annotation.height / 2,\n annotation.width,\n annotation.height\n )\n ctx.stroke()\n }\n\n if (typeof annotation.note === 'function') {\n annotation.note(ctx, {\n datum: annotation.datum,\n x: annotation.computed.text[0],\n y: annotation.computed.text[1],\n theme,\n })\n } else {\n ctx.font = `${theme.annotations.text.fontSize}px ${theme.annotations.text.fontFamily}`\n ctx.textAlign = 'left'\n ctx.textBaseline = 'alphabetic'\n\n ctx.fillStyle = theme.annotations.text.fill\n ctx.strokeStyle = theme.annotations.text.outlineColor\n ctx.lineWidth = theme.annotations.text.outlineWidth * 2\n\n if (theme.annotations.text.outlineWidth > 0) {\n ctx.lineJoin = 'round'\n ctx.strokeText(\n annotation.note,\n annotation.computed.text[0],\n annotation.computed.text[1]\n )\n ctx.lineJoin = 'miter'\n }\n ctx.fillText(annotation.note, annotation.computed.text[0], annotation.computed.text[1])\n }\n })\n ctx.restore()\n}\n"],"names":["defaultProps","dotSize","noteWidth","noteTextOffset","animate","isSvgNote","note","noteType","isValidElement","isCanvasNote","isCircleAnnotation","annotationSpec","type","isDotAnnotation","isRectAnnotation","bindAnnotations","_ref","data","annotations","getPosition","getDimensions","reduce","acc","annotation","offset","concat","filter","match","map","datum","position","dimensions","size","width","height","_extends","omit","getLinkAngle","sourceX","sourceY","targetX","targetY","angle","Math","atan2","absoluteAngleDegrees","radiansToDegrees","computeAnnotation","computedNoteX","computedNoteY","x","y","noteX","noteY","_annotation$noteWidth","_annotation$noteTextO","isNumber","undefined","abs","Error","computedX","computedY","positionFromAngle","degreesToRadians","eighth","round","textX","noteLineX","points","text","useAnnotations","useMemo","useComputedAnnotations","_ref2","computed","useComputedAnnotation","AnnotationNote","theme","useTheme","_useMotionConfig","useMotionConfig","springConfig","config","animatedProps","useSpring","immediate","createElement","_jsxs","_Fragment","children","outlineWidth","_jsx","animated","style","strokeLinejoin","strokeWidth","stroke","outlineColor","AnnotationLink","_ref$isOutline","isOutline","path","firstPoint","slice","animatedPath","useAnimatedPath","link","strokeLinecap","opacity","outlineOpacity","fill","d","CircleAnnotationOutline","radius","outline","circle","cx","cy","r","DotAnnotationOutline","_ref$size","symbol","RectAnnotationOutline","_ref$borderRadius","borderRadius","rect","rx","ry","Annotation","drawPoints","ctx","forEach","index","moveTo","lineTo","renderAnnotationsToCanvas","length","save","lineCap","strokeStyle","lineWidth","beginPath","arc","PI","fillStyle","font","fontSize","fontFamily","textAlign","textBaseline","lineJoin","strokeText","fillText","restore"],"mappings":"msBAAO,IAAMA,EAAe,CACxBC,QAAS,EACTC,UAAW,IACXC,eAAgB,EAChBC,SAAS,GCOAC,EAAY,SAAQC,GAC7B,IAAMC,SAAkBD,EAExB,OACIE,EAAeF,IACF,WAAbC,GACa,aAAbA,GACa,WAAbA,CAER,EAEaE,EAAe,SAAQH,GAChC,IAAMC,SAAkBD,EAExB,MAAoB,WAAbC,GAAsC,aAAbA,CACpC,EAEaG,EAAqB,SAC9BC,GAAqC,MACmC,WAAxBA,EAAeC,IAAiB,EAEvEC,EAAkB,SAC3BF,GAAqC,MACgC,QAAxBA,EAAeC,IAAc,EAEjEE,EAAmB,SAC5BH,GAAqC,MACiC,SAAxBA,EAAeC,IAAe,ECnBnEG,EAAkB,SAAHC,GAAA,IAMxBC,EAAID,EAAJC,KACAC,EAAWF,EAAXE,YACAC,EAAWH,EAAXG,YACAC,EAAaJ,EAAbI,cAAa,OAObF,EAAYG,QAAO,SAACC,EAA+BC,GAC/C,IAAMC,EAASD,EAAWC,QAAU,EAEpC,MAAA,GAAAC,OACOH,EACAI,EAAcT,EAAMM,EAAWI,OAAOC,KAAI,SAAAC,GACzC,IAAMC,EAAWX,EAAYU,GACvBE,EAAaX,EAAcS,GAyBjC,OAvBInB,EAAmBa,IAAeT,EAAiBS,MACnDQ,EAAWC,KAAOD,EAAWC,KAAgB,EAATR,EACpCO,EAAWE,MAAQF,EAAWE,MAAiB,EAATT,EACtCO,EAAWG,OAASH,EAAW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BS,KACjB2G,EAAIS,YAAc9D,EAAM3D,YAAYgG,QAAQlB,OAC5CkC,EAAIU,UAAY/D,EAAM3D,YAAYgG,QAAQnB,YAC1CmC,EAAIW,YACJX,EAAIL,KACAtG,EAAW2B,EAAI3B,EAAWU,MAAQ,EAClCV,EAAW4B,EAAI5B,EAAWW,OAAS,EACnCX,EAAWU,MACXV,EAAWW,QAEfgG,EAAIlC,UAGuB,mBAApBzE,EAAWjB,KAClBiB,EAAWjB,KAAK4H,EAAK,CACjBrG,MAAON,EAAWM,MAClBqB,EAAG3B,EAAWmD,SAASL,KAAK,GAC5BlB,EAAG5B,EAAWmD,SAASL,KAAK,GAC5BQ,MAAAA,KAGJqD,EAAIe,KAAUpE,EAAM3D,YAAYmD,KAAK6E,eAAcrE,EAAM3D,YAAYmD,KAAK8E,WAC1EjB,EAAIkB,UAAY,OAChBlB,EAAImB,aAAe,aAEnBnB,EAAIc,UAAYnE,EAAM3D,YAAYmD,KAAKyC,KACvCoB,EAAIS,YAAc9D,EAAM3D,YAAYmD,KAAK4B,aACzCiC,EAAIU,UAAkD,EAAtC/D,EAAM3D,YAAYmD,KAAKqB,aAEnCb,EAAM3D,YAAYmD,KAAKqB,aAAe,IACtCwC,EAAIoB,SAAW,QACfpB,EAAIqB,WACAhI,EAAWjB,KACXiB,EAAWmD,SAASL,KAAK,GACzB9C,EAAWmD,SAASL,KAAK,IAE7B6D,EAAIoB,SAAW,SAEnBpB,EAAIsB,SAASjI,EAAWjB,KAAMiB,EAAWmD,SAASL,KAAK,GAAI9C,EAAWmD,SAASL,KAAK,IAE5F,IACA6D,EAAIuB,UACR"} |
| export declare const AnnotationLink: ({ points, isOutline, }: { | ||
| points: [ | ||
| number, | ||
| number | ||
| ][]; | ||
| points: [number, number][]; | ||
| isOutline?: boolean | undefined; | ||
| }) => import("react/jsx-runtime").JSX.Element | null; | ||
| //# sourceMappingURL=AnnotationLink.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"AnnotationLink.d.ts","sourceRoot":"","sources":["../../src/AnnotationLink.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;YAIf;QAAC,MAAM;QAAE,MAAM;KAAC,EAAE;;oDA8B7B,CAAA"} | ||
| {"version":3,"file":"AnnotationLink.d.ts","sourceRoot":"","sources":["../../src/AnnotationLink.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;YAIf,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;;oDA8B7B,CAAA"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"AnnotationNote.d.ts","sourceRoot":"","sources":["../../src/AnnotationNote.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,eAAO,MAAM,cAAc;;OAOpB,MAAM;OACN,MAAM;;6CA0CZ,CAAA"} | ||
| {"version":3,"file":"AnnotationNote.d.ts","sourceRoot":"","sources":["../../src/AnnotationNote.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,eAAO,MAAM,cAAc;;OAOpB,MAAM;OACN,MAAM;;6CA0CZ,CAAA"} |
@@ -1,7 +0,7 @@ | ||
| import { CompleteTheme } from '@nivo/core'; | ||
| import { Theme } from '@nivo/theming'; | ||
| import { ComputedAnnotation } from './types'; | ||
| export declare const renderAnnotationsToCanvas: <Datum>(ctx: CanvasRenderingContext2D, { annotations, theme, }: { | ||
| annotations: ComputedAnnotation<Datum>[]; | ||
| theme: CompleteTheme; | ||
| theme: Theme; | ||
| }) => void; | ||
| //# sourceMappingURL=canvas.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAa5C,eAAO,MAAM,yBAAyB,eAC7B,wBAAwB;;WAMlB,aAAa;UAoH3B,CAAA"} | ||
| {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAa5C,eAAO,MAAM,yBAAyB,eAC7B,wBAAwB;;WAMlB,KAAK;UAoHnB,CAAA"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"CircleAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/CircleAnnotationOutline.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB;OAAyB,MAAM;OAAK,MAAM;UAAQ,MAAM;6CAsC3F,CAAA"} | ||
| {"version":3,"file":"CircleAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/CircleAnnotationOutline.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB;OAAyB,MAAM;OAAK,MAAM;UAAQ,MAAM;6CAsC3F,CAAA"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"DotAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/DotAnnotationOutline.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;OAK1B,MAAM;OACN,MAAM;;6CAsCZ,CAAA"} | ||
| {"version":3,"file":"DotAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/DotAnnotationOutline.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;OAK1B,MAAM;OACN,MAAM;;6CAsCZ,CAAA"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"RectAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/RectAnnotationOutline.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;OAO3B,MAAM;OACN,MAAM;WACF,MAAM;YACL,MAAM;;6CA+CjB,CAAA"} | ||
| {"version":3,"file":"RectAnnotationOutline.d.ts","sourceRoot":"","sources":["../../src/RectAnnotationOutline.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB;OAO3B,MAAM;OACN,MAAM;WACF,MAAM;YACL,MAAM;;6CA+CjB,CAAA"} |
@@ -1,2 +0,2 @@ | ||
| import { CompleteTheme } from '@nivo/core'; | ||
| import { Theme } from '@nivo/theming'; | ||
| import { ReactElement } from 'react'; | ||
@@ -32,3 +32,3 @@ type PartialShallow<T> = { | ||
| y: number; | ||
| theme: CompleteTheme; | ||
| theme: Theme; | ||
| }) => void; | ||
@@ -35,0 +35,0 @@ export type NoteCanvas<Datum> = string | NoteCanvasRenderer<Datum>; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGpC,KAAK,cAAc,CAAC,CAAC,IAAI;KAEpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAA;AACD,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5C,KAAK,iBAAiB,CAAC,CAAC,IAAI,YAAY,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;AAClF,KAAK,YAAY,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,OAAO,CAAA;AAC9F,KAAK,kBAAkB,CAAC,CAAC,EAAE,OAAO,IAAI,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,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EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,KAAK,IAC1B,oBAAoB,CAAC,KAAK,CAAC,GAC3B,iBAAiB,CAAC,KAAK,CAAC,GACxB,kBAAkB,CAAC,KAAK,CAAC,CAAA;AAE/B,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG;IAC3D,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAID,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,GAAG;IAGnE,CAAC,EAAE,MAAM,CAAA;IAGT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,KAAK,CAAA;CACf,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IAEjC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IAE1B,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEtB,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG;IAC7D,QAAQ,EAAE,sBAAsB,CAAA;CACnC,CAAA"} |
+5
-4
| { | ||
| "name": "@nivo/annotations", | ||
| "version": "0.91.0", | ||
| "version": "0.92.0", | ||
| "license": "MIT", | ||
@@ -31,4 +31,5 @@ "author": { | ||
| "dependencies": { | ||
| "@nivo/colors": "0.91.0", | ||
| "@nivo/core": "0.91.0", | ||
| "@nivo/colors": "0.92.0", | ||
| "@nivo/core": "0.92.0", | ||
| "@nivo/theming": "0.92.0", | ||
| "@react-spring/web": "9.4.5 || ^9.7.2", | ||
@@ -50,3 +51,3 @@ "lodash": "^4.17.21" | ||
| }, | ||
| "gitHead": "86df5a86eff7da91a6c90e7fca8d2126196e5b44" | ||
| "gitHead": "21dcc7f512262e41fe1ea2ad920f03ed46c9a9b6" | ||
| } |
114413
0.32%6
20%316
-0.94%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated