@nivo/text
Advanced tools
| import { BoxAnchor } from '@nivo/core'; | ||
| import { TextAlign, TextBaseline } from '@nivo/theming'; | ||
| export declare const getTextAlignFromBoxAnchor: (anchor: BoxAnchor) => TextAlign; | ||
| export declare const getTextBaselineFromBoxAnchor: (anchor: BoxAnchor) => TextBaseline; | ||
| //# sourceMappingURL=boxAnchor.d.ts.map |
| {"version":3,"file":"boxAnchor.d.ts","sourceRoot":"","sources":["../../src/boxAnchor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AA0BvD,eAAO,MAAM,yBAAyB,GAAI,QAAQ,SAAS,cAAiC,CAAA;AAE5F,eAAO,MAAM,4BAA4B,GAAI,QAAQ,SAAS,iBAAoC,CAAA"} |
@@ -1,2 +0,2 @@ | ||
| "use strict";var t=require("@react-spring/web"),e=require("react/jsx-runtime");function n(){return n=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},n.apply(null,arguments)}function i(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}var r=["style","children"],o=["outlineWidth","outlineColor","outlineOpacity"];exports.Text=function(l){var a=l.style,s=l.children,u=i(l,r),c=a.outlineWidth,f=a.outlineColor,d=a.outlineOpacity,h=i(a,o);return e.jsxs(e.Fragment,{children:[c>0&&e.jsx(t.animated.text,n({},u,{style:n({},h,{strokeWidth:2*c,stroke:f,strokeOpacity:d,strokeLinejoin:"round"}),children:s})),e.jsx(t.animated.text,n({},u,{style:h,children:s}))]})},exports.drawCanvasText=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=0),e.outlineWidth>0&&(t.strokeStyle=e.outlineColor,t.lineWidth=2*e.outlineWidth,t.lineJoin="round",t.strokeText(n,i,r)),t.fillStyle=e.fill,t.fillText(n,i,r)},exports.setCanvasFont=function(t,e){t.font=(e.fontWeight?e.fontWeight+" ":"")+e.fontSize+"px "+e.fontFamily}; | ||
| "use strict";var t=require("@react-spring/web"),e=require("react/jsx-runtime"),n={center:"center","top-left":"start",top:"center","top-right":"end",right:"end","bottom-right":"end",bottom:"center","bottom-left":"start",left:"start"},o={center:"center","top-left":"top",top:"top","top-right":"top",right:"center","bottom-right":"bottom",bottom:"bottom","bottom-left":"bottom",left:"center"};function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r.apply(null,arguments)}function i(t,e){if(null==t)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o]}return n}var l=["style","children"],s=["outlineWidth","outlineColor","outlineOpacity"];exports.Text=function(n){var o=n.style,a=n.children,c=i(n,l),u=o.outlineWidth,f=o.outlineColor,h=o.outlineOpacity,d=i(o,s);return e.jsxs(e.Fragment,{children:[u>0&&e.jsx(t.animated.text,r({},c,{style:r({},d,{strokeWidth:2*u,stroke:f,strokeOpacity:h,strokeLinejoin:"round"}),children:a})),e.jsx(t.animated.text,r({},c,{style:d,children:a}))]})},exports.drawCanvasText=function(t,e,n,o,r){void 0===o&&(o=0),void 0===r&&(r=0),e.outlineWidth>0&&(t.strokeStyle=e.outlineColor,t.lineWidth=2*e.outlineWidth,t.lineJoin="round",t.strokeText(n,o,r)),t.fillStyle=e.fill,t.fillText(n,o,r)},exports.getTextAlignFromBoxAnchor=function(t){return n[t]},exports.getTextBaselineFromBoxAnchor=function(t){return o[t]},exports.setCanvasFont=function(t,e){t.font=(e.fontWeight?e.fontWeight+" ":"")+e.fontSize+"px "+e.fontFamily}; | ||
| //# sourceMappingURL=nivo-text.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
| import{animated as t}from"@react-spring/web";import{jsxs as n,Fragment as i,jsx as e}from"react/jsx-runtime";var r=function(t,n){t.font=(n.fontWeight?n.fontWeight+" ":"")+n.fontSize+"px "+n.fontFamily},o=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=0),n.outlineWidth>0&&(t.strokeStyle=n.outlineColor,t.lineWidth=2*n.outlineWidth,t.lineJoin="round",t.strokeText(i,e,r)),t.fillStyle=n.fill,t.fillText(i,e,r)};function l(){return l=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var e in i)({}).hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t},l.apply(null,arguments)}function u(t,n){if(null==t)return{};var i={};for(var e in t)if({}.hasOwnProperty.call(t,e)){if(-1!==n.indexOf(e))continue;i[e]=t[e]}return i}var f=["style","children"],a=["outlineWidth","outlineColor","outlineOpacity"],c=function(r){var o=r.style,c=r.children,s=u(r,f),d=o.outlineWidth,h=o.outlineColor,y=o.outlineOpacity,p=u(o,a);return n(i,{children:[d>0&&e(t.text,l({},s,{style:l({},p,{strokeWidth:2*d,stroke:h,strokeOpacity:y,strokeLinejoin:"round"}),children:c})),e(t.text,l({},s,{style:p,children:c}))]})};export{c as Text,o as drawCanvasText,r as setCanvasFont}; | ||
| import{animated as t}from"@react-spring/web";import{jsxs as e,Fragment as o,jsx as n}from"react/jsx-runtime";var r={center:"center","top-left":"start",top:"center","top-right":"end",right:"end","bottom-right":"end",bottom:"center","bottom-left":"start",left:"start"},i={center:"center","top-left":"top",top:"top","top-right":"top",right:"center","bottom-right":"bottom",bottom:"bottom","bottom-left":"bottom",left:"center"},l=function(t){return r[t]},c=function(t){return i[t]},f=function(t,e){t.font=(e.fontWeight?e.fontWeight+" ":"")+e.fontSize+"px "+e.fontFamily},u=function(t,e,o,n,r){void 0===n&&(n=0),void 0===r&&(r=0),e.outlineWidth>0&&(t.strokeStyle=e.outlineColor,t.lineWidth=2*e.outlineWidth,t.lineJoin="round",t.strokeText(o,n,r)),t.fillStyle=e.fill,t.fillText(o,n,r)};function a(){return a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)({}).hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},a.apply(null,arguments)}function h(t,e){if(null==t)return{};var o={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;o[n]=t[n]}return o}var p=["style","children"],s=["outlineWidth","outlineColor","outlineOpacity"],d=function(r){var i=r.style,l=r.children,c=h(r,p),f=i.outlineWidth,u=i.outlineColor,d=i.outlineOpacity,m=h(i,s);return e(o,{children:[f>0&&n(t.text,a({},c,{style:a({},m,{strokeWidth:2*f,stroke:u,strokeOpacity:d,strokeLinejoin:"round"}),children:l})),n(t.text,a({},c,{style:m,children:l}))]})};export{d as Text,u as drawCanvasText,l as getTextAlignFromBoxAnchor,c as getTextBaselineFromBoxAnchor,f as setCanvasFont}; | ||
| //# sourceMappingURL=nivo-text.mjs.map |
@@ -0,3 +1,4 @@ | ||
| export * from './boxAnchor'; | ||
| export * from './canvas'; | ||
| export * from './Text'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,6 +0,5 @@ | ||
| import { PropsWithChildren, ComponentType } from 'react'; | ||
| import { PropsWithChildren, ComponentProps } from 'react'; | ||
| import { animated } from '@react-spring/web'; | ||
| import { TextStyle } from '@nivo/theming'; | ||
| type GetComponentProps<T> = T extends ComponentType<infer P> ? P : never; | ||
| type AnimatedComponentProps = GetComponentProps<(typeof animated)['text']>; | ||
| type AnimatedComponentProps = ComponentProps<(typeof animated)['text']>; | ||
| export type TextProps = PropsWithChildren<Omit<AnimatedComponentProps, 'style'> & { | ||
@@ -7,0 +6,0 @@ style: AnimatedComponentProps['style'] & Pick<TextStyle, 'outlineWidth' | 'outlineColor' | 'outlineOpacity'>; |
+4
-3
| { | ||
| "name": "@nivo/text", | ||
| "version": "0.93.0", | ||
| "version": "0.94.0", | ||
| "license": "MIT", | ||
@@ -32,3 +32,4 @@ "author": { | ||
| "dependencies": { | ||
| "@nivo/theming": "0.93.0", | ||
| "@nivo/core": "0.94.0", | ||
| "@nivo/theming": "0.94.0", | ||
| "@react-spring/web": "9.4.5 || ^9.7.2" | ||
@@ -42,3 +43,3 @@ }, | ||
| }, | ||
| "gitHead": "83293c9d3d4c8fd10e92077f6d8e64057e15221d" | ||
| "gitHead": "8a57c52bc10119d90cac8f32f0cad80c156580d1" | ||
| } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17956
27.45%15
15.38%35
29.63%4
33.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated