Skip to content

Commit 0cc3878

Browse files
authored
Merge pull request #105 from Kitware/export-types
feat(types): export types
2 parents 8498487 + 5647188 commit 0cc3878

19 files changed

+77
-44
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"type": "module",
99
"main": "dist/umd/react-vtk.js",
1010
"module": "dist/esm/index.js",
11+
"types": "dist/esm/src/index.d.ts",
1112
"source": "src/index.ts",
1213
"dependencies": {
1314
"@babel/eslint-parser": "^7.19.1",

src/core/Algorithm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
useRepresentation,
1313
} from './contexts';
1414

15-
interface Props extends PropsWithChildren {
15+
export interface AlgorithmProps extends PropsWithChildren {
1616
/**
1717
* Can either be a string containing the name of the vtkClass or a vtk object constructor.
1818
*
@@ -29,7 +29,7 @@ interface Props extends PropsWithChildren {
2929
port?: number;
3030
}
3131

32-
export default function Algorithm(props: Props) {
32+
export default function Algorithm(props: AlgorithmProps) {
3333
const prev = usePrevious(props);
3434
const { vtkClass, state, port = 0 } = props;
3535

src/core/DataArray.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { usePrevious } from '../utils/usePrevious';
1010
import useUnmount from '../utils/useUnmount';
1111
import { useDataset, useFieldData } from './contexts';
1212

13-
interface Props {
13+
export interface DataArrayProps {
1414
/**
1515
* The ID used to identify this component.
1616
*/
@@ -49,7 +49,7 @@ const DefaultProps = {
4949
numberOfComponents: 1,
5050
};
5151

52-
export default function DataArray(props: Props) {
52+
export default function DataArray(props: DataArrayProps) {
5353
const prev = usePrevious({ ...DefaultProps, ...props });
5454

5555
const [daRef, getDataArray] = useGetterRef(() => {

src/core/Geometry2DRepresentation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import useCoordinate from './modules/useCoordinate';
3030
import useMapper from './modules/useMapper';
3131
import useProp from './modules/useProp';
3232

33-
interface Props extends PropsWithChildren {
33+
export interface Geometry2DRepresentationProps extends PropsWithChildren {
3434
/**
3535
* The ID used to identify this component.
3636
*/
@@ -76,7 +76,7 @@ const DefaultProps = {
7676
};
7777

7878
export default forwardRef(function Geometry2DRepresentation(
79-
props: Props,
79+
props: Geometry2DRepresentationProps,
8080
fwdRef
8181
) {
8282
const [modifiedRef, trackModified, resetModified] = useBooleanAccumulator();

src/core/GeometryRepresentation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import useColorTransferFunction from './modules/useColorTransferFunction';
2727
import useMapper from './modules/useMapper';
2828
import useProp from './modules/useProp';
2929

30-
interface Props extends PropsWithChildren {
30+
export interface GeometryRepresentationProps extends PropsWithChildren {
3131
/**
3232
* The ID used to identify this component.
3333
*/
@@ -96,7 +96,7 @@ const DefaultProps = {
9696
};
9797

9898
export default forwardRef(function GeometryRepresentation(
99-
props: Props,
99+
props: GeometryRepresentationProps,
100100
fwdRef
101101
) {
102102
const [modifiedRef, trackModified, resetModified] = useBooleanAccumulator();

src/core/ImageData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useGetterRef from '../utils/useGetterRef';
1313
import useUnmount from '../utils/useUnmount';
1414
import { DatasetContext, useDownstream, useRepresentation } from './contexts';
1515

16-
interface Props extends PropsWithChildren {
16+
export interface ImageDataProps extends PropsWithChildren {
1717
/**
1818
* downstream connection port
1919
*/
@@ -48,7 +48,7 @@ const DefaultProps = {
4848
direction: [1, 0, 0, 0, 1, 0, 0, 0, 1] as Matrix3x3,
4949
};
5050

51-
export default forwardRef(function PolyData(props: Props, fwdRef) {
51+
export default forwardRef(function PolyData(props: ImageDataProps, fwdRef) {
5252
const {
5353
port = DefaultProps.port,
5454
dimensions = DefaultProps.dimensions,

src/core/MultiViewRoot.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ import {
1313
} from '../utils/ResizeWatcher';
1414
import { MultiViewRootContext } from './contexts';
1515
import OpenGLRenderWindow, {
16-
Props as OpenGLRenderWindowProps,
16+
OpenGLRenderWindowProps,
1717
} from './OpenGLRenderWindow';
1818
import RenderWindow from './RenderWindow';
1919

20-
interface Props extends PropsWithChildren, OpenGLRenderWindowProps {}
20+
export interface MultiViewRootProps
21+
extends PropsWithChildren,
22+
OpenGLRenderWindowProps {}
2123

2224
const RW_STYLE: CSSProperties = {
2325
pointerEvents: 'none',
2426
};
2527

26-
export default function MultiViewRoot(props: Props) {
28+
export default function MultiViewRoot(props: MultiViewRootProps) {
2729
const openGLRenderWindowRef = useRef<IOpenGLRenderWindow | null>(null);
2830
const renderWindowRef = useRef<IRenderWindow | null>(null);
2931
const resizeWatcherRef = useRef<IResizeWatcher>(new ResizeWatcher());

src/core/OpenGLRenderWindow.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ const RENDERWINDOW_STYLE: CSSProperties = {
2222
overflow: 'hidden',
2323
};
2424

25-
export interface Props extends PropsWithChildren, HTMLProps<HTMLDivElement> {
25+
export interface OpenGLRenderWindowProps
26+
extends PropsWithChildren,
27+
HTMLProps<HTMLDivElement> {
2628
renderWindowStyle?: CSSProperties;
2729
}
2830

29-
export default forwardRef(function OpenGLRenderWindow(props: Props, fwdRef) {
31+
export default forwardRef(function OpenGLRenderWindow(
32+
props: OpenGLRenderWindowProps,
33+
fwdRef
34+
) {
3035
const rwContainerRef = useRef<HTMLDivElement | null>(null);
3136

3237
const [viewRef, getRWView] = useGetterRef(() => {

src/core/Picking.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function useOpenGLHardwareSelector() {
5252
return getSelector;
5353
}
5454

55-
interface Props {
55+
export interface PickingProps {
5656
/**
5757
* Whether to enable picking and callbacks.
5858
*
@@ -112,7 +112,7 @@ const DefaultProps = {
112112
onHoverDebounceWait: 4,
113113
};
114114

115-
export default forwardRef(function ViewPicking(props: Props, fwdRef) {
115+
export default forwardRef(function ViewPicking(props: PickingProps, fwdRef) {
116116
const openGLRenderWindowAPI = useContext(OpenGLRenderWindowContext);
117117
const rendererAPI = useContext(RendererContext);
118118
const viewAPI = useContext(ViewContext);

src/core/PolyData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { usePrevious } from '../utils/usePrevious';
1919
import useUnmount from '../utils/useUnmount';
2020
import { DatasetContext, useDownstream, useRepresentation } from './contexts';
2121

22-
interface Props extends PropsWithChildren {
22+
export interface PolyDataProps extends PropsWithChildren {
2323
/**
2424
* downstream connection port
2525
*/
@@ -86,7 +86,7 @@ const DefaultProps = {
8686
connectivity: 'manual',
8787
};
8888

89-
export default forwardRef(function PolyData(props: Props, fwdRef) {
89+
export default forwardRef(function PolyData(props: PolyDataProps, fwdRef) {
9090
const {
9191
port = DefaultProps.port,
9292
points = DefaultProps.points,

0 commit comments

Comments
 (0)