@babylonjs/shared-ui-components 8.1.1 → 8.2.1

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.
Files changed (96) hide show
  1. package/colorPicker/colorComponentEntry.d.ts +1 -1
  2. package/colorPicker/colorPicker.d.ts +1 -1
  3. package/colorPicker/hexColor.d.ts +1 -1
  4. package/components/Button.d.ts +2 -1
  5. package/components/Button.js.map +1 -1
  6. package/components/bars/CommandBarComponent.d.ts +2 -2
  7. package/components/bars/CommandBarComponent.js.map +1 -1
  8. package/components/colorPicker/ColorComponentEntry.d.ts +1 -1
  9. package/components/colorPicker/ColorPicker.d.ts +1 -1
  10. package/components/colorPicker/HexColor.d.ts +1 -1
  11. package/components/layout/DraggableIcon.d.ts +1 -1
  12. package/components/layout/FlexibleColumn.d.ts +2 -2
  13. package/components/layout/FlexibleColumn.js.map +1 -1
  14. package/components/layout/FlexibleDragHandler.d.ts +2 -2
  15. package/components/layout/FlexibleDragHandler.js.map +1 -1
  16. package/components/layout/FlexibleDropZone.d.ts +2 -2
  17. package/components/layout/FlexibleDropZone.js.map +1 -1
  18. package/components/layout/FlexibleGridLayout.d.ts +1 -1
  19. package/components/layout/FlexibleResizeBar.d.ts +1 -1
  20. package/components/layout/FlexibleTab.d.ts +1 -1
  21. package/components/layout/FlexibleTabsContainer.d.ts +1 -1
  22. package/components/layout/LayoutContext.d.ts +1 -1
  23. package/components/layout/utils.d.ts +1 -1
  24. package/components/lines/ColorLineComponent.d.ts +3 -5
  25. package/components/lines/ColorPickerLineComponent.d.ts +2 -4
  26. package/components/lines/NumericInputComponent.d.ts +1 -1
  27. package/components/reactGraphSystem/GraphConnectorHandle.d.ts +2 -2
  28. package/components/reactGraphSystem/GraphConnectorHandle.js +1 -1
  29. package/components/reactGraphSystem/GraphConnectorHandle.js.map +1 -1
  30. package/components/reactGraphSystem/GraphContainer.d.ts +2 -2
  31. package/components/reactGraphSystem/GraphContainer.js.map +1 -1
  32. package/components/reactGraphSystem/GraphLinesContainer.d.ts +2 -2
  33. package/components/reactGraphSystem/GraphLinesContainer.js.map +1 -1
  34. package/components/reactGraphSystem/GraphNode.d.ts +2 -2
  35. package/components/reactGraphSystem/GraphNode.js.map +1 -1
  36. package/components/reactGraphSystem/GraphNodesContainer.d.ts +2 -2
  37. package/components/reactGraphSystem/GraphNodesContainer.js.map +1 -1
  38. package/components/reactGraphSystem/NodeRenderer.d.ts +2 -2
  39. package/components/reactGraphSystem/NodeRenderer.js.map +1 -1
  40. package/components/reactGraphSystem/useGraphContext.d.ts +1 -1
  41. package/lines/checkBoxLineComponent.d.ts +1 -1
  42. package/lines/color3LineComponent.d.ts +2 -2
  43. package/lines/color4LineComponent.d.ts +2 -2
  44. package/lines/colorLineComponent.d.ts +3 -5
  45. package/lines/colorPickerComponent.d.ts +2 -4
  46. package/lines/floatLineComponent.d.ts +2 -2
  47. package/lines/hexLineComponent.d.ts +2 -2
  48. package/lines/lineContainerComponent.d.ts +1 -1
  49. package/lines/matrixLineComponent.d.ts +2 -2
  50. package/lines/numericInputComponent.d.ts +1 -1
  51. package/lines/optionsLineComponent.d.ts +1 -1
  52. package/lines/sliderLineComponent.d.ts +2 -2
  53. package/lines/targetsProxy.d.ts +1 -1
  54. package/lines/textInputLineComponent.d.ts +2 -2
  55. package/lines/vector2LineComponent.d.ts +2 -2
  56. package/lines/vector3LineComponent.d.ts +2 -2
  57. package/lines/vector4LineComponent.d.ts +2 -2
  58. package/nodeGraphSystem/automaticProperties.d.ts +1 -1
  59. package/nodeGraphSystem/frameNodePort.d.ts +6 -6
  60. package/nodeGraphSystem/graphCanvas.d.ts +9 -9
  61. package/nodeGraphSystem/graphFrame.d.ts +4 -4
  62. package/nodeGraphSystem/graphNode.d.ts +7 -7
  63. package/nodeGraphSystem/interfaces/displayManager.d.ts +3 -3
  64. package/nodeGraphSystem/interfaces/nodeContainer.d.ts +2 -2
  65. package/nodeGraphSystem/interfaces/nodeData.d.ts +1 -1
  66. package/nodeGraphSystem/interfaces/portData.d.ts +1 -1
  67. package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +2 -2
  68. package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +5 -5
  69. package/nodeGraphSystem/nodeLink.d.ts +4 -4
  70. package/nodeGraphSystem/nodePort.d.ts +6 -6
  71. package/nodeGraphSystem/propertyLedger.d.ts +1 -1
  72. package/nodeGraphSystem/searchBox.d.ts +1 -1
  73. package/nodeGraphSystem/stateManager.d.ts +9 -9
  74. package/nodeGraphSystem/tools.d.ts +4 -4
  75. package/nodeGraphSystem/typeLedger.d.ts +4 -4
  76. package/nodeGraphSystem/types/framePortData.d.ts +2 -2
  77. package/package.json +3 -3
  78. package/split/splitContainer.d.ts +3 -2
  79. package/split/splitContainer.js.map +1 -1
  80. package/split/splitter.d.ts +1 -1
  81. package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +2 -2
  82. package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +2 -2
  83. package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +2 -2
  84. package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +2 -2
  85. package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +2 -2
  86. package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +2 -2
  87. package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +2 -2
  88. package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +2 -2
  89. package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +2 -2
  90. package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +2 -2
  91. package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +2 -2
  92. package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +2 -2
  93. package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +2 -2
  94. package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +2 -2
  95. package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +2 -2
  96. package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
