Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit b379dc7

Browse files
committed
Added TypeScript types definition
1 parent bce95dd commit b379dc7

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

index.d.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import * as React from 'react';
2+
3+
4+
export interface DatGuiProps {
5+
data: any; // The data your dat.GUI controller will mutate
6+
onUpdate: (data: any) => any; // The method which will be called whenever an update is handled by the controller
7+
children: React.ReactElement<any>; // The dat.GUI components that make up the controller
8+
liveUpdate?: boolean; // Determines if live updates should occur, defaults to true
9+
labelWidth?: number; // The width of the labels in pixels, defaults to 40
10+
className?: string; // The class name to set on the DatGui div
11+
style?: StyleSheet; // The style object to set on the DatGui div
12+
}
13+
14+
export default class DatGui extends React.Component<DatGuiProps, any> { }
15+
16+
export class DatUnChangableFieldProps {
17+
label?: string;
18+
}
19+
20+
export class DatChangableFieldProps extends DatUnChangableFieldProps {
21+
path: string;
22+
}
23+
24+
25+
export interface DatButtonProps extends DatUnChangableFieldProps {
26+
onClick: (e: React.MouseEvent) => any;
27+
}
28+
export class DatButton extends React.Component<DatButtonProps, any> { }
29+
30+
31+
export interface DatFolderProps extends DatUnChangableFieldProps {
32+
title: string;
33+
children: React.ReactNode[];
34+
}
35+
export class DatFolder extends React.Component<DatFolderProps, any> { }
36+
37+
38+
export interface DatPresetsProps extends DatUnChangableFieldProps {
39+
options: {
40+
presetName: string;
41+
data: any; // Initial data
42+
preset: any; // Your preset
43+
}
44+
}
45+
46+
47+
export interface DatBooleanProps extends DatChangableFieldProps { }
48+
export class DatBoolean extends React.Component<DatBooleanProps, any> { }
49+
50+
51+
export interface DatColorProps extends DatChangableFieldProps {
52+
[reactColorProp: string]: any;
53+
}
54+
export class DatColor extends React.Component<DatColorProps, any> { }
55+
56+
57+
export interface DatNumberProps extends DatChangableFieldProps {
58+
min: number;
59+
max: number;
60+
step: number;
61+
}
62+
export class DatNumber extends React.Component<DatNumberProps, any> { }
63+
64+
65+
export interface DatSelectProps extends DatChangableFieldProps {
66+
options: any[];
67+
}
68+
export class DatSelect extends React.Component<DatSelectProps, any> { }
69+
70+
71+
export interface DatStringProps extends DatChangableFieldProps { }
72+
export class DatString extends React.Component<DatStringProps, any> { }

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "dat.GUI reimagined for React",
55
"main": "build/react-dat-gui.js",
66
"style": "build/react-dat-gui.css",
7+
"types": "index.d.ts",
78
"contributors": [
89
{
910
"name": "Claus Wahlers",

0 commit comments

Comments
 (0)