@babylonjs/gui-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.
@@ -217,6 +217,8 @@ interface ICommonControlPropertyGridComponentProps {
217
217
  interface ICommonControlPropertyGridComponentState {
218
218
  fontFamilyOptions: IInspectableOptions[];
219
219
  value: number;
220
+ invalidFonts: string[];
221
+ invalidFontAlertName?: string;
220
222
  }
221
223
  export class CommonControlPropertyGridComponent extends React.Component<ICommonControlPropertyGridComponentProps, ICommonControlPropertyGridComponentState> {
222
224
  private _onPropertyChangedObserver;
@@ -1727,6 +1729,362 @@ export type LabelProps = {
1727
1729
  };
1728
1730
  export const Label: React.FC<LabelProps>;
1729
1731
 
1732
+ }
1733
+ declare module "@babylonjs/gui-editor/components/layout/DraggableIcon" {
1734
+ import { FC } from "react";
1735
+ import { ElementTypes, TabDrag } from "@babylonjs/gui-editor/components/layout/types";
1736
+ /**
1737
+ * Arguments for the DraggableIcon component.
1738
+ */
1739
+ export interface IDraggableIconProps {
1740
+ /**
1741
+ * Icon source
1742
+ */
1743
+ src: string;
1744
+ /**
1745
+ * Object that will be passed to the drag event
1746
+ */
1747
+ item: TabDrag;
1748
+ /**
1749
+ * Type of drag event
1750
+ */
1751
+ type: ElementTypes;
1752
+ }
1753
+ /**
1754
+ * An icon that can be dragged by the user
1755
+ */
1756
+ export const DraggableIcon: FC<IDraggableIconProps>;
1757
+
1758
+ }
1759
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleColumn" {
1760
+ import { FC } from "react";
1761
+ /**
1762
+ * Arguments for the Column component.
1763
+ */
1764
+ export interface IFlexibleColumnProps {
1765
+ /**
1766
+ * Width of column
1767
+ */
1768
+ width: string;
1769
+ }
1770
+ /**
1771
+ * This component represents a single column in the layout. It receives a width
1772
+ * that it occupies and the content to display
1773
+ * @param props
1774
+ * @returns
1775
+ */
1776
+ export const FlexibleColumn: FC<IFlexibleColumnProps>;
1777
+
1778
+ }
1779
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleDragHandler" {
1780
+ import { FC } from "react";
1781
+ /**
1782
+ * Arguments for the DragHandler component.
1783
+ */
1784
+ export interface IFlexibleDragHandlerProps {
1785
+ /**
1786
+ * The size of the containing element. Used to calculate the percentage of
1787
+ * space occupied by the component
1788
+ */
1789
+ containerSize: {
1790
+ width: number;
1791
+ height: number;
1792
+ };
1793
+ }
1794
+ /**
1795
+ * This component receives the drop events and updates the layout accordingly
1796
+ */
1797
+ export const FlexibleDragHandler: FC<IFlexibleDragHandlerProps>;
1798
+
1799
+ }
1800
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleDropZone" {
1801
+ import { FC } from "react";
1802
+ /**
1803
+ * Arguments for the FlexibleDropZone component.
1804
+ */
1805
+ export interface IFlexibleDropZoneProps {
1806
+ /**
1807
+ * The row number of the component in the layout
1808
+ */
1809
+ rowNumber: number;
1810
+ /**
1811
+ * The column number of the component in the layout
1812
+ */
1813
+ columnNumber: number;
1814
+ }
1815
+ /**
1816
+ * This component contains the drag and drop zone for the resize bars that
1817
+ * allow redefining width and height of layout elements
1818
+ */
1819
+ export const FlexibleDropZone: FC<IFlexibleDropZoneProps>;
1820
+
1821
+ }
1822
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleGridContainer" {
1823
+ import { FC } from "react";
1824
+ /**
1825
+ * Arguments for the GridContainer component.
1826
+ */
1827
+ export interface IFlexibleGridContainerProps {
1828
+ }
1829
+ /**
1830
+ * Component responsible for mapping the layout to the actual components
1831
+ */
1832
+ export const FlexibleGridContainer: FC<IFlexibleGridContainerProps>;
1833
+
1834
+ }
1835
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleGridLayout" {
1836
+ import { FC } from "react";
1837
+ import { Layout } from "@babylonjs/gui-editor/components/layout/types";
1838
+ /**
1839
+ * Arguments for the Layout component.
1840
+ */
1841
+ export interface IFlexibleGridLayoutProps {
1842
+ /**
1843
+ * A definition of the layout which can be changed by the user
1844
+ */
1845
+ layoutDefinition: Layout;
1846
+ }
1847
+ /**
1848
+ * This component represents a grid layout that can be resized and rearranged
1849
+ * by the user.
1850
+ */
1851
+ export const FlexibleGridLayout: FC<IFlexibleGridLayoutProps>;
1852
+
1853
+ }
1854
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleResizeBar" {
1855
+ import { FC } from "react";
1856
+ import { ResizeDirections } from "@babylonjs/gui-editor/components/layout/types";
1857
+ /**
1858
+ * Arguments for the ResizeBar component.
1859
+ */
1860
+ export interface IFlexibleRowResizerProps {
1861
+ /**
1862
+ * Row number of the component that is being resized
1863
+ */
1864
+ rowNumber: number;
1865
+ /**
1866
+ * Column number of the component being resized
1867
+ */
1868
+ columnNumber: number;
1869
+ /**
1870
+ * If the resizing happens in row or column direction
1871
+ */
1872
+ direction: ResizeDirections;
1873
+ }
1874
+ /**
1875
+ * The item that will be sent to the drag event
1876
+ */
1877
+ export type ResizeItem = {
1878
+ /**
1879
+ * If the resizing happens in row or column direction
1880
+ */
1881
+ direction: ResizeDirections;
1882
+ /**
1883
+ * The row number of the component that is being resized
1884
+ */
1885
+ rowNumber: number;
1886
+ /**
1887
+ * the column number of the component being resized
1888
+ */
1889
+ columnNumber: number;
1890
+ };
1891
+ /**
1892
+ * A component that renders a bar that the user can drag to resize.
1893
+ */
1894
+ export const FlexibleResizeBar: FC<IFlexibleRowResizerProps>;
1895
+
1896
+ }
1897
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleTab" {
1898
+ import { FC } from "react";
1899
+ import { TabDrag } from "@babylonjs/gui-editor/components/layout/types";
1900
+ /**
1901
+ * Arguments for the FlexibleTab component.
1902
+ */
1903
+ export interface IFlexibleTabProps {
1904
+ /**
1905
+ * The tab's title.
1906
+ */
1907
+ title: string;
1908
+ /**
1909
+ * If the tab is currently selected or not
1910
+ */
1911
+ selected: boolean;
1912
+ /**
1913
+ * What happens when the user clicks on the tab
1914
+ */
1915
+ onClick: () => void;
1916
+ /**
1917
+ * The object that will be sent to the drag event
1918
+ */
1919
+ item: TabDrag;
1920
+ /**
1921
+ * What happens when the user drops another tab after this one
1922
+ */
1923
+ onTabDroppedAction: (item: TabDrag) => void;
1924
+ }
1925
+ /**
1926
+ * A component that renders a tab that the user can click
1927
+ * to activate or drag to reorder. It also listens for
1928
+ * drop events if the user wants to drop another tab
1929
+ * after it.
1930
+ */
1931
+ export const FlexibleTab: FC<IFlexibleTabProps>;
1932
+
1933
+ }
1934
+ declare module "@babylonjs/gui-editor/components/layout/FlexibleTabsContainer" {
1935
+ import { FC } from "react";
1936
+ import { LayoutTab } from "@babylonjs/gui-editor/components/layout/types";
1937
+ /**
1938
+ * Arguments for the TabsContainer component.
1939
+ */
1940
+ export interface IFlexibleTabsContainerProps {
1941
+ /**
1942
+ * The tabs to display
1943
+ */
1944
+ tabs: LayoutTab[];
1945
+ /**
1946
+ * Row index of component in layout
1947
+ */
1948
+ rowIndex: number;
1949
+ /**
1950
+ * Column index of component in layout
1951
+ */
1952
+ columnIndex: number;
1953
+ /**
1954
+ * Which tab is selected in the layout
1955
+ */
1956
+ selectedTab?: string;
1957
+ }
1958
+ /**
1959
+ * This component contains a set of tabs of which only one is visible at a time.
1960
+ * The tabs can also be dragged from and to different containers.
1961
+ */
1962
+ export const FlexibleTabsContainer: FC<IFlexibleTabsContainerProps>;
1963
+
1964
+ }
1965
+ declare module "@babylonjs/gui-editor/components/layout/LayoutContext" {
1966
+ /// <reference types="react" />
1967
+ import { Layout } from "@babylonjs/gui-editor/components/layout/types";
1968
+ export const LayoutContext: import("react").Context<{
1969
+ /**
1970
+ * The layout object
1971
+ */
1972
+ layout: Layout;
1973
+ /**
1974
+ * Function to set the layout object in the context
1975
+ */
1976
+ setLayout: (layout: Layout) => void;
1977
+ }>;
1978
+
1979
+ }
1980
+ declare module "@babylonjs/gui-editor/components/layout/types" {
1981
+ import { ComponentType } from "react";
1982
+ export type LayoutTab = {
1983
+ /**
1984
+ * Tab id
1985
+ */
1986
+ id: string;
1987
+ /**
1988
+ * React component rendered by tab
1989
+ */
1990
+ component: ComponentType;
1991
+ };
1992
+ export type LayoutTabsRow = {
1993
+ /**
1994
+ * row id
1995
+ */
1996
+ id: string;
1997
+ /**
1998
+ * row height in its containing column
1999
+ */
2000
+ height: string;
2001
+ /**
2002
+ * selected tab in row
2003
+ */
2004
+ selectedTab: string;
2005
+ /**
2006
+ * list of tabs contained in row
2007
+ */
2008
+ tabs: LayoutTab[];
2009
+ };
2010
+ export type LayoutColumn = {
2011
+ /**
2012
+ * column id
2013
+ */
2014
+ id: string;
2015
+ /**
2016
+ * column width in the grid
2017
+ */
2018
+ width: string;
2019
+ /**
2020
+ * column rows
2021
+ */
2022
+ rows: LayoutTabsRow[];
2023
+ };
2024
+ export type Layout = {
2025
+ /**
2026
+ * layout columns
2027
+ */
2028
+ columns?: LayoutColumn[];
2029
+ };
2030
+ export type TabDrag = {
2031
+ /**
2032
+ * row number of the tab being dragged
2033
+ */
2034
+ rowNumber: number;
2035
+ /**
2036
+ * column number of the tab being dragged
2037
+ */
2038
+ columnNumber: number;
2039
+ /**
2040
+ * the tabs being dragged
2041
+ */
2042
+ tabs: {
2043
+ /**
2044
+ * id of tab being dragged
2045
+ */
2046
+ id: string;
2047
+ }[];
2048
+ };
2049
+ export enum ElementTypes {
2050
+ RESIZE_BAR = "0",
2051
+ TAB = "1",
2052
+ TAB_GROUP = "2",
2053
+ NONE = "2"
2054
+ }
2055
+ export enum ResizeDirections {
2056
+ ROW = "row",
2057
+ COLUMN = "column"
2058
+ }
2059
+
2060
+ }
2061
+ declare module "@babylonjs/gui-editor/components/layout/utils" {
2062
+ import { Layout } from "@babylonjs/gui-editor/components/layout/types";
2063
+ /**
2064
+ * Given a column and row number in the layout, return the corresponding column/row
2065
+ * @param layout
2066
+ * @param column
2067
+ * @param row
2068
+ * @returns
2069
+ */
2070
+ export const getPosInLayout: (layout: Layout, column: number, row?: number | undefined) => import("@babylonjs/gui-editor/components/layout/types").LayoutTabsRow | import("./types").LayoutColumn;
2071
+ /**
2072
+ * Remove a row in position row, column from the layout, and redistribute heights of remaining rows
2073
+ * @param layout
2074
+ * @param column
2075
+ * @param row
2076
+ */
2077
+ export const removeLayoutRowAndRedistributePercentages: (layout: Layout, column: number, row: number) => void;
2078
+ /**
2079
+ * Add a percentage string to a number
2080
+ */
2081
+ export const addPercentageStringToNumber: (p1: string, p2: number) => number;
2082
+ /**
2083
+ * Parses a percentage string into a number
2084
+ * @param p the percentage string
2085
+ */
2086
+ export const parsePercentage: (p: string) => number;
2087
+
1730
2088
  }
