@cutting/svg 4.54.9 → 4.54.11
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 +1 -1
- package/CHANGELOG.md +16 -0
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts +2 -1
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +14 -14
- package/src/components/ResponsiveSVG/ResponsiveSVG.tsx +3 -1
- package/vite.config.ts +1 -4
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @cutting/svg
|
|
2
2
|
|
|
3
|
+
## 4.54.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9d181d61: update major dependencies
|
|
8
|
+
- Updated dependencies [9d181d61]
|
|
9
|
+
- @cutting/react-abortable-fetch@0.36.4
|
|
10
|
+
- @cutting/use-get-parent-size@2.1.5
|
|
11
|
+
- @cutting/util@4.58.4
|
|
12
|
+
|
|
13
|
+
## 4.54.10
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- bab1082d: make ResponsiveSVG overflow prop
|
|
18
|
+
|
|
3
19
|
## 4.54.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ export type ResponsiveSVGProps = SVGAttributes<{
|
|
|
13
13
|
className?: string;
|
|
14
14
|
hide?: boolean;
|
|
15
15
|
children: ReactNode;
|
|
16
|
+
overflow?: 'hidden' | 'visible';
|
|
16
17
|
}>;
|
|
17
|
-
export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, ...props }: ResponsiveSVGProps): JSX.Element;
|
|
18
|
+
export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, overflow, ...props }: ResponsiveSVGProps): JSX.Element;
|
|
18
19
|
//# sourceMappingURL=ResponsiveSVG.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CACjC,CAAC,CAAC;AAEH,wBAAgB,aAAa,CAAC,EAC5B,MAAU,EACV,KAAS,EACT,QAAQ,EACR,MAAuB,EACvB,mBAAqC,EACrC,QAAQ,EACR,SAAS,EACT,QAAoB,EACpB,GAAG,KAAK,EACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA0BlC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useParentSize as t}from"@cutting/use-get-parent-size";import i from"classnames";function r({height:t=0,width:i=0,children:r,origin:n={x:0,y:0},preserveAspectRatio:s="xMaxYMid meet",innerRef:
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useParentSize as t}from"@cutting/use-get-parent-size";import i from"classnames";function r({height:t=0,width:i=0,children:r,origin:n={x:0,y:0},preserveAspectRatio:s="xMaxYMid meet",innerRef:o,className:a,overflow:l="visible",...c}){const h=Math.ceil(i/(0===t?1:i/t));return e("div",{"data-testid":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"0px"},children:e("svg",{style:{overflow:l,width:"100%",height:"auto"},className:a,preserveAspectRatio:s,viewBox:`${n.x} ${n.y} ${i} ${h}`,ref:o,...c,children:r})})}function n({parentRef:i,children:n,options:s,...o}){const{width:a,height:l}=t(i,s);return e(r,{width:a,height:l,...o,children:n})}function s({y:t=0,x:r=0,transform:n,className:s,children:o,innerRef:a,...l}){return e("g",{ref:a,className:i("visx-group",s),transform:n||`translate(${r}, ${t})`,...l,children:o})}function o({from:t={x:0,y:0},to:r={x:1,y:1},fill:n="transparent",className:s,innerRef:o,...a}){const l=t.x===r.x||t.y===r.y;return e("line",{ref:o,className:i("visx-line",s),x1:t.x,y1:t.y,x2:r.x,y2:r.y,fill:n,shapeRendering:l?"crispEdges":"auto",...a})}export{s as Group,o as Line,n as ParentsizeSVG,r 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, SVGAttributes } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport type ResponsiveSVGProps = SVGAttributes<{\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 = 0,\n width = 0,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n ...props\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = height === 0 ? 1 : width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-testid=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '0px',\n }}\n >\n <svg\n style={{ overflow
|
|
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, SVGAttributes } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport type ResponsiveSVGProps = SVGAttributes<{\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 overflow?: 'hidden' | 'visible';\n}>;\n\nexport function ResponsiveSVG({\n height = 0,\n width = 0,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n overflow = 'visible',\n ...props\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = height === 0 ? 1 : width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-testid=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '0px',\n }}\n >\n <svg\n style={{ overflow, width: '100%', height: 'auto' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n {...props}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { PropsWithChildren, RefObject } from 'react';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG.js';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n options,\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, options);\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n {children}\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","overflow","props","adjustedHeight","Math","ceil","_jsx","style","position","viewBox","ref","ParentsizeSVG","parentRef","options","rest","useParentSize","Group","transform","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"wIAoBgBA,GAAcC,OAC5BA,EAAS,EAACC,MACVA,EAAQ,EAACC,SACTA,EAAQC,OACRA,EAAS,CAAEC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KzB,EACT8B,GAAIL,EAAKxB,EACT8B,GAAIL,EAAG1B,EACPgC,GAAIN,EAAGzB,EACP0B,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,UAC3CN,GAGV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cutting/svg",
|
|
3
|
-
"version": "4.54.
|
|
3
|
+
"version": "4.54.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dagda1/cuttingedge.git"
|
|
@@ -13,28 +13,28 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"classnames": "^2.3.2",
|
|
15
15
|
"resize-observer-polyfill": "^1.5.1",
|
|
16
|
-
"@cutting/react-abortable-fetch": "0.36.
|
|
17
|
-
"@cutting/use-get-parent-size": "2.1.
|
|
18
|
-
"@cutting/util": "4.58.
|
|
16
|
+
"@cutting/react-abortable-fetch": "0.36.4",
|
|
17
|
+
"@cutting/use-get-parent-size": "2.1.5",
|
|
18
|
+
"@cutting/util": "4.58.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@testing-library/dom": "^9.3.
|
|
21
|
+
"@testing-library/dom": "^9.3.3",
|
|
22
22
|
"@testing-library/react": "14.0.0",
|
|
23
|
-
"@testing-library/user-event": "14.
|
|
24
|
-
"@types/react": "18.2.
|
|
25
|
-
"@types/react-dom": "18.2.
|
|
26
|
-
"@vanilla-extract/css": "^1.
|
|
23
|
+
"@testing-library/user-event": "14.5.1",
|
|
24
|
+
"@types/react": "18.2.33",
|
|
25
|
+
"@types/react-dom": "18.2.14",
|
|
26
|
+
"@vanilla-extract/css": "^1.13.0",
|
|
27
27
|
"@vanilla-extract/sprinkles": "1.6.1",
|
|
28
28
|
"@visx/scale": "^3.3.0",
|
|
29
29
|
"d3-scale": "4.0.2",
|
|
30
30
|
"assert-ts": "0.3.4",
|
|
31
|
-
"eslint": "8.
|
|
31
|
+
"eslint": "8.52.0",
|
|
32
32
|
"react": "18.2.0",
|
|
33
33
|
"react-dom": "18.2.0",
|
|
34
|
-
"typescript": "5.
|
|
35
|
-
"@cutting/component-library": "5.41.
|
|
36
|
-
"@cutting/devtools": "4.63.
|
|
37
|
-
"@cutting/eslint-config": "4.
|
|
34
|
+
"typescript": "5.2.2",
|
|
35
|
+
"@cutting/component-library": "5.41.14",
|
|
36
|
+
"@cutting/devtools": "4.63.3",
|
|
37
|
+
"@cutting/eslint-config": "4.45.1",
|
|
38
38
|
"@cutting/tsconfig": "4.40.1",
|
|
39
39
|
"@cutting/useful-types": "4.40.1"
|
|
40
40
|
},
|
|
@@ -15,6 +15,7 @@ export type ResponsiveSVGProps = SVGAttributes<{
|
|
|
15
15
|
className?: string;
|
|
16
16
|
hide?: boolean;
|
|
17
17
|
children: ReactNode;
|
|
18
|
+
overflow?: 'hidden' | 'visible';
|
|
18
19
|
}>;
|
|
19
20
|
|
|
20
21
|
export function ResponsiveSVG({
|
|
@@ -25,6 +26,7 @@ export function ResponsiveSVG({
|
|
|
25
26
|
preserveAspectRatio = 'xMaxYMid meet',
|
|
26
27
|
innerRef,
|
|
27
28
|
className,
|
|
29
|
+
overflow = 'visible',
|
|
28
30
|
...props
|
|
29
31
|
}: ResponsiveSVGProps): JSX.Element {
|
|
30
32
|
const aspect = height === 0 ? 1 : width / height;
|
|
@@ -41,7 +43,7 @@ export function ResponsiveSVG({
|
|
|
41
43
|
}}
|
|
42
44
|
>
|
|
43
45
|
<svg
|
|
44
|
-
style={{ overflow
|
|
46
|
+
style={{ overflow, width: '100%', height: 'auto' }}
|
|
45
47
|
className={className}
|
|
46
48
|
preserveAspectRatio={preserveAspectRatio}
|
|
47
49
|
viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}
|
package/vite.config.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
/// <reference types="vite/client" />
|
|
3
|
-
|
|
4
1
|
import react from '@vitejs/plugin-react';
|
|
5
|
-
import { defineConfig } from '
|
|
2
|
+
import { defineConfig } from 'vitest/config';
|
|
6
3
|
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
|
7
4
|
|
|
8
5
|
const isTest = process.env.NODE_ENV === 'test';
|