2
+ import type { LockObject } from "../tabs/propertyGrids/lockObject.js";
3
3
  export interface IColorComponentEntryProps {
4
4
  value: number;
5
5
  label: string;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
3
+ import type { LockObject } from "../tabs/propertyGrids/lockObject.js";
4
4
  import "./colorPicker.scss";
5
5
  /**
6
6
  * Interface used to specify creation options for color picker
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
2
+ import type { LockObject } from "../tabs/propertyGrids/lockObject.js";
3
3
  export interface IHexColorProps {
4
4
  value: string;
5
5
  expectedLength: number;
@@ -1,3 +1,4 @@
1
+ import type { PropsWithChildren } from "react";
1
2
  export type ButtonProps = {
2
3
  disabled?: boolean;
3
4
  active?: boolean;
@@ -7,4 +8,4 @@ export type ButtonProps = {
7
8
  title?: string;
8
9
  backgroundColor?: string;
9
10
  };
10
- export declare const Button: React.FC<ButtonProps>;
11
+ export declare const Button: React.FC<PropsWithChildren<ButtonProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE;IAC1H,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CACjB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EACvJ,MAAM,CACT,EACD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,EAAE,eAAe,EAAE,YAEzB,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as styles from \"./Button.module.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport type ButtonProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\" | \"smaller\";\r\n title?: string;\r\n backgroundColor?: string;\r\n};\r\n\r\nexport const Button: React.FC<ButtonProps> = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {\r\n return (\r\n <button\r\n className={ClassNames(\r\n { button: true, active, wide: size === \"wide\", small: size === \"small\", smaller: size === \"smaller\", light: color === \"light\", dark: color === \"dark\" },\r\n styles\r\n )}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n style={{ backgroundColor }}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,MAAM,CAAC,MAAM,MAAM,GAA6C,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE;IAC7I,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CACjB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EACvJ,MAAM,CACT,EACD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,EAAE,eAAe,EAAE,YAEzB,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { PropsWithChildren } from \"react\";\r\nimport * as styles from \"./Button.module.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport type ButtonProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\" | \"smaller\";\r\n title?: string;\r\n backgroundColor?: string;\r\n};\r\n\r\nexport const Button: React.FC<PropsWithChildren<ButtonProps>> = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {\r\n return (\r\n <button\r\n className={ClassNames(\r\n { button: true, active, wide: size === \"wide\", small: size === \"small\", smaller: size === \"smaller\", light: color === \"light\", dark: color === \"dark\" },\r\n styles\r\n )}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n style={{ backgroundColor }}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  export interface ICommandBarComponentProps {
3
3
  onSaveButtonClicked?: () => void;
4
4
  onSaveToSnippetButtonClicked?: () => void;
@@ -13,4 +13,4 @@ export interface ICommandBarComponentProps {
13
13
  artboardColor?: string;
14
14
  artboardColorPickerColor?: string;
15
15
  }
16
- export declare const CommandBarComponent: FC<ICommandBarComponentProps>;
16
+ export declare const CommandBarComponent: FC<PropsWithChildren<ICommandBarComponentProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandBarComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/bars/CommandBarComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,4BAA4B,CAAC;AAClD,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAE/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAiB7E,MAAM,CAAC,MAAM,mBAAmB,GAAkC,CAAC,KAAK,EAAE,EAAE;IACxE,OAAO,CACH,eAAK,SAAS,EAAE,KAAK,CAAC,UAAU,aAC5B,eAAK,SAAS,EAAE,KAAK,CAAC,YAAY,aAC9B,eAAK,SAAS,EAAE,KAAK,CAAC,OAAO,aACzB,cAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAI,EAC3E,KAAC,wBAAwB;4BACrB,sCAAsC;;gCAAt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gCACL,CAAC,GACH,CACL,IACC,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,OAAO,YAAG,KAAK,CAAC,QAAQ,GAAO,IACnD,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,aAAa,YAC/B,cAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAI,GACjE,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { JoinClassNames } from \"../classNames\";\r\nimport { CommandButtonComponent } from \"./CommandButtonComponent\";\r\nimport { CommandDropdownComponent } from \"./CommandDropdownComponent\";\r\n\r\nimport hamburgerIcon from \"../../imgs/hamburgerIcon.svg\";\r\nimport pointerIcon from \"../../imgs/pointerIcon.svg\";\r\nimport handIcon from \"../../imgs/handIcon.svg\";\r\nimport zoomIcon from \"../../imgs/zoomIcon.svg\";\r\nimport logoIcon from \"../../imgs/babylonLogo.svg\";\r\nimport canvasFitIcon from \"../../imgs/canvasFitIcon.svg\";\r\nimport betaFlag from \"../../imgs/betaFlag.svg\";\r\n\r\nimport * as style from \"./CommandBar.module.scss\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { ColorPickerLineComponent } from \"../lines/ColorPickerLineComponent\";\r\n\r\nexport interface ICommandBarComponentProps {\r\n onSaveButtonClicked?: () => void;\r\n onSaveToSnippetButtonClicked?: () => void;\r\n onLoadFromSnippetButtonClicked?: () => void;\r\n onHelpButtonClicked?: () => void;\r\n onGiveFeedbackButtonClicked?: () => void;\r\n onSelectButtonClicked?: () => void;\r\n onPanButtonClicked?: () => void;\r\n onZoomButtonClicked?: () => void;\r\n onFitButtonClicked?: () => void;\r\n onArtboardColorChanged?: (newColor: string) => void;\r\n artboardColor?: string;\r\n artboardColorPickerColor?: string;\r\n}\r\n\r\nexport const CommandBarComponent: FC<ICommandBarComponentProps> = (props) => {\r\n return (\r\n <div className={style.commandBar}>\r\n <div className={style.commandsLeft}>\r\n <div className={style.divider}>\r\n <img src={logoIcon} color=\"white\" className={\"active\"} draggable={false} />\r\n <CommandDropdownComponent\r\n //globalState={this.props.globalState}\r\n toRight={true}\r\n icon={hamburgerIcon}\r\n tooltip=\"Options\"\r\n items={[\r\n {\r\n label: \"Save\",\r\n onClick: () => {\r\n props.onSaveButtonClicked && props.onSaveButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load\",\r\n fileButton: true,\r\n },\r\n {\r\n label: \"Save to snippet\",\r\n onClick: () => {\r\n props.onSaveToSnippetButtonClicked && props.onSaveToSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load from snippet\",\r\n onClick: () => {\r\n props.onLoadFromSnippetButtonClicked && props.onLoadFromSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Help\",\r\n onClick: () => {\r\n props.onHelpButtonClicked && props.onHelpButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Give feedback\",\r\n onClick: () => {\r\n props.onGiveFeedbackButtonClicked && props.onGiveFeedbackButtonClicked();\r\n },\r\n },\r\n ]}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Select\"\r\n icon={pointerIcon}\r\n shortcut=\"S\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onSelectButtonClicked && props.onSelectButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Pan\"\r\n icon={handIcon}\r\n shortcut=\"P\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onPanButtonClicked && props.onPanButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Zoom\"\r\n shortcut=\"Z\"\r\n icon={zoomIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onZoomButtonClicked && props.onZoomButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={style.divider}>\r\n <CommandButtonComponent\r\n tooltip=\"Fit to Window\"\r\n shortcut=\"F\"\r\n icon={canvasFitIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onFitButtonClicked && props.onFitButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={JoinClassNames(style, \"divider\", \"padded\")}>\r\n <div style={{ paddingRight: \"5px\" }}>Artboard:</div>\r\n {props.onArtboardColorChanged && (\r\n <ColorPickerLineComponent\r\n backgroundColor={props.artboardColorPickerColor || \"#888888\"}\r\n value={props.artboardColor ? Color3.FromHexString(props.artboardColor) : new Color3(0, 0, 0)}\r\n onColorChanged={(newColor: string) => {\r\n if (props.onArtboardColorChanged) {\r\n props.onArtboardColorChanged(newColor);\r\n }\r\n }}\r\n />\r\n )}\r\n </div>\r\n <div className={style.divider}>{props.children}</div>\r\n </div>\r\n <div className={style.commandsRight}>\r\n <img src={betaFlag} className={style.betaFlag} draggable={false} />\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"CommandBarComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/bars/CommandBarComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,4BAA4B,CAAC;AAClD,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAE/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAiB7E,MAAM,CAAC,MAAM,mBAAmB,GAAqD,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AAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5F,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE;oCACjC,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;wCAC/B,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;oCAC3C,CAAC;gCACL,CAAC,GACH,CACL,IACC,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,OAAO,YAAG,KAAK,CAAC,QAAQ,GAAO,IACnD,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,aAAa,YAC/B,cAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAI,GACjE,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport { JoinClassNames } from \"../classNames\";\r\nimport { CommandButtonComponent } from \"./CommandButtonComponent\";\r\nimport { CommandDropdownComponent } from \"./CommandDropdownComponent\";\r\n\r\nimport hamburgerIcon from \"../../imgs/hamburgerIcon.svg\";\r\nimport pointerIcon from \"../../imgs/pointerIcon.svg\";\r\nimport handIcon from \"../../imgs/handIcon.svg\";\r\nimport zoomIcon from \"../../imgs/zoomIcon.svg\";\r\nimport logoIcon from \"../../imgs/babylonLogo.svg\";\r\nimport canvasFitIcon from \"../../imgs/canvasFitIcon.svg\";\r\nimport betaFlag from \"../../imgs/betaFlag.svg\";\r\n\r\nimport * as style from \"./CommandBar.module.scss\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { ColorPickerLineComponent } from \"../lines/ColorPickerLineComponent\";\r\n\r\nexport interface ICommandBarComponentProps {\r\n onSaveButtonClicked?: () => void;\r\n onSaveToSnippetButtonClicked?: () => void;\r\n onLoadFromSnippetButtonClicked?: () => void;\r\n onHelpButtonClicked?: () => void;\r\n onGiveFeedbackButtonClicked?: () => void;\r\n onSelectButtonClicked?: () => void;\r\n onPanButtonClicked?: () => void;\r\n onZoomButtonClicked?: () => void;\r\n onFitButtonClicked?: () => void;\r\n onArtboardColorChanged?: (newColor: string) => void;\r\n artboardColor?: string;\r\n artboardColorPickerColor?: string;\r\n}\r\n\r\nexport const CommandBarComponent: FC<PropsWithChildren<ICommandBarComponentProps>> = (props) => {\r\n return (\r\n <div className={style.commandBar}>\r\n <div className={style.commandsLeft}>\r\n <div className={style.divider}>\r\n <img src={logoIcon} color=\"white\" className={\"active\"} draggable={false} />\r\n <CommandDropdownComponent\r\n //globalState={this.props.globalState}\r\n toRight={true}\r\n icon={hamburgerIcon}\r\n tooltip=\"Options\"\r\n items={[\r\n {\r\n label: \"Save\",\r\n onClick: () => {\r\n props.onSaveButtonClicked && props.onSaveButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load\",\r\n fileButton: true,\r\n },\r\n {\r\n label: \"Save to snippet\",\r\n onClick: () => {\r\n props.onSaveToSnippetButtonClicked && props.onSaveToSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load from snippet\",\r\n onClick: () => {\r\n props.onLoadFromSnippetButtonClicked && props.onLoadFromSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Help\",\r\n onClick: () => {\r\n props.onHelpButtonClicked && props.onHelpButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Give feedback\",\r\n onClick: () => {\r\n props.onGiveFeedbackButtonClicked && props.onGiveFeedbackButtonClicked();\r\n },\r\n },\r\n ]}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Select\"\r\n icon={pointerIcon}\r\n shortcut=\"S\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onSelectButtonClicked && props.onSelectButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Pan\"\r\n icon={handIcon}\r\n shortcut=\"P\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onPanButtonClicked && props.onPanButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Zoom\"\r\n shortcut=\"Z\"\r\n icon={zoomIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onZoomButtonClicked && props.onZoomButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={style.divider}>\r\n <CommandButtonComponent\r\n tooltip=\"Fit to Window\"\r\n shortcut=\"F\"\r\n icon={canvasFitIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onFitButtonClicked && props.onFitButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={JoinClassNames(style, \"divider\", \"padded\")}>\r\n <div style={{ paddingRight: \"5px\" }}>Artboard:</div>\r\n {props.onArtboardColorChanged && (\r\n <ColorPickerLineComponent\r\n backgroundColor={props.artboardColorPickerColor || \"#888888\"}\r\n value={props.artboardColor ? Color3.FromHexString(props.artboardColor) : new Color3(0, 0, 0)}\r\n onColorChanged={(newColor: string) => {\r\n if (props.onArtboardColorChanged) {\r\n props.onArtboardColorChanged(newColor);\r\n }\r\n }}\r\n />\r\n )}\r\n </div>\r\n <div className={style.divider}>{props.children}</div>\r\n </div>\r\n <div className={style.commandsRight}>\r\n <img src={betaFlag} className={style.betaFlag} draggable={false} />\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
2
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
3
3
  export interface IColorComponentEntryProps {
4
4
  value: number;
5
5
  label: string;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
3
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
4
4
  /**
5
5
  * Interface used to specify creation options for color picker
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
2
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
3
3
  export interface IHexColorProps {
4
4
  value: string;
5
5
  expectedLength: number;
@@ -1,5 +1,5 @@
1
1
  import type { FC } from "react";
2
- import type { ElementTypes, TabDrag } from "./types";
2
+ import type { ElementTypes, TabDrag } from "./types.js";
3
3
  /**
4
4
  * Arguments for the DraggableIcon component.
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  /**
3
3
  * Arguments for the Column component.
4
4
  */
@@ -14,4 +14,4 @@ export interface IFlexibleColumnProps {
14
14
  * @param props
15
15
  * @returns
16
16
  */
17
- export declare const FlexibleColumn: FC<IFlexibleColumnProps>;
17
+ export declare const FlexibleColumn: FC<PropsWithChildren<IFlexibleColumnProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"FlexibleColumn.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleColumn.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAYtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAA6B,CAAC,KAAK,EAAE,EAAE;IAC9D,OAAO,CACH,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,YAC9D,KAAK,CAAC,QAAQ,GACb,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport * as style from \"./FlexibleColumn.module.scss\";\r\n\r\n/**\r\n * Arguments for the Column component.\r\n */\r\nexport interface IFlexibleColumnProps {\r\n /**\r\n * Width of column\r\n */\r\n width: string;\r\n}\r\n\r\n/**\r\n * This component represents a single column in the layout. It receives a width\r\n * that it occupies and the content to display\r\n * @param props\r\n * @returns\r\n */\r\nexport const FlexibleColumn: FC<IFlexibleColumnProps> = (props) => {\r\n return (\r\n <div style={{ width: props.width }} className={style.flexibleColumn}>\r\n {props.children}\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"FlexibleColumn.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleColumn.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAYtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgD,CAAC,KAAK,EAAE,EAAE;IACjF,OAAO,CACH,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,YAC9D,KAAK,CAAC,QAAQ,GACb,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport * as style from \"./FlexibleColumn.module.scss\";\r\n\r\n/**\r\n * Arguments for the Column component.\r\n */\r\nexport interface IFlexibleColumnProps {\r\n /**\r\n * Width of column\r\n */\r\n width: string;\r\n}\r\n\r\n/**\r\n * This component represents a single column in the layout. It receives a width\r\n * that it occupies and the content to display\r\n * @param props\r\n * @returns\r\n */\r\nexport const FlexibleColumn: FC<PropsWithChildren<IFlexibleColumnProps>> = (props) => {\r\n return (\r\n <div style={{ width: props.width }} className={style.flexibleColumn}>\r\n {props.children}\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  /**
3
3
  * Arguments for the DragHandler component.
4
4
  */
@@ -17,4 +17,4 @@ export interface IFlexibleDragHandlerProps {
17
17
  * @param props properties
18
18
  * @returns DragHandler element
19
19
  */
20
- export declare const FlexibleDragHandler: FC<IFlexibleDragHandlerProps>;
20
+ export declare const FlexibleDragHandler: FC<PropsWithChildren<IFlexibleDragHandlerProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"FlexibleDragHandler.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleDragHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAchD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkC,CAAC,KAAK,EAAE,EAAE;IACxE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACxD,yBAAyB;IACzB,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7B,MAAM,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC;QACjC,KAAK,CAAC,IAAI,EAAE,OAAO;YACf,MAAM,OAAO,GAAG,IAAkB,CAAC;YAEnC,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAG,CAAC,CAAC,EAAE,EAAG,CAAC,CAAC,CAAC,CAAC;YACtC,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;gBACrB,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,UAAU,EAAE,CAAC;oBACpD,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,SAA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,SAAS,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAChI,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,GAAY,EAAE,OAAgB,EAAE,IAAsB,EAAE,EAAE;QACrG,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACjB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACJ,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,CACH,cAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YACnD,KAAK,CAAC,QAAQ,GACb,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { useContext, useRef } from \"react\";\r\nimport { Vector2 } from \"core/Maths/math\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { useDrop } from \"react-dnd\";\r\nimport { ElementTypes } from \"./types\";\r\nimport type { LayoutTabsRow, LayoutColumn } from \"./types\";\r\nimport { addPercentageStringToNumber, getPosInLayout } from \"./utils\";\r\nimport { LayoutContext } from \"./LayoutContext\";\r\nimport type { ResizeItem } from \"./FlexibleResizeBar\";\r\n\r\n/**\r\n * Arguments for the DragHandler component.\r\n */\r\nexport interface IFlexibleDragHandlerProps {\r\n /**\r\n * The size of the containing element. Used to calculate the percentage of\r\n * space occupied by the component\r\n */\r\n containerSize: { width: number; height: number };\r\n}\r\n\r\n/**\r\n * This component receives the drop events and updates the layout accordingly\r\n * @param props properties\r\n * @returns DragHandler element\r\n */\r\nexport const FlexibleDragHandler: FC<IFlexibleDragHandlerProps> = (props) => {\r\n const { layout, setLayout } = useContext(LayoutContext);\r\n // CLICK/DRAG INFORMATION\r\n const pointerPos = useRef<Nullable<Vector2>>(null);\r\n const [_, drop] = useDrop(() => ({\r\n accept: [ElementTypes.RESIZE_BAR],\r\n hover(item, monitor) {\r\n const anyitem = item as ResizeItem;\r\n\r\n const xy = monitor.getClientOffset();\r\n const pos = new Vector2(xy!.x, xy!.y);\r\n if (pointerPos.current) {\r\n if (monitor.getItemType() === ElementTypes.RESIZE_BAR) {\r\n onResize(anyitem.rowNumber, anyitem.columnNumber, pos, pointerPos.current, anyitem.direction);\r\n }\r\n }\r\n pointerPos.current = pos;\r\n },\r\n drop(item, monitor) {\r\n pointerPos.current = null;\r\n },\r\n }));\r\n\r\n const getLayoutProperty = (layout: LayoutColumn | LayoutTabsRow, property: \"width\" | \"height\") => {\r\n if (property === \"width\") {\r\n return (layout as LayoutColumn)[property];\r\n } else {\r\n return (layout as LayoutTabsRow)[property];\r\n }\r\n };\r\n\r\n const setLayoutProperty = (layout: LayoutColumn | LayoutTabsRow, property: \"width\" | \"height\", value: string) => {\r\n if (property === \"width\") {\r\n (layout as LayoutColumn)[property] = value;\r\n } else {\r\n (layout as LayoutTabsRow)[property] = value;\r\n }\r\n };\r\n\r\n const processResize = (\r\n pos: Vector2,\r\n prevPos: Vector2,\r\n row0: number | undefined,\r\n column0: number,\r\n row1: number | undefined,\r\n column1: number,\r\n axis: \"x\" | \"y\",\r\n maxAxisValue: number,\r\n property: \"width\" | \"height\",\r\n minFinalValue: number\r\n ) => {\r\n // Check axis difference\r\n const axisDiff = pos[axis] - prevPos[axis];\r\n\r\n try {\r\n // Get layout rows\r\n const layoutElement0 = getPosInLayout(layout, column0, row0);\r\n const layoutElement1 = getPosInLayout(layout, column1, row1);\r\n\r\n if (layoutElement0 && layoutElement1) {\r\n const percDiff = (axisDiff / maxAxisValue) * 100;\r\n\r\n const newValue0 = addPercentageStringToNumber(getLayoutProperty(layoutElement0, property), percDiff);\r\n const newValue1 = addPercentageStringToNumber(getLayoutProperty(layoutElement1, property), -percDiff);\r\n\r\n if (newValue0 >= minFinalValue && newValue1 >= minFinalValue) {\r\n setLayoutProperty(layoutElement0, property, newValue0.toFixed(2) + \"%\");\r\n setLayoutProperty(layoutElement1, property, newValue1.toFixed(2) + \"%\");\r\n }\r\n\r\n setLayout({ ...layout });\r\n }\r\n } catch (e) {\r\n // If an error occurred, we're trying to resize something invalid, so don't do anything\r\n return;\r\n }\r\n };\r\n\r\n const processResizeRow = (pos: Vector2, prevPos: Vector2, args: { row: number; column: number }) => {\r\n processResize(pos, prevPos, args.row, args.column, args.row + 1, args.column, \"y\", props.containerSize.height, \"height\", 5);\r\n };\r\n\r\n const processResizeColumn = (pos: Vector2, prevPos: Vector2, args: { row: number; column: number }) => {\r\n processResize(pos, prevPos, undefined, args.column, undefined, args.column + 1, \"x\", props.containerSize.width, \"width\", 5);\r\n };\r\n\r\n const onResize = (row: number, column: number, pos: Vector2, prevPos: Vector2, type: \"row\" | \"column\") => {\r\n if (type === \"row\") {\r\n processResizeRow(pos, prevPos, { row, column });\r\n } else {\r\n processResizeColumn(pos, prevPos, { row, column });\r\n }\r\n pointerPos.current = pos;\r\n };\r\n\r\n return (\r\n <div ref={drop} style={{ width: \"100%\", height: \"100%\" }}>\r\n {props.children}\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"FlexibleDragHandler.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleDragHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAA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EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACJ,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,CACH,cAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YACnD,KAAK,CAAC,QAAQ,GACb,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport { useContext, useRef } from \"react\";\r\nimport { Vector2 } from \"core/Maths/math\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { useDrop } from \"react-dnd\";\r\nimport { ElementTypes } from \"./types\";\r\nimport type { LayoutTabsRow, LayoutColumn } from \"./types\";\r\nimport { addPercentageStringToNumber, getPosInLayout } from \"./utils\";\r\nimport { LayoutContext } from \"./LayoutContext\";\r\nimport type { ResizeItem } from \"./FlexibleResizeBar\";\r\n\r\n/**\r\n * Arguments for the DragHandler component.\r\n */\r\nexport interface IFlexibleDragHandlerProps {\r\n /**\r\n * The size of the containing element. Used to calculate the percentage of\r\n * space occupied by the component\r\n */\r\n containerSize: { width: number; height: number };\r\n}\r\n\r\n/**\r\n * This component receives the drop events and updates the layout accordingly\r\n * @param props properties\r\n * @returns DragHandler element\r\n */\r\nexport const FlexibleDragHandler: FC<PropsWithChildren<IFlexibleDragHandlerProps>> = (props) => {\r\n const { layout, setLayout } = useContext(LayoutContext);\r\n // CLICK/DRAG INFORMATION\r\n const pointerPos = useRef<Nullable<Vector2>>(null);\r\n const [_, drop] = useDrop(() => ({\r\n accept: [ElementTypes.RESIZE_BAR],\r\n hover(item, monitor) {\r\n const anyitem = item as ResizeItem;\r\n\r\n const xy = monitor.getClientOffset();\r\n const pos = new Vector2(xy!.x, xy!.y);\r\n if (pointerPos.current) {\r\n if (monitor.getItemType() === ElementTypes.RESIZE_BAR) {\r\n onResize(anyitem.rowNumber, anyitem.columnNumber, pos, pointerPos.current, anyitem.direction);\r\n }\r\n }\r\n pointerPos.current = pos;\r\n },\r\n drop(item, monitor) {\r\n pointerPos.current = null;\r\n },\r\n }));\r\n\r\n const getLayoutProperty = (layout: LayoutColumn | LayoutTabsRow, property: \"width\" | \"height\") => {\r\n if (property === \"width\") {\r\n return (layout as LayoutColumn)[property];\r\n } else {\r\n return (layout as LayoutTabsRow)[property];\r\n }\r\n };\r\n\r\n const setLayoutProperty = (layout: LayoutColumn | LayoutTabsRow, property: \"width\" | \"height\", value: string) => {\r\n if (property === \"width\") {\r\n (layout as LayoutColumn)[property] = value;\r\n } else {\r\n (layout as LayoutTabsRow)[property] = value;\r\n }\r\n };\r\n\r\n const processResize = (\r\n pos: Vector2,\r\n prevPos: Vector2,\r\n row0: number | undefined,\r\n column0: number,\r\n row1: number | undefined,\r\n column1: number,\r\n axis: \"x\" | \"y\",\r\n maxAxisValue: number,\r\n property: \"width\" | \"height\",\r\n minFinalValue: number\r\n ) => {\r\n // Check axis difference\r\n const axisDiff = pos[axis] - prevPos[axis];\r\n\r\n try {\r\n // Get layout rows\r\n const layoutElement0 = getPosInLayout(layout, column0, row0);\r\n const layoutElement1 = getPosInLayout(layout, column1, row1);\r\n\r\n if (layoutElement0 && layoutElement1) {\r\n const percDiff = (axisDiff / maxAxisValue) * 100;\r\n\r\n const newValue0 = addPercentageStringToNumber(getLayoutProperty(layoutElement0, property), percDiff);\r\n const newValue1 = addPercentageStringToNumber(getLayoutProperty(layoutElement1, property), -percDiff);\r\n\r\n if (newValue0 >= minFinalValue && newValue1 >= minFinalValue) {\r\n setLayoutProperty(layoutElement0, property, newValue0.toFixed(2) + \"%\");\r\n setLayoutProperty(layoutElement1, property, newValue1.toFixed(2) + \"%\");\r\n }\r\n\r\n setLayout({ ...layout });\r\n }\r\n } catch (e) {\r\n // If an error occurred, we're trying to resize something invalid, so don't do anything\r\n return;\r\n }\r\n };\r\n\r\n const processResizeRow = (pos: Vector2, prevPos: Vector2, args: { row: number; column: number }) => {\r\n processResize(pos, prevPos, args.row, args.column, args.row + 1, args.column, \"y\", props.containerSize.height, \"height\", 5);\r\n };\r\n\r\n const processResizeColumn = (pos: Vector2, prevPos: Vector2, args: { row: number; column: number }) => {\r\n processResize(pos, prevPos, undefined, args.column, undefined, args.column + 1, \"x\", props.containerSize.width, \"width\", 5);\r\n };\r\n\r\n const onResize = (row: number, column: number, pos: Vector2, prevPos: Vector2, type: \"row\" | \"column\") => {\r\n if (type === \"row\") {\r\n processResizeRow(pos, prevPos, { row, column });\r\n } else {\r\n processResizeColumn(pos, prevPos, { row, column });\r\n }\r\n pointerPos.current = pos;\r\n };\r\n\r\n return (\r\n <div ref={drop} style={{ width: \"100%\", height: \"100%\" }}>\r\n {props.children}\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  /**
3
3
  * Arguments for the FlexibleDropZone component.
4
4
  */
@@ -18,4 +18,4 @@ export interface IFlexibleDropZoneProps {
18
18
  * @param props properties
19
19
  * @returns drop zone element
20
20
  */
21
- export declare const FlexibleDropZone: FC<IFlexibleDropZoneProps>;
21
+ export declare const FlexibleDropZone: FC<PropsWithChildren<IFlexibleDropZoneProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"FlexibleDropZone.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleDropZone.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgB3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA+B,CAAC,KAAK,EAAE,EAAE;IAClE,OAAO,CACH,eAAK,SAAS,EAAE,KAAK,CAAC,yBAAyB,aAC1C,KAAK,CAAC,QAAQ,EACf,KAAC,iBAAiB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,MAAM,GAAI,EACvH,KAAC,iBAAiB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,GAAG,GAAI,IAClH,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport * as style from \"./FlexibleDropZone.module.scss\";\r\nimport { FlexibleResizeBar } from \"./FlexibleResizeBar\";\r\nimport { ResizeDirections } from \"./types\";\r\n\r\n/**\r\n * Arguments for the FlexibleDropZone component.\r\n */\r\nexport interface IFlexibleDropZoneProps {\r\n /**\r\n * The row number of the component in the layout\r\n */\r\n rowNumber: number;\r\n /**\r\n * The column number of the component in the layout\r\n */\r\n columnNumber: number;\r\n}\r\n\r\n/**\r\n * This component contains the drag and drop zone for the resize bars that\r\n * allow redefining width and height of layout elements\r\n * @param props properties\r\n * @returns drop zone element\r\n */\r\nexport const FlexibleDropZone: FC<IFlexibleDropZoneProps> = (props) => {\r\n return (\r\n <div className={style.flexibleDropZoneContainer}>\r\n {props.children}\r\n <FlexibleResizeBar rowNumber={props.rowNumber} columnNumber={props.columnNumber} direction={ResizeDirections.COLUMN} />\r\n <FlexibleResizeBar rowNumber={props.rowNumber} columnNumber={props.columnNumber} direction={ResizeDirections.ROW} />\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"FlexibleDropZone.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/layout/FlexibleDropZone.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgB3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkD,CAAC,KAAK,EAAE,EAAE;IACrF,OAAO,CACH,eAAK,SAAS,EAAE,KAAK,CAAC,yBAAyB,aAC1C,KAAK,CAAC,QAAQ,EACf,KAAC,iBAAiB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,MAAM,GAAI,EACvH,KAAC,iBAAiB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,GAAG,GAAI,IAClH,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport * as style from \"./FlexibleDropZone.module.scss\";\r\nimport { FlexibleResizeBar } from \"./FlexibleResizeBar\";\r\nimport { ResizeDirections } from \"./types\";\r\n\r\n/**\r\n * Arguments for the FlexibleDropZone component.\r\n */\r\nexport interface IFlexibleDropZoneProps {\r\n /**\r\n * The row number of the component in the layout\r\n */\r\n rowNumber: number;\r\n /**\r\n * The column number of the component in the layout\r\n */\r\n columnNumber: number;\r\n}\r\n\r\n/**\r\n * This component contains the drag and drop zone for the resize bars that\r\n * allow redefining width and height of layout elements\r\n * @param props properties\r\n * @returns drop zone element\r\n */\r\nexport const FlexibleDropZone: FC<PropsWithChildren<IFlexibleDropZoneProps>> = (props) => {\r\n return (\r\n <div className={style.flexibleDropZoneContainer}>\r\n {props.children}\r\n <FlexibleResizeBar rowNumber={props.rowNumber} columnNumber={props.columnNumber} direction={ResizeDirections.COLUMN} />\r\n <FlexibleResizeBar rowNumber={props.rowNumber} columnNumber={props.columnNumber} direction={ResizeDirections.ROW} />\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { FC } from "react";
2
- import type { Layout } from "./types";
2
+ import type { Layout } from "./types.js";
3
3
  /**
4
4
  * Arguments for the Layout component.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import type { FC } from "react";
2
- import { ResizeDirections } from "./types";
2
+ import { ResizeDirections } from "./types.js";
3
3
  /**
4
4
  * Arguments for the ResizeBar component.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import type { FC } from "react";
2
- import type { TabDrag } from "./types";
2
+ import type { TabDrag } from "./types.js";
3
3
  /**
4
4
  * Arguments for the FlexibleTab component.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import type { FC } from "react";
2
- import type { LayoutTab } from "./types";
2
+ import type { LayoutTab } from "./types.js";
3
3
  /**
4
4
  * Arguments for the TabsContainer component.
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { Layout } from "./types";
1
+ import type { Layout } from "./types.js";
2
2
  export declare const LayoutContext: import("react").Context<{
3
3
  /**
4
4
  * The layout object
@@ -1,4 +1,4 @@
1
- import type { Layout, LayoutColumn, LayoutTabsRow } from "./types";
1
+ import type { Layout, LayoutColumn, LayoutTabsRow } from "./types.js";
2
2
  /**
3
3
  * Given a column and row number in the layout, return the corresponding column/row
4
4
  * @param layout
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { Observable } from "@babylonjs/core/Misc/observable.js";
3
3
  import { Color4 } from "@babylonjs/core/Maths/math.color.js";
4
- import type { PropertyChangedEvent } from "../../propertyChangedEvent";
5
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
4
+ import type { PropertyChangedEvent } from "../../propertyChangedEvent.js";
5
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
6
6
  export interface IColorLineComponentProps {
7
7
  label: string;
8
8
  target: any;
@@ -22,9 +22,7 @@ interface IColorLineComponentState {
22
22
  export declare class ColorLineComponent extends React.Component<IColorLineComponentProps, IColorLineComponentState> {
23
23
  constructor(props: IColorLineComponentProps);
24
24
  shouldComponentUpdate(nextProps: IColorLineComponentProps, nextState: IColorLineComponentState): boolean;
25
- getValue(props?: Readonly<IColorLineComponentProps> & Readonly<{
26
- children?: React.ReactNode | undefined;
27
- }>): Color4;
25
+ getValue(props?: Readonly<IColorLineComponentProps>): Color4;
28
26
  setColorFromString(colorString: string): void;
29
27
  setColor(newColor: Color4): void;
30
28
  switchExpandState(): void;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { Color4, Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
3
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
4
4
  export interface IColorPickerLineComponentProps {
5
5
  value: Color4 | Color3;
6
6
  linearHint?: boolean;
@@ -23,9 +23,7 @@ export declare class ColorPickerLineComponent extends React.Component<IColorPick
23
23
  constructor(props: IColorPickerLineComponentProps);
24
24
  syncPositions(): void;
25
25
  shouldComponentUpdate(nextProps: IColorPickerLineComponentProps, nextState: IColorPickerComponentState): boolean;
26
- getHexString(props?: Readonly<IColorPickerLineComponentProps> & Readonly<{
27
- children?: React.ReactNode | undefined;
28
- }>): string;
26
+ getHexString(props?: Readonly<IColorPickerLineComponentProps>): string;
29
27
  componentDidUpdate(): void;
30
28
  componentDidMount(): void;
31
29
  render(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { LockObject } from "../../tabs/propertyGrids/lockObject";
2
+ import type { LockObject } from "../../tabs/propertyGrids/lockObject.js";
3
3
  interface INumericInputComponentProps {
4
4
  label: string;
5
5
  labelTooltip?: string;
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  /**
3
3
  * Props for the connector
4
4
  */
@@ -41,4 +41,4 @@ export interface IGraphConnectorHandlerProps {
41
41
  * drag the handle in a node and drop it in another node to create a connection.
42
42
  * @returns connector element
43
43
  */
44
- export declare const GraphConnectorHandler: FC<IGraphConnectorHandlerProps>;
44
+ export declare const GraphConnectorHandler: FC<PropsWithChildren<IGraphConnectorHandlerProps>>;
@@ -9,7 +9,7 @@ import { useGraphContext } from "./useGraphContext.js";
9
9
  * drag the handle in a node and drop it in another node to create a connection.
10
10
  * @returns connector element
11
11
  */
12
- export const GraphConnectorHandler = ({ parentId, parentX, parentY, offsetX = 0, offsetY = 0, parentWidth, parentHeight, parentContainerId }) => {
12
+ export const GraphConnectorHandler = ({ parentId, parentX, parentY, offsetX = 0, offsetY = 0, parentWidth, parentHeight, parentContainerId, }) => {
13
13
  const { onNodesConnected } = useGraphContext();
14
14
  const centerX = offsetX + parentWidth / 2;
15
15
  const centerY = offsetY + parentHeight / 2;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphConnectorHandle.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphConnectorHandle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAwCpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAE,EAAE;IAC7K,MAAM,EAAE,gBAAgB,EAAE,GAAG,eAAe,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,CAA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AG,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,GAAI,CAAC;AAC1J,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { useCallback } from \"react\";\r\nimport type { DropTargetMonitor } from \"react-dnd\";\r\nimport { useDrag, useDrop } from \"react-dnd\";\r\nimport { ClassNames } from \"../classNames\";\r\nimport * as style from \"./GraphConnectorHandle.module.scss\";\r\nimport { useGraphContext } from \"./useGraphContext\";\r\n\r\n/**\r\n * Props for the connector\r\n */\r\nexport interface IGraphConnectorHandlerProps {\r\n /**\r\n * id of the parent node\r\n */\r\n parentId: string;\r\n /**\r\n * x position of the parent node\r\n */\r\n parentX: number;\r\n /**\r\n * y position of the parent node\r\n */\r\n parentY: number;\r\n /**\r\n * x position of the connector relative to the parent node\r\n */\r\n offsetX?: number;\r\n /**\r\n * y position of the connector relative to the parent node\r\n */\r\n offsetY?: number;\r\n /**\r\n * width of the parent node\r\n */\r\n parentWidth: number;\r\n /**\r\n * height of the parent node\r\n */\r\n parentHeight: number;\r\n /**\r\n * id of the container where its parent node is\r\n */\r\n parentContainerId: string;\r\n}\r\n\r\n/**\r\n * This component is used to initiate a connection between two nodes. Simply\r\n * drag the handle in a node and drop it in another node to create a connection.\r\n * @returns connector element\r\n */\r\nexport const GraphConnectorHandler: FC<IGraphConnectorHandlerProps> = ({ parentId, parentX, parentY, offsetX = 0, offsetY = 0, parentWidth, parentHeight, parentContainerId }) => {\r\n const { onNodesConnected } = useGraphContext();\r\n const centerX = offsetX + parentWidth / 2;\r\n const centerY = offsetY + parentHeight / 2;\r\n const [, dragRef] = useDrag(\r\n () => ({\r\n type: \"connector\",\r\n item: { parentId, x: parentX + centerX, y: parentY + centerY, parentContainerId },\r\n canDrag: () => parentX !== undefined && parentY !== undefined,\r\n }),\r\n [parentId, parentX, parentY]\r\n );\r\n const [{ isOver }, dropRef] = useDrop(() => ({\r\n accept: \"connector\",\r\n collect: (monitor: DropTargetMonitor) => ({\r\n isOver: monitor.isOver(),\r\n }),\r\n canDrop: (item: any) => {\r\n return item.parentContainerId === parentContainerId;\r\n },\r\n drop: (item: any) => {\r\n onNodesConnected && onNodesConnected(item.parentId, parentId);\r\n },\r\n }));\r\n const attachRef = useCallback(\r\n (ref) => {\r\n dragRef(ref);\r\n dropRef(ref);\r\n },\r\n [dragRef, dropRef]\r\n );\r\n return <div ref={attachRef} className={ClassNames({ handle: true, hovered: isOver }, style)} style={{ top: centerY + \"px\", left: centerX + \"px\" }} />;\r\n};\r\n"]}
1
+ {"version":3,"file":"GraphConnectorHandle.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphConnectorHandle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAwCpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAuD,CAAC,EACtF,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,WAAW,EACX,YAAY,EACZ,iBAAiB,GACpB,EAAE,EAAE;IACD,MAAM,EAAE,gBAAgB,EAAE,GAAG,eAAe,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,CAAC;QACH,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,EAAE,QAAQ,EAAE,CAA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from \"react\";\r\nimport type { ConnectableElement, DropTargetMonitor } from \"react-dnd\";\r\nimport { useDrag, useDrop } from \"react-dnd\";\r\nimport { ClassNames } from \"../classNames\";\r\nimport * as style from \"./GraphConnectorHandle.module.scss\";\r\nimport { useGraphContext } from \"./useGraphContext\";\r\n\r\n/**\r\n * Props for the connector\r\n */\r\nexport interface IGraphConnectorHandlerProps {\r\n /**\r\n * id of the parent node\r\n */\r\n parentId: string;\r\n /**\r\n * x position of the parent node\r\n */\r\n parentX: number;\r\n /**\r\n * y position of the parent node\r\n */\r\n parentY: number;\r\n /**\r\n * x position of the connector relative to the parent node\r\n */\r\n offsetX?: number;\r\n /**\r\n * y position of the connector relative to the parent node\r\n */\r\n offsetY?: number;\r\n /**\r\n * width of the parent node\r\n */\r\n parentWidth: number;\r\n /**\r\n * height of the parent node\r\n */\r\n parentHeight: number;\r\n /**\r\n * id of the container where its parent node is\r\n */\r\n parentContainerId: string;\r\n}\r\n\r\n/**\r\n * This component is used to initiate a connection between two nodes. Simply\r\n * drag the handle in a node and drop it in another node to create a connection.\r\n * @returns connector element\r\n */\r\nexport const GraphConnectorHandler: FC<PropsWithChildren<IGraphConnectorHandlerProps>> = ({\r\n parentId,\r\n parentX,\r\n parentY,\r\n offsetX = 0,\r\n offsetY = 0,\r\n parentWidth,\r\n parentHeight,\r\n parentContainerId,\r\n}) => {\r\n const { onNodesConnected } = useGraphContext();\r\n const centerX = offsetX + parentWidth / 2;\r\n const centerY = offsetY + parentHeight / 2;\r\n const [, dragRef] = useDrag(\r\n () => ({\r\n type: \"connector\",\r\n item: { parentId, x: parentX + centerX, y: parentY + centerY, parentContainerId },\r\n canDrag: () => parentX !== undefined && parentY !== undefined,\r\n }),\r\n [parentId, parentX, parentY]\r\n );\r\n const [{ isOver }, dropRef] = useDrop(() => ({\r\n accept: \"connector\",\r\n collect: (monitor: DropTargetMonitor) => ({\r\n isOver: monitor.isOver(),\r\n }),\r\n canDrop: (item: any) => {\r\n return item.parentContainerId === parentContainerId;\r\n },\r\n drop: (item: any) => {\r\n onNodesConnected && onNodesConnected(item.parentId, parentId);\r\n },\r\n }));\r\n const attachRef = useCallback(\r\n (ref: ConnectableElement) => {\r\n dragRef(ref);\r\n dropRef(ref);\r\n },\r\n [dragRef, dropRef]\r\n );\r\n return <div ref={attachRef} className={ClassNames({ handle: true, hovered: isOver }, style)} style={{ top: centerY + \"px\", left: centerX + \"px\" }} />;\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  export interface IGraphContainerProps {
3
3
  }
4
4
  /**
@@ -7,4 +7,4 @@ export interface IGraphContainerProps {
7
7
  * @param props
8
8
  * @returns
9
9
  */
10
- export declare const GraphContainer: FC<IGraphContainerProps>;
10
+ export declare const GraphContainer: FC<PropsWithChildren<IGraphContainerProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphContainer.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAItD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAA6B,CAAC,KAAK,EAAE,EAAE;IAC9D,OAAO,cAAK,SAAS,EAAE,KAAK,CAAC,SAAS,YAAG,KAAK,CAAC,QAAQ,GAAO,CAAC;AACnE,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport * as style from \"./GraphContainer.module.scss\";\r\n\r\nexport interface IGraphContainerProps {}\r\n\r\n/**\r\n * This component is just a simple container to keep the nodes and lines containers\r\n * together\r\n * @param props\r\n * @returns\r\n */\r\nexport const GraphContainer: FC<IGraphContainerProps> = (props) => {\r\n return <div className={style.container}>{props.children}</div>;\r\n};\r\n"]}
1
+ {"version":3,"file":"GraphContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphContainer.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAItD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgD,CAAC,KAAK,EAAE,EAAE;IACjF,OAAO,cAAK,SAAS,EAAE,KAAK,CAAC,SAAS,YAAG,KAAK,CAAC,QAAQ,GAAO,CAAC;AACnE,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport * as style from \"./GraphContainer.module.scss\";\r\n\r\nexport interface IGraphContainerProps {}\r\n\r\n/**\r\n * This component is just a simple container to keep the nodes and lines containers\r\n * together\r\n * @param props\r\n * @returns\r\n */\r\nexport const GraphContainer: FC<PropsWithChildren<IGraphContainerProps>> = (props) => {\r\n return <div className={style.container}>{props.children}</div>;\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  /**
3
3
  * props for the GraphLineContainer
4
4
  */
@@ -13,4 +13,4 @@ export interface IGraphLinesContainerProps {
13
13
  * @param props
14
14
  * @returns
15
15
  */
16
- export declare const GraphLinesContainer: FC<IGraphLinesContainerProps>;
16
+ export declare const GraphLinesContainer: FC<PropsWithChildren<IGraphLinesContainerProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphLinesContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphLinesContainer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkC,CAAC,KAAK,EAAE,EAAE;IACxE,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,CAAC,IAAS,EAAE,EAAE;YACnB,OAAO,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAS;YAC/B,KAAK,EAAE,OAAO,CAAC,8BAA8B,EAAS;SACzD,CAAC;KACL,CAAC,CAAC,CAAC;IACJ,OAAO,CACH,eAAK,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,GAAG,EAAE,OAAO,aACxC,yBACI,iBAAQ,EAAE,EAAE,aAAa,EAAE,WAAW,EAAC,IAAI,EAAC,YAAY,EAAC,IAAI,EAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,MAAM,EAAC,MAAM,YACzF,eAAM,CAAC,EAAC,uBAAuB,EAAC,MAAM,EAAC,OAAO,GAAG,GAC5C,GACN,EACN,KAAK,CAAC,QAAQ,EACd,KAAK,IAAI,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,IAAI,CACzG,KAAC,SAAS,IAAC,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAI,CACzG,IACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport type { DropTargetMonitor } from \"react-dnd\";\r\nimport { useDrop } from \"react-dnd\";\r\nimport { GraphLine, MarkerArrowId } from \"./GraphLine\";\r\n\r\n/**\r\n * props for the GraphLineContainer\r\n */\r\nexport interface IGraphLinesContainerProps {\r\n /**\r\n * id of the container\r\n */\r\n id: string;\r\n}\r\n\r\n/**\r\n * this component handles the dragging of new connections\r\n * @param props\r\n * @returns\r\n */\r\nexport const GraphLinesContainer: FC<IGraphLinesContainerProps> = (props) => {\r\n const [{ start, delta }, dropRef] = useDrop(() => ({\r\n accept: \"connector\",\r\n canDrop: (item: any) => {\r\n return item.parentContainerId === props.id;\r\n },\r\n collect: (monitor: DropTargetMonitor) => ({\r\n start: monitor.getItem() as any,\r\n delta: monitor.getDifferenceFromInitialOffset() as any,\r\n }),\r\n }));\r\n return (\r\n <svg width=\"100%\" height=\"100%\" ref={dropRef}>\r\n <defs>\r\n <marker id={MarkerArrowId} markerWidth=\"15\" markerHeight=\"15\" refX=\"5\" refY=\"5\" orient=\"auto\">\r\n <path d=\"M 0 0 L 10 5 L 0 10 z\" stroke=\"black\" />\r\n </marker>\r\n </defs>\r\n {props.children}\r\n {start && start.parentContainerId === props.id && start.x !== undefined && start.y !== undefined && delta && (\r\n <GraphLine x1={start.x} y1={start.y} x2={start.x + delta.x} y2={start.y + delta.y} selected={false} />\r\n )}\r\n </svg>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"GraphLinesContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphLinesContainer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqD,CAAC,KAAK,EAAE,EAAE;IAC3F,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,CAAC,IAAS,EAAE,EAAE;YACnB,OAAO,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAS;YAC/B,KAAK,EAAE,OAAO,CAAC,8BAA8B,EAAS;SACzD,CAAC;KACL,CAAC,CAAC,CAAC;IACJ,OAAO,CACH,eAAK,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,GAAG,EAAE,OAAO,aACxC,yBACI,iBAAQ,EAAE,EAAE,aAAa,EAAE,WAAW,EAAC,IAAI,EAAC,YAAY,EAAC,IAAI,EAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,MAAM,EAAC,MAAM,YACzF,eAAM,CAAC,EAAC,uBAAuB,EAAC,MAAM,EAAC,OAAO,GAAG,GAC5C,GACN,EACN,KAAK,CAAC,QAAQ,EACd,KAAK,IAAI,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,IAAI,CACzG,KAAC,SAAS,IAAC,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAI,CACzG,IACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport type { DropTargetMonitor } from \"react-dnd\";\r\nimport { useDrop } from \"react-dnd\";\r\nimport { GraphLine, MarkerArrowId } from \"./GraphLine\";\r\n\r\n/**\r\n * props for the GraphLineContainer\r\n */\r\nexport interface IGraphLinesContainerProps {\r\n /**\r\n * id of the container\r\n */\r\n id: string;\r\n}\r\n\r\n/**\r\n * this component handles the dragging of new connections\r\n * @param props\r\n * @returns\r\n */\r\nexport const GraphLinesContainer: FC<PropsWithChildren<IGraphLinesContainerProps>> = (props) => {\r\n const [{ start, delta }, dropRef] = useDrop(() => ({\r\n accept: \"connector\",\r\n canDrop: (item: any) => {\r\n return item.parentContainerId === props.id;\r\n },\r\n collect: (monitor: DropTargetMonitor) => ({\r\n start: monitor.getItem() as any,\r\n delta: monitor.getDifferenceFromInitialOffset() as any,\r\n }),\r\n }));\r\n return (\r\n <svg width=\"100%\" height=\"100%\" ref={dropRef}>\r\n <defs>\r\n <marker id={MarkerArrowId} markerWidth=\"15\" markerHeight=\"15\" refX=\"5\" refY=\"5\" orient=\"auto\">\r\n <path d=\"M 0 0 L 10 5 L 0 10 z\" stroke=\"black\" />\r\n </marker>\r\n </defs>\r\n {props.children}\r\n {start && start.parentContainerId === props.id && start.x !== undefined && start.y !== undefined && delta && (\r\n <GraphLine x1={start.x} y1={start.y} x2={start.x + delta.x} y2={start.y + delta.y} selected={false} />\r\n )}\r\n </svg>\r\n );\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  export interface IGraphNodeProps {
3
3
  id: string;
4
4
  name: string;
@@ -10,4 +10,4 @@ export interface IGraphNodeProps {
10
10
  highlighted?: boolean;
11
11
  parentContainerId: string;
12
12
  }
13
- export declare const SingleGraphNode: FC<IGraphNodeProps>;
13
+ export declare const SingleGraphNode: FC<PropsWithChildren<IGraphNodeProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphNode.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphNode.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OA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AAE,EAAE,EACZ,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,EACpB,WAAW,EAAE,KAAK,EAClB,YAAY,EAAE,MAAM,GACtB,EACD,KAAK,CAAC,QAAQ,IACb,GACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { useDrag } from \"react-dnd\";\r\nimport { ClassNames } from \"../classNames\";\r\nimport { GraphConnectorHandler } from \"./GraphConnectorHandle\";\r\nimport * as style from \"./GraphNode.module.scss\";\r\nimport { useGraphContext } from \"./useGraphContext\";\r\n\r\nexport interface IGraphNodeProps {\r\n id: string;\r\n name: string;\r\n x: number;\r\n y: number;\r\n selected?: boolean;\r\n width?: number;\r\n height?: number;\r\n highlighted?: boolean;\r\n parentContainerId: string;\r\n}\r\n\r\nexport const SingleGraphNode: FC<IGraphNodeProps> = (props) => {\r\n const { id, name, x, y, selected, width = 100, height = 40, highlighted, parentContainerId } = props;\r\n const { onNodeSelected } = useGraphContext();\r\n\r\n const [, dragRef] = useDrag(\r\n () => ({\r\n type: \"node\",\r\n item: { id, parentContainerId },\r\n collect: (monitor) => ({\r\n isDrag: !!monitor.isDragging(),\r\n }),\r\n }),\r\n []\r\n );\r\n\r\n const onClick = () => {\r\n onNodeSelected && onNodeSelected(id);\r\n };\r\n\r\n return (\r\n <div\r\n ref={dragRef}\r\n className={ClassNames({ node: true, selected, highlighted }, style)}\r\n style={{ left: x, top: y, minWidth: width + \"px\", minHeight: height + \"px\" }}\r\n onClick={onClick}\r\n >\r\n <div className={style.container}>\r\n <h2>{name}</h2>\r\n <GraphConnectorHandler\r\n parentContainerId={parentContainerId}\r\n parentId={id}\r\n parentX={x}\r\n parentY={y}\r\n offsetY={-height / 2}\r\n parentWidth={width}\r\n parentHeight={height}\r\n />\r\n {props.children}\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"GraphNode.js","sourceRo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QAAQ,EAAE,KAAK,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,EAC5E,OAAO,EAAE,OAAO,YAEhB,eAAK,SAAS,EAAE,KAAK,CAAC,SAAS,aAC3B,uBAAK,IAAI,GAAM,EACf,KAAC,qBAAqB,IAClB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,EACpB,WAAW,EAAE,KAAK,EAClB,YAAY,EAAE,MAAM,GACtB,EACD,KAAK,CAAC,QAAQ,IACb,GACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\r\nimport { useDrag } from \"react-dnd\";\r\nimport { ClassNames } from \"../classNames\";\r\nimport { GraphConnectorHandler } from \"./GraphConnectorHandle\";\r\nimport * as style from \"./GraphNode.module.scss\";\r\nimport { useGraphContext } from \"./useGraphContext\";\r\n\r\nexport interface IGraphNodeProps {\r\n id: string;\r\n name: string;\r\n x: number;\r\n y: number;\r\n selected?: boolean;\r\n width?: number;\r\n height?: number;\r\n highlighted?: boolean;\r\n parentContainerId: string;\r\n}\r\n\r\nexport const SingleGraphNode: FC<PropsWithChildren<IGraphNodeProps>> = (props) => {\r\n const { id, name, x, y, selected, width = 100, height = 40, highlighted, parentContainerId } = props;\r\n const { onNodeSelected } = useGraphContext();\r\n\r\n const [, dragRef] = useDrag(\r\n () => ({\r\n type: \"node\",\r\n item: { id, parentContainerId },\r\n collect: (monitor) => ({\r\n isDrag: !!monitor.isDragging(),\r\n }),\r\n }),\r\n []\r\n );\r\n\r\n const onClick = () => {\r\n onNodeSelected && onNodeSelected(id);\r\n };\r\n\r\n return (\r\n <div\r\n ref={dragRef}\r\n className={ClassNames({ node: true, selected, highlighted }, style)}\r\n style={{ left: x, top: y, minWidth: width + \"px\", minHeight: height + \"px\" }}\r\n onClick={onClick}\r\n >\r\n <div className={style.container}>\r\n <h2>{name}</h2>\r\n <GraphConnectorHandler\r\n parentContainerId={parentContainerId}\r\n parentId={id}\r\n parentX={x}\r\n parentY={y}\r\n offsetY={-height / 2}\r\n parentWidth={width}\r\n parentHeight={height}\r\n />\r\n {props.children}\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import type { FC, PropsWithChildren } from "react";
2
2
  export interface IGraphContainerProps {
3
3
  onNodeMoved: (id: string, x: number, y: number) => void;
4
4
  id: string;
@@ -8,4 +8,4 @@ export interface IGraphContainerProps {
8
8
  * @param props properties
9
9
  * @returns graph node container element
10
10
  */
11
- export declare const GraphNodesContainer: FC<IGraphContainerProps>;
11
+ export declare const GraphNodesContainer: FC<PropsWithChildren<IGraphContainerProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphNodesContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphNodesContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAMzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA6B,CAAC,KAAK,EAAE,EAAE;IACnE,MAAM,WAAW,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEpD,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnE,aAAa,EAAE,OAAO,CAAC,qBAAqB,EAAE;QAC9C,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE;QACvB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;KACnC,CAAC,CAAC,CAAC;IAEJ,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACtB,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC1F,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACnD,CAAC;YACD,WAAW,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACL,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,wBAAM,KAAK,CAAC,QAAQ,GAAO,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { Vector2 } from \"core/Maths/math\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { FC } from \"react\";\r\nimport { useEffect, useRef } from \"react\";\r\nimport { useDragLayer } from \"react-dnd\";\r\nexport interface IGraphContainerProps {\r\n onNodeMoved: (id: string, x: number, y: number) => void;\r\n id: string;\r\n}\r\n\r\n/**\r\n * This component contains all the nodes and handles their dragging\r\n * @param props properties\r\n * @returns graph node container element\r\n */\r\nexport const GraphNodesContainer: FC<IGraphContainerProps> = (props) => {\r\n const lastDragPos = useRef<Nullable<Vector2>>(null);\r\n\r\n const { currentOffset, item, isDragging } = useDragLayer((monitor) => ({\r\n currentOffset: monitor.getSourceClientOffset(),\r\n item: monitor.getItem(),\r\n isDragging: monitor.isDragging(),\r\n }));\r\n\r\n useEffect(() => {\r\n if (currentOffset && item) {\r\n if (lastDragPos.current) {\r\n const delta = new Vector2(currentOffset.x, currentOffset.y).subtract(lastDragPos.current);\r\n props.onNodeMoved?.(item.id, delta.x, delta.y);\r\n }\r\n lastDragPos.current = new Vector2(currentOffset.x, currentOffset.y);\r\n }\r\n }, [currentOffset, item]);\r\n useEffect(() => {\r\n if (!isDragging) {\r\n lastDragPos.current = null;\r\n }\r\n }, [isDragging]);\r\n return <div>{props.children}</div>;\r\n};\r\n"]}
1
+ {"version":3,"file":"GraphNodesContainer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/GraphNodesContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAMzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgD,CAAC,KAAK,EAAE,EAAE;IACtF,MAAM,WAAW,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEpD,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnE,aAAa,EAAE,OAAO,CAAC,qBAAqB,EAAE;QAC9C,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE;QACvB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;KACnC,CAAC,CAAC,CAAC;IAEJ,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACtB,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC1F,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACnD,CAAC;YACD,WAAW,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACL,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,wBAAM,KAAK,CAAC,QAAQ,GAAO,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { Vector2 } from \"core/Maths/math\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { FC, PropsWithChildren } from \"react\";\r\nimport { useEffect, useRef } from \"react\";\r\nimport { useDragLayer } from \"react-dnd\";\r\nexport interface IGraphContainerProps {\r\n onNodeMoved: (id: string, x: number, y: number) => void;\r\n id: string;\r\n}\r\n\r\n/**\r\n * This component contains all the nodes and handles their dragging\r\n * @param props properties\r\n * @returns graph node container element\r\n */\r\nexport const GraphNodesContainer: FC<PropsWithChildren<IGraphContainerProps>> = (props) => {\r\n const lastDragPos = useRef<Nullable<Vector2>>(null);\r\n\r\n const { currentOffset, item, isDragging } = useDragLayer((monitor) => ({\r\n currentOffset: monitor.getSourceClientOffset(),\r\n item: monitor.getItem(),\r\n isDragging: monitor.isDragging(),\r\n }));\r\n\r\n useEffect(() => {\r\n if (currentOffset && item) {\r\n if (lastDragPos.current) {\r\n const delta = new Vector2(currentOffset.x, currentOffset.y).subtract(lastDragPos.current);\r\n props.onNodeMoved?.(item.id, delta.x, delta.y);\r\n }\r\n lastDragPos.current = new Vector2(currentOffset.x, currentOffset.y);\r\n }\r\n }, [currentOffset, item]);\r\n useEffect(() => {\r\n if (!isDragging) {\r\n lastDragPos.current = null;\r\n }\r\n }, [isDragging]);\r\n return <div>{props.children}</div>;\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { ComponentType } from "react";
1
+ import type { ComponentType, PropsWithChildren } from "react";
2
2
  import type { Nullable } from "@babylonjs/core/types.js";
3
3
  export type IVisualRecordsType = Record<string, {
4
4
  x: number;
@@ -66,4 +66,4 @@ export interface INodeRendererProps {
66
66
  * @param props
67
67
  * @returns
68
68
  */
69
- export declare const NodeRenderer: (props: INodeRendererProps) => import("react/jsx-runtime").JSX.Element;
69
+ export declare const NodeRenderer: (props: PropsWithChildren<INodeRendererProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"NodeRenderer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/NodeRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,eAAe,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAkD1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAyB,EAAE,EAAE;IACtD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,GAA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"react\";\r\nimport { useState, useEffect, useMemo } from \"react\";\r\nimport { GraphContainer } from \"./GraphContainer\";\r\nimport { GraphLine } from \"./GraphLine\";\r\nimport { SingleGraphNode } from \"./GraphNode\";\r\nimport { GraphNodesContainer } from \"./GraphNodesContainer\";\r\nimport { GraphLinesContainer } from \"./GraphLinesContainer\";\r\nimport { GraphContextManager } from \"./GraphContextManager\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst fullscreenStyle = { width: \"100%\", height: \"100%\" };\r\n\r\nexport type IVisualRecordsType = Record<string, { x: number; y: number }>;\r\nexport type IConnectionType = { id: string; sourceId: string; targetId: string };\r\nexport type ICustomDataType = { type: string; value: any };\r\nexport type INodeType = { id: string; label: string; customData?: ICustomDataType };\r\n\r\n/**\r\n * props for the node renderer\r\n */\r\nexport interface INodeRendererProps {\r\n /**\r\n * array of connections between nodes\r\n */\r\n connections: IConnectionType[];\r\n /**\r\n * function called when a new connection is created\r\n */\r\n updateConnections: (sourceId: string, targetId: string) => void;\r\n /**\r\n * function called when a connection is deleted\r\n */\r\n deleteLine: (lineId: string) => void;\r\n /**\r\n * function called when a node is deleted\r\n */\r\n deleteNode: (nodeId: string) => void;\r\n /**\r\n * array of all nodes\r\n */\r\n nodes: INodeType[];\r\n /**\r\n * id of the node to highlight\r\n */\r\n highlightedNode?: Nullable<string>;\r\n /**\r\n * function to be called if a node is selected\r\n */\r\n selectNode?: (nodeId: Nullable<string>) => void;\r\n /**\r\n * id of this renderer\r\n */\r\n id: string;\r\n /**\r\n * optional list of custom components to be rendered inside nodes of\r\n * a certain type\r\n */\r\n customComponents?: Record<string, ComponentType<any>>;\r\n}\r\n\r\n/**\r\n * This component is a bridge between the app logic related to the graph, and the actual rendering\r\n * of it. It manages the nodes' positions and selection states.\r\n * @param props\r\n * @returns\r\n */\r\nexport const NodeRenderer = (props: INodeRendererProps) => {\r\n const { nodes, connections, updateConnections, highlightedNode } = props;\r\n // Store the nodes positions\r\n const [pos, setPos] = useState<IVisualRecordsType>({});\r\n const [selectedLine, setSelectedLine] = useState<string | null>(null);\r\n const [selectedNode, setSelectedNode] = useState<string | null>(null);\r\n\r\n const updatePos = (id: string, x: number, y: number) => {\r\n setPos((currentPos) => {\r\n const currPos = currentPos[id] || { x: 0, y: 0 };\r\n currentPos[id] = { x: currPos.x + x, y: currPos.y + y };\r\n return { ...currentPos };\r\n });\r\n };\r\n\r\n const onNodesConnected = (sourceId: string, targetId: string) => {\r\n updateConnections(sourceId, targetId);\r\n };\r\n\r\n const onLineSelected = (lineId: string) => {\r\n setSelectedLine(lineId);\r\n setSelectedNode(null);\r\n };\r\n\r\n const onNodeSelected = (nodeId: string) => {\r\n setSelectedNode(nodeId);\r\n setSelectedLine(null);\r\n };\r\n\r\n useEffect(() => {\r\n props.selectNode && props.selectNode(selectedNode);\r\n }, [selectedNode]);\r\n\r\n const onKeyDown = (evt: KeyboardEvent) => {\r\n if (evt.key === \"Delete\") {\r\n if (selectedLine) {\r\n props.deleteLine(selectedLine);\r\n } else if (selectedNode) {\r\n props.deleteNode(selectedNode);\r\n }\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n document.addEventListener(\"keydown\", onKeyDown);\r\n return () => {\r\n document.removeEventListener(\"keydown\", onKeyDown);\r\n };\r\n }, [selectedLine, selectedNode]);\r\n\r\n const graphContext = useMemo(() => ({ updatePos, onNodesConnected, onLineSelected, onNodeSelected }), []);\r\n return (\r\n <div style={fullscreenStyle}>\r\n <GraphContextManager.Provider value={graphContext}>\r\n <GraphContainer>\r\n <GraphNodesContainer id={props.id} onNodeMoved={updatePos}>\r\n {nodes.map(({ id, label, customData }) => {\r\n const posInRecord = pos[id] || { x: 0, y: 0 };\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const CustomComponent = customData && customData.type && props.customComponents && props.customComponents[customData.type];\r\n return (\r\n <SingleGraphNode\r\n parentContainerId={props.id}\r\n key={id}\r\n id={id}\r\n name={label}\r\n x={posInRecord.x}\r\n y={posInRecord.y}\r\n selected={id === selectedNode}\r\n highlighted={id === highlightedNode}\r\n >\r\n {CustomComponent && <CustomComponent {...customData.value} />}\r\n </SingleGraphNode>\r\n );\r\n })}\r\n </GraphNodesContainer>\r\n <GraphLinesContainer id={props.id}>\r\n {connections.map(({ id, sourceId, targetId }) => {\r\n const sourcePos = pos[sourceId] || { x: 0, y: 0 };\r\n const targetPos = pos[targetId] || { x: 0, y: 0 };\r\n return <GraphLine key={id} id={id} x1={sourcePos.x} y1={sourcePos.y} x2={targetPos.x} y2={targetPos.y} selected={id === selectedLine} />;\r\n })}\r\n </GraphLinesContainer>\r\n </GraphContainer>\r\n </GraphContextManager.Provider>\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"NodeRenderer.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/reactGraphSystem/NodeRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,eAAe,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAkD1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAA4C,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IACzE,4BAA4B;IAC5B,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GA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gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;4BAC3H,OAAO,CACH,KAAC,eAAe,IACZ,iBAAiB,EAAE,KAAK,CAAC,EAAE,EAE3B,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,KAAK,EACX,CAAC,EAAE,WAAW,CAAC,CAAC,EAChB,CAAC,EAAE,WAAW,CAAC,CAAC,EAChB,QAAQ,EAAE,EAAE,KAAK,YAAY,EAC7B,WAAW,EAAE,EAAE,KAAK,eAAe,YAElC,eAAe,IAAI,KAAC,eAAe,OAAK,UAAU,CAAC,KAAK,GAAI,IARxD,EAAE,CASO,CACrB,CAAC;wBACN,CAAC,CAAC,GACgB,EACtB,KAAC,mBAAmB,IAAC,EAAE,EAAE,KAAK,CAAC,EAAE,YAC5B,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;4BAC5C,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;4BAClD,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;4BAClD,OAAO,KAAC,SAAS,IAAU,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,YAAY,IAA7G,EAAE,CAA+G,CAAC;wBAC7I,CAAC,CAAC,GACgB,IACT,GACU,GAC7B,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { ComponentType, PropsWithChildren } from \"react\";\r\nimport { useState, useEffect, useMemo } from \"react\";\r\nimport { GraphContainer } from \"./GraphContainer\";\r\nimport { GraphLine } from \"./GraphLine\";\r\nimport { SingleGraphNode } from \"./GraphNode\";\r\nimport { GraphNodesContainer } from \"./GraphNodesContainer\";\r\nimport { GraphLinesContainer } from \"./GraphLinesContainer\";\r\nimport { GraphContextManager } from \"./GraphContextManager\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst fullscreenStyle = { width: \"100%\", height: \"100%\" };\r\n\r\nexport type IVisualRecordsType = Record<string, { x: number; y: number }>;\r\nexport type IConnectionType = { id: string; sourceId: string; targetId: string };\r\nexport type ICustomDataType = { type: string; value: any };\r\nexport type INodeType = { id: string; label: string; customData?: ICustomDataType };\r\n\r\n/**\r\n * props for the node renderer\r\n */\r\nexport interface INodeRendererProps {\r\n /**\r\n * array of connections between nodes\r\n */\r\n connections: IConnectionType[];\r\n /**\r\n * function called when a new connection is created\r\n */\r\n updateConnections: (sourceId: string, targetId: string) => void;\r\n /**\r\n * function called when a connection is deleted\r\n */\r\n deleteLine: (lineId: string) => void;\r\n /**\r\n * function called when a node is deleted\r\n */\r\n deleteNode: (nodeId: string) => void;\r\n /**\r\n * array of all nodes\r\n */\r\n nodes: INodeType[];\r\n /**\r\n * id of the node to highlight\r\n */\r\n highlightedNode?: Nullable<string>;\r\n /**\r\n * function to be called if a node is selected\r\n */\r\n selectNode?: (nodeId: Nullable<string>) => void;\r\n /**\r\n * id of this renderer\r\n */\r\n id: string;\r\n /**\r\n * optional list of custom components to be rendered inside nodes of\r\n * a certain type\r\n */\r\n customComponents?: Record<string, ComponentType<any>>;\r\n}\r\n\r\n/**\r\n * This component is a bridge between the app logic related to the graph, and the actual rendering\r\n * of it. It manages the nodes' positions and selection states.\r\n * @param props\r\n * @returns\r\n */\r\nexport const NodeRenderer = (props: PropsWithChildren<INodeRendererProps>) => {\r\n const { nodes, connections, updateConnections, highlightedNode } = props;\r\n // Store the nodes positions\r\n const [pos, setPos] = useState<IVisualRecordsType>({});\r\n const [selectedLine, setSelectedLine] = useState<string | null>(null);\r\n const [selectedNode, setSelectedNode] = useState<string | null>(null);\r\n\r\n const updatePos = (id: string, x: number, y: number) => {\r\n setPos((currentPos) => {\r\n const currPos = currentPos[id] || { x: 0, y: 0 };\r\n currentPos[id] = { x: currPos.x + x, y: currPos.y + y };\r\n return { ...currentPos };\r\n });\r\n };\r\n\r\n const onNodesConnected = (sourceId: string, targetId: string) => {\r\n updateConnections(sourceId, targetId);\r\n };\r\n\r\n const onLineSelected = (lineId: string) => {\r\n setSelectedLine(lineId);\r\n setSelectedNode(null);\r\n };\r\n\r\n const onNodeSelected = (nodeId: string) => {\r\n setSelectedNode(nodeId);\r\n setSelectedLine(null);\r\n };\r\n\r\n useEffect(() => {\r\n props.selectNode && props.selectNode(selectedNode);\r\n }, [selectedNode]);\r\n\r\n const onKeyDown = (evt: KeyboardEvent) => {\r\n if (evt.key === \"Delete\") {\r\n if (selectedLine) {\r\n props.deleteLine(selectedLine);\r\n } else if (selectedNode) {\r\n props.deleteNode(selectedNode);\r\n }\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n document.addEventListener(\"keydown\", onKeyDown);\r\n return () => {\r\n document.removeEventListener(\"keydown\", onKeyDown);\r\n };\r\n }, [selectedLine, selectedNode]);\r\n\r\n const graphContext = useMemo(() => ({ updatePos, onNodesConnected, onLineSelected, onNodeSelected }), []);\r\n return (\r\n <div style={fullscreenStyle}>\r\n <GraphContextManager.Provider value={graphContext}>\r\n <GraphContainer>\r\n <GraphNodesContainer id={props.id} onNodeMoved={updatePos}>\r\n {nodes.map(({ id, label, customData }) => {\r\n const posInRecord = pos[id] || { x: 0, y: 0 };\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const CustomComponent = customData && customData.type && props.customComponents && props.customComponents[customData.type];\r\n return (\r\n <SingleGraphNode\r\n parentContainerId={props.id}\r\n key={id}\r\n id={id}\r\n name={label}\r\n x={posInRecord.x}\r\n y={posInRecord.y}\r\n selected={id === selectedNode}\r\n highlighted={id === highlightedNode}\r\n >\r\n {CustomComponent && <CustomComponent {...customData.value} />}\r\n </SingleGraphNode>\r\n );\r\n })}\r\n </GraphNodesContainer>\r\n <GraphLinesContainer id={props.id}>\r\n {connections.map(({ id, sourceId, targetId }) => {\r\n const sourcePos = pos[sourceId] || { x: 0, y: 0 };\r\n const targetPos = pos[targetId] || { x: 0, y: 0 };\r\n return <GraphLine key={id} id={id} x1={sourcePos.x} y1={sourcePos.y} x2={targetPos.x} y2={targetPos.y} selected={id === selectedLine} />;\r\n })}\r\n </GraphLinesContainer>\r\n </GraphContainer>\r\n </GraphContextManager.Provider>\r\n </div>\r\n );\r\n};\r\n"]}