@babylonjs/node-editor 5.28.0 → 5.29.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,362 @@ 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 { ComponentType } from "react";
1811
+ export type LayoutTab = {
1812
+ /**
1813
+ * Tab id
1814
+ */
1815
+ id: string;
1816
+ /**
1817
+ * React component rendered by tab
1818
+ */
1819
+ component: ComponentType;
1820
+ };
1821
+ export type LayoutTabsRow = {
1822
+ /**
1823
+ * row id
1824
+ */
1825
+ id: string;
1826
+ /**
1827
+ * row height in its containing column
1828
+ */
1829
+ height: string;
1830
+ /**
1831
+ * selected tab in row
1832
+ */
1833
+ selectedTab: string;
1834
+ /**
1835
+ * list of tabs contained in row
1836
+ */
1837
+ tabs: LayoutTab[];
1838
+ };
1839
+ export type LayoutColumn = {
1840
+ /**
1841
+ * column id
1842
+ */
1843
+ id: string;
1844
+ /**
1845
+ * column width in the grid
1846
+ */
1847
+ width: string;
1848
+ /**
1849
+ * column rows
1850
+ */
1851
+ rows: LayoutTabsRow[];
1852
+ };
1853
+ export type Layout = {
1854
+ /**
1855
+ * layout columns
1856
+ */
1857
+ columns?: LayoutColumn[];
1858
+ };
1859
+ export type TabDrag = {
1860
+ /**
1861
+ * row number of the tab being dragged
1862
+ */
1863
+ rowNumber: number;
1864
+ /**
1865
+ * column number of the tab being dragged
1866
+ */
1867
+ columnNumber: number;
1868
+ /**
1869
+ * the tabs being dragged
1870
+ */
1871
+ tabs: {
1872
+ /**
1873
+ * id of tab being dragged
1874
+ */
1875
+ id: string;
1876
+ }[];
1877
+ };
1878
+ export enum ElementTypes {
1879
+ RESIZE_BAR = "0",
1880
+ TAB = "1",
1881
+ TAB_GROUP = "2",
1882
+ NONE = "2"
1883
+ }
1884
+ export enum ResizeDirections {
1885
+ ROW = "row",
1886
+ COLUMN = "column"
1887
+ }
1888
+
1889
+ }
1890
+ declare module "@babylonjs/node-editor/components/layout/utils" {
1891
+ import { Layout } from "@babylonjs/node-editor/components/layout/types";
1892
+ /**
1893
+ * Given a column and row number in the layout, return the corresponding column/row
1894
+ * @param layout
1895
+ * @param column
1896
+ * @param row
1897
+ * @returns
1898
+ */
1899
+ export const getPosInLayout: (layout: Layout, column: number, row?: number | undefined) => import("@babylonjs/node-editor/components/layout/types").LayoutTabsRow | import("./types").LayoutColumn;
1900
+ /**
1901
+ * Remove a row in position row, column from the layout, and redistribute heights of remaining rows
1902
+ * @param layout
1903
+ * @param column
1904
+ * @param row
1905
+ */
1906
+ export const removeLayoutRowAndRedistributePercentages: (layout: Layout, column: number, row: number) => void;
1907
+ /**
1908
+ * Add a percentage string to a number
1909
+ */
1910
+ export const addPercentageStringToNumber: (p1: string, p2: number) => number;
1911
+ /**
1912
+ * Parses a percentage string into a number
1913
+ * @param p the percentage string
1914
+ */
1915
+ export const parsePercentage: (p: string) => number;
1916
+
1561
1917
  }
1562
1918
  declare module "@babylonjs/node-editor/components/lines/ColorLineComponent" {
1563
1919
  import * as React from "react";
@@ -3367,6 +3723,55 @@ const _default: {
3367
3723
  export default _default;
3368
3724
  export const Default: any;
3369
3725
 
3726
+ }
3727
+ declare module "@babylonjs/node-editor/stories/layout/FlexibleGridLayout.stories" {
3728
+ /// <reference types="react" />
3729
+ import { IFlexibleGridLayoutProps } from "@babylonjs/node-editor/components/layout/FlexibleGridLayout";
3730
+ const _default: {
3731
+ component: import("react").FC<IFlexibleGridLayoutProps>;
3732
+ };
3733
+ export default _default;
3734
+ export const Default: {
3735
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3736
+ args: {
3737
+ layoutDefinition: {
3738
+ columns: {
3739
+ id: string;
3740
+ width: string;
3741
+ rows: {
3742
+ id: string;
3743
+ height: string;
3744
+ selectedTab: string;
3745
+ tabs: {
3746
+ id: string;
3747
+ component: JSX.Element;
3748
+ }[];
3749
+ }[];
3750
+ }[];
3751
+ };
3752
+ };
3753
+ };
3754
+ export const TwoColumn: {
3755
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3756
+ args: {
3757
+ layoutDefinition: {
3758
+ columns: {
3759
+ id: string;
3760
+ width: string;
3761
+ rows: {
3762
+ id: string;
3763
+ height: string;
3764
+ selectedTab: string;
3765
+ tabs: {
3766
+ id: string;
3767
+ component: JSX.Element;
3768
+ }[];
3769
+ }[];
3770
+ }[];
3771
+ };
3772
+ };
3773
+ };
3774
+
3370
3775
  }
3371
3776
  declare module "@babylonjs/node-editor/stories/lines/ColorLineComponent.stories" {
3372
3777
  /// <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.29.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.29.0",
27
27
  "react": "^17.0.2",
28
28
  "react-dom": "^17.0.2",
29
29
  "rimraf": "^3.0.2",