@cutting/svg 4.45.1 → 4.46.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 +2 -2
- package/CHANGELOG.md +28 -0
- package/dist/cjs/svg.cjs.development.js.map +1 -1
- package/dist/cjs/svg.cjs.production.min.js.map +1 -1
- package/dist/esm/components/Group/Group.d.ts +14 -14
- package/dist/esm/components/Group/Group.js +1 -0
- package/dist/esm/components/Group/Group.js.map +1 -0
- package/dist/esm/components/Line/Line.d.ts +11 -11
- package/dist/esm/components/Line/Line.js +1 -0
- package/dist/esm/components/Line/Line.js.map +1 -0
- package/dist/esm/components/ParentsizeSVG/ParentsizeSVG.d.ts +14 -14
- package/dist/esm/components/ParentsizeSVG/ParentsizeSVG.js +1 -0
- package/dist/esm/components/ParentsizeSVG/ParentsizeSVG.js.map +1 -0
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts +17 -17
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.js +1 -0
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.js.map +1 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/types.d.ts +8 -8
- package/dist/esm/types/types.js +1 -0
- package/dist/esm/types/types.js.map +1 -0
- package/dist/tsconfig.dist.tsbuildinfo +1 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +28 -26
- package/cutting-svg-4.45.1.tgz +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@cutting/svg:build: cache hit, replaying output
|
|
1
|
+
@cutting/svg:build: cache hit, replaying output 9413d5a038e790a3
|
|
2
2
|
@cutting/svg:build:
|
|
3
|
-
@cutting/svg:build: > @cutting/svg@4.
|
|
3
|
+
@cutting/svg:build: > @cutting/svg@4.46.0 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
|
|
4
4
|
@cutting/svg:build: > NODE_ENV=production devtools rollup
|
|
5
5
|
@cutting/svg:build:
|
|
6
6
|
@cutting/svg:build: DEBUG using tsconfig.dist.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @cutting/svg
|
|
2
2
|
|
|
3
|
+
## 4.46.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 22f71e166: upgrade all dependencies
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [22f71e166]
|
|
12
|
+
- @cutting/use-get-parent-size@1.20.0
|
|
13
|
+
- @cutting/util@4.52.0
|
|
14
|
+
|
|
15
|
+
## 4.45.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [1781542e]
|
|
20
|
+
- @cutting/util@4.51.0
|
|
21
|
+
- @cutting/use-get-parent-size@1.19.3
|
|
22
|
+
|
|
23
|
+
## 4.45.2
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [f732b2a7]
|
|
28
|
+
- @cutting/util@4.50.2
|
|
29
|
+
- @cutting/use-get-parent-size@1.19.2
|
|
30
|
+
|
|
3
31
|
## 4.45.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -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","_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;
|
|
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;EAAA,IARS;IAC5BC,MAD4B;IAE5BC,KAF4B;IAG5BC,QAH4B;AAI5BC,IAAAA,MAAM,GAAG;AAAEC,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE,CAAA;KAJQ;AAK5BC,IAAAA,mBAAmB,GAAG,eALM;IAM5BC,QAN4B;AAO5BC,IAAAA,SAAAA;GACmB,GAAA,I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AAd,IAAmB4C,IAAI,CAAC3C,CAAL,KAAW4C,EAAE,CAAC5C,CAAvD,CAAA;EAEA,OACEQ,cACE,CAAA,MAAA,EAAAuB,iCAAA,CAAA;AAAAlB,IAAAA,GAAG,EAAEX,QAAL;AACAC,IAAAA,SAAS,EAAEsC,sBAAE,CAAC,WAAD,EAActC,SAAd,CADb;IAEA4C,EAAE,EAAEJ,IAAI,CAAC5C,CAFT;IAGAiD,EAAE,EAAEL,IAAI,CAAC3C,CAHT;IAIAiD,EAAE,EAAEL,EAAE,CAAC7C,CAJP;IAKAmD,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 +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","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","
|
|
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","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","concat"],"mappings":"sXAmBgB,SAAAA,EAQKC,GAAA,IARSC,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,IAIvB,OACEY,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAYb,GAAAA,OAAAA,EAAOC,EAAKD,KAAAA,OAAAA,EAAOE,EAAKJ,KAAAA,OAAAA,EAASQ,KAAAA,OAAAA,GAC7CQ,IAAKV,EAAQL,SAEZA,6FC/BIgB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXR,SAAU,gICPN,SAQOhB,GAAA,IARSM,EACpBA,EAAI,EADgBD,EAEpBA,EAAI,EAFgBoB,UAGpBA,EAHoBhB,UAIpBA,EAJoBN,SAKpBA,EALoBK,SAMpBA,GAEWR,EADR0B,EACQC,EAAA,QAAA3B,EAAA4B,GACX,OACEf,MAAA,IAAAgB,EAAA,QAAAA,UAAA,CACEX,IAAKV,EACLC,UAAWqB,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4Bd,EAH9B,KAKA,OACE7B,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY8C,OAAI5C,SACnDU,EAAGsB,IAAA,IAAA,CAAAV,UAAWA,WAAYtB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
declare type GroupOnlyProps = {
|
|
2
|
-
/** Top offset applied to `<g/>`. */
|
|
3
|
-
y?: number;
|
|
4
|
-
/** Left offset applied to `<g/>`. */
|
|
5
|
-
x?: number;
|
|
6
|
-
/** Override `x` and `y` to provide the entire `transform` string. */
|
|
7
|
-
transform?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
innerRef?: React.Ref<SVGGElement>;
|
|
11
|
-
};
|
|
12
|
-
declare type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
|
|
13
|
-
export declare function Group({ y, x, transform, className, children, innerRef, ...restProps }: GroupProps): JSX.Element;
|
|
14
|
-
export {};
|
|
1
|
+
declare type GroupOnlyProps = {
|
|
2
|
+
/** Top offset applied to `<g/>`. */
|
|
3
|
+
y?: number;
|
|
4
|
+
/** Left offset applied to `<g/>`. */
|
|
5
|
+
x?: number;
|
|
6
|
+
/** Override `x` and `y` to provide the entire `transform` string. */
|
|
7
|
+
transform?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
innerRef?: React.Ref<SVGGElement>;
|
|
11
|
+
};
|
|
12
|
+
declare type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
|
|
13
|
+
export declare function Group({ y, x, transform, className, children, innerRef, ...restProps }: GroupProps): JSX.Element;
|
|
14
|
+
export {};
|
|
15
15
|
//# sourceMappingURL=Group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import cx from"classnames";export function Group({y:r=0,x:s=0,transform:e,className:a,children:n,innerRef:t,...m}){return _jsx("g",{ref:t,className:cx("visx-group",a),transform:e||`translate(${s}, ${r})`,...m,children:n})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAgB5B,MAAM,UAAU,KAAK,CAAC,EACpB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,SAAS,EACD;IACX,OAAO,CACL,YACE,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,EACtC,SAAS,EAAE,SAAS,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,KAC3C,SAAS,YAEZ,QAAQ,GACP,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { AddSVGProps, Point } from '../../types/types';
|
|
2
|
-
export declare type LineProps = {
|
|
3
|
-
className?: string;
|
|
4
|
-
innerRef?: React.Ref<SVGLineElement>;
|
|
5
|
-
fill?: string;
|
|
6
|
-
/** Starting x,y point of the line. */
|
|
7
|
-
from?: Point;
|
|
8
|
-
/** Ending x,y point of the line. */
|
|
9
|
-
to?: Point;
|
|
10
|
-
};
|
|
11
|
-
export declare function Line({ from, to, fill, className, innerRef, ...restProps }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element;
|
|
1
|
+
import type { AddSVGProps, Point } from '../../types/types';
|
|
2
|
+
export declare type LineProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
innerRef?: React.Ref<SVGLineElement>;
|
|
5
|
+
fill?: string;
|
|
6
|
+
/** Starting x,y point of the line. */
|
|
7
|
+
from?: Point;
|
|
8
|
+
/** Ending x,y point of the line. */
|
|
9
|
+
to?: Point;
|
|
10
|
+
};
|
|
11
|
+
export declare function Line({ from, to, fill, className, innerRef, ...restProps }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element;
|
|
12
12
|
//# sourceMappingURL=Line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import cx from"classnames";export function Line({from:e={x:0,y:0},to:s={x:1,y:1},fill:r="transparent",className:x,innerRef:n,...i}){const a=e.x===s.x||e.y===s.y;return _jsx("line",{ref:n,className:cx("visx-line",x),x1:e.x,y1:e.y,x2:s.x,y2:s.y,fill:r,shapeRendering:a?"crispEdges":"auto",...i})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.js","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAa5B,MAAM,UAAU,IAAI,CAAC,EACnB,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EACrB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EACnB,IAAI,GAAG,aAAa,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EAC2B;IACvC,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,eACE,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EACrC,EAAE,EAAE,IAAI,CAAC,CAAC,EACV,EAAE,EAAE,IAAI,CAAC,CAAC,EACV,EAAE,EAAE,EAAE,CAAC,CAAC,EACR,EAAE,EAAE,EAAE,CAAC,CAAC,EACR,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,KACjD,SAAS,GACb,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
|
|
2
|
-
import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
|
|
3
|
-
import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
|
|
4
|
-
declare type Align = 'none' | 'center';
|
|
5
|
-
export declare type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
|
|
6
|
-
parentRef: RefObject<E>;
|
|
7
|
-
style?: CSSProperties;
|
|
8
|
-
align?: Align;
|
|
9
|
-
scale?: number;
|
|
10
|
-
options?: Partial<UseParentSizeOptions>;
|
|
11
|
-
} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;
|
|
12
|
-
export declare const DefaultStyle: CSSProperties;
|
|
13
|
-
export declare function ParentsizeSVG<E extends HTMLElement>({ parentRef, children, style, scale, align, options: { debounceDelay, ...optionsRest }, ...rest }: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null;
|
|
14
|
-
export {};
|
|
1
|
+
import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
|
|
3
|
+
import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
|
|
4
|
+
declare type Align = 'none' | 'center';
|
|
5
|
+
export declare type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
|
|
6
|
+
parentRef: RefObject<E>;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
align?: Align;
|
|
9
|
+
scale?: number;
|
|
10
|
+
options?: Partial<UseParentSizeOptions>;
|
|
11
|
+
} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;
|
|
12
|
+
export declare const DefaultStyle: CSSProperties;
|
|
13
|
+
export declare function ParentsizeSVG<E extends HTMLElement>({ parentRef, children, style, scale, align, options: { debounceDelay, ...optionsRest }, ...rest }: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null;
|
|
14
|
+
export {};
|
|
15
15
|
//# sourceMappingURL=ParentsizeSVG.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect}from"react";import{useParentSize}from"@cutting/use-get-parent-size";import{ResponsiveSVG}from"../ResponsiveSVG/ResponsiveSVG";export const DefaultStyle={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};export function ParentsizeSVG({parentRef:e,children:t,style:r=DefaultStyle,scale:n=1,align:s="none",options:{debounceDelay:i=50,...o}={},...l}){const{width:a,height:c}=useParentSize(e,{debounceDelay:i,...o});useEffect((()=>{if(e.current)for(const[t,n]of Object.entries(r))e.current.style[t]=n}),[e,r]);return _jsx(ResponsiveSVG,{width:a,height:c,...l,children:_jsx("g",{transform:"center"===s?`translate(${a/2},${c/2-20}) scale(${n})`:`translate(0,0) scale(${n})`,children:t})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParentsizeSVG.js","sourceRoot":"","sources":["../../../../src/components/ParentsizeSVG/ParentsizeSVG.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAY/D,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,QAAQ;CACV,CAAC;AAEX,MAAM,UAAU,aAAa,CAAwB,EACnD,SAAS,EACT,QAAQ,EACR,KAAK,GAAG,YAAY,EACpB,KAAK,GAAG,CAAC,EACT,KAAK,GAAG,MAAM,EACd,OAAO,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,EAAE,EACpD,GAAG,IAAI,EACkC;IACzC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;IAEtF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YACtB,OAAO;SACR;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAChD,8DAA8D;YAC9D,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAU,CAAC,GAAG,KAAK,CAAC;SAC7C;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,MAAM,SAAS,GACb,KAAK,KAAK,QAAQ;QAChB,CAAC,CAAC,aAAa,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,GAAG;QAC9D,CAAC,CAAC,wBAAwB,KAAK,GAAG,CAAC;IAEvC,OAAO,CACL,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAM,IAAI,YACnD,YAAG,SAAS,EAAE,SAAS,YAAG,QAAQ,GAAK,GACzB,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { ReactNode, Ref } from 'react';
|
|
2
|
-
import type { PreserveAspectRatio } from '../../types/types';
|
|
3
|
-
export interface Point {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ResponsiveSVGProps {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
origin?: Point;
|
|
11
|
-
preserveAspectRatio?: PreserveAspectRatio;
|
|
12
|
-
innerRef?: Ref<SVGSVGElement>;
|
|
13
|
-
className?: string;
|
|
14
|
-
hide?: boolean;
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, }: ResponsiveSVGProps): JSX.Element;
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
|
+
import type { PreserveAspectRatio } from '../../types/types';
|
|
3
|
+
export interface Point {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ResponsiveSVGProps {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
origin?: Point;
|
|
11
|
+
preserveAspectRatio?: PreserveAspectRatio;
|
|
12
|
+
innerRef?: Ref<SVGSVGElement>;
|
|
13
|
+
className?: string;
|
|
14
|
+
hide?: boolean;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, }: ResponsiveSVGProps): JSX.Element;
|
|
18
18
|
//# sourceMappingURL=ResponsiveSVG.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";export function ResponsiveSVG({height:e,width:i,children:s,origin:t={x:0,y:0},preserveAspectRatio:r="xMaxYMid meet",innerRef:o,className:n}){const a=i/e,c=Math.ceil(i/a);return _jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:_jsx("svg",{style:{overflow:"visible"},className:n,preserveAspectRatio:r,viewBox:`${t.x} ${t.y} ${i} ${c}`,ref:o,children:s})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponsiveSVG.js","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":";AAmBA,MAAM,UAAU,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EACvB,mBAAmB,GAAG,eAAe,EACrC,QAAQ,EACR,SAAS,GACU;IACnB,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAE9B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAEjD,OAAO,CACL,+BACgB,uBAAuB,EACrC,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,KAAK;SACd,YAED,cACE,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAC9B,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,cAAc,EAAE,EAC7D,GAAG,EAAE,QAAQ,YAEZ,QAAQ,GACL,GACF,CACP,CAAC;AACJ,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { Point } from './types/types';
|
|
2
|
-
export { ResponsiveSVG } from './components/ResponsiveSVG/ResponsiveSVG';
|
|
3
|
-
export { ParentsizeSVG } from './components/ParentsizeSVG/ParentsizeSVG';
|
|
4
|
-
export { Group } from './components/Group/Group';
|
|
5
|
-
export { Line } from './components/Line/Line';
|
|
1
|
+
export type { Point } from './types/types';
|
|
2
|
+
export { ResponsiveSVG } from './components/ResponsiveSVG/ResponsiveSVG';
|
|
3
|
+
export { ParentsizeSVG } from './components/ParentsizeSVG/ParentsizeSVG';
|
|
4
|
+
export { Group } from './components/Group/Group';
|
|
5
|
+
export { Line } from './components/Line/Line';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{ResponsiveSVG}from"./components/ResponsiveSVG/ResponsiveSVG";export{ParentsizeSVG}from"./components/ParentsizeSVG/ParentsizeSVG";export{Group}from"./components/Group/Group";export{Line}from"./components/Line/Line";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare type PreserveAspectRatioAlignment = 'xMinYMin' | 'xMidYMin' | 'xMaxYMin' | 'xMinYMid' | 'xMidYMid' | 'xMaxYMid' | 'xMinYMax' | 'xMidYMax' | 'xMaxYMax';
|
|
2
|
-
export declare type MeetOrSlice = 'meet' | 'slice';
|
|
3
|
-
export declare type PreserveAspectRatio = `${PreserveAspectRatioAlignment} ${MeetOrSlice}`;
|
|
4
|
-
export declare type AddSVGProps<Props, Element extends SVGElement> = Props & Omit<React.SVGProps<Element>, keyof Props>;
|
|
5
|
-
export interface Point {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}
|
|
1
|
+
export declare type PreserveAspectRatioAlignment = 'xMinYMin' | 'xMidYMin' | 'xMaxYMin' | 'xMinYMid' | 'xMidYMid' | 'xMaxYMid' | 'xMinYMax' | 'xMidYMax' | 'xMaxYMax';
|
|
2
|
+
export declare type MeetOrSlice = 'meet' | 'slice';
|
|
3
|
+
export declare type PreserveAspectRatio = `${PreserveAspectRatioAlignment} ${MeetOrSlice}`;
|
|
4
|
+
export declare type AddSVGProps<Props, Element extends SVGElement> = Props & Omit<React.SVGProps<Element>, keyof Props>;
|
|
5
|
+
export interface Point {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/@types/react/global.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react/jsx-runtime.d.ts","../src/types/types.ts","../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../node_modules/@cutting/use-get-parent-size/node_modules/@types/react/index.d.ts","../node_modules/@cutting/use-get-parent-size/dist/esm/useParentSize/types.d.ts","../node_modules/@cutting/use-get-parent-size/dist/esm/useParentSize/useParentSize.d.ts","../node_modules/@cutting/use-get-parent-size/dist/esm/index.d.ts","../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../node_modules/classnames/index.d.ts","../src/components/Group/Group.tsx","../src/components/Line/Line.tsx","../src/index.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../node_modules/@cutting/useful-types/global.d.ts","../node_modules/@cutting/use-get-parent-size/node_modules/@types/react/global.d.ts"],"fileInfos":[{"version":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","affectsGlobalScope":true},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"e7e7eec1dd67134d37fc1f14d19b45de9cff9bdde6cb3961b7de2a277df48029","affectsGlobalScope":true},"af7fd2870746deed40e130fc0a3966de74e8f52a97ec114d0fbb35876ab05ca9",{"version":"fdc2fb7650d20725b5071c5ab1f88167aa7fed7d5bcdfd7587e0ebe7098bde81","signature":"959e2ef70bc5df87567f36fe46af3f1aa7dfe5c4924337becbb80a9d91fa7a0e"},{"version":"1296a5ce9e4c670487d9a95d3b89d726918ec1075bdacc2abdc15178e9e3ee3e","signature":"cfb670fe86a93086e635a4003e5fb3f472cfe19d35b88c0fa2d6e0d08103ae8f"},{"version":"e7e7eec1dd67134d37fc1f14d19b45de9cff9bdde6cb3961b7de2a277df48029","affectsGlobalScope":true},"5be5cef57c4f2ed975d5c25b0f80c90743d30a81070130c72950c97ff07dd081","a07f5f79ed2f1890657db5a8c58221cb9f83d7f0609cb4ea888af4161c061592","c69a59e3e36c8e6ccfbf742458a188e2a929015ed6718d430419401353bc9fc3",{"version":"6d46dc874cb5d3eb8eff45cd960740ea4ab82cb181d4364b39e4f7256c5d8373","signature":"df9df6f6337ba34ed7893c3d22891677b4c30d315d1fecdb33dc3d2fbcf3bbd0"},"d153cbce75b7e1621eda0a4148748f44edd71ff44cc5351bac1c7787da4d5b05",{"version":"c72b9978350f95cdb683c82a639306adf59962a9b0df225fb34bc6f564db8916","signature":"748084edc9b2cd8f3ce4bb4b51c3198a9658b1846d40ecee0d04be5a7b65eaf3"},{"version":"556899aeccc161beaef2eb2da06268b3a40b62ddb533ff840838865ad5a33094","signature":"88a16163f49d837b55101c13530a1dc38ab21069d8fb9fafa740f6bacbfa17fa"},"b6c3dfc96aa0449be1e1fcfc75d0636360a897f060993846b62ade1584fbe3c7","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"e5979905796fe2740d85fbaf4f11f42b7ee1851421afe750823220813421b1af",{"version":"fcdcb42da18dd98dc286b1876dd425791772036012ae61263c011a76b13a190f","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5b30f550565fd0a7524282c81c27fe8534099e2cd26170ca80852308f07ae68d","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","d97cd8a4a42f557fc62271369ed0461c8e50d47b7f9c8ad0b5462f53306f6060","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"58df92fa3b18e84865bb0d2fe4b9d2d5bcb9952d4548c871f10ef02702b386f8","52f38aecbb24bebde0b7a0203a686902fc6be930bd0cdb80f482441e4f56fd7d","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","063f53ff674228c190efa19dd9448bcbd540acdbb48a928f4cf3a1b9f9478e43","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"963fe86b2ebd07a34b92b52c6532ab45ec5ccda218a6c477de354fcad2aae0cb","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"9f8dd3922db205bc8a362a6b18078708fd699185b11648522159cbf3743561b5","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","821dcb2b571bf698841d8ec25fde9d5f615ef3958957227962602f9dbfa8d800","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"f234fa210fdce190f851211bccf105301f62736fe9d536aed1abc1639967fdec","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","103d70bfbeb3cd3a3f26d1705bf986322d8738c2c143f38ebb743b1e228d7444","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"aee3379fb20741a337a779530cc3e608aba5f34776511033d1d2db7ca45c4193",{"version":"3a6de361cea25e21054d8f8a8e35c5c0df730982f9b9fb613a6e9029e54071e5","affectsGlobalScope":true},{"version":"bcaa86fe5b4017046d3ea6ccd8f06e4a65f15ebf6d8b5dc320c0efdcaf08a61a","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"downlevelIteration":true,"esModuleInterop":true,"jsx":4,"module":99,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"outDir":"./esm","removeComments":false,"rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":99},"fileIdsList":[[101],[58,101],[61,101],[62,67,101],[63,73,74,81,90,100,101],[63,64,73,81,101],[65,101],[66,67,74,82,101],[67,90,97,101],[68,70,73,81,101],[69,101],[70,71,101],[72,73,101],[73,101],[73,74,75,90,100,101],[73,74,75,90,93,101],[101,105],[76,81,90,100,101],[73,74,76,77,81,90,97,100,101],[76,78,90,97,100,101],[58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107],[73,79,101],[80,100,101],[70,73,81,90,101],[82,101],[83,101],[61,84,101],[85,99,101,105],[86,101],[87,101],[73,88,101],[88,89,101,103],[73,90,91,92,101],[90,92,101],[90,91,101],[93,101],[94,101],[73,95,96,101],[95,96,101],[67,81,90,97,101],[98,101],[81,99,101],[62,76,87,100,101],[67,101],[90,101,102],[101,103],[101,104],[62,67,73,75,84,90,100,101,103,105],[90,101,106],[50,51,101],[45,101],[45,50,101],[43,44,101,111],[42,43,44,101],[46,54,101],[46,47,54,101],[45,46,48,52,101],[45,46,47,101],[46,47,48,53,55,56,101],[46,101],[47],[45,48,52],[45,47]],"referencedMap":[[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[58,2],[59,2],[61,3],[62,4],[63,5],[64,6],[65,7],[66,8],[67,9],[68,10],[69,11],[70,12],[71,12],[72,13],[73,14],[74,15],[75,16],[60,17],[107,1],[76,18],[77,19],[78,20],[108,21],[79,22],[80,23],[81,24],[82,25],[83,26],[84,27],[85,28],[86,29],[87,30],[88,31],[89,32],[90,33],[92,34],[91,35],[93,36],[94,37],[95,38],[96,39],[97,40],[98,41],[99,42],[100,43],[101,44],[102,45],[103,46],[104,47],[105,48],[106,49],[43,1],[44,1],[109,1],[52,50],[50,51],[51,52],[49,53],[110,1],[42,1],[45,54],[46,51],[54,1],[55,55],[56,56],[53,57],[48,58],[57,59],[47,60]],"exportedModulesMap":[[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[58,2],[59,2],[61,3],[62,4],[63,5],[64,6],[65,7],[66,8],[67,9],[68,10],[69,11],[70,12],[71,12],[72,13],[73,14],[74,15],[75,16],[60,17],[107,1],[76,18],[77,19],[78,20],[108,21],[79,22],[80,23],[81,24],[82,25],[83,26],[84,27],[85,28],[86,29],[87,30],[88,31],[89,32],[90,33],[92,34],[91,35],[93,36],[94,37],[95,38],[96,39],[97,40],[98,41],[99,42],[100,43],[101,44],[102,45],[103,46],[104,47],[105,48],[106,49],[43,1],[44,1],[109,1],[52,50],[50,51],[51,52],[49,53],[110,1],[42,1],[45,54],[46,51],[54,1],[56,61],[53,62],[48,63],[57,59]],"semanticDiagnosticsPerFile":[8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,58,59,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,60,107,76,77,78,108,79,80,81,82,83,84,85,86,87,88,89,90,92,91,93,94,95,96,97,98,99,100,101,102,103,104,105,106,43,44,109,52,50,51,49,110,42,45,46,54,55,56,53,48,57,47]},"version":"4.7.3"}
|
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","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","
|
|
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","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","concat"],"mappings":"6xBAmBgB,SAAAA,EAQKC,GAAA,IARSC,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,IAIvB,OACEY,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAYb,GAAAA,OAAAA,EAAOC,EAAKD,KAAAA,OAAAA,EAAOE,EAAKJ,KAAAA,OAAAA,EAASQ,KAAAA,OAAAA,GAC7CQ,IAAKV,EAAQL,SAEZA,6FC/BIgB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW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IAEvEI,EAAAA,WAAU,KACR,GAAKT,EAAUU,QAIf,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQzC,GAExC2B,EAAUU,QAAQrC,MAAMsC,GAAcC,IAEvC,CAACZ,EAAW3B,IAEf,MAAMW,EACM,WAAVkB,EAAA,aAAAa,OACiBtD,EAAQ,cAAKD,EAAS,EAAI,sBAAayC,EADxD,KAAA,wBAAAc,OAE4Bd,EAH9B,KAKA,OACE7B,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY8C,OAAI5C,SACnDU,EAAGsB,IAAA,IAAA,CAAAV,UAAWA,WAAYtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cutting/svg",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.46.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dagda1/cuttingedge.git"
|
|
@@ -15,40 +15,35 @@
|
|
|
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": "1.20.0",
|
|
19
|
+
"@cutting/util": "4.52.0",
|
|
20
20
|
"classnames": "^2.3.1",
|
|
21
21
|
"resize-observer-polyfill": "^1.5.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/runtime": "7.
|
|
25
|
-
"@cutting/component-library": "
|
|
26
|
-
"@cutting/devtools": "
|
|
27
|
-
"@cutting/eslint-config": "
|
|
28
|
-
"@cutting/tsconfig": "
|
|
29
|
-
"@cutting/useful-types": "
|
|
30
|
-
"@jest/globals": "
|
|
24
|
+
"@babel/runtime": "7.18.3",
|
|
25
|
+
"@cutting/component-library": "5.27.0",
|
|
26
|
+
"@cutting/devtools": "4.55.0",
|
|
27
|
+
"@cutting/eslint-config": "4.41.0",
|
|
28
|
+
"@cutting/tsconfig": "4.38.0",
|
|
29
|
+
"@cutting/useful-types": "4.36.1",
|
|
30
|
+
"@jest/globals": "28.1.0",
|
|
31
31
|
"@testing-library/jest-dom": "5.16.4",
|
|
32
|
-
"@testing-library/react": "^13.0
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@vanilla-extract/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
32
|
+
"@testing-library/react": "^13.3.0",
|
|
33
|
+
"@types/react": "18.0.11",
|
|
34
|
+
"@types/react-dom": "18.0.5",
|
|
35
|
+
"@vanilla-extract/babel-plugin": "1.1.6",
|
|
36
|
+
"@vanilla-extract/css": "^1.7.1",
|
|
37
|
+
"@vanilla-extract/sprinkles": "1.4.1",
|
|
38
|
+
"eslint": "8.17.0",
|
|
39
|
+
"react": "18.1.0",
|
|
40
|
+
"react-dom": "18.1.0",
|
|
41
|
+
"typescript": "4.7.3"
|
|
40
42
|
},
|
|
41
43
|
"peerDependencies": {
|
|
42
44
|
"react": ">= 18.x.x",
|
|
43
45
|
"react-dom": ">= 18.x.x"
|
|
44
46
|
},
|
|
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
|
-
},
|
|
52
47
|
"volta": {
|
|
53
48
|
"extends": "../../package.json"
|
|
54
49
|
},
|
|
@@ -63,5 +58,12 @@
|
|
|
63
58
|
"dist/esm/index.d.ts"
|
|
64
59
|
]
|
|
65
60
|
}
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "NODE_ENV=production devtools rollup",
|
|
64
|
+
"lint": "eslint ./src/**/*.{ts,tsx} --fix",
|
|
65
|
+
"start": "PORT=8888 NODE_ENV=development devtools devserver-start",
|
|
66
|
+
"test": "NODE_ENV=test devtools test",
|
|
67
|
+
"test:ci": "CI=true pnpm test"
|
|
66
68
|
}
|
|
67
|
-
}
|
|
69
|
+
}
|
package/cutting-svg-4.45.1.tgz
DELETED
|
Binary file
|