@babylonjs/shared-ui-components 9.26.0 → 9.26.2
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.
- package/copyCommandToClipboard.d.ts +1 -1
- package/copyCommandToClipboard.js +5 -2
- package/copyCommandToClipboard.js.map +1 -1
- package/fluent/hoc/propertyLines/colorPropertyLine.d.ts +10 -0
- package/fluent/hoc/propertyLines/colorPropertyLine.js +24 -33
- package/fluent/hoc/propertyLines/colorPropertyLine.js.map +1 -1
- package/fluent/hoc/propertyLines/colorPropertyLineCore.d.ts +20 -0
- package/fluent/hoc/propertyLines/colorPropertyLineCore.js +42 -0
- package/fluent/hoc/propertyLines/colorPropertyLineCore.js.map +1 -0
- package/fluent/hoc/propertyLines/vectorPropertyLine.d.ts +30 -47
- package/fluent/hoc/propertyLines/vectorPropertyLine.js +80 -65
- package/fluent/hoc/propertyLines/vectorPropertyLine.js.map +1 -1
- package/fluent/hoc/propertyLines/vectorPropertyLineCore.d.ts +70 -0
- package/fluent/hoc/propertyLines/vectorPropertyLineCore.js +68 -0
- package/fluent/hoc/propertyLines/vectorPropertyLineCore.js.map +1 -0
- package/fluent/primitives/accordion.contexts.js +27 -6
- package/fluent/primitives/accordion.contexts.js.map +1 -1
- package/fluent/primitives/spinButton.js +1 -2
- package/fluent/primitives/spinButton.js.map +1 -1
- package/fluent/primitives/structuralColorPicker.d.ts +21 -0
- package/fluent/primitives/structuralColorPicker.js +123 -0
- package/fluent/primitives/structuralColorPicker.js.map +1 -0
- package/lite/fluent/hoc/propertyLines/colorPropertyLine.d.ts +10 -0
- package/lite/fluent/hoc/propertyLines/colorPropertyLine.js +50 -0
- package/lite/fluent/hoc/propertyLines/colorPropertyLine.js.map +1 -0
- package/lite/fluent/hoc/propertyLines/vectorPropertyLine.d.ts +28 -0
- package/lite/fluent/hoc/propertyLines/vectorPropertyLine.js +89 -0
- package/lite/fluent/hoc/propertyLines/vectorPropertyLine.js.map +1 -0
- package/lite/index.d.ts +2 -0
- package/lite/index.js +3 -0
- package/lite/index.js.map +1 -0
- package/nodeGraphSystem/graphFrame.module.scss +4 -1
- package/package.json +28 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Color3, type Color4 } from "@babylonjs/lite";
|
|
2
|
+
import { type FunctionComponent } from "react";
|
|
3
|
+
import { type PropertyLineProps } from "../../../../fluent/hoc/propertyLines/propertyLine.js";
|
|
4
|
+
import { type StructuralColorPickerProps } from "../../../../fluent/primitives/structuralColorPicker.js";
|
|
5
|
+
export type Color3Value = Color3 | readonly [number, number, number];
|
|
6
|
+
export type Color4Value = Color4 | readonly [number, number, number, number];
|
|
7
|
+
export type ColorPickerProps<ValueT extends Color3Value | Color4Value> = Omit<StructuralColorPickerProps<ValueT>, "adapter">;
|
|
8
|
+
export type ColorPropertyLineProps<ValueT extends Color3Value | Color4Value> = ColorPickerProps<ValueT> & PropertyLineProps<ValueT>;
|
|
9
|
+
export declare const Color3PropertyLine: FunctionComponent<ColorPropertyLineProps<Color3Value>>;
|
|
10
|
+
export declare const Color4PropertyLine: FunctionComponent<ColorPropertyLineProps<Color4Value>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ControlledColorPropertyLine } from "../../../../fluent/hoc/propertyLines/colorPropertyLineCore.js";
|
|
3
|
+
import { StructuralColorPickerPopup } from "../../../../fluent/primitives/structuralColorPicker.js";
|
|
4
|
+
function IsColor4Value(value) {
|
|
5
|
+
return "r" in value ? "a" in value : value.length === 4;
|
|
6
|
+
}
|
|
7
|
+
function GetStructuralColor(value) {
|
|
8
|
+
if (!("r" in value)) {
|
|
9
|
+
return {
|
|
10
|
+
r: value[0],
|
|
11
|
+
g: value[1],
|
|
12
|
+
b: value[2],
|
|
13
|
+
...(value.length === 4 ? { a: value[3] } : {}),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function CreateColor3Value(color, source) {
|
|
19
|
+
if (!("r" in source)) {
|
|
20
|
+
return [color.r, color.g, color.b];
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
r: color.r,
|
|
24
|
+
g: color.g,
|
|
25
|
+
b: color.b,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function CreateColor4Value(color, source) {
|
|
29
|
+
if (!("r" in source)) {
|
|
30
|
+
return [color.r, color.g, color.b, color.a ?? source[3]];
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
r: color.r,
|
|
34
|
+
g: color.g,
|
|
35
|
+
b: color.b,
|
|
36
|
+
a: color.a ?? source.a,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const Picker = (props) => (_jsx(StructuralColorPickerPopup, { ...props, adapter: {
|
|
40
|
+
getColor: GetStructuralColor,
|
|
41
|
+
createColor: (color, source) => (IsColor4Value(source) ? CreateColor4Value(color, source) : CreateColor3Value(color, source)),
|
|
42
|
+
} }));
|
|
43
|
+
const Adapter = {
|
|
44
|
+
picker: Picker,
|
|
45
|
+
getColor: GetStructuralColor,
|
|
46
|
+
createColor: (color, source) => (IsColor4Value(source) ? CreateColor4Value(color, source) : CreateColor3Value(color, source)),
|
|
47
|
+
};
|
|
48
|
+
export const Color3PropertyLine = (props) => (_jsx(ControlledColorPropertyLine, { ...props, adapter: Adapter }));
|
|
49
|
+
export const Color4PropertyLine = (props) => (_jsx(ControlledColorPropertyLine, { ...props, adapter: Adapter }));
|
|
50
|
+
//# sourceMappingURL=colorPropertyLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorPropertyLine.js","sourceRoot":"","sources":["../../../../../../../dev/sharedUiComponents/src/lite/fluent/hoc/propertyLines/colorPropertyLine.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,2BAA2B,EAAiC,MAAM,qEAAqE,CAAC;AAEjJ,OAAO,EAAE,0BAA0B,EAAyD,MAAM,8DAA8D,C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ACH,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;KACzB,CAAC;AACN,CAAC;AAED,MAAM,MAAM,GAAmE,CAAC,KAAK,EAAE,EAAE,CAAC,CACtF,KAAC,0BAA0B,OACnB,KAAK,EACT,OAAO,EAAE;QACL,QAAQ,EAAE,kBAAkB;QAC5B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAChI,GACH,CACL,CAAC;AAEF,MAAM,OAAO,GAAwD;IACjE,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,kBAAkB;IAC5B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAChI,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA2D,CAAC,KAAK,EAAE,EAAE,CAAC,CACjG,KAAC,2BAA2B,OAAK,KAAK,EAAE,OAAO,EAAE,OAAgD,GAAI,CACxG,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAA2D,CAAC,KAAK,EAAE,EAAE,CAAC,CACjG,KAAC,2BAA2B,OAAK,KAAK,EAAE,OAAO,EAAE,OAAgD,GAAI,CACxG,CAAC","sourcesContent":["import { type Color3, type Color4 } from \"@babylonjs/lite\";\r\nimport { type FunctionComponent } from \"react\";\r\n\r\nimport { ControlledColorPropertyLine, type ColorPropertyLineAdapter } from \"shared-ui-components/fluent/hoc/propertyLines/colorPropertyLineCore\";\r\nimport { type PropertyLineProps } from \"shared-ui-components/fluent/hoc/propertyLines/propertyLine\";\r\nimport { StructuralColorPickerPopup, type StructuralColorPickerProps, type StructuralColor } from \"shared-ui-components/fluent/primitives/structuralColorPicker\";\r\n\r\nexport type Color3Value = Color3 | readonly [number, number, number];\r\nexport type Color4Value = Color4 | readonly [number, number, number, number];\r\n\r\nexport type ColorPickerProps<ValueT extends Color3Value | Color4Value> = Omit<StructuralColorPickerProps<ValueT>, \"adapter\">;\r\nexport type ColorPropertyLineProps<ValueT extends Color3Value | Color4Value> = ColorPickerProps<ValueT> & PropertyLineProps<ValueT>;\r\n\r\nfunction IsColor4Value(value: Color3Value | Color4Value): value is Color4Value {\r\n return \"r\" in value ? \"a\" in value : value.length === 4;\r\n}\r\n\r\nfunction GetStructuralColor(value: Color3Value | Color4Value): StructuralColor {\r\n if (!(\"r\" in value)) {\r\n return {\r\n r: value[0],\r\n g: value[1],\r\n b: value[2],\r\n ...(value.length === 4 ? { a: value[3] } : {}),\r\n };\r\n }\r\n return value;\r\n}\r\n\r\nfunction CreateColor3Value(color: StructuralColor, source: Color3Value): Color3Value {\r\n if (!(\"r\" in source)) {\r\n return [color.r, color.g, color.b];\r\n }\r\n return {\r\n r: color.r,\r\n g: color.g,\r\n b: color.b,\r\n };\r\n}\r\n\r\nfunction CreateColor4Value(color: StructuralColor, source: Color4Value): Color4Value {\r\n if (!(\"r\" in source)) {\r\n return [color.r, color.g, color.b, color.a ?? source[3]];\r\n }\r\n return {\r\n r: color.r,\r\n g: color.g,\r\n b: color.b,\r\n a: color.a ?? source.a,\r\n };\r\n}\r\n\r\nconst Picker: FunctionComponent<ColorPickerProps<Color3Value | Color4Value>> = (props) => (\r\n <StructuralColorPickerPopup\r\n {...props}\r\n adapter={{\r\n getColor: GetStructuralColor,\r\n createColor: (color, source) => (IsColor4Value(source) ? CreateColor4Value(color, source) : CreateColor3Value(color, source)),\r\n }}\r\n />\r\n);\r\n\r\nconst Adapter: ColorPropertyLineAdapter<Color3Value | Color4Value> = {\r\n picker: Picker,\r\n getColor: GetStructuralColor,\r\n createColor: (color, source) => (IsColor4Value(source) ? CreateColor4Value(color, source) : CreateColor3Value(color, source)),\r\n};\r\n\r\nexport const Color3PropertyLine: FunctionComponent<ColorPropertyLineProps<Color3Value>> = (props) => (\r\n <ControlledColorPropertyLine {...props} adapter={Adapter as ColorPropertyLineAdapter<Color3Value>} />\r\n);\r\nexport const Color4PropertyLine: FunctionComponent<ColorPropertyLineProps<Color4Value>> = (props) => (\r\n <ControlledColorPropertyLine {...props} adapter={Adapter as ColorPropertyLineAdapter<Color4Value>} />\r\n);\r\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Quat, type Vec2, type Vec3, type Vec4 } from "@babylonjs/lite";
|
|
2
|
+
import { type FunctionComponent } from "react";
|
|
3
|
+
import { type TensorPropertyLineProps as RuntimeNeutralTensorPropertyLineProps } from "../../../../fluent/hoc/propertyLines/vectorPropertyLineCore.js";
|
|
4
|
+
export type Vector2Value = Vec2 | readonly [number, number];
|
|
5
|
+
export type Vector3Value = Vec3 | readonly [number, number, number];
|
|
6
|
+
export type Vector4Value = Vec4 | readonly [number, number, number, number];
|
|
7
|
+
export type QuaternionValue = Quat | readonly [number, number, number, number];
|
|
8
|
+
export type TensorPropertyLineProps<ValueT extends Vector2Value | Vector3Value | Vector4Value | QuaternionValue> = RuntimeNeutralTensorPropertyLineProps<ValueT>;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a Lite Euler value to a quaternion while preserving tuple versus structural representation.
|
|
11
|
+
* @param value The Euler value in radians.
|
|
12
|
+
* @param source The source quaternion whose representation should be preserved.
|
|
13
|
+
* @returns The converted quaternion.
|
|
14
|
+
*/
|
|
15
|
+
export declare function CreateQuaternionFromEuler(value: Vector3Value, source: QuaternionValue): QuaternionValue;
|
|
16
|
+
type RotationVectorPropertyLineProps = TensorPropertyLineProps<Vector3Value> & {
|
|
17
|
+
useDegrees?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type QuaternionPropertyLineProps = TensorPropertyLineProps<QuaternionValue> & {
|
|
20
|
+
useDegrees?: boolean;
|
|
21
|
+
useEuler?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const Vector2PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector2Value>>;
|
|
24
|
+
export declare const Vector3PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector3Value>>;
|
|
25
|
+
export declare const Vector4PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector4Value>>;
|
|
26
|
+
export declare const RotationVectorPropertyLine: FunctionComponent<RotationVectorPropertyLineProps>;
|
|
27
|
+
export declare const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLineProps>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { eulerToQuat, quatToEulerXYZ } from "@babylonjs/lite";
|
|
3
|
+
import { ControlledQuaternionPropertyLine, ControlledRotationVectorPropertyLine, ControlledTensorPropertyLine, } from "../../../../fluent/hoc/propertyLines/vectorPropertyLineCore.js";
|
|
4
|
+
const ComponentIndices = {
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 1,
|
|
7
|
+
z: 2,
|
|
8
|
+
w: 3,
|
|
9
|
+
};
|
|
10
|
+
function IsNumberTuple(value) {
|
|
11
|
+
return Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
function GetComponent(value, component) {
|
|
14
|
+
if (IsNumberTuple(value)) {
|
|
15
|
+
return value[ComponentIndices[component]];
|
|
16
|
+
}
|
|
17
|
+
switch (component) {
|
|
18
|
+
case "x":
|
|
19
|
+
return value.x;
|
|
20
|
+
case "y":
|
|
21
|
+
return value.y;
|
|
22
|
+
case "z":
|
|
23
|
+
return "z" in value ? value.z : 0;
|
|
24
|
+
case "w":
|
|
25
|
+
return "w" in value ? value.w : 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const Vector2Adapter = {
|
|
29
|
+
components: ["x", "y"],
|
|
30
|
+
getComponent: GetComponent,
|
|
31
|
+
withComponent: (value, component, componentValue) => IsNumberTuple(value) ? [component === "x" ? componentValue : value[0], component === "y" ? componentValue : value[1]] : { ...value, [component]: componentValue },
|
|
32
|
+
};
|
|
33
|
+
const Vector3Adapter = {
|
|
34
|
+
components: ["x", "y", "z"],
|
|
35
|
+
getComponent: GetComponent,
|
|
36
|
+
withComponent: (value, component, componentValue) => IsNumberTuple(value)
|
|
37
|
+
? [component === "x" ? componentValue : value[0], component === "y" ? componentValue : value[1], component === "z" ? componentValue : value[2]]
|
|
38
|
+
: { ...value, [component]: componentValue },
|
|
39
|
+
};
|
|
40
|
+
const Vector4Adapter = {
|
|
41
|
+
components: ["x", "y", "z", "w"],
|
|
42
|
+
getComponent: GetComponent,
|
|
43
|
+
withComponent: (value, component, componentValue) => IsNumberTuple(value)
|
|
44
|
+
? [
|
|
45
|
+
component === "x" ? componentValue : value[0],
|
|
46
|
+
component === "y" ? componentValue : value[1],
|
|
47
|
+
component === "z" ? componentValue : value[2],
|
|
48
|
+
component === "w" ? componentValue : value[3],
|
|
49
|
+
]
|
|
50
|
+
: { ...value, [component]: componentValue },
|
|
51
|
+
};
|
|
52
|
+
const QuaternionTensorAdapter = {
|
|
53
|
+
components: ["x", "y", "z", "w"],
|
|
54
|
+
getComponent: GetComponent,
|
|
55
|
+
withComponent: (value, component, componentValue) => IsNumberTuple(value)
|
|
56
|
+
? [
|
|
57
|
+
component === "x" ? componentValue : value[0],
|
|
58
|
+
component === "y" ? componentValue : value[1],
|
|
59
|
+
component === "z" ? componentValue : value[2],
|
|
60
|
+
component === "w" ? componentValue : value[3],
|
|
61
|
+
]
|
|
62
|
+
: { ...value, [component]: componentValue },
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Converts a Lite Euler value to a quaternion while preserving tuple versus structural representation.
|
|
66
|
+
* @param value The Euler value in radians.
|
|
67
|
+
* @param source The source quaternion whose representation should be preserved.
|
|
68
|
+
* @returns The converted quaternion.
|
|
69
|
+
*/
|
|
70
|
+
export function CreateQuaternionFromEuler(value, source) {
|
|
71
|
+
const [x, y, z] = "x" in value ? [value.x, value.y, value.z] : value;
|
|
72
|
+
const quaternion = eulerToQuat(x, y, z);
|
|
73
|
+
return "x" in source ? { x: quaternion[0], y: quaternion[1], z: quaternion[2], w: quaternion[3] } : quaternion;
|
|
74
|
+
}
|
|
75
|
+
const QuaternionAdapter = {
|
|
76
|
+
quaternion: QuaternionTensorAdapter,
|
|
77
|
+
euler: Vector3Adapter,
|
|
78
|
+
fromEuler: CreateQuaternionFromEuler,
|
|
79
|
+
toEuler: (value) => {
|
|
80
|
+
const [x, y, z, w] = "x" in value ? [value.x, value.y, value.z, value.w] : value;
|
|
81
|
+
return quatToEulerXYZ(x, y, z, w);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const Vector2PropertyLine = (props) => _jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector2Adapter });
|
|
85
|
+
export const Vector3PropertyLine = (props) => _jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector3Adapter });
|
|
86
|
+
export const Vector4PropertyLine = (props) => _jsx(ControlledTensorPropertyLine, { ...props, adapter: Vector4Adapter });
|
|
87
|
+
export const RotationVectorPropertyLine = (props) => (_jsx(ControlledRotationVectorPropertyLine, { ...props, adapter: Vector3Adapter }));
|
|
88
|
+
export const QuaternionPropertyLine = (props) => _jsx(ControlledQuaternionPropertyLine, { ...props, adapter: QuaternionAdapter });
|
|
89
|
+
//# sourceMappingURL=vectorPropertyLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorPropertyLine.js","sourceRoot":"","sources":["../../../../../../../dev/sharedUiComponents/src/lite/fluent/hoc/propertyLines/vectorPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAA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AAuD,CAAC,KAAK,EAAE,EAAE,CAAC,CACrG,KAAC,oCAAoC,OAAK,KAAK,EAAE,OAAO,EAAE,cAAc,GAAI,CAC/E,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAmD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,gCAAgC,OAAK,KAAK,EAAE,OAAO,EAAE,iBAAiB,GAAI,CAAC","sourcesContent":["import { eulerToQuat, quatToEulerXYZ, type Quat, type Vec2, type Vec3, type Vec4 } from \"@babylonjs/lite\";\r\nimport { type FunctionComponent } from \"react\";\r\n\r\nimport {\r\n ControlledQuaternionPropertyLine,\r\n ControlledRotationVectorPropertyLine,\r\n ControlledTensorPropertyLine,\r\n type QuaternionValueAdapter,\r\n type TensorComponent,\r\n type TensorPropertyLineProps as RuntimeNeutralTensorPropertyLineProps,\r\n type TensorValueAdapter,\r\n} from \"shared-ui-components/fluent/hoc/propertyLines/vectorPropertyLineCore\";\r\n\r\nexport type Vector2Value = Vec2 | readonly [number, number];\r\nexport type Vector3Value = Vec3 | readonly [number, number, number];\r\nexport type Vector4Value = Vec4 | readonly [number, number, number, number];\r\nexport type QuaternionValue = Quat | readonly [number, number, number, number];\r\n\r\nexport type TensorPropertyLineProps<ValueT extends Vector2Value | Vector3Value | Vector4Value | QuaternionValue> = RuntimeNeutralTensorPropertyLineProps<ValueT>;\r\n\r\nconst ComponentIndices: Readonly<Record<TensorComponent, number>> = {\r\n x: 0,\r\n y: 1,\r\n z: 2,\r\n w: 3,\r\n};\r\n\r\ntype TupleValue = readonly [number, number] | readonly [number, number, number] | readonly [number, number, number, number];\r\n\r\nfunction IsNumberTuple(value: Vector2Value | Vector3Value | Vector4Value | QuaternionValue): value is TupleValue {\r\n return Array.isArray(value);\r\n}\r\n\r\nfunction GetComponent(value: Vector2Value | Vector3Value | Vector4Value | QuaternionValue, component: TensorComponent): number {\r\n if (IsNumberTuple(value)) {\r\n return value[ComponentIndices[component]];\r\n }\r\n switch (component) {\r\n case \"x\":\r\n return value.x;\r\n case \"y\":\r\n return value.y;\r\n case \"z\":\r\n return \"z\" in value ? value.z : 0;\r\n case \"w\":\r\n return \"w\" in value ? value.w : 0;\r\n }\r\n}\r\n\r\nconst Vector2Adapter: TensorValueAdapter<Vector2Value> = {\r\n components: [\"x\", \"y\"],\r\n getComponent: GetComponent,\r\n withComponent: (value, component, componentValue) =>\r\n IsNumberTuple(value) ? [component === \"x\" ? componentValue : value[0], component === \"y\" ? componentValue : value[1]] : { ...value, [component]: componentValue },\r\n};\r\nconst Vector3Adapter: TensorValueAdapter<Vector3Value> = {\r\n components: [\"x\", \"y\", \"z\"],\r\n getComponent: GetComponent,\r\n withComponent: (value, component, componentValue) =>\r\n IsNumberTuple(value)\r\n ? [component === \"x\" ? componentValue : value[0], component === \"y\" ? componentValue : value[1], component === \"z\" ? componentValue : value[2]]\r\n : { ...value, [component]: componentValue },\r\n};\r\nconst Vector4Adapter: TensorValueAdapter<Vector4Value> = {\r\n components: [\"x\", \"y\", \"z\", \"w\"],\r\n getComponent: GetComponent,\r\n withComponent: (value, component, componentValue) =>\r\n IsNumberTuple(value)\r\n ? [\r\n component === \"x\" ? componentValue : value[0],\r\n component === \"y\" ? componentValue : value[1],\r\n component === \"z\" ? componentValue : value[2],\r\n component === \"w\" ? componentValue : value[3],\r\n ]\r\n : { ...value, [component]: componentValue },\r\n};\r\nconst QuaternionTensorAdapter: TensorValueAdapter<QuaternionValue> = {\r\n components: [\"x\", \"y\", \"z\", \"w\"],\r\n getComponent: GetComponent,\r\n withComponent: (value, component, componentValue) =>\r\n IsNumberTuple(value)\r\n ? [\r\n component === \"x\" ? componentValue : value[0],\r\n component === \"y\" ? componentValue : value[1],\r\n component === \"z\" ? componentValue : value[2],\r\n component === \"w\" ? componentValue : value[3],\r\n ]\r\n : { ...value, [component]: componentValue },\r\n};\r\n\r\n/**\r\n * Converts a Lite Euler value to a quaternion while preserving tuple versus structural representation.\r\n * @param value The Euler value in radians.\r\n * @param source The source quaternion whose representation should be preserved.\r\n * @returns The converted quaternion.\r\n */\r\nexport function CreateQuaternionFromEuler(value: Vector3Value, source: QuaternionValue): QuaternionValue {\r\n const [x, y, z] = \"x\" in value ? [value.x, value.y, value.z] : value;\r\n const quaternion = eulerToQuat(x, y, z);\r\n return \"x\" in source ? { x: quaternion[0], y: quaternion[1], z: quaternion[2], w: quaternion[3] } : quaternion;\r\n}\r\n\r\nconst QuaternionAdapter: QuaternionValueAdapter<QuaternionValue, Vector3Value> = {\r\n quaternion: QuaternionTensorAdapter,\r\n euler: Vector3Adapter,\r\n fromEuler: CreateQuaternionFromEuler,\r\n toEuler: (value) => {\r\n const [x, y, z, w] = \"x\" in value ? [value.x, value.y, value.z, value.w] : value;\r\n return quatToEulerXYZ(x, y, z, w);\r\n },\r\n};\r\n\r\ntype RotationVectorPropertyLineProps = TensorPropertyLineProps<Vector3Value> & {\r\n useDegrees?: boolean;\r\n};\r\n\r\ntype QuaternionPropertyLineProps = TensorPropertyLineProps<QuaternionValue> & {\r\n useDegrees?: boolean;\r\n useEuler?: boolean;\r\n};\r\n\r\nexport const Vector2PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector2Value>> = (props) => <ControlledTensorPropertyLine {...props} adapter={Vector2Adapter} />;\r\nexport const Vector3PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector3Value>> = (props) => <ControlledTensorPropertyLine {...props} adapter={Vector3Adapter} />;\r\nexport const Vector4PropertyLine: FunctionComponent<TensorPropertyLineProps<Vector4Value>> = (props) => <ControlledTensorPropertyLine {...props} adapter={Vector4Adapter} />;\r\nexport const RotationVectorPropertyLine: FunctionComponent<RotationVectorPropertyLineProps> = (props) => (\r\n <ControlledRotationVectorPropertyLine {...props} adapter={Vector3Adapter} />\r\n);\r\nexport const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLineProps> = (props) => <ControlledQuaternionPropertyLine {...props} adapter={QuaternionAdapter} />;\r\n"]}
|
package/lite/index.d.ts
ADDED
package/lite/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lite/index.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC","sourcesContent":["export * from \"./fluent/hoc/propertyLines/colorPropertyLine\";\r\nexport * from \"./fluent/hoc/propertyLines/vectorPropertyLine\";\r\n"]}
|
|
@@ -26,14 +26,17 @@
|
|
|
26
26
|
display: grid;
|
|
27
27
|
grid-row: 2;
|
|
28
28
|
grid-column: 1;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
overflow: hidden;
|
|
29
31
|
padding: 0 10px;
|
|
30
32
|
font-style: italic;
|
|
31
33
|
word-wrap: break-word;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
.frame-comment-span {
|
|
37
|
+
min-width: 0;
|
|
35
38
|
white-space: normal;
|
|
36
|
-
overflow-wrap:
|
|
39
|
+
overflow-wrap: anywhere;
|
|
37
40
|
word-wrap: break-word;
|
|
38
41
|
}
|
|
39
42
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/shared-ui-components",
|
|
3
|
-
"version": "9.26.
|
|
3
|
+
"version": "9.26.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
},
|
|
12
|
+
"./lite": {
|
|
13
|
+
"types": "./lite/index.d.ts",
|
|
14
|
+
"default": "./lite/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./*.js": "./*.js",
|
|
17
|
+
"./*.d.ts": "./*.d.ts",
|
|
18
|
+
"./*.map": "./*.map",
|
|
19
|
+
"./*.svg": "./*.svg",
|
|
20
|
+
"./*.scss": "./*.scss",
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./*.d.ts",
|
|
23
|
+
"default": "./*.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
7
27
|
"files": [
|
|
8
28
|
"**/*.js",
|
|
9
29
|
"**/*.d.ts",
|
|
@@ -21,10 +41,12 @@
|
|
|
21
41
|
"postcompile": "build-tools -c add-js-to-es6"
|
|
22
42
|
},
|
|
23
43
|
"devDependencies": {
|
|
44
|
+
"@babylonjs/lite": "1.27.0",
|
|
24
45
|
"@dev/build-tools": "^1.0.0",
|
|
25
46
|
"@dev/shared-ui-components": "^1.0.0"
|
|
26
47
|
},
|
|
27
48
|
"peerDependencies": {
|
|
49
|
+
"@babylonjs/lite": "^1.27.0",
|
|
28
50
|
"@types/dagre": "^0.7.47",
|
|
29
51
|
"dagre": "^0.8.5",
|
|
30
52
|
"react": "^18.2.0",
|
|
@@ -32,6 +54,11 @@
|
|
|
32
54
|
"react-dnd-touch-backend": "15.0.1",
|
|
33
55
|
"react-dom": "^18.2.0"
|
|
34
56
|
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@babylonjs/lite": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
35
62
|
"keywords": [
|
|
36
63
|
"3D",
|
|
37
64
|
"javascript",
|