@babylonjs/shared-ui-components 5.28.0 → 5.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/colorPicker/colorComponentEntry.d.ts +18 -18
  2. package/colorPicker/colorComponentEntry.js +36 -36
  3. package/colorPicker/colorPicker.d.ts +43 -43
  4. package/colorPicker/colorPicker.js +136 -136
  5. package/colorPicker/hexColor.d.ts +20 -20
  6. package/colorPicker/hexColor.js +42 -42
  7. package/components/Button.d.ts +10 -10
  8. package/components/Button.js +6 -6
  9. package/components/Icon.d.ts +6 -6
  10. package/components/Icon.js +6 -6
  11. package/components/Label.d.ts +7 -7
  12. package/components/Label.js +6 -6
  13. package/components/MessageDialog.d.ts +7 -7
  14. package/components/MessageDialog.js +22 -22
  15. package/components/Toggle.d.ts +8 -8
  16. package/components/Toggle.js +15 -15
  17. package/components/bars/CommandBarComponent.d.ts +16 -16
  18. package/components/bars/CommandBarComponent.js +68 -68
  19. package/components/bars/CommandBarComponent.js.map +1 -1
  20. package/components/bars/CommandButtonComponent.d.ts +11 -11
  21. package/components/bars/CommandButtonComponent.js +6 -6
  22. package/components/bars/CommandDropdownComponent.d.ts +26 -26
  23. package/components/bars/CommandDropdownComponent.js +48 -48
  24. package/components/classNames.d.ts +2 -2
  25. package/components/classNames.js +18 -18
  26. package/components/colorPicker/ColorComponentEntry.d.ts +18 -18
  27. package/components/colorPicker/ColorComponentEntry.js +37 -37
  28. package/components/colorPicker/ColorPicker.d.ts +43 -43
  29. package/components/colorPicker/ColorPicker.js +137 -137
  30. package/components/colorPicker/HexColor.d.ts +20 -20
  31. package/components/colorPicker/HexColor.js +45 -45
  32. package/components/layout/DraggableIcon.d.ts +23 -0
  33. package/components/layout/DraggableIcon.js +18 -0
  34. package/components/layout/DraggableIcon.js.map +1 -0
  35. package/components/layout/FlexibleColumn.d.ts +17 -0
  36. package/components/layout/FlexibleColumn.js +12 -0
  37. package/components/layout/FlexibleColumn.js.map +1 -0
  38. package/components/layout/FlexibleDragHandler.d.ts +18 -0
  39. package/components/layout/FlexibleDragHandler.js +88 -0
  40. package/components/layout/FlexibleDragHandler.js.map +1 -0
  41. package/components/layout/FlexibleDropZone.d.ts +19 -0
  42. package/components/layout/FlexibleDropZone.js +12 -0
  43. package/components/layout/FlexibleDropZone.js.map +1 -0
  44. package/components/layout/FlexibleGridContainer.d.ts +10 -0
  45. package/components/layout/FlexibleGridContainer.js +23 -0
  46. package/components/layout/FlexibleGridContainer.js.map +1 -0
  47. package/components/layout/FlexibleGridLayout.d.ts +16 -0
  48. package/components/layout/FlexibleGridLayout.js +24 -0
  49. package/components/layout/FlexibleGridLayout.js.map +1 -0
  50. package/components/layout/FlexibleResizeBar.d.ts +40 -0
  51. package/components/layout/FlexibleResizeBar.js +21 -0
  52. package/components/layout/FlexibleResizeBar.js.map +1 -0
  53. package/components/layout/FlexibleTab.d.ts +34 -0
  54. package/components/layout/FlexibleTab.js +36 -0
  55. package/components/layout/FlexibleTab.js.map +1 -0
  56. package/components/layout/FlexibleTabsContainer.d.ts +28 -0
  57. package/components/layout/FlexibleTabsContainer.js +54 -0
  58. package/components/layout/FlexibleTabsContainer.js.map +1 -0
  59. package/components/layout/LayoutContext.d.ts +12 -0
  60. package/components/layout/LayoutContext.js +3 -0
  61. package/components/layout/LayoutContext.js.map +1 -0
  62. package/components/layout/types.d.ts +82 -0
  63. package/components/layout/types.js +13 -0
  64. package/components/layout/types.js.map +1 -0
  65. package/components/layout/utils.d.ts +25 -0
  66. package/components/layout/utils.js +68 -0
  67. package/components/layout/utils.js.map +1 -0
  68. package/components/lines/ColorLineComponent.d.ts +40 -40
  69. package/components/lines/ColorLineComponent.js +145 -145
  70. package/components/lines/ColorPickerLineComponent.d.ts +33 -33
  71. package/components/lines/ColorPickerLineComponent.js +61 -61
  72. package/components/lines/FileButtonLineComponent.d.ts +16 -16
  73. package/components/lines/FileButtonLineComponent.js +21 -21
  74. package/components/lines/NumericInputComponent.d.ts +31 -31
  75. package/components/lines/NumericInputComponent.js +86 -86
  76. package/lines/booleanLineComponent.d.ts +11 -11
  77. package/lines/booleanLineComponent.js +14 -14
  78. package/lines/buttonLineComponent.d.ts +12 -12
  79. package/lines/buttonLineComponent.js +10 -10
  80. package/lines/checkBoxLineComponent.d.ts +36 -36
  81. package/lines/checkBoxLineComponent.js +88 -88
  82. package/lines/color3LineComponent.d.ts +18 -18
  83. package/lines/color3LineComponent.js +9 -9
  84. package/lines/color4LineComponent.d.ts +18 -18
  85. package/lines/color4LineComponent.js +9 -9
  86. package/lines/colorLineComponent.d.ts +40 -40
  87. package/lines/colorLineComponent.js +144 -144
  88. package/lines/colorPickerComponent.d.ts +31 -31
  89. package/lines/colorPickerComponent.js +60 -60
  90. package/lines/draggableLineComponent.d.ts +9 -9
  91. package/lines/draggableLineComponent.js +12 -12
  92. package/lines/fileButtonLineComponent.d.ts +17 -17
  93. package/lines/fileButtonLineComponent.js +20 -20
  94. package/lines/fileMultipleButtonLineComponent.d.ts +17 -17
  95. package/lines/fileMultipleButtonLineComponent.js +20 -20
  96. package/lines/floatLineComponent.d.ts +50 -50
  97. package/lines/floatLineComponent.js +175 -175
  98. package/lines/hexLineComponent.d.ts +40 -40
  99. package/lines/hexLineComponent.js +121 -121
  100. package/lines/iSelectedLineContainer.d.ts +4 -4
  101. package/lines/iSelectedLineContainer.js +1 -1
  102. package/lines/iconButtonLineComponent.d.ts +11 -11
  103. package/lines/iconButtonLineComponent.js +10 -10
  104. package/lines/iconComponent.d.ts +9 -9
  105. package/lines/iconComponent.js +7 -7
  106. package/lines/indentedTextLineComponent.d.ts +16 -16
  107. package/lines/indentedTextLineComponent.js +26 -26
  108. package/lines/inputArrowsComponent.d.ts +13 -13
  109. package/lines/inputArrowsComponent.js +37 -37
  110. package/lines/lineContainerComponent.d.ts +19 -19
  111. package/lines/lineContainerComponent.js +49 -49
  112. package/lines/linkButtonComponent.d.ts +16 -16
  113. package/lines/linkButtonComponent.js +20 -20
  114. package/lines/matrixLineComponent.d.ts +36 -36
  115. package/lines/matrixLineComponent.js +102 -102
  116. package/lines/messageLineComponent.d.ts +12 -12
  117. package/lines/messageLineComponent.js +14 -14
  118. package/lines/numericInputComponent.d.ts +31 -31
  119. package/lines/numericInputComponent.js +85 -85
  120. package/lines/optionsLineComponent.d.ts +48 -48
  121. package/lines/optionsLineComponent.js +118 -118
  122. package/lines/popup.d.ts +4 -4
  123. package/lines/popup.js +67 -67
  124. package/lines/radioLineComponent.d.ts +21 -21
  125. package/lines/radioLineComponent.js +26 -26
  126. package/lines/sliderLineComponent.d.ts +37 -37
  127. package/lines/sliderLineComponent.js +89 -89
  128. package/lines/targetsProxy.d.ts +11 -11
  129. package/lines/targetsProxy.js +42 -42
  130. package/lines/textInputLineComponent.d.ts +47 -47
  131. package/lines/textInputLineComponent.js +154 -154
  132. package/lines/textLineComponent.d.ts +21 -21
  133. package/lines/textLineComponent.js +30 -30
  134. package/lines/unitButton.d.ts +8 -8
  135. package/lines/unitButton.js +7 -7
  136. package/lines/valueLineComponent.d.ts +15 -15
  137. package/lines/valueLineComponent.js +12 -12
  138. package/lines/vector2LineComponent.d.ts +36 -36
  139. package/lines/vector2LineComponent.js +63 -63
  140. package/lines/vector3LineComponent.d.ts +41 -41
  141. package/lines/vector3LineComponent.js +74 -74
  142. package/lines/vector4LineComponent.d.ts +42 -42
  143. package/lines/vector4LineComponent.js +81 -81
  144. package/nodeGraphSystem/displayLedger.d.ts +5 -5
  145. package/nodeGraphSystem/displayLedger.js +3 -3
  146. package/nodeGraphSystem/frameNodePort.d.ts +25 -25
  147. package/nodeGraphSystem/frameNodePort.js +59 -59
  148. package/nodeGraphSystem/graphCanvas.d.ts +117 -111
  149. package/nodeGraphSystem/graphCanvas.js +1137 -1131
  150. package/nodeGraphSystem/graphCanvas.js.map +1 -1
  151. package/nodeGraphSystem/graphFrame.d.ts +153 -153
  152. package/nodeGraphSystem/graphFrame.js +1328 -1328
  153. package/nodeGraphSystem/graphNode.d.ts +81 -79
  154. package/nodeGraphSystem/graphNode.js +465 -459
  155. package/nodeGraphSystem/graphNode.js.map +1 -1
  156. package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -13
  157. package/nodeGraphSystem/interfaces/displayManager.js +1 -1
  158. package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -6
  159. package/nodeGraphSystem/interfaces/nodeContainer.js +1 -1
  160. package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -15
  161. package/nodeGraphSystem/interfaces/nodeData.js +1 -1
  162. package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -26
  163. package/nodeGraphSystem/interfaces/nodeLocationInfo.js +1 -1
  164. package/nodeGraphSystem/interfaces/portData.d.ts +28 -28
  165. package/nodeGraphSystem/interfaces/portData.js +7 -7
  166. package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -6
  167. package/nodeGraphSystem/interfaces/propertyComponentProps.js +1 -1
  168. package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -11
  169. package/nodeGraphSystem/interfaces/selectionChangedOptions.js +1 -1
  170. package/nodeGraphSystem/nodeLink.d.ts +31 -31
  171. package/nodeGraphSystem/nodeLink.js +182 -182
  172. package/nodeGraphSystem/nodePort.d.ts +35 -35
  173. package/nodeGraphSystem/nodePort.js +128 -128
  174. package/nodeGraphSystem/propertyLedger.d.ts +8 -8
  175. package/nodeGraphSystem/propertyLedger.js +3 -3
  176. package/nodeGraphSystem/stateManager.d.ts +45 -45
  177. package/nodeGraphSystem/stateManager.js +18 -18
  178. package/nodeGraphSystem/tools.d.ts +5 -5
  179. package/nodeGraphSystem/tools.js +36 -36
  180. package/nodeGraphSystem/typeLedger.d.ts +8 -8
  181. package/nodeGraphSystem/typeLedger.js +2 -2
  182. package/nodeGraphSystem/types/framePortData.d.ts +7 -7
  183. package/nodeGraphSystem/types/framePortData.js +1 -1
  184. package/package.json +4 -3
  185. package/propertyChangedEvent.d.ts +7 -7
  186. package/propertyChangedEvent.js +2 -2
  187. package/stories/Button.stories.d.ts +10 -10
  188. package/stories/Button.stories.js +19 -19
  189. package/stories/Icon.stories.d.ts +9 -9
  190. package/stories/Icon.stories.js +16 -16
  191. package/stories/Label.stories.d.ts +8 -8
  192. package/stories/Label.stories.js +10 -10
  193. package/stories/MessageDialog.stories.d.ts +9 -9
  194. package/stories/MessageDialog.stories.js +19 -19
  195. package/stories/Toggle.stories.d.ts +9 -9
  196. package/stories/Toggle.stories.js +17 -17
  197. package/stories/bars/CommandBarComponent.stories.d.ts +11 -11
  198. package/stories/bars/CommandBarComponent.stories.js +12 -12
  199. package/stories/bars/CommandButtonComponent.stories.d.ts +6 -6
  200. package/stories/bars/CommandButtonComponent.stories.js +6 -6
  201. package/stories/colorPicker/ColorPicker.stories.d.ts +11 -11
  202. package/stories/colorPicker/ColorPicker.stories.js +4 -4
  203. package/stories/layout/FlexibleGridLayout.stories.d.ts +46 -0
  204. package/stories/layout/FlexibleGridLayout.stories.js +48 -0
  205. package/stories/layout/FlexibleGridLayout.stories.js.map +1 -0
  206. package/stories/lines/ColorLineComponent.stories.d.ts +21 -21
  207. package/stories/lines/ColorLineComponent.stories.js +9 -9
  208. package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -14
  209. package/stories/lines/ColorPickerLineComponent.stories.js +10 -10
  210. package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -6
  211. package/stories/lines/FileButtonLineComponent.stories.js +5 -5
  212. package/stories/lines/NumericInputComponent.stories.d.ts +11 -11
  213. package/stories/lines/NumericInputComponent.stories.js +5 -5
  214. package/stringTools.d.ts +11 -11
  215. package/stringTools.js +88 -88
  216. package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -15
  217. package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +15 -15
  218. package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -15
  219. package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +14 -14
  220. package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -17
  221. package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +55 -55
  222. package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -15
  223. package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +12 -12
  224. package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -15
  225. package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +15 -15
  226. package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -17
  227. package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +38 -38
  228. package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -15
  229. package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +16 -16
  230. package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -15
  231. package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +25 -25
  232. package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -15
  233. package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +17 -17
  234. package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -16
  235. package/tabs/propertyGrids/gui/linePropertyGridComponent.js +27 -27
  236. package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -15
  237. package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +17 -17
  238. package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -15
  239. package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +15 -15
  240. package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -15
  241. package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +15 -15
  242. package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -15
  243. package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +16 -16
  244. package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -15
  245. package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +14 -14
  246. package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -15
  247. package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +34 -34
  248. package/tabs/propertyGrids/lockObject.d.ts +9 -9
  249. package/tabs/propertyGrids/lockObject.js +11 -11
