babylon.nodeEditor.d.ts 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. /// <reference types="react" />
  2. declare module NODEEDITOR {
  3. export class BlockTools {
  4. static GetBlockFromString(data: string): BABYLON.BonesBlock | BABYLON.InstancesBlock | BABYLON.MorphTargetsBlock | BABYLON.AlphaTestBlock | BABYLON.ImageProcessingBlock | BABYLON.ColorMergerBlock | BABYLON.VectorMergerBlock | BABYLON.ColorSplitterBlock | BABYLON.VectorSplitterBlock | BABYLON.TextureBlock | BABYLON.LightBlock | BABYLON.FogBlock | BABYLON.VertexOutputBlock | BABYLON.FragmentOutputBlock | BABYLON.AddBlock | BABYLON.ClampBlock | BABYLON.CrossBlock | BABYLON.DotBlock | BABYLON.MultiplyBlock | BABYLON.TransformBlock | null;
  5. static GetColorFromConnectionNodeType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  6. static GetConnectionNodeTypeFromString(type: string): BABYLON.NodeMaterialBlockConnectionPointTypes.Float | BABYLON.NodeMaterialBlockConnectionPointTypes.Vector2 | BABYLON.NodeMaterialBlockConnectionPointTypes.Vector3 | BABYLON.NodeMaterialBlockConnectionPointTypes.Vector4 | BABYLON.NodeMaterialBlockConnectionPointTypes.Color3 | BABYLON.NodeMaterialBlockConnectionPointTypes.Color4 | BABYLON.NodeMaterialBlockConnectionPointTypes.Matrix | BABYLON.NodeMaterialBlockConnectionPointTypes.AutoDetect;
  7. static GetStringFromConnectionNodeType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): "Float" | "Vector2" | "Vector3" | "Vector4" | "Matrix" | "Color3" | "Color4" | "";
  8. }
  9. }
  10. declare module NODEEDITOR {
  11. export class DataStorage {
  12. private static _InMemoryStorage;
  13. static ReadBoolean(key: string, defaultValue: boolean): boolean;
  14. static StoreBoolean(key: string, value: boolean): void;
  15. static ReadNumber(key: string, defaultValue: number): number;
  16. static StoreNumber(key: string, value: number): void;
  17. }
  18. }
  19. declare module NODEEDITOR {
  20. interface ITextLineComponentProps {
  21. label: string;
  22. value: string;
  23. color?: string;
  24. underline?: boolean;
  25. onLink?: () => void;
  26. }
  27. export class TextLineComponent extends React.Component<ITextLineComponentProps> {
  28. constructor(props: ITextLineComponentProps);
  29. onLink(): void;
  30. renderContent(): JSX.Element;
  31. render(): JSX.Element;
  32. }
  33. }
  34. declare module NODEEDITOR {
  35. interface ILineContainerComponentProps {
  36. title: string;
  37. children: any[] | any;
  38. closed?: boolean;
  39. }
  40. export class LineContainerComponent extends React.Component<ILineContainerComponentProps, {
  41. isExpanded: boolean;
  42. }> {
  43. constructor(props: ILineContainerComponentProps);
  44. switchExpandedState(): void;
  45. renderHeader(): JSX.Element;
  46. render(): JSX.Element;
  47. }
  48. }
  49. declare module NODEEDITOR {
  50. export class PropertyChangedEvent {
  51. object: any;
  52. property: string;
  53. value: any;
  54. initialValue: any;
  55. }
  56. }
  57. declare module NODEEDITOR {
  58. interface ITextInputLineComponentProps {
  59. label: string;
  60. target?: any;
  61. propertyName?: string;
  62. value?: string;
  63. onChange?: (value: string) => void;
  64. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  65. }
  66. export class TextInputLineComponent extends React.Component<ITextInputLineComponentProps, {
  67. value: string;
  68. }> {
  69. private _localChange;
  70. constructor(props: ITextInputLineComponentProps);
  71. shouldComponentUpdate(nextProps: ITextInputLineComponentProps, nextState: {
  72. value: string;
  73. }): boolean;
  74. raiseOnPropertyChanged(newValue: string, previousValue: string): void;
  75. updateValue(value: string): void;
  76. render(): JSX.Element;
  77. }
  78. }
  79. declare module NODEEDITOR {
  80. /**
  81. * Generic node model which stores information about a node editor block
  82. */
  83. export class GenericNodeModel extends DefaultNodeModel {
  84. /**
  85. * BABYLON.Vector2 for the node if it exists
  86. */
  87. vector2: BABYLON.Nullable<BABYLON.Vector2>;
  88. /**
  89. * BABYLON.Vector3 for the node if it exists
  90. */
  91. vector3: BABYLON.Nullable<BABYLON.Vector3>;
  92. /**
  93. * BABYLON.Vector4 for the node if it exists
  94. */
  95. vector4: BABYLON.Nullable<BABYLON.Vector4>;
  96. /**
  97. * BABYLON.Matrix for the node if it exists
  98. */
  99. matrix: BABYLON.Nullable<BABYLON.Matrix>;
  100. /**
  101. * Constructs the node model
  102. */
  103. constructor();
  104. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor): void;
  105. renderProperties(globalState: GlobalState): JSX.Element;
  106. }
  107. }
  108. declare module NODEEDITOR {
  109. export class AdvancedLinkModel extends DefaultLinkModel {
  110. constructor();
  111. }
  112. }
  113. declare module NODEEDITOR {
  114. /**
  115. * Port model
  116. */
  117. export class DefaultPortModel extends PortModel {
  118. /**
  119. * If the port is input or output
  120. */
  121. position: string | "input" | "output";
  122. /**
  123. * What the port is connected to
  124. */
  125. connection: BABYLON.Nullable<BABYLON.NodeMaterialConnectionPoint>;
  126. defaultValue: any;
  127. static idCounter: number;
  128. constructor(name: string, type?: string);
  129. canLinkToPort(port: DefaultPortModel): boolean;
  130. syncWithNodeMaterialConnectionPoint(connection: BABYLON.NodeMaterialConnectionPoint): void;
  131. getNodeModel(): DefaultNodeModel;
  132. link(outPort: DefaultPortModel): LinkModel<import("storm-react-diagrams").LinkModelListener>;
  133. createLinkModel(): LinkModel;
  134. static SortInputOutput(a: BABYLON.Nullable<DefaultPortModel>, b: BABYLON.Nullable<DefaultPortModel>): {
  135. input: DefaultPortModel;
  136. output: DefaultPortModel;
  137. } | null;
  138. }
  139. }
  140. declare module NODEEDITOR {
  141. export interface IDefaultPortWidgetProps extends BaseWidgetProps {
  142. name: string;
  143. node: NodeModel;
  144. style: any;
  145. }
  146. export class DefaultPortWidget extends BaseWidget<IDefaultPortWidgetProps, PortState> {
  147. constructor(props: IDefaultPortWidgetProps);
  148. getClassName(): string;
  149. render(): JSX.Element;
  150. }
  151. }
  152. declare module NODEEDITOR {
  153. export class PortHelper {
  154. private static _GetPortTypeIndicator;
  155. static _GetPortStyle(type: BABYLON.NodeMaterialBlockConnectionPointTypes): {
  156. background: string;
  157. };
  158. static GenerateOutputPorts(node: BABYLON.Nullable<DefaultNodeModel>, ignoreLabel: boolean): JSX.Element[];
  159. static GenerateInputPorts(node: BABYLON.Nullable<DefaultNodeModel>, includeOnly?: string[]): JSX.Element[];
  160. }
  161. }
  162. declare module NODEEDITOR {
  163. /**
  164. * GenericNodeWidgetProps
  165. */
  166. export interface GenericNodeWidgetProps {
  167. node: BABYLON.Nullable<GenericNodeModel>;
  168. globalState: GlobalState;
  169. }
  170. /**
  171. * GenericNodeWidgetState
  172. */
  173. export interface GenericNodeWidgetState {
  174. }
  175. /**
  176. * Used to display a node block for the node editor
  177. */
  178. export class GenericNodeWidget extends React.Component<GenericNodeWidgetProps, GenericNodeWidgetState> {
  179. /**
  180. * Creates a GenericNodeWidget
  181. * @param props
  182. */
  183. constructor(props: GenericNodeWidgetProps);
  184. render(): JSX.Element;
  185. }
  186. }
  187. declare module NODEEDITOR {
  188. /**
  189. * Node factory which creates editor nodes
  190. */
  191. export class GenericNodeFactory extends SRD.AbstractNodeFactory {
  192. private _globalState;
  193. /**
  194. * Constructs a GenericNodeFactory
  195. */
  196. constructor(globalState: GlobalState);
  197. /**
  198. * Generates a node widget
  199. * @param diagramEngine diagram engine
  200. * @param node node to generate
  201. * @returns node widget jsx
  202. */
  203. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: GenericNodeModel): JSX.Element;
  204. /**
  205. * Gets a new instance of a node model
  206. * @returns generic node model
  207. */
  208. getNewInstance(): GenericNodeModel;
  209. }
  210. }
  211. declare module NODEEDITOR {
  212. export interface IButtonLineComponentProps {
  213. data: string;
  214. }
  215. export class DraggableLineComponent extends React.Component<IButtonLineComponentProps> {
  216. constructor(props: IButtonLineComponentProps);
  217. render(): JSX.Element;
  218. }
  219. }
  220. declare module NODEEDITOR {
  221. interface INodeListComponentProps {
  222. globalState: GlobalState;
  223. }
  224. export class NodeListComponent extends React.Component<INodeListComponentProps> {
  225. render(): JSX.Element;
  226. }
  227. }
  228. declare module NODEEDITOR {
  229. export interface IButtonLineComponentProps {
  230. label: string;
  231. onClick: () => void;
  232. }
  233. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  234. constructor(props: IButtonLineComponentProps);
  235. render(): JSX.Element;
  236. }
  237. }
  238. declare module NODEEDITOR {
  239. export class StringTools {
  240. /**
  241. * Gets the base math type of node material block connection point.
  242. * @param type Type to parse.
  243. */
  244. static GetBaseType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  245. /**
  246. * Download a string into a file that will be saved locally by the browser
  247. * @param content defines the string to download locally as a file
  248. */
  249. static DownloadAsFile(content: string, filename: string): void;
  250. }
  251. }
  252. declare module NODEEDITOR {
  253. interface IFileButtonLineComponentProps {
  254. label: string;
  255. onClick: (file: File) => void;
  256. accept: string;
  257. }
  258. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  259. constructor(props: IFileButtonLineComponentProps);
  260. onChange(evt: any): void;
  261. render(): JSX.Element;
  262. }
  263. }
  264. declare module NODEEDITOR {
  265. interface IPropertyTabComponentProps {
  266. globalState: GlobalState;
  267. }
  268. export class PropertyTabComponent extends React.Component<IPropertyTabComponentProps, {
  269. currentNode: BABYLON.Nullable<DefaultNodeModel>;
  270. }> {
  271. constructor(props: IPropertyTabComponentProps);
  272. componentWillMount(): void;
  273. load(file: File): void;
  274. render(): JSX.Element;
  275. }
  276. }
  277. declare module NODEEDITOR {
  278. interface IPortalProps {
  279. globalState: GlobalState;
  280. }
  281. export class Portal extends React.Component<IPortalProps> {
  282. render(): React.ReactPortal;
  283. }
  284. }
  285. declare module NODEEDITOR {
  286. export interface ICheckBoxLineComponentProps {
  287. label: string;
  288. target?: any;
  289. propertyName?: string;
  290. isSelected?: () => boolean;
  291. onSelect?: (value: boolean) => void;
  292. onValueChanged?: () => void;
  293. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  294. }
  295. export class CheckBoxLineComponent extends React.Component<ICheckBoxLineComponentProps, {
  296. isSelected: boolean;
  297. }> {
  298. private static _UniqueIdSeed;
  299. private _uniqueId;
  300. private _localChange;
  301. constructor(props: ICheckBoxLineComponentProps);
  302. shouldComponentUpdate(nextProps: ICheckBoxLineComponentProps, nextState: {
  303. isSelected: boolean;
  304. }): boolean;
  305. onChange(): void;
  306. render(): JSX.Element;
  307. }
  308. }
  309. declare module NODEEDITOR {
  310. interface ITexturePropertyTabComponentProps {
  311. globalState: GlobalState;
  312. node: TextureNodeModel;
  313. }
  314. export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps> {
  315. /**
  316. * Replaces the texture of the node
  317. * @param file the file of the texture to use
  318. */
  319. replaceTexture(file: File): void;
  320. render(): JSX.Element;
  321. }
  322. }
  323. declare module NODEEDITOR {
  324. /**
  325. * Texture node model which stores information about a node editor block
  326. */
  327. export class TextureNodeModel extends DefaultNodeModel {
  328. private _block;
  329. /**
  330. * Texture for the node if it exists
  331. */
  332. texture: BABYLON.Nullable<BABYLON.BaseTexture>;
  333. /**
  334. * Constructs the node model
  335. */
  336. constructor();
  337. renderProperties(globalState: GlobalState): JSX.Element;
  338. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor): void;
  339. }
  340. }
  341. declare module NODEEDITOR {
  342. interface ITextureLineComponentProps {
  343. texture: BABYLON.BaseTexture;
  344. width: number;
  345. height: number;
  346. globalState?: any;
  347. hideChannelSelect?: boolean;
  348. }
  349. export class TextureLineComponent extends React.Component<ITextureLineComponentProps, {
  350. displayRed: boolean;
  351. displayGreen: boolean;
  352. displayBlue: boolean;
  353. displayAlpha: boolean;
  354. face: number;
  355. }> {
  356. constructor(props: ITextureLineComponentProps);
  357. shouldComponentUpdate(nextProps: ITextureLineComponentProps, nextState: {
  358. displayRed: boolean;
  359. displayGreen: boolean;
  360. displayBlue: boolean;
  361. displayAlpha: boolean;
  362. face: number;
  363. }): boolean;
  364. componentDidMount(): void;
  365. componentDidUpdate(): void;
  366. updatePreview(): void;
  367. render(): JSX.Element;
  368. }
  369. }
  370. declare module NODEEDITOR {
  371. /**
  372. * GenericNodeWidgetProps
  373. */
  374. export interface ITextureNodeWidgetProps {
  375. node: BABYLON.Nullable<TextureNodeModel>;
  376. globalState: GlobalState;
  377. }
  378. /**
  379. * Used to display a node block for the node editor
  380. */
  381. export class TextureNodeWidget extends React.Component<ITextureNodeWidgetProps> {
  382. /**
  383. * Creates a GenericNodeWidget
  384. * @param props
  385. */
  386. constructor(props: ITextureNodeWidgetProps);
  387. render(): JSX.Element;
  388. }
  389. }
  390. declare module NODEEDITOR {
  391. /**
  392. * Node factory which creates editor nodes
  393. */
  394. export class TextureNodeFactory extends SRD.AbstractNodeFactory {
  395. private _globalState;
  396. /**
  397. * Constructs a TextureNodeFactory
  398. */
  399. constructor(globalState: GlobalState);
  400. /**
  401. * Generates a node widget
  402. * @param diagramEngine diagram engine
  403. * @param node node to generate
  404. * @returns node widget jsx
  405. */
  406. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: TextureNodeModel): JSX.Element;
  407. /**
  408. * Gets a new instance of a node model
  409. * @returns texture node model
  410. */
  411. getNewInstance(): TextureNodeModel;
  412. }
  413. }
  414. declare module NODEEDITOR {
  415. interface INumericInputComponentProps {
  416. label: string;
  417. value: number;
  418. step?: number;
  419. onChange: (value: number) => void;
  420. }
  421. export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
  422. value: string;
  423. }> {
  424. static defaultProps: {
  425. step: number;
  426. };
  427. private _localChange;
  428. constructor(props: INumericInputComponentProps);
  429. shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
  430. value: string;
  431. }): boolean;
  432. updateValue(evt: any): void;
  433. render(): JSX.Element;
  434. }
  435. }
  436. declare module NODEEDITOR {
  437. interface IVector2LineComponentProps {
  438. label: string;
  439. target: any;
  440. propertyName: string;
  441. step?: number;
  442. onChange?: (newvalue: BABYLON.Vector2) => void;
  443. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  444. }
  445. export class Vector2LineComponent extends React.Component<IVector2LineComponentProps, {
  446. isExpanded: boolean;
  447. value: BABYLON.Vector2;
  448. }> {
  449. static defaultProps: {
  450. step: number;
  451. };
  452. private _localChange;
  453. constructor(props: IVector2LineComponentProps);
  454. shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: {
  455. isExpanded: boolean;
  456. value: BABYLON.Vector2;
  457. }): boolean;
  458. switchExpandState(): void;
  459. raiseOnPropertyChanged(previousValue: BABYLON.Vector2): void;
  460. updateStateX(value: number): void;
  461. updateStateY(value: number): void;
  462. render(): JSX.Element;
  463. }
  464. }
  465. declare module NODEEDITOR {
  466. interface IVector2PropertyTabComponentProps {
  467. globalState: GlobalState;
  468. inputBlock: BABYLON.InputBlock;
  469. }
  470. export class Vector2PropertyTabComponent extends React.Component<IVector2PropertyTabComponentProps> {
  471. render(): JSX.Element;
  472. }
  473. }
  474. declare module NODEEDITOR {
  475. interface IVector3LineComponentProps {
  476. label: string;
  477. target: any;
  478. propertyName: string;
  479. step?: number;
  480. onChange?: (newvalue: BABYLON.Vector3) => void;
  481. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  482. }
  483. export class Vector3LineComponent extends React.Component<IVector3LineComponentProps, {
  484. isExpanded: boolean;
  485. value: BABYLON.Vector3;
  486. }> {
  487. static defaultProps: {
  488. step: number;
  489. };
  490. private _localChange;
  491. constructor(props: IVector3LineComponentProps);
  492. shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: {
  493. isExpanded: boolean;
  494. value: BABYLON.Vector3;
  495. }): boolean;
  496. switchExpandState(): void;
  497. raiseOnPropertyChanged(previousValue: BABYLON.Vector3): void;
  498. updateVector3(): void;
  499. updateStateX(value: number): void;
  500. updateStateY(value: number): void;
  501. updateStateZ(value: number): void;
  502. render(): JSX.Element;
  503. }
  504. }
  505. declare module NODEEDITOR {
  506. interface IVector3PropertyTabComponentProps {
  507. globalState: GlobalState;
  508. inputBlock: BABYLON.InputBlock;
  509. }
  510. export class Vector3PropertyTabComponent extends React.Component<IVector3PropertyTabComponentProps> {
  511. render(): JSX.Element;
  512. }
  513. }
  514. declare module NODEEDITOR {
  515. class ListLineOption {
  516. label: string;
  517. value: number | string;
  518. }
  519. interface IOptionsLineComponentProps {
  520. label: string;
  521. target: any;
  522. propertyName: string;
  523. options: ListLineOption[];
  524. noDirectUpdate?: boolean;
  525. onSelect?: (value: number | string) => void;
  526. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  527. valuesAreStrings?: boolean;
  528. defaultIfNull?: number;
  529. }
  530. export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
  531. value: number | string;
  532. }> {
  533. private _localChange;
  534. private _getValue;
  535. constructor(props: IOptionsLineComponentProps);
  536. shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
  537. value: number;
  538. }): boolean;
  539. raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
  540. updateValue(valueString: string): void;
  541. render(): JSX.Element;
  542. }
  543. }
  544. declare module NODEEDITOR {
  545. export interface IColor3LineComponentProps {
  546. label: string;
  547. target: any;
  548. propertyName: string;
  549. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  550. onChange?: () => void;
  551. }
  552. export class Color3LineComponent extends React.Component<IColor3LineComponentProps, {
  553. isExpanded: boolean;
  554. color: BABYLON.Color3;
  555. }> {
  556. private _localChange;
  557. constructor(props: IColor3LineComponentProps);
  558. shouldComponentUpdate(nextProps: IColor3LineComponentProps, nextState: {
  559. color: BABYLON.Color3;
  560. }): boolean;
  561. onChange(newValue: string): void;
  562. switchExpandState(): void;
  563. raiseOnPropertyChanged(previousValue: BABYLON.Color3): void;
  564. updateStateR(value: number): void;
  565. updateStateG(value: number): void;
  566. updateStateB(value: number): void;
  567. copyToClipboard(): void;
  568. render(): JSX.Element;
  569. }
  570. }
  571. declare module NODEEDITOR {
  572. interface IColor3PropertyTabComponentProps {
  573. globalState: GlobalState;
  574. inputBlock: BABYLON.InputBlock;
  575. }
  576. export class Color3PropertyTabComponent extends React.Component<IColor3PropertyTabComponentProps> {
  577. render(): JSX.Element;
  578. }
  579. }
  580. declare module NODEEDITOR {
  581. interface IFloatLineComponentProps {
  582. label: string;
  583. target: any;
  584. propertyName: string;
  585. onChange?: (newValue: number) => void;
  586. isInteger?: boolean;
  587. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  588. additionalClass?: string;
  589. step?: string;
  590. digits?: number;
  591. }
  592. export class FloatLineComponent extends React.Component<IFloatLineComponentProps, {
  593. value: string;
  594. }> {
  595. private _localChange;
  596. private _store;
  597. constructor(props: IFloatLineComponentProps);
  598. shouldComponentUpdate(nextProps: IFloatLineComponentProps, nextState: {
  599. value: string;
  600. }): boolean;
  601. raiseOnPropertyChanged(newValue: number, previousValue: number): void;
  602. updateValue(valueString: string): void;
  603. render(): JSX.Element;
  604. }
  605. }
  606. declare module NODEEDITOR {
  607. interface IFloatPropertyTabComponentProps {
  608. globalState: GlobalState;
  609. inputBlock: BABYLON.InputBlock;
  610. }
  611. export class FloatPropertyTabComponent extends React.Component<IFloatPropertyTabComponentProps> {
  612. render(): JSX.Element;
  613. }
  614. }
  615. declare module NODEEDITOR {
  616. interface IInputPropertyTabComponentProps {
  617. globalState: GlobalState;
  618. inputNode: InputNodeModel;
  619. }
  620. export class InputPropertyTabComponentProps extends React.Component<IInputPropertyTabComponentProps> {
  621. constructor(props: IInputPropertyTabComponentProps);
  622. renderValue(globalState: GlobalState): JSX.Element | null;
  623. setDefaultValue(): void;
  624. render(): JSX.Element;
  625. }
  626. }
  627. declare module NODEEDITOR {
  628. /**
  629. * Generic node model which stores information about a node editor block
  630. */
  631. export class InputNodeModel extends DefaultNodeModel {
  632. readonly inputBlock: BABYLON.InputBlock;
  633. /**
  634. * Constructs the node model
  635. */
  636. constructor();
  637. renderProperties(globalState: GlobalState): JSX.Element;
  638. }
  639. }
  640. declare module NODEEDITOR {
  641. /**
  642. * GenericNodeWidgetProps
  643. */
  644. export interface InputNodeWidgetProps {
  645. node: BABYLON.Nullable<InputNodeModel>;
  646. globalState: GlobalState;
  647. }
  648. /**
  649. * Used to display a node block for the node editor
  650. */
  651. export class InputNodeWidget extends React.Component<InputNodeWidgetProps> {
  652. /**
  653. * Creates a GenericNodeWidget
  654. * @param props
  655. */
  656. constructor(props: InputNodeWidgetProps);
  657. renderValue(value: string): JSX.Element | null;
  658. render(): JSX.Element | null;
  659. }
  660. }
  661. declare module NODEEDITOR {
  662. /**
  663. * Node factory which creates editor nodes
  664. */
  665. export class InputNodeFactory extends SRD.AbstractNodeFactory {
  666. private _globalState;
  667. /**
  668. * Constructs a GenericNodeFactory
  669. */
  670. constructor(globalState: GlobalState);
  671. /**
  672. * Generates a node widget
  673. * @param diagramEngine diagram engine
  674. * @param node node to generate
  675. * @returns node widget jsx
  676. */
  677. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: InputNodeModel): JSX.Element;
  678. /**
  679. * Gets a new instance of a node model
  680. * @returns input node model
  681. */
  682. getNewInstance(): InputNodeModel;
  683. }
  684. }
  685. declare module NODEEDITOR {
  686. interface ILogComponentProps {
  687. globalState: GlobalState;
  688. }
  689. export class LogEntry {
  690. message: string;
  691. isError: boolean;
  692. constructor(message: string, isError: boolean);
  693. }
  694. export class LogComponent extends React.Component<ILogComponentProps, {
  695. logs: LogEntry[];
  696. }> {
  697. constructor(props: ILogComponentProps);
  698. componentWillMount(): void;
  699. componentDidUpdate(): void;
  700. render(): JSX.Element;
  701. }
  702. }
  703. declare module NODEEDITOR {
  704. interface ILightPropertyTabComponentProps {
  705. globalState: GlobalState;
  706. node: LightNodeModel;
  707. }
  708. export class LightPropertyTabComponent extends React.Component<ILightPropertyTabComponentProps> {
  709. render(): JSX.Element;
  710. }
  711. }
  712. declare module NODEEDITOR {
  713. /**
  714. * BABYLON.Light node model which stores information about a node editor block
  715. */
  716. export class LightNodeModel extends DefaultNodeModel {
  717. private _block;
  718. /**
  719. * BABYLON.Light for the node if it exists
  720. */
  721. light: BABYLON.Nullable<BABYLON.Light>;
  722. /**
  723. * Constructs the node model
  724. */
  725. constructor();
  726. renderProperties(globalState: GlobalState): JSX.Element;
  727. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor): void;
  728. }
  729. }
  730. declare module NODEEDITOR {
  731. /**
  732. * GenericNodeWidgetProps
  733. */
  734. export interface ILightNodeWidgetProps {
  735. node: BABYLON.Nullable<LightNodeModel>;
  736. globalState: GlobalState;
  737. }
  738. /**
  739. * Used to display a node block for the node editor
  740. */
  741. export class LightNodeWidget extends React.Component<ILightNodeWidgetProps> {
  742. /**
  743. * Creates a GenericNodeWidget
  744. * @param props
  745. */
  746. constructor(props: ILightNodeWidgetProps);
  747. render(): JSX.Element;
  748. }
  749. }
  750. declare module NODEEDITOR {
  751. /**
  752. * Node factory which creates editor nodes
  753. */
  754. export class LightNodeFactory extends SRD.AbstractNodeFactory {
  755. private _globalState;
  756. /**
  757. * Constructs a LightNodeFactory
  758. */
  759. constructor(globalState: GlobalState);
  760. /**
  761. * Generates a node widget
  762. * @param diagramEngine diagram engine
  763. * @param node node to generate
  764. * @returns node widget jsx
  765. */
  766. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: LightNodeModel): JSX.Element;
  767. /**
  768. * Gets a new instance of a node model
  769. * @returns light node model
  770. */
  771. getNewInstance(): LightNodeModel;
  772. }
  773. }
  774. declare module NODEEDITOR {
  775. interface IMessageDialogComponentProps {
  776. globalState: GlobalState;
  777. }
  778. export class MessageDialogComponent extends React.Component<IMessageDialogComponentProps, {
  779. message: string;
  780. isError: boolean;
  781. }> {
  782. constructor(props: IMessageDialogComponentProps);
  783. render(): JSX.Element | null;
  784. }
  785. }
  786. declare module NODEEDITOR {
  787. export class AdvancedLinkFactory extends DefaultLinkFactory {
  788. constructor();
  789. getNewInstance(initialConfig?: any): AdvancedLinkModel;
  790. generateLinkSegment(model: AdvancedLinkModel, widget: DefaultLinkWidget, selected: boolean, path: string): JSX.Element;
  791. }
  792. }
  793. declare module NODEEDITOR {
  794. interface IGraphEditorProps {
  795. globalState: GlobalState;
  796. }
  797. export class NodeCreationOptions {
  798. nodeMaterialBlock: BABYLON.NodeMaterialBlock;
  799. type?: string;
  800. connection?: BABYLON.NodeMaterialConnectionPoint;
  801. }
  802. export class GraphEditor extends React.Component<IGraphEditorProps> {
  803. private readonly NodeWidth;
  804. private _engine;
  805. private _model;
  806. private _startX;
  807. private _moveInProgress;
  808. private _leftWidth;
  809. private _rightWidth;
  810. private _nodes;
  811. private _blocks;
  812. /** @hidden */
  813. _toAdd: LinkModel[] | null;
  814. /**
  815. * Creates a node and recursivly creates its parent nodes from it's input
  816. * @param nodeMaterialBlock
  817. */
  818. createNodeFromObject(options: NodeCreationOptions): DefaultNodeModel;
  819. componentDidMount(): void;
  820. componentWillUnmount(): void;
  821. constructor(props: IGraphEditorProps);
  822. zoomToFit(retry?: number): void;
  823. distributeGraph(): dagre.Node[];
  824. mapElements(): {
  825. id: string;
  826. metadata: {
  827. id: string;
  828. width: number;
  829. height: number;
  830. };
  831. }[];
  832. mapEdges(): {
  833. from: import("storm-react-diagrams").NodeModel;
  834. to: import("storm-react-diagrams").NodeModel;
  835. }[];
  836. buildMaterial(): void;
  837. build(needToWait?: boolean): void;
  838. reOrganize(): void;
  839. addValueNode(type: string): DefaultNodeModel;
  840. onPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  841. onPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  842. resizeColumns(evt: React.PointerEvent<HTMLDivElement>, forLeft?: boolean): void;
  843. buildColumnLayout(): string;
  844. emitNewBlock(event: React.DragEvent<HTMLDivElement>): void;
  845. render(): JSX.Element;
  846. }
  847. }
  848. declare module NODEEDITOR {
  849. /**
  850. * Generic node model which stores information about a node editor block
  851. */
  852. export class DefaultNodeModel extends NodeModel {
  853. /**
  854. * The babylon block this node represents
  855. */
  856. block: BABYLON.Nullable<BABYLON.NodeMaterialBlock>;
  857. ports: {
  858. [s: string]: DefaultPortModel;
  859. };
  860. /**
  861. * Constructs the node model
  862. */
  863. constructor(key: string);
  864. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor): void;
  865. renderProperties(globalState: GlobalState): JSX.Element | null;
  866. }
  867. }
  868. declare module NODEEDITOR {
  869. export class GlobalState {
  870. nodeMaterial?: BABYLON.NodeMaterial;
  871. hostElement: HTMLElement;
  872. hostDocument: HTMLDocument;
  873. onSelectionChangedObservable: BABYLON.Observable<BABYLON.Nullable<DefaultNodeModel>>;
  874. onRebuildRequiredObservable: BABYLON.Observable<void>;
  875. onResetRequiredObservable: BABYLON.Observable<void>;
  876. onUpdateRequiredObservable: BABYLON.Observable<void>;
  877. onZoomToFitRequiredObservable: BABYLON.Observable<void>;
  878. onReOrganizedRequiredObservable: BABYLON.Observable<void>;
  879. onLogRequiredObservable: BABYLON.Observable<LogEntry>;
  880. onErrorMessageDialogRequiredObservable: BABYLON.Observable<string>;
  881. }
  882. }
  883. declare module NODEEDITOR {
  884. export class Popup {
  885. static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
  886. private static _CopyStyles;
  887. }
  888. }
  889. declare module NODEEDITOR {
  890. /**
  891. * Interface used to specify creation options for the node editor
  892. */
  893. export interface INodeEditorOptions {
  894. nodeMaterial: BABYLON.NodeMaterial;
  895. }
  896. /**
  897. * Class used to create a node editor
  898. */
  899. export class NodeEditor {
  900. /**
  901. * Show the node editor
  902. * @param options defines the options to use to configure the node editor
  903. */
  904. static Show(options: INodeEditorOptions): void;
  905. }
  906. }