@babylonjs/node-editor 5.28.0 → 5.30.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.
@@ -1558,6 +1558,366 @@ export type LabelProps = {
1558
1558
  };
1559
1559
  export const Label: React.FC<LabelProps>;
1560
1560
 
1561
+ }
1562
+ declare module "@babylonjs/node-editor/components/layout/DraggableIcon" {
1563
+ import { FC } from "react";
1564
+ import { ElementTypes, TabDrag } from "@babylonjs/node-editor/components/layout/types";
1565
+ /**
1566
+ * Arguments for the DraggableIcon component.
1567
+ */
1568
+ export interface IDraggableIconProps {
1569
+ /**
1570
+ * Icon source
1571
+ */
1572
+ src: string;
1573
+ /**
1574
+ * Object that will be passed to the drag event
1575
+ */
1576
+ item: TabDrag;
1577
+ /**
1578
+ * Type of drag event
1579
+ */
1580
+ type: ElementTypes;
1581
+ }
1582
+ /**
1583
+ * An icon that can be dragged by the user
1584
+ */
1585
+ export const DraggableIcon: FC<IDraggableIconProps>;
1586
+
1587
+ }
1588
+ declare module "@babylonjs/node-editor/components/layout/FlexibleColumn" {
1589
+ import { FC } from "react";
1590
+ /**
1591
+ * Arguments for the Column component.
1592
+ */
1593
+ export interface IFlexibleColumnProps {
1594
+ /**
1595
+ * Width of column
1596
+ */
1597
+ width: string;
1598
+ }
1599
+ /**
1600
+ * This component represents a single column in the layout. It receives a width
1601
+ * that it occupies and the content to display
1602
+ * @param props
1603
+ * @returns
1604
+ */
1605
+ export const FlexibleColumn: FC<IFlexibleColumnProps>;
1606
+
1607
+ }
1608
+ declare module "@babylonjs/node-editor/components/layout/FlexibleDragHandler" {
1609
+ import { FC } from "react";
1610
+ /**
1611
+ * Arguments for the DragHandler component.
1612
+ */
1613
+ export interface IFlexibleDragHandlerProps {
1614
+ /**
1615
+ * The size of the containing element. Used to calculate the percentage of
1616
+ * space occupied by the component
1617
+ */
1618
+ containerSize: {
1619
+ width: number;
1620
+ height: number;
1621
+ };
1622
+ }
1623
+ /**
1624
+ * This component receives the drop events and updates the layout accordingly
1625
+ */
1626
+ export const FlexibleDragHandler: FC<IFlexibleDragHandlerProps>;
1627
+
1628
+ }
1629
+ declare module "@babylonjs/node-editor/components/layout/FlexibleDropZone" {
1630
+ import { FC } from "react";
1631
+ /**
1632
+ * Arguments for the FlexibleDropZone component.
1633
+ */
1634
+ export interface IFlexibleDropZoneProps {
1635
+ /**
1636
+ * The row number of the component in the layout
1637
+ */
1638
+ rowNumber: number;
1639
+ /**
1640
+ * The column number of the component in the layout
1641
+ */
1642
+ columnNumber: number;
1643
+ }
1644
+ /**
1645
+ * This component contains the drag and drop zone for the resize bars that
1646
+ * allow redefining width and height of layout elements
1647
+ */
1648
+ export const FlexibleDropZone: FC<IFlexibleDropZoneProps>;
1649
+
1650
+ }
1651
+ declare module "@babylonjs/node-editor/components/layout/FlexibleGridContainer" {
1652
+ import { FC } from "react";
1653
+ /**
1654
+ * Arguments for the GridContainer component.
1655
+ */
1656
+ export interface IFlexibleGridContainerProps {
1657
+ }
1658
+ /**
1659
+ * Component responsible for mapping the layout to the actual components
1660
+ */
1661
+ export const FlexibleGridContainer: FC<IFlexibleGridContainerProps>;
1662
+
1663
+ }
1664
+ declare module "@babylonjs/node-editor/components/layout/FlexibleGridLayout" {
1665
+ import { FC } from "react";
1666
+ import { Layout } from "@babylonjs/node-editor/components/layout/types";
1667
+ /**
1668
+ * Arguments for the Layout component.
1669
+ */
1670
+ export interface IFlexibleGridLayoutProps {
1671
+ /**
1672
+ * A definition of the layout which can be changed by the user
1673
+ */
1674
+ layoutDefinition: Layout;
1675
+ }
1676
+ /**
1677
+ * This component represents a grid layout that can be resized and rearranged
1678
+ * by the user.
1679
+ */
1680
+ export const FlexibleGridLayout: FC<IFlexibleGridLayoutProps>;
1681
+
1682
+ }
1683
+ declare module "@babylonjs/node-editor/components/layout/FlexibleResizeBar" {
1684
+ import { FC } from "react";
1685
+ import { ResizeDirections } from "@babylonjs/node-editor/components/layout/types";
1686
+ /**
1687
+ * Arguments for the ResizeBar component.
1688
+ */
1689
+ export interface IFlexibleRowResizerProps {
1690
+ /**
1691
+ * Row number of the component that is being resized
1692
+ */
1693
+ rowNumber: number;
1694
+ /**
1695
+ * Column number of the component being resized
1696
+ */
1697
+ columnNumber: number;
1698
+ /**
1699
+ * If the resizing happens in row or column direction
1700
+ */
1701
+ direction: ResizeDirections;
1702
+ }
1703
+ /**
1704
+ * The item that will be sent to the drag event
1705
+ */
1706
+ export type ResizeItem = {
1707
+ /**
1708
+ * If the resizing happens in row or column direction
1709
+ */
1710
+ direction: ResizeDirections;
1711
+ /**
1712
+ * The row number of the component that is being resized
1713
+ */
1714
+ rowNumber: number;
1715
+ /**
1716
+ * the column number of the component being resized
1717
+ */
1718
+ columnNumber: number;
1719
+ };
1720
+ /**
1721
+ * A component that renders a bar that the user can drag to resize.
1722
+ */
1723
+ export const FlexibleResizeBar: FC<IFlexibleRowResizerProps>;
1724
+
1725
+ }
1726
+ declare module "@babylonjs/node-editor/components/layout/FlexibleTab" {
1727
+ import { FC } from "react";
1728
+ import { TabDrag } from "@babylonjs/node-editor/components/layout/types";
1729
+ /**
1730
+ * Arguments for the FlexibleTab component.
1731
+ */
1732
+ export interface IFlexibleTabProps {
1733
+ /**
1734
+ * The tab's title.
1735
+ */
1736
+ title: string;
1737
+ /**
1738
+ * If the tab is currently selected or not
1739
+ */
1740
+ selected: boolean;
1741
+ /**
1742
+ * What happens when the user clicks on the tab
1743
+ */
1744
+ onClick: () => void;
1745
+ /**
1746
+ * The object that will be sent to the drag event
1747
+ */
1748
+ item: TabDrag;
1749
+ /**
1750
+ * What happens when the user drops another tab after this one
1751
+ */
1752
+ onTabDroppedAction: (item: TabDrag) => void;
1753
+ }
1754
+ /**
1755
+ * A component that renders a tab that the user can click
1756
+ * to activate or drag to reorder. It also listens for
1757
+ * drop events if the user wants to drop another tab
1758
+ * after it.
1759
+ */
1760
+ export const FlexibleTab: FC<IFlexibleTabProps>;
1761
+
1762
+ }
1763
+ declare module "@babylonjs/node-editor/components/layout/FlexibleTabsContainer" {
1764
+ import { FC } from "react";
1765
+ import { LayoutTab } from "@babylonjs/node-editor/components/layout/types";
1766
+ /**
1767
+ * Arguments for the TabsContainer component.
1768
+ */
1769
+ export interface IFlexibleTabsContainerProps {
1770
+ /**
1771
+ * The tabs to display
1772
+ */
1773
+ tabs: LayoutTab[];
1774
+ /**
1775
+ * Row index of component in layout
1776
+ */
1777
+ rowIndex: number;
1778
+ /**
1779
+ * Column index of component in layout
1780
+ */
1781
+ columnIndex: number;
1782
+ /**
1783
+ * Which tab is selected in the layout
1784
+ */
1785
+ selectedTab?: string;
1786
+ }
1787
+ /**
1788
+ * This component contains a set of tabs of which only one is visible at a time.
1789
+ * The tabs can also be dragged from and to different containers.
1790
+ */
1791
+ export const FlexibleTabsContainer: FC<IFlexibleTabsContainerProps>;
1792
+
1793
+ }
1794
+ declare module "@babylonjs/node-editor/components/layout/LayoutContext" {
1795
+ /// <reference types="react" />
1796
+ import { Layout } from "@babylonjs/node-editor/components/layout/types";
1797
+ export const LayoutContext: import("react").Context<{
1798
+ /**
1799
+ * The layout object
1800
+ */
1801
+ layout: Layout;
1802
+ /**
1803
+ * Function to set the layout object in the context
1804
+ */
1805
+ setLayout: (layout: Layout) => void;
1806
+ }>;
1807
+
1808
+ }
1809
+ declare module "@babylonjs/node-editor/components/layout/types" {
1810
+ import { ReactElement } from "react";
1811
+ export type LayoutTab = {
1812
+ /**
1813
+ * Tab id
1814
+ */
1815
+ id: string;
1816
+ /**
1817
+ * React component rendered by tab
1818
+ */
1819
+ component: ReactElement;
1820
+ /**
1821
+ * Tab title
1822
+ */
1823
+ title: string;
1824
+ };
1825
+ export type LayoutTabsRow = {
1826
+ /**
1827
+ * row id
1828
+ */
1829
+ id: string;
1830
+ /**
1831
+ * row height in its containing column
1832
+ */
1833
+ height: string;
1834
+ /**
1835
+ * selected tab in row
1836
+ */
1837
+ selectedTab: string;
1838
+ /**
1839
+ * list of tabs contained in row
1840
+ */
1841
+ tabs: LayoutTab[];
1842
+ };
1843
+ export type LayoutColumn = {
1844
+ /**
1845
+ * column id
1846
+ */
1847
+ id: string;
1848
+ /**
1849
+ * column width in the grid
1850
+ */
1851
+ width: string;
1852
+ /**
1853
+ * column rows
1854
+ */
1855
+ rows: LayoutTabsRow[];
1856
+ };
1857
+ export type Layout = {
1858
+ /**
1859
+ * layout columns
1860
+ */
1861
+ columns?: LayoutColumn[];
1862
+ };
1863
+ export type TabDrag = {
1864
+ /**
1865
+ * row number of the tab being dragged
1866
+ */
1867
+ rowNumber: number;
1868
+ /**
1869
+ * column number of the tab being dragged
1870
+ */
1871
+ columnNumber: number;
1872
+ /**
1873
+ * the tabs being dragged
1874
+ */
1875
+ tabs: {
1876
+ /**
1877
+ * id of tab being dragged
1878
+ */
1879
+ id: string;
1880
+ }[];
1881
+ };
1882
+ export enum ElementTypes {
1883
+ RESIZE_BAR = "0",
1884
+ TAB = "1",
1885
+ TAB_GROUP = "2",
1886
+ NONE = "2"
1887
+ }
1888
+ export enum ResizeDirections {
1889
+ ROW = "row",
1890
+ COLUMN = "column"
1891
+ }
1892
+
1893
+ }
1894
+ declare module "@babylonjs/node-editor/components/layout/utils" {
1895
+ import { Layout } from "@babylonjs/node-editor/components/layout/types";
1896
+ /**
1897
+ * Given a column and row number in the layout, return the corresponding column/row
1898
+ * @param layout
1899
+ * @param column
1900
+ * @param row
1901
+ * @returns
1902
+ */
1903
+ export const getPosInLayout: (layout: Layout, column: number, row?: number | undefined) => import("@babylonjs/node-editor/components/layout/types").LayoutTabsRow | import("./types").LayoutColumn;
1904
+ /**
1905
+ * Remove a row in position row, column from the layout, and redistribute heights of remaining rows
1906
+ * @param layout
1907
+ * @param column
1908
+ * @param row
1909
+ */
1910
+ export const removeLayoutRowAndRedistributePercentages: (layout: Layout, column: number, row: number) => void;
1911
+ /**
1912
+ * Add a percentage string to a number
1913
+ */
1914
+ export const addPercentageStringToNumber: (p1: string, p2: number) => number;
1915
+ /**
1916
+ * Parses a percentage string into a number
1917
+ * @param p the percentage string
1918
+ */
1919
+ export const parsePercentage: (p: string) => number;
1920
+
1561
1921
  }