@@ -1,18 +1,18 @@
1
- import * as React from "react";
2
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
3
- export interface IColorComponentEntryProps {
4
- value: number;
5
- label: string;
6
- max?: number;
7
- min?: number;
8
- onChange: (value: number) => void;
9
- disabled?: boolean;
10
- lockObject: LockObject;
11
- }
12
- export declare class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {
13
- constructor(props: IColorComponentEntryProps);
14
- updateValue(valueString: string): void;
15
- lock(): void;
16
- unlock(): void;
17
- render(): JSX.Element;
18
- }
1
+ import * as React from "react";
2
+ import type { LockObject } from "../tabs/propertyGrids/lockObject";
3
+ export interface IColorComponentEntryProps {
4
+ value: number;
5
+ label: string;
6
+ max?: number;
7
+ min?: number;
8
+ onChange: (value: number) => void;
9
+ disabled?: boolean;
10
+ lockObject: LockObject;
11
+ }
12
+ export declare class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {
13
+ constructor(props: IColorComponentEntryProps);
14
+ updateValue(valueString: string): void;
15
+ lock(): void;
16
+ unlock(): void;
17
+ render(): JSX.Element;
18
+ }
@@ -1,37 +1,37 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- export class ColorComponentEntry extends React.Component {
4
- constructor(props) {
5
- super(props);
6
- }
7
- updateValue(valueString) {
8
- if (/[^0-9.-]/g.test(valueString)) {
9
- return;
10
- }
11
- let valueAsNumber = parseInt(valueString);
12
- if (isNaN(valueAsNumber)) {
13
- return;
14
- }
15
- if (this.props.max != undefined && valueAsNumber > this.props.max) {
16
- valueAsNumber = this.props.max;
17
- }
18
- if (this.props.min != undefined && valueAsNumber < this.props.min) {
19
- valueAsNumber = this.props.min;
20
- }
21
- this.props.onChange(valueAsNumber);
22
- }
23
- lock() {
24
- if (this.props.lockObject) {
25
- this.props.lockObject.lock = true;
26
- }
27
- }
28
- unlock() {
29
- if (this.props.lockObject) {
30
- this.props.lockObject.lock = false;
31
- }
32
- }
33
- render() {
34
- return (_jsxs("div", { className: "color-picker-component", children: [_jsx("div", { className: "color-picker-component-value", children: _jsx("input", { type: "number", step: 1, className: "numeric-input", value: this.props.value, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateValue(evt.target.value), disabled: this.props.disabled }) }), _jsx("div", { className: "color-picker-component-label", children: this.props.label })] }));
35
- }
36
- }
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ export class ColorComponentEntry extends React.Component {
4
+ constructor(props) {
5
+ super(props);
6
+ }
7
+ updateValue(valueString) {
8
+ if (/[^0-9.-]/g.test(valueString)) {
9
+ return;
10
+ }
11
+ let valueAsNumber = parseInt(valueString);
12
+ if (isNaN(valueAsNumber)) {
13
+ return;
14
+ }
15
+ if (this.props.max != undefined && valueAsNumber > this.props.max) {
16
+ valueAsNumber = this.props.max;
17
+ }
18
+ if (this.props.min != undefined && valueAsNumber < this.props.min) {
19
+ valueAsNumber = this.props.min;
20
+ }
21
+ this.props.onChange(valueAsNumber);
22
+ }
23
+ lock() {
24
+ if (this.props.lockObject) {
25
+ this.props.lockObject.lock = true;
26
+ }
27
+ }
28
+ unlock() {
29
+ if (this.props.lockObject) {
30
+ this.props.lockObject.lock = false;
31
+ }
32
+ }
33
+ render() {
34
+ return (_jsxs("div", { className: "color-picker-component", children: [_jsx("div", { className: "color-picker-component-value", children: _jsx("input", { type: "number", step: 1, className: "numeric-input", value: this.props.value, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateValue(evt.target.value), disabled: this.props.disabled }) }), _jsx("div", { className: "color-picker-component-label", children: this.props.label })] }));
35
+ }
36
+ }
37
37
  //# sourceMappingURL=colorComponentEntry.js.map
