@babylonjs/shared-ui-components 9.25.0 → 9.26.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.
- 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/modularTool/hooks/observableHooks.d.ts +10 -5
- package/modularTool/hooks/observableHooks.js +7 -2
- package/modularTool/hooks/observableHooks.js.map +1 -1
- package/modularTool/misc/observableCollection.d.ts +19 -1
- package/modularTool/misc/observableCollection.js +20 -0
- package/modularTool/misc/observableCollection.js.map +1 -1
- package/modularTool/services/shellService.js +11 -4
- package/modularTool/services/shellService.js.map +1 -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,CAAC;AAQjK,SAAS,aAAa,CAAC,KAAgC;IACnD,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAgC;IACxD,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO;YACH,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACX,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACX,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACX,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjD,CAAC;IACN,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAsB,EAAE,MAAmB;IAClE,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;QACH,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,CAAC,EAAE,KAAK,CAAC,CAAC;KACb,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAsB,EAAE,MAAmB;IAClE,IAAI,CAAC,CAAC,GAAG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A2D,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,WAAW,EAAE,cAAc,EAA8C,MAAM,iBAAiB,CAAC;AAG1G,OAAO,EACH,gCAAgC,EAChC,oCAAoC,EACpC,4BAA4B,GAK/B,MAAM,sEAAsE,CAAC;AAS9E,MAAM,gBAAgB,GAA8C;IAChE,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACP,CAAC;AAIF,SAAS,aAAa,CAAC,KAAmE;IACtF,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,YAAY,CAAC,KAAmE,EAAE,SAA0B;IACjH,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,QAAQ,SAAS,EAAE,CAAC;QAChB,KAAK,GAAG;YACJ,OAAO,KAAK,CAAC,CAAC,CAAC;QACnB,KAAK,GAAG;YACJ,OAAO,KAAK,CAAC,CAAC,CAAC;QACnB,KAAK,GAAG;YACJ,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,GAAG;YACJ,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;AACL,CAAC;AAED,MAAM,cAAc,GAAqC;IACrD,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACtB,YAAY,EAAE,YAAY;IAC1B,aAAa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K,EAAE,OAAO,EAAE,cAAc,GAAI,CAAC;AAC7K,MAAM,CAAC,MAAM,mBAAmB,GAA6D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,4BAA4B,OAAK,KAAK,EAAE,OAAO,EAAE,cAAc,GAAI,CAAC;AAC7K,MAAM,CAAC,MAAM,0BAA0B,GAAuD,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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IReadonlyObservable } from "@babylonjs/core/index.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type IReadonlyObservableCollection } from "../misc/observableCollection.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns the current value of the accessor and updates it when the specified event is fired on the specified element.
|
|
5
5
|
* @param accessor A function that returns the current value.
|
|
@@ -15,8 +15,13 @@ export declare function useEventfulState<T>(accessor: () => T, element: HTMLElem
|
|
|
15
15
|
* @param accessor A function that returns the current value.
|
|
16
16
|
* @param observables The observables to listen for changes on.
|
|
17
17
|
* @returns The current value of the accessor.
|
|
18
|
-
* @remarks
|
|
19
|
-
*
|
|
18
|
+
* @remarks Prefer this hook when the source already exposes precise change observables. Pair it
|
|
19
|
+
* with a polling observable only when a fixed refresh cadence is intentional; use the source
|
|
20
|
+
* system's adapter hook when refresh policy is configurable elsewhere.
|
|
21
|
+
*
|
|
22
|
+
* If the accessor function is not idempotent (e.g. it returns a different array or object instance
|
|
23
|
+
* each time it is called), then there is a good chance it should be wrapped in a `useCallback` to
|
|
24
|
+
* prevent unnecessary re-renders or re-render infinite loops.
|
|
20
25
|
*/
|
|
21
26
|
export declare function useObservableState<T>(accessor: () => T, ...observables: Array<IReadonlyObservable | null | undefined>): T;
|
|
22
27
|
/**
|
|
@@ -24,7 +29,7 @@ export declare function useObservableState<T>(accessor: () => T, ...observables:
|
|
|
24
29
|
* @param collection The collection to observe.
|
|
25
30
|
* @returns A copy of the items in the collection.
|
|
26
31
|
*/
|
|
27
|
-
export declare function useObservableCollection<T>(collection:
|
|
32
|
+
export declare function useObservableCollection<T>(collection: IReadonlyObservableCollection<T>): T[];
|
|
28
33
|
/**
|
|
29
34
|
* Returns a copy of the items in the collection sorted by the order property and updates it when the collection changes.
|
|
30
35
|
* @param collection The collection to observe.
|
|
@@ -32,4 +37,4 @@ export declare function useObservableCollection<T>(collection: ObservableCollect
|
|
|
32
37
|
*/
|
|
33
38
|
export declare function useOrderedObservableCollection<T extends Readonly<{
|
|
34
39
|
order?: number;
|
|
35
|
-
}>>(collection:
|
|
40
|
+
}>>(collection: IReadonlyObservableCollection<T>): T[];
|
|
@@ -35,8 +35,13 @@ export function useEventfulState(accessor, element, ...eventNames) {
|
|
|
35
35
|
* @param accessor A function that returns the current value.
|
|
36
36
|
* @param observables The observables to listen for changes on.
|
|
37
37
|
* @returns The current value of the accessor.
|
|
38
|
-
* @remarks
|
|
39
|
-
*
|
|
38
|
+
* @remarks Prefer this hook when the source already exposes precise change observables. Pair it
|
|
39
|
+
* with a polling observable only when a fixed refresh cadence is intentional; use the source
|
|
40
|
+
* system's adapter hook when refresh policy is configurable elsewhere.
|
|
41
|
+
*
|
|
42
|
+
* If the accessor function is not idempotent (e.g. it returns a different array or object instance
|
|
43
|
+
* each time it is called), then there is a good chance it should be wrapped in a `useCallback` to
|
|
44
|
+
* prevent unnecessary re-renders or re-render infinite loops.
|
|
40
45
|
*/
|
|
41
46
|
export function useObservableState(accessor, ...observables) {
|
|
42
47
|
const [current, setCurrent] = useState(accessor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observableHooks.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/hooks/observableHooks.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAI,QAAiB,EAAE,OAAuC,EAAE,GAAG,UAAoB;IACnH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACX,UAAU,CAAC,QAAQ,CAAC,CAAC;QACrB,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;gBAC1C,MAAM,OAAO,GAAG,GAAG,EAAE;oBACjB,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC3B,CAAC,CAAC;gBAEF,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAE7C,OAAO,GAAG,EAAE;oBACR,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBACpD,CAAC,CAAC;YACN,CAAC,CAAC,CAAC;YAEH,OAAO,GAAG,EAAE;gBACR,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3C,CAAC,CAAC;QACN,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC;AACnB,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"observableHooks.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/hooks/observableHooks.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,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,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAClG,OAAO,WAAW,CAAC;AACvB,CAAC","sourcesContent":["import { type IReadonlyObservable } from \"core/index\";\r\n\r\nimport { type IReadonlyObservableCollection } from \"../misc/observableCollection\";\r\n\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\r\n\r\n/**\r\n * Returns the current value of the accessor and updates it when the specified event is fired on the specified element.\r\n * @param accessor A function that returns the current value.\r\n * @param element The element to listen for the event on.\r\n * @param eventNames The names of the events to listen for.\r\n * @returns The current value of the accessor.\r\n * * @remarks If the accessor function is not idempotent (e.g. it returns a different array or object instance each time it is called),\r\n * then there is a good chance it should be wrapped in a `useCallback` to prevent unnecessary re-renders or re-render infinite loops.\r\n */\r\nexport function useEventfulState<T>(accessor: () => T, element: HTMLElement | null | undefined, ...eventNames: string[]): T {\r\n const [current, setCurrent] = useState(accessor);\r\n\r\n useEffect(() => {\r\n setCurrent(accessor);\r\n if (element) {\r\n const removers = eventNames.map((eventName) => {\r\n const handler = () => {\r\n setCurrent(accessor());\r\n };\r\n\r\n element.addEventListener(eventName, handler);\r\n\r\n return () => {\r\n element.removeEventListener(eventName, handler);\r\n };\r\n });\r\n\r\n return () => {\r\n removers.forEach((remove) => remove());\r\n };\r\n }\r\n\r\n return undefined;\r\n }, [accessor, element, ...eventNames]);\r\n\r\n return current;\r\n}\r\n\r\n/**\r\n * Returns the current value of the accessor and updates it when any of the specified observables change.\r\n * @param accessor A function that returns the current value.\r\n * @param observables The observables to listen for changes on.\r\n * @returns The current value of the accessor.\r\n * @remarks Prefer this hook when the source already exposes precise change observables. Pair it\r\n * with a polling observable only when a fixed refresh cadence is intentional; use the source\r\n * system's adapter hook when refresh policy is configurable elsewhere.\r\n *\r\n * If the accessor function is not idempotent (e.g. it returns a different array or object instance\r\n * each time it is called), then there is a good chance it should be wrapped in a `useCallback` to\r\n * prevent unnecessary re-renders or re-render infinite loops.\r\n */\r\nexport function useObservableState<T>(accessor: () => T, ...observables: Array<IReadonlyObservable | null | undefined>): T {\r\n const [current, setCurrent] = useState(accessor);\r\n\r\n useEffect(() => {\r\n setCurrent(accessor);\r\n const observers = observables.map((observable) => {\r\n if (observable) {\r\n const observer = observable.add(() => {\r\n setCurrent(accessor());\r\n });\r\n\r\n return observer;\r\n }\r\n return null;\r\n });\r\n\r\n return () => {\r\n observers.forEach((observer) => observer?.remove());\r\n };\r\n }, [accessor, ...observables]);\r\n\r\n return current;\r\n}\r\n\r\n/**\r\n * Returns a copy of the items in the collection and updates it when the collection changes.\r\n * @param collection The collection to observe.\r\n * @returns A copy of the items in the collection.\r\n */\r\nexport function useObservableCollection<T>(collection: IReadonlyObservableCollection<T>) {\r\n const itemsRef = useRef([...collection.items]);\r\n return useObservableState(\r\n useCallback(() => {\r\n if (itemsRef.current.length !== collection.items.length || !itemsRef.current.every((item, index) => item === collection.items[index])) {\r\n itemsRef.current = [...collection.items];\r\n }\r\n return itemsRef.current;\r\n }, [collection]),\r\n collection.observable\r\n );\r\n}\r\n\r\n/**\r\n * Returns a copy of the items in the collection sorted by the order property and updates it when the collection changes.\r\n * @param collection The collection to observe.\r\n * @returns A copy of the items in the collection sorted by the order property.\r\n */\r\nexport function useOrderedObservableCollection<T extends Readonly<{ order?: number }>>(collection: IReadonlyObservableCollection<T>) {\r\n const items = useObservableCollection(collection);\r\n const sortedItems = useMemo(() => items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0)), [items]);\r\n return sortedItems;\r\n}\r\n"]}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { type IDisposable, type IReadonlyObservable } from "@babylonjs/core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A read-only view of a collection whose changes can be observed.
|
|
4
|
+
*/
|
|
5
|
+
export interface IReadonlyObservableCollection<T> {
|
|
6
|
+
/**
|
|
7
|
+
* An observable that notifies observers when the collection changes.
|
|
8
|
+
*/
|
|
9
|
+
readonly observable: IReadonlyObservable<void>;
|
|
10
|
+
/**
|
|
11
|
+
* The items in the collection.
|
|
12
|
+
*/
|
|
13
|
+
readonly items: readonly T[];
|
|
14
|
+
}
|
|
2
15
|
/**
|
|
3
16
|
* A collection of items that can be observed for changes.
|
|
4
17
|
*/
|
|
5
|
-
export declare class ObservableCollection<T> {
|
|
18
|
+
export declare class ObservableCollection<T> implements IReadonlyObservableCollection<T>, IDisposable {
|
|
6
19
|
private readonly _items;
|
|
7
20
|
private readonly _keys;
|
|
8
21
|
private readonly _observable;
|
|
22
|
+
private _isDisposed;
|
|
9
23
|
/**
|
|
10
24
|
* An observable that notifies observers when the collection changes.
|
|
11
25
|
*/
|
|
@@ -20,4 +34,8 @@ export declare class ObservableCollection<T> {
|
|
|
20
34
|
* @returns A disposable that removes the item from the collection when disposed.
|
|
21
35
|
*/
|
|
22
36
|
add(item: T): IDisposable;
|
|
37
|
+
/**
|
|
38
|
+
* Removes all items and observers and rejects subsequent additions.
|
|
39
|
+
*/
|
|
40
|
+
dispose(): void;
|
|
23
41
|
}
|
|
@@ -7,6 +7,7 @@ export class ObservableCollection {
|
|
|
7
7
|
this._items = [];
|
|
8
8
|
this._keys = [];
|
|
9
9
|
this._observable = new Observable();
|
|
10
|
+
this._isDisposed = false;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* An observable that notifies observers when the collection changes.
|
|
@@ -26,6 +27,9 @@ export class ObservableCollection {
|
|
|
26
27
|
* @returns A disposable that removes the item from the collection when disposed.
|
|
27
28
|
*/
|
|
28
29
|
add(item) {
|
|
30
|
+
if (this._isDisposed) {
|
|
31
|
+
throw new Error("Observable collection is disposed.");
|
|
32
|
+
}
|
|
29
33
|
const key = Symbol();
|
|
30
34
|
this._items.push(item);
|
|
31
35
|
this._keys.push(key);
|
|
@@ -33,11 +37,27 @@ export class ObservableCollection {
|
|
|
33
37
|
return {
|
|
34
38
|
dispose: () => {
|
|
35
39
|
const index = this._keys.indexOf(key);
|
|
40
|
+
if (index === -1) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
36
43
|
this._items.splice(index, 1);
|
|
37
44
|
this._keys.splice(index, 1);
|
|
38
45
|
this._observable.notifyObservers();
|
|
39
46
|
},
|
|
40
47
|
};
|
|
41
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Removes all items and observers and rejects subsequent additions.
|
|
51
|
+
*/
|
|
52
|
+
dispose() {
|
|
53
|
+
if (this._isDisposed) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this._isDisposed = true;
|
|
57
|
+
this._items.length = 0;
|
|
58
|
+
this._keys.length = 0;
|
|
59
|
+
this._observable.notifyObservers();
|
|
60
|
+
this._observable.clear();
|
|
61
|
+
}
|
|
42
62
|
}
|
|
43
63
|
//# sourceMappingURL=observableCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observableCollection.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/misc/observableCollection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"observableCollection.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/modularTool/misc/observableCollection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAiBlD;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QACqB,WAAM,GAAQ,EAAE,CAAC;QACjB,UAAK,GAAa,EAAE,CAAC;QACrB,gBAAW,GAAG,IAAI,UAAU,EAAQ,CAAC;QAC9C,gBAAW,GAAG,KAAK,CAAC;IA2DhC,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AAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type IDisposable, type IReadonlyObservable } from \"core/index\";\r\n\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * A read-only view of a collection whose changes can be observed.\r\n */\r\nexport interface IReadonlyObservableCollection<T> {\r\n /**\r\n * An observable that notifies observers when the collection changes.\r\n */\r\n readonly observable: IReadonlyObservable<void>;\r\n\r\n /**\r\n * The items in the collection.\r\n */\r\n readonly items: readonly T[];\r\n}\r\n\r\n/**\r\n * A collection of items that can be observed for changes.\r\n */\r\nexport class ObservableCollection<T> implements IReadonlyObservableCollection<T>, IDisposable {\r\n private readonly _items: T[] = [];\r\n private readonly _keys: symbol[] = [];\r\n private readonly _observable = new Observable<void>();\r\n private _isDisposed = false;\r\n\r\n /**\r\n * An observable that notifies observers when the collection changes.\r\n */\r\n public get observable(): IReadonlyObservable<void> {\r\n return this._observable;\r\n }\r\n\r\n /**\r\n * The items in the collection.\r\n */\r\n public get items(): readonly T[] {\r\n return this._items;\r\n }\r\n\r\n /**\r\n * Adds an item to the collection.\r\n * @param item The item to add.\r\n * @returns A disposable that removes the item from the collection when disposed.\r\n */\r\n public add(item: T): IDisposable {\r\n if (this._isDisposed) {\r\n throw new Error(\"Observable collection is disposed.\");\r\n }\r\n\r\n const key = Symbol();\r\n this._items.push(item);\r\n this._keys.push(key);\r\n this._observable.notifyObservers();\r\n\r\n return {\r\n dispose: () => {\r\n const index = this._keys.indexOf(key);\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n this._items.splice(index, 1);\r\n this._keys.splice(index, 1);\r\n this._observable.notifyObservers();\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Removes all items and observers and rejects subsequent additions.\r\n */\r\n public dispose(): void {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n\r\n this._isDisposed = true;\r\n this._items.length = 0;\r\n this._keys.length = 0;\r\n this._observable.notifyObservers();\r\n this._observable.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -127,9 +127,12 @@ const useStyles = makeStyles({
|
|
|
127
127
|
borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
128
128
|
backgroundColor: tokens.colorNeutralBackground2,
|
|
129
129
|
},
|
|
130
|
-
|
|
130
|
+
paneCollapseButtonWithLeftBorder: {
|
|
131
131
|
borderLeft: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
132
132
|
},
|
|
133
|
+
paneCollapseButtonWithRightBorder: {
|
|
134
|
+
borderRight: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
135
|
+
},
|
|
133
136
|
collapseMenuPopover: {
|
|
134
137
|
minWidth: 0,
|
|
135
138
|
},
|
|
@@ -297,7 +300,7 @@ const Toolbar = ({ location, components }) => {
|
|
|
297
300
|
const classes = useStyles();
|
|
298
301
|
const leftComponents = useMemo(() => components.filter((entry) => entry.horizontalLocation === "left"), [components]);
|
|
299
302
|
const rightComponents = useMemo(() => components.filter((entry) => entry.horizontalLocation === "right"), [components]);
|
|
300
|
-
return (
|
|
303
|
+
return (_jsxs("div", { className: `${classes.bar} ${location === "top" ? classes.barTop : classes.barBottom}`, children: [_jsx("div", { className: classes.barLeft, children: leftComponents.map((entry) => (_jsx(ToolbarItem, { verticalLocation: location, horizontalLocation: entry.horizontalLocation, id: entry.key, component: entry.component, displayName: entry.displayName, teachingMoment: entry.teachingMoment }, entry.key))) }), _jsx("div", { className: classes.barRight, children: rightComponents.map((entry) => (_jsx(ToolbarItem, { verticalLocation: location, horizontalLocation: entry.horizontalLocation, id: entry.key, component: entry.component, displayName: entry.displayName, teachingMoment: entry.teachingMoment }, entry.key))) })] }));
|
|
301
304
|
};
|
|
302
305
|
// This is a wrapper for a tab in a side pane that simply adds a teaching moment, which is useful for dynamically added items, possibly from extensions.
|
|
303
306
|
const SidePaneTab = (props) => {
|
|
@@ -415,7 +418,11 @@ function usePane(location, defaultWidth, minWidth, sidePanes, onSelectSidePane,
|
|
|
415
418
|
}, [childWindow, location]);
|
|
416
419
|
const expandCollapseButton = useMemo(() => {
|
|
417
420
|
const expandCollapseIcon = location === "left" ? collapsed ? _jsx(PanelLeftExpandRegular, {}) : _jsx(PanelLeftContractRegular, {}) : collapsed ? _jsx(PanelRightExpandRegular, {}) : _jsx(PanelRightContractRegular, {});
|
|
418
|
-
return (_jsxs(Menu, { positioning: "below-end", children: [_jsx(MenuTrigger, { disableButtonEnhancement: true, children: (triggerProps) => (_jsx(Tooltip, { content: collapsed ? "Show Side Pane" : "Hide Side Pane", children: _jsx(SplitButton, { className: mergeClasses(classes.paneCollapseButton,
|
|
421
|
+
return (_jsxs(Menu, { positioning: "below-end", children: [_jsx(MenuTrigger, { disableButtonEnhancement: true, children: (triggerProps) => (_jsx(Tooltip, { content: collapsed ? "Show Side Pane" : "Hide Side Pane", children: _jsx(SplitButton, { className: mergeClasses(classes.paneCollapseButton, toolbarMode === "compact"
|
|
422
|
+
? location === "left"
|
|
423
|
+
? classes.paneCollapseButtonWithRightBorder
|
|
424
|
+
: classes.paneCollapseButtonWithLeftBorder
|
|
425
|
+
: undefined), menuButton: triggerProps, primaryActionButton: { onClick: onExpandCollapseClick }, size: "small", appearance: "transparent", icon: expandCollapseIcon }) })) }), _jsx(MenuPopover, { className: classes.collapseMenuPopover, children: _jsx(MenuList, { children: _jsx(MenuItem, { icon: _jsx(PictureInPictureEnterRegular, {}), onClick: () => setUndocked(true), children: "Undock" }) }) })] }));
|
|
419
426
|
}, [collapsed, onExpandCollapseClick, location]);
|
|
420
427
|
const createPaneTabList = useCallback((paneComponents, toolbarMode, selectedTab, setSelectedTab, dockOptions) => {
|
|
421
428
|
return (_jsx(_Fragment, { children: paneComponents.length > 0 && (_jsxs("div", { className: `${classes.paneTabListDiv} ${location === "left" || toolbarMode === "compact" ? classes.paneTabListDivLeft : classes.paneTabListDivRight}`, children: [paneComponents.length > 1 && (_jsx(_Fragment, { children: _jsx(FluentToolbar, { className: classes.tabToolbar, checkedValues: { selectedTab: [selectedTab?.key ?? ""] }, onCheckedValueChange: (event, data) => {
|
|
@@ -499,7 +506,7 @@ function usePane(location, defaultWidth, minWidth, sidePanes, onSelectSidePane,
|
|
|
499
506
|
}, [childWindow, isChildWindowOpen, topPanes, bottomPanes]);
|
|
500
507
|
// This memoizes the pane itself, which may or may not include the tab list, depending on the toolbar mode.
|
|
501
508
|
const corePane = useMemo(() => {
|
|
502
|
-
return (_jsxs(_Fragment, { children: [toolbarMode === "compact" && (topPanes.length > 1 || topBarItems.length > 0) && (_jsx(_Fragment, { children: _jsxs("div", { className: classes.barDiv, children: [!isChildWindowOpen && location === "left" && expandCollapseButton, topPaneTabList, _jsx(Toolbar, { location: "top", components: topBarItems }), !isChildWindowOpen && location === "right" && expandCollapseButton] }) })), topPanes.length > 0 && (_jsx("div", { className: classes.paneContent, children: topSelectedTab && (_jsxs(_Fragment, { children: [_jsx(PaneHeader, { id: topSelectedTab.key, title: topSelectedTab.title, icon: topPanes.length > 1 ? undefined : topSelectedTab.icon, dockOptions: validTopDockOptions }), topPanes
|
|
509
|
+
return (_jsxs(_Fragment, { children: [toolbarMode === "compact" && (topPanes.length > 1 || topBarItems.length > 0 || (!isChildWindowOpen && (topPanes.length > 0 || bottomPanes.length > 0))) && (_jsx(_Fragment, { children: _jsxs("div", { className: classes.barDiv, children: [!isChildWindowOpen && location === "left" && expandCollapseButton, topPaneTabList, _jsx(Toolbar, { location: "top", components: topBarItems }), !isChildWindowOpen && location === "right" && expandCollapseButton] }) })), topPanes.length > 0 && (_jsx("div", { className: classes.paneContent, children: topSelectedTab && (_jsxs(_Fragment, { children: [_jsx(PaneHeader, { id: topSelectedTab.key, title: topSelectedTab.title, icon: topPanes.length > 1 ? undefined : topSelectedTab.icon, dockOptions: validTopDockOptions }), topPanes
|
|
503
510
|
.filter((pane) => pane.key === topSelectedTab.key || pane.keepMounted)
|
|
504
511
|
.map((pane) => (_jsx("div", { className: mergeClasses(classes.paneContent, pane.key !== topSelectedTab.key ? classes.unselectedPane : undefined), children: _jsx(ErrorBoundary, { name: pane.title, children: _jsx(pane.content, {}) }) }, pane.key)))] })) })), topPanes.length > 0 && bottomPanes.length > 0 && _jsx(Divider, { ref: paneVerticalResizeHandleRef, className: classes.paneDivider }), bottomPanes.length > 1 && (_jsx(_Fragment, { children: _jsx("div", { className: classes.barDiv, children: bottomPaneTabList }) })), bottomPanes.length > 0 && (_jsx("div", { ref: composedVerticalElementRef, className: classes.paneContent, style: { height: `clamp(200px, calc(45% + var(${paneHeightAdjustCSSVar}, 0px)), 100% - 300px)`, flex: "0 0 auto" }, children: bottomSelectedTab && (_jsxs(_Fragment, { children: [_jsx(PaneHeader, { id: bottomSelectedTab.key, title: bottomSelectedTab.title, icon: bottomPanes.length > 1 ? undefined : bottomSelectedTab.icon, dockOptions: validBottomDockOptions }), bottomPanes
|
|
505
512
|
.filter((pane) => pane.key === bottomSelectedTab.key || pane.keepMounted)
|