1562
1922
  declare module "@babylonjs/node-editor/components/lines/ColorLineComponent" {
1563
1923
  import * as React from "react";
@@ -2667,11 +3027,17 @@ export class GraphCanvasComponent extends React.Component<IGraphCanvasComponentP
2667
3027
  static readonly NodeWidth: number;
2668
3028
  private readonly _minZoom;
2669
3029
  private readonly _maxZoom;
3030
+ private _hostCanvasRef;
2670
3031
  private _hostCanvas;
3032
+ private _graphCanvasRef;
2671
3033
  private _graphCanvas;
3034
+ private _selectionContainerRef;
2672
3035
  private _selectionContainer;
3036
+ private _frameContainerRef;
2673
3037
  private _frameContainer;
3038
+ private _svgCanvasRef;
2674
3039
  private _svgCanvas;
3040
+ private _rootContainerRef;
2675
3041
  private _rootContainer;
2676
3042
  private _nodes;
2677
3043
  private _links;
@@ -2959,6 +3325,8 @@ export class GraphNode {
2959
3325
  private _displayManager;
2960
3326
  private _isVisible;
2961
3327
  private _enclosingFrameId;
3328
+ addClassToVisual(className: string): void;
3329
+ removeClassFromVisual(className: string): void;
2962
3330
  get isVisible(): boolean;
2963
3331
  set isVisible(value: boolean);
2964
3332
  private _upateNodePortNames;
@@ -3367,6 +3735,55 @@ const _default: {
3367
3735
  export default _default;
3368
3736
  export const Default: any;
3369
3737
 
3738
+ }
3739
+ declare module "@babylonjs/node-editor/stories/layout/FlexibleGridLayout.stories" {
3740
+ /// <reference types="react" />
3741
+ import { IFlexibleGridLayoutProps } from "@babylonjs/node-editor/components/layout/FlexibleGridLayout";
3742
+ const _default: {
3743
+ component: import("react").FC<IFlexibleGridLayoutProps>;
3744
+ };
3745
+ export default _default;
3746
+ export const Default: {
3747
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3748
+ args: {
3749
+ layoutDefinition: {
3750
+ columns: {
3751
+ id: string;
3752
+ width: string;
3753
+ rows: {
3754
+ id: string;
3755
+ height: string;
3756
+ selectedTab: string;
3757
+ tabs: {
3758
+ id: string;
3759
+ component: JSX.Element;
3760
+ }[];
3761
+ }[];
3762
+ }[];
3763
+ };
3764
+ };
3765
+ };
3766
+ export const TwoColumn: {
3767
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3768
+ args: {
3769
+ layoutDefinition: {
3770
+ columns: {
3771
+ id: string;
3772
+ width: string;
3773
+ rows: {
3774
+ id: string;
3775
+ height: string;
3776
+ selectedTab: string;
3777
+ tabs: {
3778
+ id: string;
3779
+ component: JSX.Element;
3780
+ }[];
3781
+ }[];
3782
+ }[];
3783
+ };
3784
+ };
3785
+ };
3786
+
3370
3787
  }
3371
3788
  declare module "@babylonjs/node-editor/stories/lines/ColorLineComponent.stories" {
3372
3789
  /// <reference types="react" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/node-editor",
3
- "version": "5.28.0",
3
+ "version": "5.30.0",
4
4
  "main": "dist/babylon.nodeEditor.max.js",
5
5
  "module": "dist/babylon.nodeEditor.max.js",
6
6
  "esnext": "dist/babylon.nodeEditor.max.js",
@@ -23,7 +23,7 @@
23
23
  "@types/react-dom": ">=16.0.9"
24
24
  },
25
25
  "devDependencies": {
26
- "@babylonjs/core": "^5.28.0",
26
+ "@babylonjs/core": "^5.30.0",
27
27
  "react": "^17.0.2",
28
28
  "react-dom": "^17.0.2",
29
29
  "rimraf": "^3.0.2",