@@ -1,43 +1,43 @@
1
- import * as React from "react";
2
- import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
4
- import "./colorPicker.scss";
5
- /**
6
- * Interface used to specify creation options for color picker
7
- */
8
- export interface IColorPickerProps {
9
- color: Color3 | Color4;
10
- linearhint?: boolean;
11
- debugMode?: boolean;
12
- onColorChanged?: (color: Color3 | Color4) => void;
13
- lockObject: LockObject;
14
- }
15
- /**
16
- * Interface used to specify creation options for color picker
17
- */
18
- export interface IColorPickerState {
19
- color: Color3;
20
- alpha: number;
21
- }
22
- /**
23
- * Class used to create a color picker
24
- */
25
- export declare class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
26
- private _saturationRef;
27
- private _hueRef;
28
- private _isSaturationPointerDown;
29
- private _isHuePointerDown;
30
- constructor(props: IColorPickerProps);
31
- shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState): boolean;
32
- onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
33
- onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
34
- onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
35
- onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
36
- onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
37
- onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
38
- private _evaluateSaturation;
39
- private _evaluateHue;
40
- componentDidUpdate(): void;
41
- raiseOnColorChanged(): void;
42
- render(): JSX.Element;
43
- }
1
+ import * as React from "react";
2
+ import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
3
+ import type { LockObject } from "../tabs/propertyGrids/lockObject";
4
+ import "./colorPicker.scss";
5
+ /**
6
+ * Interface used to specify creation options for color picker
7
+ */
8
+ export interface IColorPickerProps {
9
+ color: Color3 | Color4;
10
+ linearhint?: boolean;
11
+ debugMode?: boolean;
12
+ onColorChanged?: (color: Color3 | Color4) => void;
13
+ lockObject: LockObject;
14
+ }
15
+ /**
16
+ * Interface used to specify creation options for color picker
17
+ */
18
+ export interface IColorPickerState {
19
+ color: Color3;
20
+ alpha: number;
21
+ }
22
+ /**
23
+ * Class used to create a color picker
24
+ */
25
+ export declare class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
26
+ private _saturationRef;
27
+ private _hueRef;
28
+ private _isSaturationPointerDown;
29
+ private _isHuePointerDown;
30
+ constructor(props: IColorPickerProps);
31
+ shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState): boolean;
32
+ onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
33
+ onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
34
+ onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
35
+ onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
36
+ onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
37
+ onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
38
+ private _evaluateSaturation;
39
+ private _evaluateHue;
40
+ componentDidUpdate(): void;
41
+ raiseOnColorChanged(): void;
42
+ render(): JSX.Element;
43
+ }
@@ -1,137 +1,137 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
4
- import { ColorComponentEntry } from "./colorComponentEntry.js";
5
- import { HexColor } from "./hexColor.js";
6
- import "./colorPicker.scss";
7
- /**
8
- * Class used to create a color picker
9
- */
10
- export class ColorPicker extends React.Component {
11
- constructor(props) {
12
- super(props);
13
- if (this.props.color instanceof Color4) {
14
- this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
15
- }
16
- else {
17
- this.state = { color: this.props.color.clone(), alpha: 1 };
18
- }
19
- this._saturationRef = React.createRef();
20
- this._hueRef = React.createRef();
21
- }
22
- shouldComponentUpdate(nextProps, nextState) {
23
- return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
24
- }
25
- onSaturationPointerDown(evt) {
26
- this._evaluateSaturation(evt);
27
- this._isSaturationPointerDown = true;
28
- evt.currentTarget.setPointerCapture(evt.pointerId);
29
- }
30
- onSaturationPointerUp(evt) {
31
- this._isSaturationPointerDown = false;
32
- evt.currentTarget.releasePointerCapture(evt.pointerId);
33
- }
34
- onSaturationPointerMove(evt) {
35
- if (!this._isSaturationPointerDown) {
36
- return;
37
- }
38
- this._evaluateSaturation(evt);
39
- }
40
- onHuePointerDown(evt) {
41
- this._evaluateHue(evt);
42
- this._isHuePointerDown = true;
43
- evt.currentTarget.setPointerCapture(evt.pointerId);
44
- }
45
- onHuePointerUp(evt) {
46
- this._isHuePointerDown = false;
47
- evt.currentTarget.releasePointerCapture(evt.pointerId);
48
- }
49
- onHuePointerMove(evt) {
50
- if (!this._isHuePointerDown) {
51
- return;
52
- }
53
- this._evaluateHue(evt);
54
- }
55
- _evaluateSaturation(evt) {
56
- const left = evt.nativeEvent.offsetX;
57
- const top = evt.nativeEvent.offsetY;
58
- const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
59
- const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
60
- if (this.props.debugMode) {
61
- console.log("Saturation: " + saturation);
62
- console.log("Value: " + value);
63
- }
64
- const hsv = this.state.color.toHSV();
65
- Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
66
- if (this.state.alpha === 0) {
67
- this.setState({ alpha: 1 });
68
- }
69
- this.setState({ color: this.state.color });
70
- }
71
- _evaluateHue(evt) {
72
- const left = evt.nativeEvent.offsetX;
73
- const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
74
- if (this.props.debugMode) {
75
- console.log("Hue: " + hue);
76
- }
77
- const hsv = this.state.color.toHSV();
78
- Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
79
- this.setState({ color: this.state.color });
80
- }
81
- componentDidUpdate() {
82
- this.raiseOnColorChanged();
83
- }
84
- raiseOnColorChanged() {
85
- if (!this.props.onColorChanged) {
86
- return;
87
- }
88
- if (this.props.color instanceof Color4) {
89
- const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
90
- this.props.onColorChanged(newColor4);
91
- return;
92
- }
93
- this.props.onColorChanged(this.state.color.clone());
94
- }
95
- render() {
96
- const color4 = Color4.FromColor3(this.state.color);
97
- color4.a = this.state.alpha;
98
- const colorHex = color4.toHexString();
99
- const hsv = this.state.color.toHSV();
100
- const colorRef = new Color3();
101
- Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
102
- const colorHexRef = colorRef.toHexString();
103
- const hasAlpha = this.props.color instanceof Color4;
104
- return (_jsxs("div", { className: "color-picker-container" + (this.props.linearhint ? " with-hints" : ""), children: [_jsxs("div", { className: "color-picker-saturation", onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
105
- background: colorHexRef,
106
- }, children: [_jsx("div", { className: "color-picker-saturation-white" }), _jsx("div", { className: "color-picker-saturation-black" }), _jsx("div", { className: "color-picker-saturation-cursor", style: {
107
- top: `${-(hsv.b * 100) + 100}%`,
108
- left: `${hsv.g * 100}%`,
109
- } })] }), _jsxs("div", { className: "color-picker-hue", children: [_jsx("div", { className: "color-picker-hue-color", style: {
110
- background: colorHex,
111
- } }), _jsx("div", { className: "color-picker-hue-slider", ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: "color-picker-hue-cursor", style: {
112
- left: `${(hsv.r / 360.0) * 100}%`,
113
- border: `1px solid ` + colorHexRef,
114
- } }) })] }), _jsx("div", { className: "color-picker-alpha" }), _jsxs("div", { className: "color-picker-rgb", children: [_jsx("div", { className: "red", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
115
- this.state.color.r = value / 255.0;
116
- this.forceUpdate();
117
- } }) }), _jsx("div", { className: "green", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
118
- this.state.color.g = value / 255.0;
119
- this.forceUpdate();
120
- } }) }), _jsx("div", { className: "blue", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
121
- this.state.color.b = value / 255.0;
122
- this.forceUpdate();
123
- } }) }), _jsx("div", { className: "alpha" + (hasAlpha ? "" : " grayed"), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
124
- this.setState({ alpha: value / 255.0 });
125
- this.forceUpdate();
126
- } }) })] }), _jsxs("div", { className: "color-picker-hex", children: [_jsx("div", { className: "color-picker-hex-label", children: "Hex" }), _jsx("div", { className: "color-picker-hex-value", children: _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
127
- if (hasAlpha) {
128
- const color4 = Color4.FromHexString(value);
129
- this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
130
- }
131
- else {
132
- this.setState({ color: Color3.FromHexString(value) });
133
- }
134
- } }) })] }), this.props.linearhint && (_jsx("div", { className: "color-picker-warning", children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
135
- }
136
- }
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
4
+ import { ColorComponentEntry } from "./colorComponentEntry.js";
5
+ import { HexColor } from "./hexColor.js";
6
+ import "./colorPicker.scss";
7
+ /**
8
+ * Class used to create a color picker
9
+ */
10
+ export class ColorPicker extends React.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ if (this.props.color instanceof Color4) {
14
+ this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
15
+ }
16
+ else {
17
+ this.state = { color: this.props.color.clone(), alpha: 1 };
18
+ }
19
+ this._saturationRef = React.createRef();
20
+ this._hueRef = React.createRef();
21
+ }
22
+ shouldComponentUpdate(nextProps, nextState) {
23
+ return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
24
+ }
25
+ onSaturationPointerDown(evt) {
26
+ this._evaluateSaturation(evt);
27
+ this._isSaturationPointerDown = true;
28
+ evt.currentTarget.setPointerCapture(evt.pointerId);
29
+ }
30
+ onSaturationPointerUp(evt) {
31
+ this._isSaturationPointerDown = false;
32
+ evt.currentTarget.releasePointerCapture(evt.pointerId);
33
+ }
34
+ onSaturationPointerMove(evt) {
35
+ if (!this._isSaturationPointerDown) {
36
+ return;
37
+ }
38
+ this._evaluateSaturation(evt);
39
+ }
40
+ onHuePointerDown(evt) {
41
+ this._evaluateHue(evt);
42
+ this._isHuePointerDown = true;
43
+ evt.currentTarget.setPointerCapture(evt.pointerId);
44
+ }
45
+ onHuePointerUp(evt) {
46
+ this._isHuePointerDown = false;
47
+ evt.currentTarget.releasePointerCapture(evt.pointerId);
48
+ }
49
+ onHuePointerMove(evt) {
50
+ if (!this._isHuePointerDown) {
51
+ return;
52
+ }
53
+ this._evaluateHue(evt);
54
+ }
55
+ _evaluateSaturation(evt) {
56
+ const left = evt.nativeEvent.offsetX;
57
+ const top = evt.nativeEvent.offsetY;
58
+ const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
59
+ const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
60
+ if (this.props.debugMode) {
61
+ console.log("Saturation: " + saturation);
62
+ console.log("Value: " + value);
63
+ }
64
+ const hsv = this.state.color.toHSV();
65
+ Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
66
+ if (this.state.alpha === 0) {
67
+ this.setState({ alpha: 1 });
68
+ }
69
+ this.setState({ color: this.state.color });
70
+ }
71
+ _evaluateHue(evt) {
72
+ const left = evt.nativeEvent.offsetX;
73
+ const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
74
+ if (this.props.debugMode) {
75
+ console.log("Hue: " + hue);
76
+ }
77
+ const hsv = this.state.color.toHSV();
78
+ Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
79
+ this.setState({ color: this.state.color });
80
+ }
81
+ componentDidUpdate() {
82
+ this.raiseOnColorChanged();
83
+ }
84
+ raiseOnColorChanged() {
85
+ if (!this.props.onColorChanged) {
86
+ return;
87
+ }
88
+ if (this.props.color instanceof Color4) {
89
+ const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
90
+ this.props.onColorChanged(newColor4);
91
+ return;
92
+ }
93
+ this.props.onColorChanged(this.state.color.clone());
94
+ }
95
+ render() {
96
+ const color4 = Color4.FromColor3(this.state.color);
97
+ color4.a = this.state.alpha;
98
+ const colorHex = color4.toHexString();
99
+ const hsv = this.state.color.toHSV();
100
+ const colorRef = new Color3();
101
+ Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
102
+ const colorHexRef = colorRef.toHexString();
103
+ const hasAlpha = this.props.color instanceof Color4;
104
+ return (_jsxs("div", { className: "color-picker-container" + (this.props.linearhint ? " with-hints" : ""), children: [_jsxs("div", { className: "color-picker-saturation", onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
105
+ background: colorHexRef,
106
+ }, children: [_jsx("div", { className: "color-picker-saturation-white" }), _jsx("div", { className: "color-picker-saturation-black" }), _jsx("div", { className: "color-picker-saturation-cursor", style: {
107
+ top: `${-(hsv.b * 100) + 100}%`,
108
+ left: `${hsv.g * 100}%`,
109
+ } })] }), _jsxs("div", { className: "color-picker-hue", children: [_jsx("div", { className: "color-picker-hue-color", style: {
110
+ background: colorHex,
111
+ } }), _jsx("div", { className: "color-picker-hue-slider", ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: "color-picker-hue-cursor", style: {
112
+ left: `${(hsv.r / 360.0) * 100}%`,
113
+ border: `1px solid ` + colorHexRef,
114
+ } }) })] }), _jsx("div", { className: "color-picker-alpha" }), _jsxs("div", { className: "color-picker-rgb", children: [_jsx("div", { className: "red", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
115
+ this.state.color.r = value / 255.0;
116
+ this.forceUpdate();
117
+ } }) }), _jsx("div", { className: "green", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
118
+ this.state.color.g = value / 255.0;
119
+ this.forceUpdate();
120
+ } }) }), _jsx("div", { className: "blue", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
121
+ this.state.color.b = value / 255.0;
122
+ this.forceUpdate();
123
+ } }) }), _jsx("div", { className: "alpha" + (hasAlpha ? "" : " grayed"), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
124
+ this.setState({ alpha: value / 255.0 });
125
+ this.forceUpdate();
126
+ } }) })] }), _jsxs("div", { className: "color-picker-hex", children: [_jsx("div", { className: "color-picker-hex-label", children: "Hex" }), _jsx("div", { className: "color-picker-hex-value", children: _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
127
+ if (hasAlpha) {
128
+ const color4 = Color4.FromHexString(value);
129
+ this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
130
+ }
131
+ else {
132
+ this.setState({ color: Color3.FromHexString(value) });
133
+ }
134
+ } }) })] }), this.props.linearhint && (_jsx("div", { className: "color-picker-warning", children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
135
+ }
136
+ }
137
137
  //# sourceMappingURL=colorPicker.js.map
@@ -1,20 +1,20 @@
1
- import * as React from "react";
2
- import type { LockObject } from "../tabs/propertyGrids/lockObject";
3
- export interface IHexColorProps {
4
- value: string;
5
- expectedLength: number;
6
- onChange: (value: string) => void;
7
- lockObject: LockObject;
8
- }
9
- export declare class HexColor extends React.Component<IHexColorProps, {
10
- hex: string;
11
- }> {
12
- constructor(props: IHexColorProps);
13
- shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
14
- hex: string;
15
- }): boolean;
16
- lock(): void;
17
- unlock(): void;
18
- updateHexValue(valueString: string): void;
19
- render(): JSX.Element;
20
- }
1
+ import * as React from "react";
2
+ import type { LockObject } from "../tabs/propertyGrids/lockObject";
3
+ export interface IHexColorProps {
4
+ value: string;
5
+ expectedLength: number;
6
+ onChange: (value: string) => void;
7
+ lockObject: LockObject;
8
+ }
9
+ export declare class HexColor extends React.Component<IHexColorProps, {
10
+ hex: string;
11
+ }> {
12
+ constructor(props: IHexColorProps);
13
+ shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
14
+ hex: string;
15
+ }): boolean;
16
+ lock(): void;
17
+ unlock(): void;
18
+ updateHexValue(valueString: string): void;
19
+ render(): JSX.Element;
20
+ }
@@ -1,43 +1,43 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
- export class HexColor extends React.Component {
4
- constructor(props) {
5
- super(props);
6
- this.state = { hex: this.props.value.replace("#", "") };
7
- }
8
- shouldComponentUpdate(nextProps, nextState) {
9
- if (nextProps.value !== this.props.value) {
10
- nextState.hex = nextProps.value.replace("#", "");
11
- }
12
- return true;
13
- }
14
- lock() {
15
- if (this.props.lockObject) {
16
- this.props.lockObject.lock = true;
17
- }
18
- }
19
- unlock() {
20
- if (this.props.lockObject) {
21
- this.props.lockObject.lock = false;
22
- }
23
- }
24
- updateHexValue(valueString) {
25
- if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
26
- return;
27
- }
28
- this.setState({ hex: valueString });
29
- if (valueString.length !== this.props.expectedLength) {
30
- if (this.props.expectedLength === 8 && valueString.length === 6) {
31
- valueString = valueString + "FF";
32
- }
33
- else {
34
- return;
35
- }
36
- }
37
- this.props.onChange("#" + valueString);
38
- }
39
- render() {
40
- return (_jsx("input", { type: "string", className: "hex-input", value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }));
41
- }
42
- }
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ export class HexColor extends React.Component {
4
+ constructor(props) {
5
+ super(props);
6
+ this.state = { hex: this.props.value.replace("#", "") };
7
+ }
8
+ shouldComponentUpdate(nextProps, nextState) {
9
+ if (nextProps.value !== this.props.value) {
10
+ nextState.hex = nextProps.value.replace("#", "");
11
+ }
12
+ return true;
13
+ }
14
+ lock() {
15
+ if (this.props.lockObject) {
16
+ this.props.lockObject.lock = true;
17
+ }
18
+ }
19
+ unlock() {
20
+ if (this.props.lockObject) {
21
+ this.props.lockObject.lock = false;
22
+ }
23
+ }
24
+ updateHexValue(valueString) {
25
+ if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
26
+ return;
27
+ }
28
+ this.setState({ hex: valueString });
29
+ if (valueString.length !== this.props.expectedLength) {
30
+ if (this.props.expectedLength === 8 && valueString.length === 6) {
31
+ valueString = valueString + "FF";
32
+ }
33
+ else {
34
+ return;
35
+ }
36
+ }
37
+ this.props.onChange("#" + valueString);
38
+ }
39
+ render() {
40
+ return (_jsx("input", { type: "string", className: "hex-input", value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }));
41
+ }
42
+ }
43
43
  //# sourceMappingURL=hexColor.js.map
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- export declare type ButtonProps = {
3
- disabled?: boolean;
4
- active?: boolean;
5
- onClick?: () => void;
6
- color: "light" | "dark";
7
- size: "default" | "small" | "wide";
8
- title?: string;
9
- };
10
- export declare const Button: React.FC<ButtonProps>;
1
+ /// <reference types="react" />
2
+ export declare type ButtonProps = {
3
+ disabled?: boolean;
4
+ active?: boolean;
5
+ onClick?: () => void;
6
+ color: "light" | "dark";
7
+ size: "default" | "small" | "wide";
8
+ title?: string;
9
+ };
10
+ export declare const Button: React.FC<ButtonProps>;
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import styles from "./Button.modules.scss";
3
- import { ClassNames } from "./classNames.js";
4
- export const Button = ({ disabled, active, onClick, children, color, size, title }) => {
5
- return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, children: children }));
6
- };
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styles from "./Button.modules.scss";
3
+ import { ClassNames } from "./classNames.js";
4
+ export const Button = ({ disabled, active, onClick, children, color, size, title }) => {
5
+ return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, children: children }));
6
+ };
7
7
  //# sourceMappingURL=Button.js.map