1731
2089
  declare module "@babylonjs/gui-editor/components/lines/ColorLineComponent" {
1732
2090
  import * as React from "react";
@@ -3536,6 +3894,55 @@ const _default: {
3536
3894
  export default _default;
3537
3895
  export const Default: any;
3538
3896
 
3897
+ }
3898
+ declare module "@babylonjs/gui-editor/stories/layout/FlexibleGridLayout.stories" {
3899
+ /// <reference types="react" />
3900
+ import { IFlexibleGridLayoutProps } from "@babylonjs/gui-editor/components/layout/FlexibleGridLayout";
3901
+ const _default: {
3902
+ component: import("react").FC<IFlexibleGridLayoutProps>;
3903
+ };
3904
+ export default _default;
3905
+ export const Default: {
3906
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3907
+ args: {
3908
+ layoutDefinition: {
3909
+ columns: {
3910
+ id: string;
3911
+ width: string;
3912
+ rows: {
3913
+ id: string;
3914
+ height: string;
3915
+ selectedTab: string;
3916
+ tabs: {
3917
+ id: string;
3918
+ component: JSX.Element;
3919
+ }[];
3920
+ }[];
3921
+ }[];
3922
+ };
3923
+ };
3924
+ };
3925
+ export const TwoColumn: {
3926
+ render: (props: IFlexibleGridLayoutProps) => JSX.Element;
3927
+ args: {
3928
+ layoutDefinition: {
3929
+ columns: {
3930
+ id: string;
3931
+ width: string;
3932
+ rows: {
3933
+ id: string;
3934
+ height: string;
3935
+ selectedTab: string;
3936
+ tabs: {
3937
+ id: string;
3938
+ component: JSX.Element;
3939
+ }[];
3940
+ }[];
3941
+ }[];
3942
+ };
3943
+ };
3944
+ };
3945
+
3539
3946
  }
3540
3947
  declare module "@babylonjs/gui-editor/stories/lines/ColorLineComponent.stories" {
3541
3948
  /// <reference types="react" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/gui-editor",
3
- "version": "5.28.0",
3
+ "version": "5.29.0",
4
4
  "main": "dist/babylon.guiEditor.max.js",
5
5
  "module": "dist/babylon.guiEditor.max.js",
6
6
  "esnext": "dist/babylon.guiEditor.max.js",
@@ -24,8 +24,8 @@
24
24
  "@types/react-dom": ">=16.0.9"
25
25
  },
26
26
  "devDependencies": {
27
- "@babylonjs/core": "^5.28.0",
28
- "@babylonjs/gui": "^5.28.0",
27
+ "@babylonjs/core": "^5.29.0",
28
+ "@babylonjs/gui": "^5.29.0",
29
29
  "react": "^17.0.2",
30
30
  "react-dom": "^17.0.2",
31
31
  "rimraf": "^3.0.2",