babylon.guiEditor.d.ts 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. /// <reference types="react" />
  2. declare module GUIEDITOR {
  3. export class BlockTools {
  4. static GetGuiFromString(data: string): Slider | Checkbox | ColorPicker | Ellipse | Rectangle | Line | TextBlock;
  5. }
  6. }
  7. declare module GUIEDITOR {
  8. interface ILogComponentProps {
  9. globalState: GlobalState;
  10. }
  11. export class LogEntry {
  12. message: string;
  13. isError: boolean;
  14. constructor(message: string, isError: boolean);
  15. }
  16. export class LogComponent extends React.Component<ILogComponentProps, {
  17. logs: LogEntry[];
  18. }> {
  19. constructor(props: ILogComponentProps);
  20. componentDidMount(): void;
  21. componentDidUpdate(): void;
  22. render(): JSX.Element;
  23. }
  24. }
  25. declare module GUIEDITOR {
  26. export interface IWorkbenchComponentProps {
  27. globalState: GlobalState;
  28. }
  29. export type FramePortData = {};
  30. export const isFramePortData: (variableToCheck: any) => variableToCheck is FramePortData;
  31. export class WorkbenchComponent extends React.Component<IWorkbenchComponentProps> {
  32. private readonly MinZoom;
  33. private readonly MaxZoom;
  34. private _hostCanvas;
  35. private _graphCanvas;
  36. private _selectionContainer;
  37. private _frameContainer;
  38. private _svgCanvas;
  39. private _rootContainer;
  40. private _guiNodes;
  41. private _mouseStartPointX;
  42. private _mouseStartPointY;
  43. private _selectionStartX;
  44. private _selectionStartY;
  45. private _x;
  46. private _y;
  47. private _zoom;
  48. private _selectedGuiNodes;
  49. private _gridSize;
  50. private _selectionBox;
  51. private _frameCandidate;
  52. private _altKeyIsPressed;
  53. private _ctrlKeyIsPressed;
  54. private _oldY;
  55. _frameIsMoving: boolean;
  56. _isLoading: boolean;
  57. isOverGUINode: boolean;
  58. get gridSize(): number;
  59. set gridSize(value: number);
  60. get globalState(): GlobalState;
  61. get nodes(): GUINode[];
  62. get zoom(): number;
  63. set zoom(value: number);
  64. get x(): number;
  65. set x(value: number);
  66. get y(): number;
  67. set y(value: number);
  68. get selectedGuiNodes(): GUINode[];
  69. get canvasContainer(): HTMLDivElement;
  70. get hostCanvas(): HTMLDivElement;
  71. get svgCanvas(): HTMLElement;
  72. get selectionContainer(): HTMLDivElement;
  73. get frameContainer(): HTMLDivElement;
  74. constructor(props: IWorkbenchComponentProps);
  75. getGridPosition(position: number, useCeil?: boolean): number;
  76. getGridPositionCeil(position: number): number;
  77. updateTransform(): void;
  78. onKeyUp(): void;
  79. findNodeFromGuiElement(guiElement: Control): GUINode;
  80. reset(): void;
  81. appendBlock(guiElement: Control): GUINode;
  82. distributeGraph(): void;
  83. componentDidMount(): void;
  84. onMove(evt: React.PointerEvent): void;
  85. onDown(evt: React.PointerEvent<HTMLElement>): void;
  86. onUp(evt: React.PointerEvent): void;
  87. onWheel(evt: React.WheelEvent): void;
  88. zoomToFit(): void;
  89. createGUICanvas(): void;
  90. updateGUIs(): void;
  91. render(): JSX.Element;
  92. }
  93. }
  94. declare module GUIEDITOR {
  95. export interface IPropertyComponentProps {
  96. globalState: GlobalState;
  97. guiBlock: Control;
  98. }
  99. }
  100. declare module GUIEDITOR {
  101. interface ILineContainerComponentProps {
  102. title: string;
  103. children: any[] | any;
  104. closed?: boolean;
  105. }
  106. export class LineContainerComponent extends React.Component<ILineContainerComponentProps, {
  107. isExpanded: boolean;
  108. }> {
  109. constructor(props: ILineContainerComponentProps);
  110. switchExpandedState(): void;
  111. renderHeader(): JSX.Element;
  112. render(): JSX.Element;
  113. }
  114. }
  115. declare module GUIEDITOR {
  116. export class PropertyChangedEvent {
  117. object: any;
  118. property: string;
  119. value: any;
  120. initialValue: any;
  121. }
  122. }
  123. declare module GUIEDITOR {
  124. export interface ICheckBoxLineComponentProps {
  125. label: string;
  126. target?: any;
  127. propertyName?: string;
  128. isSelected?: () => boolean;
  129. onSelect?: (value: boolean) => void;
  130. onValueChanged?: () => void;
  131. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  132. disabled?: boolean;
  133. }
  134. export class CheckBoxLineComponent extends React.Component<ICheckBoxLineComponentProps, {
  135. isSelected: boolean;
  136. isDisabled?: boolean;
  137. }> {
  138. private static _UniqueIdSeed;
  139. private _uniqueId;
  140. private _localChange;
  141. constructor(props: ICheckBoxLineComponentProps);
  142. shouldComponentUpdate(nextProps: ICheckBoxLineComponentProps, nextState: {
  143. isSelected: boolean;
  144. isDisabled: boolean;
  145. }): boolean;
  146. onChange(): void;
  147. render(): JSX.Element;
  148. }
  149. }
  150. declare module GUIEDITOR {
  151. interface IFloatLineComponentProps {
  152. label: string;
  153. target: any;
  154. propertyName: string;
  155. onChange?: (newValue: number) => void;
  156. isInteger?: boolean;
  157. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  158. additionalClass?: string;
  159. step?: string;
  160. digits?: number;
  161. globalState: GlobalState;
  162. min?: number;
  163. max?: number;
  164. smallUI?: boolean;
  165. onEnter?: (newValue: number) => void;
  166. }
  167. export class FloatLineComponent extends React.Component<IFloatLineComponentProps, {
  168. value: string;
  169. }> {
  170. private _localChange;
  171. private _store;
  172. private _regExp;
  173. constructor(props: IFloatLineComponentProps);
  174. shouldComponentUpdate(nextProps: IFloatLineComponentProps, nextState: {
  175. value: string;
  176. }): boolean;
  177. raiseOnPropertyChanged(newValue: number, previousValue: number): void;
  178. updateValue(valueString: string): void;
  179. render(): JSX.Element;
  180. }
  181. }
  182. declare module GUIEDITOR {
  183. interface ISliderLineComponentProps {
  184. label: string;
  185. target?: any;
  186. propertyName?: string;
  187. minimum: number;
  188. maximum: number;
  189. step: number;
  190. directValue?: number;
  191. useEuler?: boolean;
  192. onChange?: (value: number) => void;
  193. onInput?: (value: number) => void;
  194. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  195. decimalCount?: number;
  196. globalState: GlobalState;
  197. }
  198. export class SliderLineComponent extends React.Component<ISliderLineComponentProps, {
  199. value: number;
  200. }> {
  201. private _localChange;
  202. constructor(props: ISliderLineComponentProps);
  203. shouldComponentUpdate(nextProps: ISliderLineComponentProps, nextState: {
  204. value: number;
  205. }): boolean;
  206. onChange(newValueString: any): void;
  207. onInput(newValueString: any): void;
  208. prepareDataToRead(value: number): number;
  209. render(): JSX.Element;
  210. }
  211. }
  212. declare module GUIEDITOR {
  213. export class GenericPropertyComponent extends React.Component<IPropertyComponentProps> {
  214. constructor(props: IPropertyComponentProps);
  215. render(): JSX.Element;
  216. }
  217. export class GeneralPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  218. constructor(props: IPropertyComponentProps);
  219. render(): JSX.Element;
  220. }
  221. export class GenericPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  222. constructor(props: IPropertyComponentProps);
  223. forceRebuild(notifiers?: {
  224. "rebuild"?: boolean;
  225. "update"?: boolean;
  226. }): void;
  227. render(): JSX.Element;
  228. }
  229. }
  230. declare module GUIEDITOR {
  231. interface ITextLineComponentProps {
  232. label: string;
  233. value: string;
  234. color?: string;
  235. underline?: boolean;
  236. onLink?: () => void;
  237. }
  238. export class TextLineComponent extends React.Component<ITextLineComponentProps> {
  239. constructor(props: ITextLineComponentProps);
  240. onLink(): void;
  241. renderContent(): JSX.Element;
  242. render(): JSX.Element;
  243. }
  244. }
  245. declare module GUIEDITOR {
  246. interface INumericInputComponentProps {
  247. label: string;
  248. value: number;
  249. step?: number;
  250. onChange: (value: number) => void;
  251. globalState: GlobalState;
  252. }
  253. export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
  254. value: string;
  255. }> {
  256. static defaultProps: {
  257. step: number;
  258. };
  259. private _localChange;
  260. constructor(props: INumericInputComponentProps);
  261. shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
  262. value: string;
  263. }): boolean;
  264. updateValue(evt: any): void;
  265. render(): JSX.Element;
  266. }
  267. }
  268. declare module GUIEDITOR {
  269. export class SliderPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  270. constructor(props: IPropertyComponentProps);
  271. private slider;
  272. render(): JSX.Element;
  273. }
  274. }
  275. declare module GUIEDITOR {
  276. export class PropertyGuiLedger {
  277. static RegisteredControls: {
  278. [key: string]: React.ComponentClass<IPropertyComponentProps>;
  279. };
  280. }
  281. }
  282. declare module GUIEDITOR {
  283. export class GUINode {
  284. guiNode: Control;
  285. private _x;
  286. private _y;
  287. private _gridAlignedX;
  288. private _gridAlignedY;
  289. private _globalState;
  290. private _onSelectionChangedObserver;
  291. private _onSelectionBoxMovedObserver;
  292. private _onUpdateRequiredObserver;
  293. private _ownerCanvas;
  294. private _isSelected;
  295. private _isVisible;
  296. private _enclosingFrameId;
  297. get isVisible(): boolean;
  298. set isVisible(value: boolean);
  299. get gridAlignedX(): number;
  300. get gridAlignedY(): number;
  301. get x(): number;
  302. set x(value: number);
  303. get y(): number;
  304. set y(value: number);
  305. get width(): number;
  306. get height(): number;
  307. get id(): number;
  308. get name(): string | undefined;
  309. get isSelected(): boolean;
  310. get enclosingFrameId(): number;
  311. set enclosingFrameId(value: number);
  312. set isSelected(value: boolean);
  313. constructor(globalState: GlobalState, guiNode: Control);
  314. cleanAccumulation(useCeil?: boolean): void;
  315. clicked: boolean;
  316. _onMove(evt: BABYLON.Vector2, startPos: BABYLON.Vector2): boolean;
  317. renderProperties(): BABYLON.Nullable<JSX.Element>;
  318. updateVisual(): void;
  319. appendVisual(root: HTMLDivElement, owner: WorkbenchComponent): void;
  320. dispose(): void;
  321. }
  322. }
  323. declare module GUIEDITOR {
  324. export class GlobalState {
  325. guiTexture: AdvancedDynamicTexture;
  326. hostElement: HTMLElement;
  327. hostDocument: HTMLDocument;
  328. hostWindow: Window;
  329. onSelectionChangedObservable: BABYLON.Observable<BABYLON.Nullable<FramePortData | GUINode>>;
  330. onRebuildRequiredObservable: BABYLON.Observable<void>;
  331. onBuiltObservable: BABYLON.Observable<void>;
  332. onResetRequiredObservable: BABYLON.Observable<void>;
  333. onUpdateRequiredObservable: BABYLON.Observable<void>;
  334. onZoomToFitRequiredObservable: BABYLON.Observable<void>;
  335. onReOrganizedRequiredObservable: BABYLON.Observable<void>;
  336. onLogRequiredObservable: BABYLON.Observable<LogEntry>;
  337. onErrorMessageDialogRequiredObservable: BABYLON.Observable<string>;
  338. onIsLoadingChanged: BABYLON.Observable<boolean>;
  339. onPreviewCommandActivated: BABYLON.Observable<boolean>;
  340. onLightUpdated: BABYLON.Observable<void>;
  341. onPreviewBackgroundChanged: BABYLON.Observable<void>;
  342. onBackFaceCullingChanged: BABYLON.Observable<void>;
  343. onDepthPrePassChanged: BABYLON.Observable<void>;
  344. onAnimationCommandActivated: BABYLON.Observable<void>;
  345. onCandidateLinkMoved: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector2>>;
  346. onSelectionBoxMoved: BABYLON.Observable<DOMRect | ClientRect>;
  347. onImportFrameObservable: BABYLON.Observable<any>;
  348. onGraphNodeRemovalObservable: BABYLON.Observable<GUINode>;
  349. onGetNodeFromBlock: (block: BABYLON.NodeMaterialBlock) => GUINode;
  350. onGridSizeChanged: BABYLON.Observable<void>;
  351. onExposePortOnFrameObservable: BABYLON.Observable<GUINode>;
  352. previewFile: File;
  353. listOfCustomPreviewFiles: File[];
  354. rotatePreview: boolean;
  355. backgroundColor: BABYLON.Color4;
  356. backFaceCulling: boolean;
  357. depthPrePass: boolean;
  358. blockKeyboardEvents: boolean;
  359. hemisphericLight: boolean;
  360. directionalLight0: boolean;
  361. directionalLight1: boolean;
  362. controlCamera: boolean;
  363. workbench: WorkbenchComponent;
  364. storeEditorData: (serializationObject: any, frame?: BABYLON.Nullable<null>) => void;
  365. customSave?: {
  366. label: string;
  367. action: (data: string) => Promise<void>;
  368. };
  369. constructor();
  370. }
  371. }
  372. declare module GUIEDITOR {
  373. export interface IButtonLineComponentProps {
  374. data: string;
  375. tooltip: string;
  376. }
  377. export class DraggableLineComponent extends React.Component<IButtonLineComponentProps> {
  378. constructor(props: IButtonLineComponentProps);
  379. render(): JSX.Element;
  380. }
  381. }
  382. declare module GUIEDITOR {
  383. interface IGuiListComponentProps {
  384. globalState: GlobalState;
  385. }
  386. export class GuiListComponent extends React.Component<IGuiListComponentProps, {
  387. filter: string;
  388. }> {
  389. private _onResetRequiredObserver;
  390. private static _Tooltips;
  391. constructor(props: IGuiListComponentProps);
  392. componentWillUnmount(): void;
  393. filterContent(filter: string): void;
  394. render(): JSX.Element;
  395. }
  396. }
  397. declare module GUIEDITOR {
  398. export interface IButtonLineComponentProps {
  399. label: string;
  400. onClick: () => void;
  401. }
  402. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  403. constructor(props: IButtonLineComponentProps);
  404. render(): JSX.Element;
  405. }
  406. }
  407. declare module GUIEDITOR {
  408. interface IFileButtonLineComponentProps {
  409. label: string;
  410. onClick: (file: File) => void;
  411. accept: string;
  412. uploadName?: string;
  413. }
  414. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  415. private uploadRef;
  416. constructor(props: IFileButtonLineComponentProps);
  417. onChange(evt: any): void;
  418. render(): JSX.Element;
  419. }
  420. }
  421. declare module GUIEDITOR {
  422. export class SerializationTools {
  423. static UpdateLocations(material: BABYLON.NodeMaterial, globalState: GlobalState): void;
  424. static Serialize(material: BABYLON.NodeMaterial, globalState: GlobalState): string;
  425. static Deserialize(serializationObject: any, globalState: GlobalState): void;
  426. static AddFrameToMaterial(serializationObject: any, globalState: GlobalState, currentMaterial: BABYLON.NodeMaterial): void;
  427. }
  428. }
  429. declare module GUIEDITOR {
  430. interface IPropertyTabComponentProps {
  431. globalState: GlobalState;
  432. }
  433. interface IPropertyTabComponentState {
  434. currentNode: BABYLON.Nullable<GUINode>;
  435. }
  436. export class PropertyTabComponent extends React.Component<IPropertyTabComponentProps, IPropertyTabComponentState> {
  437. private _onBuiltObserver;
  438. constructor(props: IPropertyTabComponentProps);
  439. componentDidMount(): void;
  440. componentWillUnmount(): void;
  441. processInputBlockUpdate(ib: BABYLON.InputBlock): void;
  442. load(file: File): void;
  443. loadFrame(file: File): void;
  444. save(): void;
  445. customSave(): void;
  446. saveToSnippetServer(): void;
  447. loadFromSnippet(): void;
  448. render(): JSX.Element;
  449. }
  450. }
  451. declare module GUIEDITOR {
  452. interface IPortalProps {
  453. globalState: GlobalState;
  454. }
  455. export class Portal extends React.Component<IPortalProps> {
  456. render(): React.ReactPortal;
  457. }
  458. }
  459. declare module GUIEDITOR {
  460. export interface INodeLocationInfo {
  461. blockId: number;
  462. x: number;
  463. y: number;
  464. }
  465. export interface IFrameData {
  466. x: number;
  467. y: number;
  468. width: number;
  469. height: number;
  470. color: number[];
  471. name: string;
  472. isCollapsed: boolean;
  473. blocks: number[];
  474. comments: string;
  475. }
  476. export interface IEditorData {
  477. locations: INodeLocationInfo[];
  478. x: number;
  479. y: number;
  480. zoom: number;
  481. frames?: IFrameData[];
  482. map?: {
  483. [key: number]: number;
  484. };
  485. }
  486. }
  487. declare module GUIEDITOR {
  488. interface IMessageDialogComponentProps {
  489. globalState: GlobalState;
  490. }
  491. export class MessageDialogComponent extends React.Component<IMessageDialogComponentProps, {
  492. message: string;
  493. isError: boolean;
  494. }> {
  495. constructor(props: IMessageDialogComponentProps);
  496. render(): JSX.Element | null;
  497. }
  498. }
  499. declare module GUIEDITOR {
  500. interface IGraphEditorProps {
  501. globalState: GlobalState;
  502. }
  503. interface IGraphEditorState {
  504. showPreviewPopUp: boolean;
  505. }
  506. export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEditorState> {
  507. private _workbenchCanvas;
  508. private _startX;
  509. private _moveInProgress;
  510. private _leftWidth;
  511. private _rightWidth;
  512. private _blocks;
  513. private _onWidgetKeyUpPointer;
  514. private _popUpWindow;
  515. /**
  516. * Creates a node and recursivly creates its parent nodes from it's input
  517. * @param block
  518. */
  519. createNodeFromObject(block: Control, recursion?: boolean): BABYLON.Nullable<GUINode>;
  520. componentDidMount(): void;
  521. componentWillUnmount(): void;
  522. constructor(props: IGraphEditorProps);
  523. pasteSelection(copiedNodes: GUINode[], currentX: number, currentY: number, selectNew?: boolean): GUINode[];
  524. zoomToFit(): void;
  525. buildMaterial(): void;
  526. showWaitScreen(): void;
  527. hideWaitScreen(): void;
  528. reOrganize(editorData?: BABYLON.Nullable<IEditorData>, isImportingAFrame?: boolean): void;
  529. onPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  530. onPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  531. resizeColumns(evt: React.PointerEvent<HTMLDivElement>, forLeft?: boolean): void;
  532. buildColumnLayout(): string;
  533. emitNewBlock(event: React.DragEvent<HTMLDivElement>): void;
  534. handlePopUp: () => void;
  535. handleClosingPopUp: () => void;
  536. createPopupWindow: (title: string, windowVariableName: string, width?: number, height?: number) => Window | null;
  537. copyStyles: (sourceDoc: HTMLDocument, targetDoc: HTMLDocument) => void;
  538. fixPopUpStyles: (document: Document) => void;
  539. render(): JSX.Element;
  540. }
  541. }
  542. declare module GUIEDITOR {
  543. export class Popup {
  544. static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
  545. private static _CopyStyles;
  546. }
  547. }
  548. declare module GUIEDITOR {
  549. /**
  550. * Interface used to specify creation options for the gui editor
  551. */
  552. export interface INodeEditorOptions {
  553. hostElement?: HTMLElement;
  554. customSave?: {
  555. label: string;
  556. action: (data: string) => Promise<void>;
  557. };
  558. customLoadObservable?: BABYLON.Observable<any>;
  559. }
  560. /**
  561. * Class used to create a gui editor
  562. */
  563. export class GuiEditor {
  564. private static _CurrentState;
  565. /**
  566. * Show the gui editor
  567. * @param options defines the options to use to configure the gui editor
  568. */
  569. static Show(options: INodeEditorOptions): void;
  570. }
  571. }
  572. declare module GUIEDITOR {
  573. export class StringTools {
  574. private static _SaveAs;
  575. private static _Click;
  576. /**
  577. * Gets the base math type of node material block connection point.
  578. * @param type Type to parse.
  579. */
  580. static GetBaseType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  581. /**
  582. * Download a string into a file that will be saved locally by the browser
  583. * @param content defines the string to download locally as a file
  584. */
  585. static DownloadAsFile(document: HTMLDocument, content: string, filename: string): void;
  586. }
  587. }
  588. declare module GUIEDITOR {
  589. interface IFloatPropertyTabComponentProps {
  590. globalState: GlobalState;
  591. inputBlock: BABYLON.InputBlock;
  592. }
  593. export class FloatPropertyTabComponent extends React.Component<IFloatPropertyTabComponentProps> {
  594. render(): JSX.Element;
  595. }
  596. }
  597. declare module GUIEDITOR {
  598. interface ILineWithFileButtonComponentProps {
  599. title: string;
  600. closed?: boolean;
  601. label: string;
  602. iconImage: any;
  603. onIconClick: (file: File) => void;
  604. accept: string;
  605. uploadName?: string;
  606. }
  607. export class LineWithFileButtonComponent extends React.Component<ILineWithFileButtonComponentProps, {
  608. isExpanded: boolean;
  609. }> {
  610. private uploadRef;
  611. constructor(props: ILineWithFileButtonComponentProps);
  612. onChange(evt: any): void;
  613. switchExpandedState(): void;
  614. render(): JSX.Element;
  615. }
  616. }
  617. declare module GUIEDITOR {
  618. interface ITextInputLineComponentProps {
  619. label: string;
  620. globalState: GlobalState;
  621. target?: any;
  622. propertyName?: string;
  623. value?: string;
  624. multilines?: boolean;
  625. onChange?: (value: string) => void;
  626. validator?: (value: string) => boolean;
  627. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  628. }
  629. export class TextInputLineComponent extends React.Component<ITextInputLineComponentProps, {
  630. value: string;
  631. }> {
  632. private _localChange;
  633. constructor(props: ITextInputLineComponentProps);
  634. shouldComponentUpdate(nextProps: ITextInputLineComponentProps, nextState: {
  635. value: string;
  636. }): boolean;
  637. raiseOnPropertyChanged(newValue: string, previousValue: string): void;
  638. updateValue(value: string, raisePropertyChanged: boolean): void;
  639. render(): JSX.Element;
  640. }
  641. }
  642. declare module GUIEDITOR {
  643. export interface IColorComponentEntryProps {
  644. value: number;
  645. label: string;
  646. max?: number;
  647. min?: number;
  648. onChange: (value: number) => void;
  649. }
  650. export class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {
  651. constructor(props: IColorComponentEntryProps);
  652. updateValue(valueString: string): void;
  653. render(): JSX.Element;
  654. }
  655. }
  656. declare module GUIEDITOR {
  657. export interface IHexColorProps {
  658. value: string;
  659. expectedLength: number;
  660. onChange: (value: string) => void;
  661. }
  662. export class HexColor extends React.Component<IHexColorProps, {
  663. hex: string;
  664. }> {
  665. constructor(props: IHexColorProps);
  666. shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
  667. hex: string;
  668. }): boolean;
  669. updateHexValue(valueString: string): void;
  670. render(): JSX.Element;
  671. }
  672. }
  673. declare module GUIEDITOR {
  674. /**
  675. * Interface used to specify creation options for color picker
  676. */
  677. export interface IColorPickerProps {
  678. color: BABYLON.Color3 | BABYLON.Color4;
  679. debugMode?: boolean;
  680. onColorChanged?: (color: BABYLON.Color3 | BABYLON.Color4) => void;
  681. }
  682. /**
  683. * Interface used to specify creation options for color picker
  684. */
  685. export interface IColorPickerState {
  686. color: BABYLON.Color3;
  687. alpha: number;
  688. }
  689. /**
  690. * Class used to create a color picker
  691. */
  692. export class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
  693. private _saturationRef;
  694. private _hueRef;
  695. private _isSaturationPointerDown;
  696. private _isHuePointerDown;
  697. constructor(props: IColorPickerProps);
  698. onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  699. onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  700. onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
  701. onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  702. onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  703. onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
  704. private _evaluateSaturation;
  705. private _evaluateHue;
  706. componentDidUpdate(): void;
  707. raiseOnColorChanged(): void;
  708. render(): JSX.Element;
  709. }
  710. }
  711. declare module GUIEDITOR {
  712. export interface IBooleanLineComponentProps {
  713. label: string;
  714. value: boolean;
  715. }
  716. export class BooleanLineComponent extends React.Component<IBooleanLineComponentProps> {
  717. constructor(props: IBooleanLineComponentProps);
  718. render(): JSX.Element;
  719. }
  720. }
  721. declare module GUIEDITOR {
  722. export interface IButtonLineComponentProps {
  723. label: string;
  724. onClick: () => void;
  725. }
  726. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  727. constructor(props: IButtonLineComponentProps);
  728. render(): JSX.Element;
  729. }
  730. }
  731. declare module GUIEDITOR {
  732. interface IFileButtonLineComponentProps {
  733. label: string;
  734. onClick: (file: File) => void;
  735. accept: string;
  736. }
  737. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  738. private static _IDGenerator;
  739. private _id;
  740. private uploadInputRef;
  741. constructor(props: IFileButtonLineComponentProps);
  742. onChange(evt: any): void;
  743. render(): JSX.Element;
  744. }
  745. }
  746. declare module GUIEDITOR {
  747. interface IFileMultipleButtonLineComponentProps {
  748. label: string;
  749. onClick: (event: any) => void;
  750. accept: string;
  751. }
  752. export class FileMultipleButtonLineComponent extends React.Component<IFileMultipleButtonLineComponentProps> {
  753. private static _IDGenerator;
  754. private _id;
  755. private uploadInputRef;
  756. constructor(props: IFileMultipleButtonLineComponentProps);
  757. onChange(evt: any): void;
  758. render(): JSX.Element;
  759. }
  760. }
  761. declare module GUIEDITOR {
  762. export interface IIconButtonLineComponentProps {
  763. icon: string;
  764. onClick: () => void;
  765. tooltip: string;
  766. active?: boolean;
  767. }
  768. export class IconButtonLineComponent extends React.Component<IIconButtonLineComponentProps> {
  769. constructor(props: IIconButtonLineComponentProps);
  770. render(): JSX.Element;
  771. }
  772. }
  773. declare module GUIEDITOR {
  774. interface IIndentedTextLineComponentProps {
  775. value?: string;
  776. color?: string;
  777. underline?: boolean;
  778. onLink?: () => void;
  779. url?: string;
  780. additionalClass?: string;
  781. }
  782. export class IndentedTextLineComponent extends React.Component<IIndentedTextLineComponentProps> {
  783. constructor(props: IIndentedTextLineComponentProps);
  784. onLink(): void;
  785. renderContent(): JSX.Element;
  786. render(): JSX.Element;
  787. }
  788. }
  789. declare module GUIEDITOR {
  790. interface ILinkButtonComponentProps {
  791. label: string;
  792. buttonLabel: string;
  793. url?: string;
  794. onClick: () => void;
  795. onIconClick?: () => void;
  796. }
  797. export class LinkButtonComponent extends React.Component<ILinkButtonComponentProps> {
  798. constructor(props: ILinkButtonComponentProps);
  799. onLink(): void;
  800. render(): JSX.Element;
  801. }
  802. }
  803. declare module GUIEDITOR {
  804. interface IMessageLineComponentProps {
  805. text: string;
  806. color?: string;
  807. }
  808. export class MessageLineComponent extends React.Component<IMessageLineComponentProps> {
  809. constructor(props: IMessageLineComponentProps);
  810. render(): JSX.Element;
  811. }
  812. }
  813. declare module GUIEDITOR {
  814. interface INumericInputComponentProps {
  815. label: string;
  816. value: number;
  817. step?: number;
  818. onChange: (value: number) => void;
  819. precision?: number;
  820. }
  821. export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
  822. value: string;
  823. }> {
  824. static defaultProps: {
  825. step: number;
  826. };
  827. private _localChange;
  828. constructor(props: INumericInputComponentProps);
  829. shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
  830. value: string;
  831. }): boolean;
  832. updateValue(evt: any): void;
  833. onBlur(): void;
  834. render(): JSX.Element;
  835. }
  836. }
  837. declare module GUIEDITOR {
  838. interface IRadioButtonLineComponentProps {
  839. onSelectionChangedObservable: BABYLON.Observable<RadioButtonLineComponent>;
  840. label: string;
  841. isSelected: () => boolean;
  842. onSelect: () => void;
  843. }
  844. export class RadioButtonLineComponent extends React.Component<IRadioButtonLineComponentProps, {
  845. isSelected: boolean;
  846. }> {
  847. private _onSelectionChangedObserver;
  848. constructor(props: IRadioButtonLineComponentProps);
  849. componentDidMount(): void;
  850. componentWillUnmount(): void;
  851. onChange(): void;
  852. render(): JSX.Element;
  853. }
  854. }
  855. declare module GUIEDITOR {
  856. interface ITextLineComponentProps {
  857. label?: string;
  858. value?: string;
  859. color?: string;
  860. underline?: boolean;
  861. onLink?: () => void;
  862. url?: string;
  863. ignoreValue?: boolean;
  864. additionalClass?: string;
  865. }
  866. export class TextLineComponent extends React.Component<ITextLineComponentProps> {
  867. constructor(props: ITextLineComponentProps);
  868. onLink(): void;
  869. renderContent(): JSX.Element | null;
  870. render(): JSX.Element;
  871. }
  872. }
  873. declare module GUIEDITOR {
  874. interface IValueLineComponentProps {
  875. label: string;
  876. value: number;
  877. color?: string;
  878. fractionDigits?: number;
  879. units?: string;
  880. }
  881. export class ValueLineComponent extends React.Component<IValueLineComponentProps> {
  882. constructor(props: IValueLineComponentProps);
  883. render(): JSX.Element;
  884. }
  885. }