@cutting/svg 4.42.0 → 4.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +21 -22
- package/CHANGELOG.md +5 -419
- package/cutting-svg-4.43.0.tgz +0 -0
- package/dist/cjs/svg.cjs.development.js +61 -71
- package/dist/cjs/svg.cjs.development.js.map +1 -1
- package/dist/cjs/svg.cjs.production.min.js +1 -1
- package/dist/cjs/svg.cjs.production.min.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +17 -18
- package/.coverage/clover.xml +0 -81
- package/.coverage/coverage-final.json +0 -5
- package/.coverage/lcov-report/Group/Group.tsx.html +0 -193
- package/.coverage/lcov-report/Group/index.html +0 -116
- package/.coverage/lcov-report/Line/Line.tsx.html +0 -196
- package/.coverage/lcov-report/Line/index.html +0 -116
- package/.coverage/lcov-report/ParentsizeSVG/ParentsizeSVG.tsx.html +0 -262
- package/.coverage/lcov-report/ParentsizeSVG/index.html +0 -116
- package/.coverage/lcov-report/ResponsiveSVG/ResponsiveSVG.tsx.html +0 -244
- package/.coverage/lcov-report/ResponsiveSVG/index.html +0 -116
- package/.coverage/lcov-report/base.css +0 -224
- package/.coverage/lcov-report/block-navigation.js +0 -87
- package/.coverage/lcov-report/favicon.png +0 -0
- package/.coverage/lcov-report/index.html +0 -161
- package/.coverage/lcov-report/prettify.css +0 -1
- package/.coverage/lcov-report/prettify.js +0 -2
- package/.coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/.coverage/lcov-report/sorter.js +0 -196
- package/.coverage/lcov.info +0 -130
- package/.turbo/turbo-lint.log +0 -5
- package/.turbo/turbo-test.log +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","aspect","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","parentRef","scale","align","options","debounceDelay","optionsRest","_objectWithoutProperties","_excluded","rest","useParentSize","_objectSpread","useEffect","current","Object","entries","_slicedToArray","key","value","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBgB,SAAAA,aAAA,CAQK,IAAA,EAAA;AAAA,EAPnBC,IAAAA,MAOmB,QAPnBA,MAOmB;AAAA,MANnBC,KAMmB,QANnBA,KAMmB;AAAA,MALnBC,QAKmB,QALnBA,QAKmB;AAAA,MAAA,WAAA,GAAA,IAAA,CAJnBC,MAImB;AAAA,MAJnBA,MAImB,GAJV,WAAA,KAAA,KAAA,CAAA,GAAA;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE,CAAA;AAAX,GAIU,GAAA,WAAA;AAAA,MAAA,qBAAA,GAAA,IAAA,CAHnBC,mBAGmB;AAAA,MAHnBA,mBAGmB,sCAHG,eAGH,GAAA,qBAAA;AAAA,MAFnBC,QAEmB,QAFnBA,QAEmB;AAAA,MADnBC,SACmB,QADnBA,SACmB,CAAA;AACnB,EAAA,IAAMC,MAAM,GAAGR,KAAK,GAAGD,MAAvB,CAAA;AAEA,EAAMU,IAAAA,cAAc,GAAGC,IAAI,CAACC,IAAL,CAAUX,KAAK,GAAGQ,MAAlB,CAAvB,CAAA;AAEA,EACEI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EAAE,EAAEL,IAAI,CAAC5C,CAHT;AAIAkD,IAAAA,EAAE,EAAEL,EAAE,CAAC9C,CAJP;AAKAoD,IAAAA,EAAE,EAAEN,EAAE,CAAC7C,CALP;AAMA8C,IAAAA,IAAI,EAAEA,IANN;AAOAM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB,MAAA;AAP/C,GAAA,EAQIN,SARJ,CAFJ,CAAA,CAAA;AAaD;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","aspect","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","parentRef","scale","align","options","debounceDelay","optionsRest","_excluded","rest","_objectWithoutProperties","useParentSize","_objectSpread","useEffect","current","key","value","Object","entries","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;AAmBgB,SAAAA,aAAA,CAQK,IAAA,EAAA;AAAA,EARS,IAAA;AAC5BC,IAAAA,MAD4B;AAE5BC,IAAAA,KAF4B;AAG5BC,IAAAA,QAH4B;AAI5BC,IAAAA,MAAM,GAAG;AAAEC,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE,CAAA;AAAX,KAJmB;AAK5BC,IAAAA,mBAAmB,GAAG,eALM;AAM5BC,IAAAA,QAN4B;AAO5BC,IAAAA,SAAAA;AAP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AOoB,GAAA,IAAA;AAAA,MADpCsC,SACoC,GAAAX,4CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AACvC,EAAA,MAAMiB,aAAa,GAAGH,IAAI,CAAC5C,CAAL,KAAW6C,EAAE,CAAC7C,CAAd,IAAmB4C,IAAI,CAAC3C,CAAL,KAAW4C,EAAE,CAAC5C,CAAvD,CAAA;AAEA,EACEQ,OAAAA,cACE,CAAA,MAAA,EAAAuB,iCAAA,CAAA;AAAAlB,IAAAA,GAAG,EAAEX,QAAL;AACAC,IAAAA,SAAS,EAAEsC,sBAAE,CAAC,WAAD,EAActC,SAAd,CADb;AAEA4C,IAAAA,EAAE,EAAEJ,IAAI,CAAC5C,CAFT;AAGAiD,IAAAA,EAAE,EAAEL,IAAI,CAAC3C,CAHT;AAIAiD,IAAAA,EAAE,EAAEL,EAAE,CAAC7C,CAJP;AAKAmD,IAAAA,EAAE,EAAEN,EAAE,CAAC5C,CALP;AAMA6C,IAAAA,IAAI,EAAEA,IANN;AAOAM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB,MAAA;AAP/C,GAAA,EAQIN,SARJ,CAFJ,CAAA,CAAA;AAaD;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@babel/runtime/helpers/objectSpread2"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function i(e){return e&&e.__esModule?e:{default:e}}var l=i(t),c=i(r),o=i(a);function f(t){let{height:r,width:n,children:s,origin:a={x:0,y:0},preserveAspectRatio:i="xMaxYMid meet",innerRef:l,className:c}=t;const o=Math.ceil(n/(n/r));return e.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e.jsx("svg",{style:{overflow:"visible"},className:c,preserveAspectRatio:i,viewBox:"".concat(a.x," ").concat(a.y," ").concat(n," ").concat(o),ref:l,children:s})})}const u=["debounceDelay"],d=["parentRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},p=["y","x","transform","className","children","innerRef"],h=["from","to","fill","className","innerRef"];exports.Group=function(t){let{y:r=0,x:n=0,transform:s,className:a,children:i,innerRef:f}=t,u=c.default(t,p);return e.jsx("g",l.default(l.default({ref:f,className:o.default("visx-group",a),transform:s||"translate(".concat(n,", ").concat(r,")")},u),{},{children:i}))},exports.Line=function(t){let{from:r={x:0,y:0},to:n={x:1,y:1},fill:s="transparent",className:a,innerRef:i}=t,f=c.default(t,h);const u=r.x===n.x||r.y===n.y;return e.jsx("line",l.default({ref:i,className:o.default("visx-line",a),x1:r.x,y1:r.y,x2:n.x,y2:n.y,fill:s,shapeRendering:u?"crispEdges":"auto"},f))},exports.ParentsizeSVG=function(t){let{parentRef:r,children:a,style:i=x,scale:o=1,align:p="none",options:{debounceDelay:h=50}={}}=t,y=c.default(t.options,u),m=c.default(t,d);const{width:v,height:g}=s.useParentSize(r,l.default({debounceDelay:h},y));n.useEffect((()=>{if(r.current)for(const[e,t]of Object.entries(i))r.current.style[e]=t}),[r,i]);const b="center"===p?"translate(".concat(v/2,",").concat(g/2-20,") scale(").concat(o,")"):"translate(0,0) scale(".concat(o,")");return e.jsx(f,l.default(l.default({width:v,height:g},m),{},{children:e.jsx("g",{transform:b,children:a})}))},exports.ResponsiveSVG=f;
|
|
2
2
|
//# sourceMappingURL=svg.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","
|
|
1
|
+
{"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","from","to","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","scale","align","options","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","key","value","Object","entries"],"mappings":"sXAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD4BC,MAE5BA,EAF4BC,SAG5BA,EAH4BC,OAI5BA,EAAS,CAAEC,EAAG,EAAGC,EAAG,GAJQC,oBAK5BA,EAAsB,gBALMC,SAM5BA,EAN4BC,UAO5BA,GACmBT,EACnB,MAEMU,EAAiBC,KAAKC,KAAKV,GAFlBA,EAAQD,IAKrBY,OAAAA,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKd,EAAOC,EAAZ,KAAAa,OAAiBd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,IAET9C,EAFP+C,cAAlCF,QAEyChB,GADtCmB,EACsCpB,EAAA,QAAA5B,EAAAiD,GACnC,MAAA/C,MAAEA,EAAFD,OAASA,GAAWiD,EAAaA,cAACR,EAADZ,UAAA,CAAcgB,cAAAA,GAAkBC,IAEvEI,EAAAA,WAAU,KACR,GAAKT,EAAUU,QAIf,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQ1C,GAExC4B,EAAUU,QAAQtC,MAAMuC,GAAcC,IAEvC,CAACZ,EAAW5B,IAEf,MAAMY,EACM,WAAVkB,EAAA,aAAA1B,OACiBhB,EAAQ,cAAKD,EAAS,EAAI,sBAAa0C,EADxD,KAAA,wBAAAzB,OAE4ByB,EAH9B,KAME9B,OAAAA,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY+C,OAAI7C,SACnDU,EAAGuB,IAAA,IAAA,CAAAV,UAAWA,WAAYvB"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import t from"@babel/runtime/helpers/esm/objectSpread2";import n from"@babel/runtime/helpers/esm/objectWithoutProperties";import{useEffect as r}from"react";import{useParentSize as i}from"@cutting/use-get-parent-size";import o from"classnames";function c(t){let{height:n,width:r,children:i,origin:o={x:0,y:0},preserveAspectRatio:c="xMaxYMid meet",innerRef:s,className:a}=t;const l=Math.ceil(r/(r/n));return e("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:a,preserveAspectRatio:c,viewBox:"".concat(o.x," ").concat(o.y," ").concat(r," ").concat(l),ref:s,children:i})})}const s=["debounceDelay"],a=["parentRef","children","style","scale","align","options"],l={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};function f(o){let{parentRef:f,children:m,style:h=l,scale:p=1,align:d="none",options:{debounceDelay:x=50}={}}=o,u=n(o.options,s),y=n(o,a);const{width:g,height:v}=i(f,t({debounceDelay:x},u));r((()=>{if(f.current)for(const[e,t]of Object.entries(h))f.current.style[e]=t}),[f,h]);const b="center"===d?"translate(".concat(g/2,",").concat(v/2-20,") scale(").concat(p,")"):"translate(0,0) scale(".concat(p,")");return e(c,t(t({width:g,height:v},y),{},{children:e("g",{transform:b,children:m})}))}const m=["y","x","transform","className","children","innerRef"];function h(r){let{y:i=0,x:c=0,transform:s,className:a,children:l,innerRef:f}=r,h=n(r,m);return e("g",t(t({ref:f,className:o("visx-group",a),transform:s||"translate(".concat(c,", ").concat(i,")")},h),{},{children:l}))}const p=["from","to","fill","className","innerRef"];function d(r){let{from:i={x:0,y:0},to:c={x:1,y:1},fill:s="transparent",className:a,innerRef:l}=r,f=n(r,p);const m=i.x===c.x||i.y===c.y;return e("line",t({ref:l,className:o("visx-line",a),x1:i.x,y1:i.y,x2:c.x,y2:c.y,fill:s,shapeRendering:m?"crispEdges":"auto"},f))}export{h as Group,d as Line,f as ParentsizeSVG,c as ResponsiveSVG};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","parentRef","scale","align","options","debounceDelay","optionsRest","_excluded","rest","_objectWithoutProperties","_excluded2","useParentSize","_objectSpread","useEffect","current","key","value","Object","entries","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"2RAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD4BC,MAE5BA,EAF4BC,SAG5BA,EAH4BC,OAI5BA,EAAS,CAAEC,EAAG,EAAGC,EAAG,GAJQC,oBAK5BA,EAAsB,gBALMC,SAM5BA,EAN4BC,UAO5BA,GACmBT,EACnB,MAEMU,EAAiBC,KAAKC,KAAKV,GAFlBA,EAAQD,IAKrBY,OAAAA,EAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,SACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKd,EAAOC,EAAZ,KAAAa,OAAiBd,EAAOE,EAAxB,KAAAY,OAA6BhB,EAA7B,KAAAgB,OAAsCR,GAC7CS,IAAKX,EAAQL,SAEZA,6FC/BIiB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXT,SAAU,UAGI,SAAAU,EAQ2B1B,GARU,IAAA2B,UACnDA,EADmDxB,SAEnDA,EAFmDW,MAGnDA,EAAQM,EAH2CQ,MAInDA,EAAQ,EAJ2CC,MAKnDA,EAAQ,OACRC,SAASC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AyB,EAAA,CAAAnB,IAAKX,EACLC,UAAWuC,EAAG,YAAavC,GAC3B6C,GAAIJ,EAAK7C,EACTkD,GAAIL,EAAK5C,EACTkD,GAAIL,EAAG9C,EACPoD,GAAIN,EAAG7C,EACP8C,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CN"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/objectSpread2"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react"),require("@cutting/use-get-parent-size"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@babel/runtime/helpers/objectSpread2","@babel/runtime/helpers/objectWithoutProperties","react","@cutting/use-get-parent-size","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@cutting/svg"]={},e.jsxRuntime,e._objectSpread,e._objectWithoutProperties,e.React,e.useGetParentSize,e.cx)}(this,(function(e,t,n,r,i,s,a){"use strict";function c(e){return e&&e.__esModule?e:{default:e}}var l=c(n),o=c(r),u=c(a);function f(e){let{height:n,width:r,children:i,origin:s={x:0,y:0},preserveAspectRatio:a="xMaxYMid meet",innerRef:c,className:l}=e;const o=Math.ceil(r/(r/n));return t.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:t.jsx("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:a,viewBox:"".concat(s.x," ").concat(s.y," ").concat(r," ").concat(o),ref:c,children:i})})}const d=["debounceDelay"],p=["parentRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},h=["y","x","transform","className","children","innerRef"],m=["from","to","fill","className","innerRef"];e.Group=function(e){let{y:n=0,x:r=0,transform:i,className:s,children:a,innerRef:c}=e,f=o.default(e,h);return t.jsx("g",l.default(l.default({ref:c,className:u.default("visx-group",s),transform:i||"translate(".concat(r,", ").concat(n,")")},f),{},{children:a}))},e.Line=function(e){let{from:n={x:0,y:0},to:r={x:1,y:1},fill:i="transparent",className:s,innerRef:a}=e,c=o.default(e,m);const f=n.x===r.x||n.y===r.y;return t.jsx("line",l.default({ref:a,className:u.default("visx-line",s),x1:n.x,y1:n.y,x2:r.x,y2:r.y,fill:i,shapeRendering:f?"crispEdges":"auto"},c))},e.ParentsizeSVG=function(e){let{parentRef:n,children:r,style:a=x,scale:c=1,align:u="none",options:{debounceDelay:h=50}={}}=e,m=o.default(e.options,d),y=o.default(e,p);const{width:b,height:g}=s.useParentSize(n,l.default({debounceDelay:h},m));i.useEffect((()=>{if(n.current)for(const[e,t]of Object.entries(a))n.current.style[e]=t}),[n,a]);const j="center"===u?"translate(".concat(b/2,",").concat(g/2-20,") scale(").concat(c,")"):"translate(0,0) scale(".concat(c,")");return t.jsx(f,l.default(l.default({width:b,height:g},y),{},{children:t.jsx("g",{transform:j,children:r})}))},e.ResponsiveSVG=f}));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/umd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","from","to","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","scale","align","options","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","key","value","Object","entries"],"mappings":"6xBAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD4BC,MAE5BA,EAF4BC,SAG5BA,EAH4BC,OAI5BA,EAAS,CAAEC,EAAG,EAAGC,EAAG,GAJQC,oBAK5BA,EAAsB,gBALMC,SAM5BA,EAN4BC,UAO5BA,GACmBT,EACnB,MAEMU,EAAiBC,KAAKC,KAAKV,GAFlBA,EAAQD,IAKrBY,OAAAA,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKd,EAAOC,EAAZ,KAAAa,OAAiBd,EAAOE,EAAxB,KAAAY,OAA6BhB,EAA7B,KAAAgB,OAAsCR,GAC7CS,IAAKX,EAAQL,SAEZA,6FC/BIiB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXT,SAAU,0HCPN,SAQOhB,GARS,IAAAM,EACpBA,EAAI,EADgBD,EAEpBA,EAAI,EAFgBqB,UAGpBA,EAHoBjB,UAI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UU,QAAQtC,MAAMuC,GAAcC,IAEvC,CAACZ,EAAW5B,IAEf,MAAMY,EACM,WAAVkB,EAAA,aAAA1B,OACiBhB,EAAQ,cAAKD,EAAS,EAAI,sBAAa0C,EADxD,KAAA,wBAAAzB,OAE4ByB,EAH9B,KAME9B,OAAAA,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY+C,OAAI7C,SACnDU,EAAGuB,IAAA,IAAA,CAAAV,UAAWA,WAAYvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cutting/svg",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.43.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dagda1/cuttingedge.git"
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"types": "dist/esm/index.d.ts",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cutting/use-get-parent-size": "
|
|
19
|
-
"@cutting/util": "
|
|
18
|
+
"@cutting/use-get-parent-size": "workspace:*",
|
|
19
|
+
"@cutting/util": "workspace:*",
|
|
20
20
|
"classnames": "^2.3.1",
|
|
21
21
|
"resize-observer-polyfill": "^1.5.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/runtime": "7.17.9",
|
|
25
|
-
"@cutting/component-library": "
|
|
26
|
-
"@cutting/devtools": "
|
|
27
|
-
"@cutting/eslint-config": "
|
|
28
|
-
"@cutting/tsconfig": "
|
|
29
|
-
"@cutting/useful-types": "
|
|
25
|
+
"@cutting/component-library": "workspace:*",
|
|
26
|
+
"@cutting/devtools": "workspace:*",
|
|
27
|
+
"@cutting/eslint-config": "workspace:*",
|
|
28
|
+
"@cutting/tsconfig": "workspace:*",
|
|
29
|
+
"@cutting/useful-types": "workspace:*",
|
|
30
30
|
"@jest/globals": "27.5.1",
|
|
31
31
|
"@testing-library/jest-dom": "5.16.4",
|
|
32
32
|
"@testing-library/react": "^13.0.1",
|
|
@@ -42,6 +42,13 @@
|
|
|
42
42
|
"react": ">= 18.x.x",
|
|
43
43
|
"react-dom": ">= 18.x.x"
|
|
44
44
|
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "NODE_ENV=production devtools rollup",
|
|
47
|
+
"lint": "eslint ./src/**/*.{ts,tsx} --fix",
|
|
48
|
+
"start": "PORT=8888 NODE_ENV=development devtools devserver-start",
|
|
49
|
+
"test": "NODE_ENV=test devtools test",
|
|
50
|
+
"test:ci": "CI=true pnpm test"
|
|
51
|
+
},
|
|
45
52
|
"volta": {
|
|
46
53
|
"extends": "../../package.json"
|
|
47
54
|
},
|
|
@@ -56,13 +63,5 @@
|
|
|
56
63
|
"dist/esm/index.d.ts"
|
|
57
64
|
]
|
|
58
65
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
"build": "NODE_ENV=production devtools rollup",
|
|
62
|
-
"lint": "eslint ./src/**/*.{ts,tsx} --fix",
|
|
63
|
-
"start": "PORT=8888 NODE_ENV=development devtools devserver-start",
|
|
64
|
-
"test": "NODE_ENV=test devtools test",
|
|
65
|
-
"test:ci": "CI=true pnpm test"
|
|
66
|
-
},
|
|
67
|
-
"readme": "# @cutting/svg - reusable svg components for SVG documents\n[](https://www.npmjs.com/package/@cutting/svg)\n[](https://github.com/prettier/prettier)\n\n## install \n\n```sh\npnpm add @cutting/svg\n\n# or\n\nnpm install @cutting/svg\n```\n\n## ParentsizeSVG\n\nA react component that will resize and scale to the dimensions of the supplied react [ref object](https://reactjs.org/docs/refs-and-the-dom.html).\n\n\n\nThe `ParentsizeSVG` component takes an `parentRef` prop that should point to a valid HTML DOM element.\n\n## usage\n\n```ts\nimport { useRef } from 'react';\nimport { ParentsizeSVG } from '@cutting/svg';\n\nexport function App(): JSX.Element {\n const ref = useRef<HTMLDivElement>(null);\n\n return (\n <div className={styles.container} ref={ref}>\n <ParentsizeSVG ref={ref}>\n <rect\n x=\"20%\"\n y=\"20%\"\n width={'50%'}\n height={'50%'}\n rx=\"20\"\n style={{ fill: '#ff0000', stroke: '#000000', strokeWidth: '2px' }}\n />\n </ParentsizeSVG>\n </div>\n );\n};\n```"
|
|
68
|
-
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/.coverage/clover.xml
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="1649970808564" clover="3.2.0">
|
|
3
|
-
<project timestamp="1649970808564" name="All files">
|
|
4
|
-
<metrics statements="51" coveredstatements="29" conditionals="33" coveredconditionals="11" methods="5" coveredmethods="3" elements="89" coveredelements="43" complexity="0" loc="51" ncloc="51" packages="4" files="4" classes="4"/>
|
|
5
|
-
<package name="Group">
|
|
6
|
-
<metrics statements="10" coveredstatements="0" conditionals="6" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
7
|
-
<file name="Group.tsx" path="/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Group/Group.tsx">
|
|
8
|
-
<metrics statements="10" coveredstatements="0" conditionals="6" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
9
|
-
<line num="1" count="0" type="stmt"/>
|
|
10
|
-
<line num="17" count="0" type="stmt"/>
|
|
11
|
-
<line num="18" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
12
|
-
<line num="19" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
13
|
-
<line num="20" count="0" type="stmt"/>
|
|
14
|
-
<line num="21" count="0" type="stmt"/>
|
|
15
|
-
<line num="22" count="0" type="stmt"/>
|
|
16
|
-
<line num="23" count="0" type="stmt"/>
|
|
17
|
-
<line num="24" count="0" type="stmt"/>
|
|
18
|
-
<line num="26" count="0" type="stmt"/>
|
|
19
|
-
</file>
|
|
20
|
-
</package>
|
|
21
|
-
<package name="Line">
|
|
22
|
-
<metrics statements="10" coveredstatements="0" conditionals="10" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
23
|
-
<file name="Line.tsx" path="/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Line/Line.tsx">
|
|
24
|
-
<metrics statements="10" coveredstatements="0" conditionals="10" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
25
|
-
<line num="1" count="0" type="stmt"/>
|
|
26
|
-
<line num="14" count="0" type="stmt"/>
|
|
27
|
-
<line num="15" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
28
|
-
<line num="16" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
29
|
-
<line num="17" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
30
|
-
<line num="18" count="0" type="stmt"/>
|
|
31
|
-
<line num="19" count="0" type="stmt"/>
|
|
32
|
-
<line num="20" count="0" type="stmt"/>
|
|
33
|
-
<line num="22" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
34
|
-
<line num="24" count="0" type="stmt"/>
|
|
35
|
-
</file>
|
|
36
|
-
</package>
|
|
37
|
-
<package name="ParentsizeSVG">
|
|
38
|
-
<metrics statements="20" coveredstatements="18" conditionals="13" coveredconditionals="9" methods="2" coveredmethods="2"/>
|
|
39
|
-
<file name="ParentsizeSVG.tsx" path="/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ParentsizeSVG/ParentsizeSVG.tsx">
|
|
40
|
-
<metrics statements="20" coveredstatements="18" conditionals="13" coveredconditionals="9" methods="2" coveredmethods="2"/>
|
|
41
|
-
<line num="2" count="1" type="stmt"/>
|
|
42
|
-
<line num="4" count="1" type="stmt"/>
|
|
43
|
-
<line num="6" count="1" type="stmt"/>
|
|
44
|
-
<line num="18" count="1" type="stmt"/>
|
|
45
|
-
<line num="27" count="1" type="stmt"/>
|
|
46
|
-
<line num="28" count="6" type="stmt"/>
|
|
47
|
-
<line num="29" count="6" type="stmt"/>
|
|
48
|
-
<line num="30" count="6" type="cond" truecount="1" falsecount="1"/>
|
|
49
|
-
<line num="31" count="6" type="cond" truecount="1" falsecount="1"/>
|
|
50
|
-
<line num="32" count="6" type="cond" truecount="2" falsecount="0"/>
|
|
51
|
-
<line num="33" count="6" type="cond" truecount="2" falsecount="2"/>
|
|
52
|
-
<line num="34" count="6" type="stmt"/>
|
|
53
|
-
<line num="36" count="6" type="stmt"/>
|
|
54
|
-
<line num="38" count="6" type="stmt"/>
|
|
55
|
-
<line num="39" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
56
|
-
<line num="40" count="3" type="stmt"/>
|
|
57
|
-
<line num="43" count="0" type="stmt"/>
|
|
58
|
-
<line num="45" count="0" type="stmt"/>
|
|
59
|
-
<line num="50" count="6" type="cond" truecount="2" falsecount="0"/>
|
|
60
|
-
<line num="54" count="6" type="stmt"/>
|
|
61
|
-
</file>
|
|
62
|
-
</package>
|
|
63
|
-
<package name="ResponsiveSVG">
|
|
64
|
-
<metrics statements="11" coveredstatements="11" conditionals="4" coveredconditionals="2" methods="1" coveredmethods="1"/>
|
|
65
|
-
<file name="ResponsiveSVG.tsx" path="/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ResponsiveSVG/ResponsiveSVG.tsx">
|
|
66
|
-
<metrics statements="11" coveredstatements="11" conditionals="4" coveredconditionals="2" methods="1" coveredmethods="1"/>
|
|
67
|
-
<line num="20" count="2" type="stmt"/>
|
|
68
|
-
<line num="21" count="9" type="stmt"/>
|
|
69
|
-
<line num="22" count="9" type="stmt"/>
|
|
70
|
-
<line num="23" count="9" type="stmt"/>
|
|
71
|
-
<line num="24" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
72
|
-
<line num="25" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
73
|
-
<line num="26" count="9" type="stmt"/>
|
|
74
|
-
<line num="27" count="9" type="stmt"/>
|
|
75
|
-
<line num="29" count="9" type="stmt"/>
|
|
76
|
-
<line num="31" count="9" type="stmt"/>
|
|
77
|
-
<line num="33" count="9" type="stmt"/>
|
|
78
|
-
</file>
|
|
79
|
-
</package>
|
|
80
|
-
</project>
|
|
81
|
-
</coverage>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
{"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Group/Group.tsx": {"path":"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Group/Group.tsx","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"1":{"start":{"line":18,"column":2},"end":{"line":18,"column":3}},"2":{"start":{"line":18,"column":3},"end":{"line":18,"column":null}},"3":{"start":{"line":19,"column":2},"end":{"line":19,"column":3}},"4":{"start":{"line":19,"column":3},"end":{"line":19,"column":null}},"5":{"start":{"line":20,"column":11},"end":{"line":20,"column":null}},"6":{"start":{"line":21,"column":11},"end":{"line":21,"column":null}},"7":{"start":{"line":22,"column":10},"end":{"line":22,"column":null}},"8":{"start":{"line":23,"column":10},"end":{"line":23,"column":null}},"9":{"start":{"line":24,"column":14},"end":{"line":24,"column":null}},"10":{"start":{"line":26,"column":2},"end":{"line":26,"column":null}},"11":{"start":{"line":17,"column":0},"end":{"line":17,"column":16}}},"fnMap":{"0":{"name":"Group","decl":{"start":{"line":17,"column":16},"end":{"line":17,"column":22}},"loc":{"start":{"line":25,"column":13},"end":{"line":36,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":18,"column":3},"end":{"line":18,"column":null}},"type":"cond-expr","locations":[{"start":{"line":18,"column":6},"end":{"line":18,"column":7}},{"start":{"line":18,"column":7},"end":{"line":18,"column":null}}]},"1":{"loc":{"start":{"line":19,"column":3},"end":{"line":19,"column":null}},"type":"cond-expr","locations":[{"start":{"line":19,"column":6},"end":{"line":19,"column":7}},{"start":{"line":19,"column":7},"end":{"line":19,"column":null}}]},"2":{"loc":{"start":{"line":30,"column":17},"end":{"line":30,"column":43}},"type":"binary-expr","locations":[{"start":{"line":30,"column":17},"end":{"line":30,"column":26}},{"start":{"line":30,"column":30},"end":{"line":30,"column":43}}]}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0},"f":{"0":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0]}}
|
|
2
|
-
,"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Line/Line.tsx": {"path":"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/Line/Line.tsx","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"1":{"start":{"line":15,"column":2},"end":{"line":15,"column":6}},"2":{"start":{"line":15,"column":6},"end":{"line":15,"column":null}},"3":{"start":{"line":16,"column":2},"end":{"line":16,"column":4}},"4":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"5":{"start":{"line":17,"column":2},"end":{"line":17,"column":6}},"6":{"start":{"line":17,"column":6},"end":{"line":17,"column":null}},"7":{"start":{"line":18,"column":11},"end":{"line":18,"column":null}},"8":{"start":{"line":19,"column":10},"end":{"line":19,"column":null}},"9":{"start":{"line":20,"column":14},"end":{"line":20,"column":null}},"10":{"start":{"line":22,"column":24},"end":{"line":22,"column":null}},"11":{"start":{"line":24,"column":2},"end":{"line":24,"column":null}},"12":{"start":{"line":14,"column":0},"end":{"line":14,"column":16}}},"fnMap":{"0":{"name":"Line","decl":{"start":{"line":14,"column":16},"end":{"line":14,"column":21}},"loc":{"start":{"line":21,"column":41},"end":{"line":37,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":null}},"type":"cond-expr","locations":[{"start":{"line":15,"column":9},"end":{"line":15,"column":11}},{"start":{"line":15,"column":23},"end":{"line":15,"column":null}}]},"1":{"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":null}},"type":"cond-expr","locations":[{"start":{"line":16,"column":7},"end":{"line":16,"column":9}},{"start":{"line":16,"column":21},"end":{"line":16,"column":null}}]},"2":{"loc":{"start":{"line":17,"column":6},"end":{"line":17,"column":null}},"type":"cond-expr","locations":[{"start":{"line":17,"column":9},"end":{"line":17,"column":22}},{"start":{"line":17,"column":22},"end":{"line":17,"column":null}}]},"3":{"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":null}},"type":"binary-expr","locations":[{"start":{"line":22,"column":24},"end":{"line":22,"column":43}},{"start":{"line":22,"column":43},"end":{"line":22,"column":null}}]},"4":{"loc":{"start":{"line":33,"column":22},"end":{"line":33,"column":null}},"type":"cond-expr","locations":[{"start":{"line":33,"column":38},"end":{"line":33,"column":53}},{"start":{"line":33,"column":53},"end":{"line":33,"column":null}}]}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"f":{"0":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0]}}
|
|
3
|
-
,"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ParentsizeSVG/ParentsizeSVG.tsx": {"path":"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ParentsizeSVG/ParentsizeSVG.tsx","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":null}},"1":{"start":{"line":4,"column":0},"end":{"line":4,"column":null}},"2":{"start":{"line":6,"column":0},"end":{"line":6,"column":null}},"3":{"start":{"line":18,"column":13},"end":{"line":18,"column":43}},"4":{"start":{"line":28,"column":11},"end":{"line":28,"column":null}},"5":{"start":{"line":29,"column":10},"end":{"line":29,"column":null}},"6":{"start":{"line":30,"column":2},"end":{"line":30,"column":7}},"7":{"start":{"line":30,"column":7},"end":{"line":30,"column":null}},"8":{"start":{"line":31,"column":2},"end":{"line":31,"column":7}},"9":{"start":{"line":31,"column":7},"end":{"line":31,"column":null}},"10":{"start":{"line":32,"column":2},"end":{"line":32,"column":7}},"11":{"start":{"line":32,"column":7},"end":{"line":32,"column":null}},"12":{"start":{"line":33,"column":2},"end":{"line":33,"column":11}},"13":{"start":{"line":33,"column":2},"end":{"line":33,"column":null}},"14":{"start":{"line":33,"column":13},"end":{"line":33,"column":26}},"15":{"start":{"line":33,"column":26},"end":{"line":33,"column":36}},"16":{"start":{"line":33,"column":47},"end":{"line":33,"column":52}},"17":{"start":{"line":34,"column":9},"end":{"line":34,"column":null}},"18":{"start":{"line":36,"column":28},"end":{"line":36,"column":42}},"19":{"start":{"line":36,"column":15},"end":{"line":36,"column":17}},"20":{"start":{"line":36,"column":23},"end":{"line":36,"column":28}},"21":{"start":{"line":38,"column":2},"end":{"line":38,"column":12}},"22":{"start":{"line":39,"column":4},"end":{"line":41,"column":null}},"23":{"start":{"line":40,"column":6},"end":{"line":40,"column":null}},"24":{"start":{"line":43,"column":4},"end":{"line":46,"column":null}},"25":{"start":{"line":43,"column":31},"end":{"line":43,"column":37}},"26":{"start":{"line":43,"column":52},"end":{"line":43,"column":54}},"27":{"start":{"line":43,"column":15},"end":{"line":43,"column":16}},"28":{"start":{"line":43,"column":19},"end":{"line":43,"column":21}},"29":{"start":{"line":43,"column":26},"end":{"line":43,"column":31}},"30":{"start":{"line":45,"column":6},"end":{"line":45,"column":15}},"31":{"start":{"line":50,"column":4},"end":{"line":52,"column":32}},"32":{"start":{"line":54,"column":2},"end":{"line":54,"column":null}},"33":{"start":{"line":27,"column":0},"end":{"line":27,"column":16}}},"fnMap":{"0":{"name":"ParentsizeSVG","decl":{"start":{"line":27,"column":16},"end":{"line":27,"column":53}},"loc":{"start":{"line":35,"column":43},"end":{"line":59,"column":null}}},"1":{"name":"(anonymous_7)","decl":{"start":{"line":38,"column":12},"end":{"line":38,"column":null}},"loc":{"start":{"line":38,"column":12},"end":{"line":47,"column":5}}}},"branchMap":{"0":{"loc":{"start":{"line":30,"column":7},"end":{"line":30,"column":null}},"type":"cond-expr","locations":[{"start":{"line":30,"column":10},"end":{"line":30,"column":22}},{"start":{"line":30,"column":22},"end":{"line":30,"column":null}}]},"1":{"loc":{"start":{"line":31,"column":7},"end":{"line":31,"column":null}},"type":"cond-expr","locations":[{"start":{"line":31,"column":10},"end":{"line":31,"column":11}},{"start":{"line":31,"column":11},"end":{"line":31,"column":null}}]},"2":{"loc":{"start":{"line":32,"column":7},"end":{"line":32,"column":null}},"type":"cond-expr","locations":[{"start":{"line":32,"column":10},"end":{"line":32,"column":16}},{"start":{"line":32,"column":16},"end":{"line":32,"column":null}}]},"3":{"loc":{"start":{"line":33,"column":2},"end":{"line":33,"column":null}},"type":"cond-expr","locations":[{"start":{"line":33,"column":52},"end":{"line":33,"column":54}},{"start":{"line":33,"column":54},"end":{"line":33,"column":null}}]},"4":{"loc":{"start":{"line":33,"column":26},"end":{"line":33,"column":36}},"type":"cond-expr","locations":[{"start":{"line":33,"column":29},"end":{"line":33,"column":31}},{"start":{"line":33,"column":31},"end":{"line":33,"column":36}}]},"5":{"loc":{"start":{"line":39,"column":4},"end":{"line":41,"column":null}},"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":41,"column":null}}]},"6":{"loc":{"start":{"line":50,"column":4},"end":{"line":52,"column":32}},"type":"cond-expr","locations":[{"start":{"line":51,"column":8},"end":{"line":51,"column":21}},{"start":{"line":52,"column":8},"end":{"line":52,"column":32}}]}},"s":{"0":1,"1":1,"2":1,"3":1,"4":6,"5":6,"6":6,"7":6,"8":6,"9":6,"10":6,"11":6,"12":6,"13":6,"14":6,"15":6,"16":6,"17":6,"18":6,"19":6,"20":6,"21":6,"22":3,"23":3,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":6,"32":6,"33":1},"f":{"0":6,"1":3},"b":{"0":[6,0],"1":[6,0],"2":[4,2],"3":[6,0],"4":[6,0],"5":[3],"6":[2,4]}}
|
|
4
|
-
,"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ResponsiveSVG/ResponsiveSVG.tsx": {"path":"/Users/paulcowan/projects/cuttingedge/packages/svg/src/components/ResponsiveSVG/ResponsiveSVG.tsx","statementMap":{"0":{"start":{"line":21,"column":8},"end":{"line":21,"column":null}},"1":{"start":{"line":22,"column":7},"end":{"line":22,"column":null}},"2":{"start":{"line":23,"column":10},"end":{"line":23,"column":null}},"3":{"start":{"line":24,"column":2},"end":{"line":24,"column":8}},"4":{"start":{"line":24,"column":8},"end":{"line":24,"column":null}},"5":{"start":{"line":25,"column":2},"end":{"line":25,"column":21}},"6":{"start":{"line":25,"column":21},"end":{"line":25,"column":null}},"7":{"start":{"line":26,"column":10},"end":{"line":26,"column":null}},"8":{"start":{"line":27,"column":11},"end":{"line":27,"column":null}},"9":{"start":{"line":29,"column":17},"end":{"line":29,"column":null}},"10":{"start":{"line":31,"column":25},"end":{"line":31,"column":29}},"11":{"start":{"line":33,"column":2},"end":{"line":33,"column":null}},"12":{"start":{"line":20,"column":0},"end":{"line":20,"column":16}}},"fnMap":{"0":{"name":"ResponsiveSVG","decl":{"start":{"line":20,"column":16},"end":{"line":20,"column":30}},"loc":{"start":{"line":28,"column":21},"end":{"line":53,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":24,"column":8},"end":{"line":24,"column":null}},"type":"cond-expr","locations":[{"start":{"line":24,"column":11},"end":{"line":24,"column":13}},{"start":{"line":24,"column":25},"end":{"line":24,"column":null}}]},"1":{"loc":{"start":{"line":25,"column":21},"end":{"line":25,"column":null}},"type":"cond-expr","locations":[{"start":{"line":25,"column":24},"end":{"line":25,"column":39}},{"start":{"line":25,"column":39},"end":{"line":25,"column":null}}]}},"s":{"0":9,"1":9,"2":9,"3":9,"4":9,"5":9,"6":9,"7":9,"8":9,"9":9,"10":9,"11":9,"12":2},"f":{"0":9},"b":{"0":[9,0],"1":[9,0]}}
|
|
5
|
-
}
|