@babylonjs/shared-ui-components 8.41.2 → 8.43.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 (43) hide show
  1. package/fluent/hoc/childWindow.d.ts +61 -0
  2. package/fluent/hoc/childWindow.js +174 -0
  3. package/fluent/hoc/childWindow.js.map +1 -0
  4. package/fluent/hoc/fileUploadLine.d.ts +5 -0
  5. package/fluent/hoc/fileUploadLine.js +10 -17
  6. package/fluent/hoc/fileUploadLine.js.map +1 -1
  7. package/fluent/hoc/propertyLines/comboBoxPropertyLine.d.ts +11 -0
  8. package/fluent/hoc/propertyLines/comboBoxPropertyLine.js +13 -0
  9. package/fluent/hoc/propertyLines/comboBoxPropertyLine.js.map +1 -0
  10. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.d.ts +15 -0
  11. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.js +9 -0
  12. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.js.map +1 -0
  13. package/fluent/hoc/textureUpload.d.ts +40 -0
  14. package/fluent/hoc/textureUpload.js +64 -0
  15. package/fluent/hoc/textureUpload.js.map +1 -0
  16. package/fluent/primitives/button.d.ts +7 -3
  17. package/fluent/primitives/button.js +5 -5
  18. package/fluent/primitives/button.js.map +1 -1
  19. package/fluent/primitives/colorPicker.d.ts +8 -1
  20. package/fluent/primitives/colorPicker.js +25 -28
  21. package/fluent/primitives/colorPicker.js.map +1 -1
  22. package/fluent/primitives/comboBox.d.ts +23 -4
  23. package/fluent/primitives/comboBox.js +28 -8
  24. package/fluent/primitives/comboBox.js.map +1 -1
  25. package/fluent/primitives/entitySelector.d.ts +33 -0
  26. package/fluent/primitives/entitySelector.js +31 -0
  27. package/fluent/primitives/entitySelector.js.map +1 -0
  28. package/fluent/primitives/materialSelector.d.ts +21 -0
  29. package/fluent/primitives/materialSelector.js +16 -0
  30. package/fluent/primitives/materialSelector.js.map +1 -0
  31. package/fluent/primitives/nodeSelector.d.ts +21 -0
  32. package/fluent/primitives/nodeSelector.js +16 -0
  33. package/fluent/primitives/nodeSelector.js.map +1 -0
  34. package/fluent/primitives/popover.d.ts +13 -0
  35. package/fluent/primitives/popover.js +27 -0
  36. package/fluent/primitives/popover.js.map +1 -0
  37. package/fluent/primitives/textureSelector.d.ts +26 -0
  38. package/fluent/primitives/textureSelector.js +29 -0
  39. package/fluent/primitives/textureSelector.js.map +1 -0
  40. package/fluent/primitives/uploadButton.d.ts +24 -0
  41. package/fluent/primitives/uploadButton.js +27 -0
  42. package/fluent/primitives/uploadButton.js.map +1 -0
  43. package/package.json +1 -1
@@ -0,0 +1,61 @@
1
+ import type { FunctionComponent, PropsWithChildren, Ref } from "react";
2
+ export type ChildWindowOptions = {
3
+ /**
4
+ * The default width of the child window in pixels.
5
+ * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.
6
+ */
7
+ defaultWidth?: number;
8
+ /**
9
+ * The default height of the child window in pixels.
10
+ * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.
11
+ */
12
+ defaultHeight?: number;
13
+ /**
14
+ * The default left position of the child window in pixels.
15
+ * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.
16
+ */
17
+ defaultLeft?: number;
18
+ /**
19
+ * The default top position of the child window in pixels.
20
+ * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.
21
+ */
22
+ defaultTop?: number;
23
+ /**
24
+ * The title of the child window.
25
+ * @remarks If not provided, the id will be used instead (if any).
26
+ */
27
+ title?: string;
28
+ };
29
+ export type ChildWindow = {
30
+ /**
31
+ * Opens the child window.
32
+ * @param options Options for opening the child window.
33
+ */
34
+ open: (options?: ChildWindowOptions) => void;
35
+ /**
36
+ * Closes the child window.
37
+ */
38
+ close: () => void;
39
+ };
40
+ export type ChildWindowProps = {
41
+ /**
42
+ * An optional unique identity for the child window.
43
+ * @remarks If provided, the child window's bounds will be saved/restored using this identity.
44
+ */
45
+ id?: string;
46
+ /**
47
+ * Called when the open state of the child window changes.
48
+ * @param isOpen Whether the child window is open.
49
+ */
50
+ onOpenChange?: (isOpen: boolean) => void;
51
+ /**
52
+ * A ref that exposes the ChildWindow imperative API.
53
+ */
54
+ imperativeRef?: Ref<ChildWindow>;
55
+ };
56
+ /**
57
+ * Allows displaying a child window that can contain child components.
58
+ * @param props Props for the child window.
59
+ * @returns The child window component.
60
+ */
61
+ export declare const ChildWindow: FunctionComponent<PropsWithChildren<ChildWindowProps>>;
@@ -0,0 +1,174 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createDOMRenderer, FluentProvider, makeStyles, Portal, RendererProvider } from "@fluentui/react-components";
3
+ import { useCallback, useEffect, useImperativeHandle, useState } from "react";
4
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
5
+ function ToFeaturesString(options) {
6
+ const { defaultWidth, defaultHeight, defaultLeft, defaultTop } = options;
7
+ const features = [];
8
+ if (defaultWidth !== undefined) {
9
+ features.push({ key: "width", value: defaultWidth.toString() });
10
+ }
11
+ if (defaultHeight !== undefined) {
12
+ features.push({ key: "height", value: defaultHeight.toString() });
13
+ }
14
+ if (defaultLeft !== undefined) {
15
+ features.push({ key: "left", value: defaultLeft.toString() });
16
+ }
17
+ if (defaultTop !== undefined) {
18
+ features.push({ key: "top", value: defaultTop.toString() });
19
+ }
20
+ features.push({ key: "location", value: "no" });
21
+ return features.map((feature) => `${feature.key}=${feature.value}`).join(",");
22
+ }
23
+ const useStyles = makeStyles({
24
+ container: {
25
+ display: "flex",
26
+ flexGrow: 1,
27
+ flexDirection: "column",
28
+ overflow: "hidden",
29
+ },
30
+ });
31
+ /**
32
+ * Allows displaying a child window that can contain child components.
33
+ * @param props Props for the child window.
34
+ * @returns The child window component.
35
+ */
36
+ export const ChildWindow = (props) => {
37
+ const { id, children, onOpenChange, imperativeRef: imperativeRef } = props;
38
+ const classes = useStyles();
39
+ const [windowState, setWindowState] = useState();
40
+ const [childWindow, setChildWindow] = useState();
41
+ const storageKey = id ? `Babylon/Settings/ChildWindow/${id}/Bounds` : null;
42
+ // This function is just for creating the child window itself. It is a function because
43
+ // it must be called synchronously in response to a user interaction (e.g. button click),
44
+ // otherwise the browser will block it as a scripted popup.
45
+ const createWindow = useCallback((options = {}) => {
46
+ if (storageKey) {
47
+ // If we are persisting window bounds, but the window is already open, just use the existing bounds.
48
+ // Otherwise, try to load bounds from storage.
49
+ if (childWindow) {
50
+ options.defaultLeft = childWindow.screenX;
51
+ options.defaultTop = childWindow.screenY;
52
+ options.defaultWidth = childWindow.innerWidth;
53
+ options.defaultHeight = childWindow.innerHeight;
54
+ }
55
+ else {
56
+ const savedBounds = localStorage.getItem(storageKey);
57
+ if (savedBounds) {
58
+ try {
59
+ const bounds = JSON.parse(savedBounds);
60
+ options.defaultLeft = bounds.left;
61
+ options.defaultTop = bounds.top;
62
+ options.defaultWidth = bounds.width;
63
+ options.defaultHeight = bounds.height;
64
+ }
65
+ catch {
66
+ Logger.Warn(`Could not parse saved bounds for child window with key ${storageKey}`);
67
+ }
68
+ }
69
+ }
70
+ }
71
+ // Half width by default.
72
+ if (!options.defaultWidth) {
73
+ options.defaultWidth = window.innerWidth * (2 / 3);
74
+ }
75
+ // Half height by default.
76
+ if (!options.defaultHeight) {
77
+ options.defaultHeight = window.innerHeight * (2 / 3);
78
+ }
79
+ // Horizontally centered by default.
80
+ if (!options.defaultLeft) {
81
+ options.defaultLeft = window.screenX + (window.innerWidth - options.defaultWidth) * (2 / 3);
82
+ }
83
+ // Vertically centered by default.
84
+ if (!options.defaultTop) {
85
+ options.defaultTop = window.screenY + (window.innerHeight - options.defaultHeight) * (2 / 3);
86
+ }
87
+ // Try to create the child window (can be null if popups are blocked).
88
+ const newChildWindow = window.open("", "", ToFeaturesString(options));
89
+ if (newChildWindow) {
90
+ // Set the title if provided.
91
+ newChildWindow.document.title = options.title ?? id ?? "";
92
+ // Set the child window state.
93
+ setChildWindow((current) => {
94
+ // But first close any existing child window.
95
+ current?.close();
96
+ return newChildWindow;
97
+ });
98
+ }
99
+ }, [childWindow, storageKey]);
100
+ useImperativeHandle(imperativeRef, () => {
101
+ return {
102
+ open: createWindow,
103
+ close: () => setChildWindow(undefined),
104
+ };
105
+ }, [createWindow]);
106
+ // This side effect runs any time the child window instance changes. It does the rest of the child window
107
+ // setup work, including creating resources and state needed to properly render the content of the child window.
108
+ useEffect(() => {
109
+ const disposeActions = [];
110
+ if (childWindow) {
111
+ const body = childWindow.document.body;
112
+ body.style.width = "100%";
113
+ body.style.height = "100%";
114
+ body.style.margin = "0";
115
+ body.style.padding = "0";
116
+ body.style.display = "flex";
117
+ body.style.overflow = "hidden";
118
+ const applyWindowState = () => {
119
+ // Setup the window state, including creating a Fluent/Griffel "renderer" for managing runtime styles/classes in the child window.
120
+ setWindowState({ mountNode: body, renderer: createDOMRenderer(childWindow.document) });
121
+ onOpenChange?.(true);
122
+ };
123
+ // Once the child window document is ready, setup the window state which will trigger another effect that renders into the child window.
124
+ if (childWindow.document.readyState === "complete") {
125
+ applyWindowState();
126
+ }
127
+ else {
128
+ const onChildWindowLoad = () => {
129
+ applyWindowState();
130
+ };
131
+ childWindow.addEventListener("load", onChildWindowLoad, { once: true });
132
+ disposeActions.push(() => childWindow.removeEventListener("load", onChildWindowLoad));
133
+ }
134
+ // When the child window is closed for any reason, transition back to a closed state.
135
+ const onChildWindowUnload = () => {
136
+ setWindowState(undefined);
137
+ setChildWindow(undefined);
138
+ onOpenChange?.(false);
139
+ };
140
+ childWindow.addEventListener("unload", onChildWindowUnload, { once: true });
141
+ disposeActions.push(() => childWindow.removeEventListener("unload", onChildWindowUnload));
142
+ // If the main window closes, close any open child windows as well (don't leave them orphaned).
143
+ const onParentWindowUnload = () => {
144
+ childWindow.close();
145
+ };
146
+ window.addEventListener("unload", onParentWindowUnload, { once: true });
147
+ disposeActions.push(() => window.removeEventListener("unload", onParentWindowUnload));
148
+ // On dispose, close the child window.
149
+ disposeActions.push(() => childWindow.close());
150
+ // On dispose, save the window bounds.
151
+ disposeActions.push(() => {
152
+ if (storageKey) {
153
+ localStorage.setItem(storageKey, JSON.stringify({
154
+ left: childWindow.screenX,
155
+ top: childWindow.screenY,
156
+ width: childWindow.innerWidth,
157
+ height: childWindow.innerHeight,
158
+ }));
159
+ }
160
+ });
161
+ }
162
+ return () => {
163
+ disposeActions.reverse().forEach((dispose) => dispose());
164
+ };
165
+ }, [childWindow]);
166
+ if (!windowState) {
167
+ return null;
168
+ }
169
+ const { mountNode, renderer } = windowState;
170
+ return (
171
+ // Portal targets the body of the child window.
172
+ _jsx(Portal, { mountNode: mountNode, children: _jsx(RendererProvider, { renderer: renderer, targetDocument: mountNode.ownerDocument, children: _jsx(FluentProvider, { className: classes.container, applyStylesToPortals: false, targetDocument: mountNode.ownerDocument, children: children }) }) }));
173
+ };
174
+ //# sourceMappingURL=childWindow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"childWindow.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/childWindow.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C,SAAS,gBAAgB,CAAC,OAA2B;IACjD,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEzE,MAAM,QAAQ,GAAqC,EAAE,CAAC;IAEtD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAC9B,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AAE,WAAW,CAAC,WAAW;qBAClC,CAAC,CACL,CAAC;gBACN,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;QAED,OAAO,GAAG,EAAE;YACR,cAAc,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAE5C,OAAO;IACH,+CAA+C;IAC/C,KAAC,MAAM,IAAC,SAAS,EAAE,SAAS,YAExB,KAAC,gBAAgB,IAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,CAAC,aAAa,YAEzE,KAAC,cAAc,IAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,aAAa,YAC7G,QAAQ,GACI,GACF,GACd,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { GriffelRenderer } from \"@fluentui/react-components\";\r\nimport type { FunctionComponent, PropsWithChildren, Ref } from \"react\";\r\n\r\nimport { createDOMRenderer, FluentProvider, makeStyles, Portal, RendererProvider } from \"@fluentui/react-components\";\r\nimport { useCallback, useEffect, useImperativeHandle, useState } from \"react\";\r\n\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nfunction ToFeaturesString(options: ChildWindowOptions) {\r\n const { defaultWidth, defaultHeight, defaultLeft, defaultTop } = options;\r\n\r\n const features: { key: string; value: string }[] = [];\r\n\r\n if (defaultWidth !== undefined) {\r\n features.push({ key: \"width\", value: defaultWidth.toString() });\r\n }\r\n if (defaultHeight !== undefined) {\r\n features.push({ key: \"height\", value: defaultHeight.toString() });\r\n }\r\n if (defaultLeft !== undefined) {\r\n features.push({ key: \"left\", value: defaultLeft.toString() });\r\n }\r\n if (defaultTop !== undefined) {\r\n features.push({ key: \"top\", value: defaultTop.toString() });\r\n }\r\n features.push({ key: \"location\", value: \"no\" });\r\n\r\n return features.map((feature) => `${feature.key}=${feature.value}`).join(\",\");\r\n}\r\n\r\nconst useStyles = makeStyles({\r\n container: {\r\n display: \"flex\",\r\n flexGrow: 1,\r\n flexDirection: \"column\",\r\n overflow: \"hidden\",\r\n },\r\n});\r\n\r\nexport type ChildWindowOptions = {\r\n /**\r\n * The default width of the child window in pixels.\r\n * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.\r\n */\r\n defaultWidth?: number;\r\n\r\n /**\r\n * The default height of the child window in pixels.\r\n * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.\r\n */\r\n defaultHeight?: number;\r\n\r\n /**\r\n * The default left position of the child window in pixels.\r\n * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.\r\n */\r\n defaultLeft?: number;\r\n\r\n /**\r\n * The default top position of the child window in pixels.\r\n * @remarks Ignored if the ChildWindow was passed an id and previous bounds were saved.\r\n */\r\n defaultTop?: number;\r\n\r\n /**\r\n * The title of the child window.\r\n * @remarks If not provided, the id will be used instead (if any).\r\n */\r\n title?: string;\r\n};\r\n\r\nexport type ChildWindow = {\r\n /**\r\n * Opens the child window.\r\n * @param options Options for opening the child window.\r\n */\r\n open: (options?: ChildWindowOptions) => void;\r\n\r\n /**\r\n * Closes the child window.\r\n */\r\n close: () => void;\r\n};\r\n\r\nexport type ChildWindowProps = {\r\n /**\r\n * An optional unique identity for the child window.\r\n * @remarks If provided, the child window's bounds will be saved/restored using this identity.\r\n */\r\n id?: string;\r\n\r\n /**\r\n * Called when the open state of the child window changes.\r\n * @param isOpen Whether the child window is open.\r\n */\r\n onOpenChange?: (isOpen: boolean) => void;\r\n\r\n /**\r\n * A ref that exposes the ChildWindow imperative API.\r\n */\r\n imperativeRef?: Ref<ChildWindow>;\r\n};\r\n\r\n/**\r\n * Allows displaying a child window that can contain child components.\r\n * @param props Props for the child window.\r\n * @returns The child window component.\r\n */\r\nexport const ChildWindow: FunctionComponent<PropsWithChildren<ChildWindowProps>> = (props) => {\r\n const { id, children, onOpenChange, imperativeRef: imperativeRef } = props;\r\n const classes = useStyles();\r\n\r\n const [windowState, setWindowState] = useState<{ mountNode: HTMLElement; renderer: GriffelRenderer }>();\r\n const [childWindow, setChildWindow] = useState<Window>();\r\n\r\n const storageKey = id ? `Babylon/Settings/ChildWindow/${id}/Bounds` : null;\r\n\r\n // This function is just for creating the child window itself. It is a function because\r\n // it must be called synchronously in response to a user interaction (e.g. button click),\r\n // otherwise the browser will block it as a scripted popup.\r\n const createWindow = useCallback(\r\n (options: ChildWindowOptions = {}) => {\r\n if (storageKey) {\r\n // If we are persisting window bounds, but the window is already open, just use the existing bounds.\r\n // Otherwise, try to load bounds from storage.\r\n if (childWindow) {\r\n options.defaultLeft = childWindow.screenX;\r\n options.defaultTop = childWindow.screenY;\r\n options.defaultWidth = childWindow.innerWidth;\r\n options.defaultHeight = childWindow.innerHeight;\r\n } else {\r\n const savedBounds = localStorage.getItem(storageKey);\r\n if (savedBounds) {\r\n try {\r\n const bounds = JSON.parse(savedBounds);\r\n options.defaultLeft = bounds.left;\r\n options.defaultTop = bounds.top;\r\n options.defaultWidth = bounds.width;\r\n options.defaultHeight = bounds.height;\r\n } catch {\r\n Logger.Warn(`Could not parse saved bounds for child window with key ${storageKey}`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Half width by default.\r\n if (!options.defaultWidth) {\r\n options.defaultWidth = window.innerWidth * (2 / 3);\r\n }\r\n // Half height by default.\r\n if (!options.defaultHeight) {\r\n options.defaultHeight = window.innerHeight * (2 / 3);\r\n }\r\n // Horizontally centered by default.\r\n if (!options.defaultLeft) {\r\n options.defaultLeft = window.screenX + (window.innerWidth - options.defaultWidth) * (2 / 3);\r\n }\r\n // Vertically centered by default.\r\n if (!options.defaultTop) {\r\n options.defaultTop = window.screenY + (window.innerHeight - options.defaultHeight) * (2 / 3);\r\n }\r\n\r\n // Try to create the child window (can be null if popups are blocked).\r\n const newChildWindow = window.open(\"\", \"\", ToFeaturesString(options));\r\n if (newChildWindow) {\r\n // Set the title if provided.\r\n newChildWindow.document.title = options.title ?? id ?? \"\";\r\n\r\n // Set the child window state.\r\n setChildWindow((current) => {\r\n // But first close any existing child window.\r\n current?.close();\r\n return newChildWindow;\r\n });\r\n }\r\n },\r\n [childWindow, storageKey]\r\n );\r\n\r\n useImperativeHandle(imperativeRef, () => {\r\n return {\r\n open: createWindow,\r\n close: () => setChildWindow(undefined),\r\n };\r\n }, [createWindow]);\r\n\r\n // This side effect runs any time the child window instance changes. It does the rest of the child window\r\n // setup work, including creating resources and state needed to properly render the content of the child window.\r\n useEffect(() => {\r\n const disposeActions: (() => void)[] = [];\r\n\r\n if (childWindow) {\r\n const body = childWindow.document.body;\r\n body.style.width = \"100%\";\r\n body.style.height = \"100%\";\r\n body.style.margin = \"0\";\r\n body.style.padding = \"0\";\r\n body.style.display = \"flex\";\r\n body.style.overflow = \"hidden\";\r\n\r\n const applyWindowState = () => {\r\n // Setup the window state, including creating a Fluent/Griffel \"renderer\" for managing runtime styles/classes in the child window.\r\n setWindowState({ mountNode: body, renderer: createDOMRenderer(childWindow.document) });\r\n onOpenChange?.(true);\r\n };\r\n\r\n // Once the child window document is ready, setup the window state which will trigger another effect that renders into the child window.\r\n if (childWindow.document.readyState === \"complete\") {\r\n applyWindowState();\r\n } else {\r\n const onChildWindowLoad = () => {\r\n applyWindowState();\r\n };\r\n childWindow.addEventListener(\"load\", onChildWindowLoad, { once: true });\r\n disposeActions.push(() => childWindow.removeEventListener(\"load\", onChildWindowLoad));\r\n }\r\n\r\n // When the child window is closed for any reason, transition back to a closed state.\r\n const onChildWindowUnload = () => {\r\n setWindowState(undefined);\r\n setChildWindow(undefined);\r\n onOpenChange?.(false);\r\n };\r\n childWindow.addEventListener(\"unload\", onChildWindowUnload, { once: true });\r\n disposeActions.push(() => childWindow.removeEventListener(\"unload\", onChildWindowUnload));\r\n\r\n // If the main window closes, close any open child windows as well (don't leave them orphaned).\r\n const onParentWindowUnload = () => {\r\n childWindow.close();\r\n };\r\n window.addEventListener(\"unload\", onParentWindowUnload, { once: true });\r\n disposeActions.push(() => window.removeEventListener(\"unload\", onParentWindowUnload));\r\n\r\n // On dispose, close the child window.\r\n disposeActions.push(() => childWindow.close());\r\n\r\n // On dispose, save the window bounds.\r\n disposeActions.push(() => {\r\n if (storageKey) {\r\n localStorage.setItem(\r\n storageKey,\r\n JSON.stringify({\r\n left: childWindow.screenX,\r\n top: childWindow.screenY,\r\n width: childWindow.innerWidth,\r\n height: childWindow.innerHeight,\r\n })\r\n );\r\n }\r\n });\r\n }\r\n\r\n return () => {\r\n disposeActions.reverse().forEach((dispose) => dispose());\r\n };\r\n }, [childWindow]);\r\n\r\n if (!windowState) {\r\n return null;\r\n }\r\n\r\n const { mountNode, renderer } = windowState;\r\n\r\n return (\r\n // Portal targets the body of the child window.\r\n <Portal mountNode={mountNode}>\r\n {/* RenderProvider manages Fluent style/class state. */}\r\n <RendererProvider renderer={renderer} targetDocument={mountNode.ownerDocument}>\r\n {/* Fluent Provider is needed for managing other Fluent state and applying the current theme mode. */}\r\n <FluentProvider className={classes.container} applyStylesToPortals={false} targetDocument={mountNode.ownerDocument}>\r\n {children}\r\n </FluentProvider>\r\n </RendererProvider>\r\n </Portal>\r\n );\r\n};\r\n"]}
@@ -5,5 +5,10 @@ type FileUploadLineProps = Omit<ButtonProps, "onClick" | "label"> & {
5
5
  label: string;
6
6
  accept: string;
7
7
  };
8
+ /**
9
+ * A full-width line with an upload button.
10
+ * For just the button without the line wrapper, use UploadButton directly.
11
+ * @returns An UploadButton wrapped in a LineContainer
12
+ */
8
13
  export declare const FileUploadLine: FunctionComponent<FileUploadLineProps>;
9
14
  export {};
@@ -1,20 +1,13 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { ButtonLine } from "./buttonLine.js";
4
- import { ArrowUploadRegular } from "@fluentui/react-icons";
5
- export const FileUploadLine = (props) => {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LineContainer } from "./propertyLines/propertyLine.js";
3
+ import { UploadButton } from "../primitives/uploadButton.js";
4
+ /**
5
+ * A full-width line with an upload button.
6
+ * For just the button without the line wrapper, use UploadButton directly.
7
+ * @returns An UploadButton wrapped in a LineContainer
8
+ */
9
+ export const FileUploadLine = ({ onClick, label, accept, ...buttonProps }) => {
6
10
  FileUploadLine.displayName = "FileUploadLine";
7
- const inputRef = useRef(null);
8
- const handleButtonClick = () => {
9
- inputRef.current?.click();
10
- };
11
- const handleChange = (evt) => {
12
- const files = evt.target.files;
13
- if (files && files.length) {
14
- props.onClick(files);
15
- }
16
- evt.target.value = "";
17
- };
18
- return (_jsxs(_Fragment, { children: [_jsx(ButtonLine, { onClick: handleButtonClick, icon: ArrowUploadRegular, label: props.label }), _jsx("input", { ref: inputRef, type: "file", accept: props.accept, style: { display: "none" }, onChange: handleChange })] }));
11
+ return (_jsx(LineContainer, { children: _jsx(UploadButton, { onUpload: onClick, accept: accept, label: label, ...buttonProps }) }));
19
12
  };
20
13
  //# sourceMappingURL=fileUploadLine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileUploadLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/fileUploadLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,KAAK,EAAE,EAAE;IAC5E,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEhD,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC3B,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,GAAwC,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/B,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACH,8BACI,KAAC,UAAU,IAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAe,EACnG,gBAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,GAAI,IAC/G,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useRef } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { ButtonLine } from \"./buttonLine\";\r\nimport type { ButtonProps } from \"../primitives/button\";\r\nimport { ArrowUploadRegular } from \"@fluentui/react-icons\";\r\n\r\ntype FileUploadLineProps = Omit<ButtonProps, \"onClick\" | \"label\"> & {\r\n onClick: (files: FileList) => void;\r\n label: string; // Require a label when button is the entire line (by default, label is optional on a button)\r\n accept: string;\r\n};\r\n\r\nexport const FileUploadLine: FunctionComponent<FileUploadLineProps> = (props) => {\r\n FileUploadLine.displayName = \"FileUploadLine\";\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n\r\n const handleButtonClick = () => {\r\n inputRef.current?.click();\r\n };\r\n\r\n const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {\r\n const files = evt.target.files;\r\n if (files && files.length) {\r\n props.onClick(files);\r\n }\r\n evt.target.value = \"\";\r\n };\r\n\r\n return (\r\n <>\r\n <ButtonLine onClick={handleButtonClick} icon={ArrowUploadRegular} label={props.label}></ButtonLine>\r\n <input ref={inputRef} type=\"file\" accept={props.accept} style={{ display: \"none\" }} onChange={handleChange} />\r\n </>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"fileUploadLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/fileUploadLine.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,EAAE,EAAE;IACjH,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;IAE9C,OAAO,CACH,KAAC,aAAa,cACV,KAAC,YAAY,IAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAM,WAAW,GAAI,GACtE,CACnB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport { LineContainer } from \"./propertyLines/propertyLine\";\r\nimport { UploadButton } from \"../primitives/uploadButton\";\r\nimport type { ButtonProps } from \"../primitives/button\";\r\n\r\ntype FileUploadLineProps = Omit<ButtonProps, \"onClick\" | \"label\"> & {\r\n onClick: (files: FileList) => void;\r\n label: string; // Require a label when button is the entire line (by default, label is optional on an UploadButton\r\n accept: string;\r\n};\r\n\r\n/**\r\n * A full-width line with an upload button.\r\n * For just the button without the line wrapper, use UploadButton directly.\r\n * @returns An UploadButton wrapped in a LineContainer\r\n */\r\nexport const FileUploadLine: FunctionComponent<FileUploadLineProps> = ({ onClick, label, accept, ...buttonProps }) => {\r\n FileUploadLine.displayName = \"FileUploadLine\";\r\n\r\n return (\r\n <LineContainer>\r\n <UploadButton onUpload={onClick} accept={accept} label={label} {...buttonProps} />\r\n </LineContainer>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,11 @@
1
+ import type { FunctionComponent } from "react";
2
+ import type { PropertyLineProps } from "./propertyLine.js";
3
+ import type { ComboBoxProps } from "../../primitives/comboBox.js";
4
+ type ComboBoxPropertyLineProps = ComboBoxProps & PropertyLineProps<string>;
5
+ /**
6
+ * A property line with a filterable ComboBox
7
+ * @param props - ComboBoxProps & PropertyLineProps
8
+ * @returns property-line wrapped ComboBox component
9
+ */
10
+ export declare const ComboBoxPropertyLine: FunctionComponent<ComboBoxPropertyLineProps>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PropertyLine } from "./propertyLine.js";
3
+ import { ComboBox } from "../../primitives/comboBox.js";
4
+ /**
5
+ * A property line with a filterable ComboBox
6
+ * @param props - ComboBoxProps & PropertyLineProps
7
+ * @returns property-line wrapped ComboBox component
8
+ */
9
+ export const ComboBoxPropertyLine = (props) => {
10
+ ComboBoxPropertyLine.displayName = "ComboBoxPropertyLine";
11
+ return (_jsx(PropertyLine, { ...props, children: _jsx(ComboBox, { ...props }) }));
12
+ };
13
+ //# sourceMappingURL=comboBoxPropertyLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comboBoxPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/comboBoxPropertyLine.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiD,CAAC,KAAK,EAAE,EAAE;IACxF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;IAE1D,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,QAAQ,OAAK,KAAK,GAAI,GACZ,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { ComboBoxProps } from \"../../primitives/comboBox\";\r\n\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport { ComboBox } from \"../../primitives/comboBox\";\r\n\r\ntype ComboBoxPropertyLineProps = ComboBoxProps & PropertyLineProps<string>;\r\n\r\n/**\r\n * A property line with a filterable ComboBox\r\n * @param props - ComboBoxProps & PropertyLineProps\r\n * @returns property-line wrapped ComboBox component\r\n */\r\nexport const ComboBoxPropertyLine: FunctionComponent<ComboBoxPropertyLineProps> = (props) => {\r\n ComboBoxPropertyLine.displayName = \"ComboBoxPropertyLine\";\r\n\r\n return (\r\n <PropertyLine {...props}>\r\n <ComboBox {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,15 @@
1
+ import type { Node } from "@babylonjs/core/node.js";
2
+ import type { Nullable } from "@babylonjs/core/types.js";
3
+ import type { PropertyLineProps } from "./propertyLine.js";
4
+ import type { NodeSelectorProps } from "../../primitives/nodeSelector.js";
5
+ import type { MaterialSelectorProps } from "../../primitives/materialSelector.js";
6
+ import type { TextureSelectorProps } from "../../primitives/textureSelector.js";
7
+ import type { Material } from "@babylonjs/core/Materials/material.js";
8
+ import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
9
+ type NodeSelectorPropertyLineProps = PropertyLineProps<Nullable<Node>> & NodeSelectorProps;
10
+ type MaterialSelectorPropertyLineProps = PropertyLineProps<Nullable<Material>> & MaterialSelectorProps;
11
+ type TextureSelectorPropertyLineProps = PropertyLineProps<Nullable<BaseTexture>> & TextureSelectorProps;
12
+ export declare const NodeSelectorPropertyLine: (props: NodeSelectorPropertyLineProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const MaterialSelectorPropertyLine: (props: MaterialSelectorPropertyLineProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const TextureSelectorPropertyLine: (props: TextureSelectorPropertyLineProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MaterialSelector } from "../../primitives/materialSelector.js";
3
+ import { PropertyLine } from "./propertyLine.js";
4
+ import { NodeSelector } from "../../primitives/nodeSelector.js";
5
+ import { TextureSelector } from "../../primitives/textureSelector.js";
6
+ export const NodeSelectorPropertyLine = (props) => _jsx(PropertyLine, { ...props, children: _jsx(NodeSelector, { ...props }) });
7
+ export const MaterialSelectorPropertyLine = (props) => _jsx(PropertyLine, { ...props, children: _jsx(MaterialSelector, { ...props }) });
8
+ export const TextureSelectorPropertyLine = (props) => _jsx(PropertyLine, { ...props, children: _jsx(TextureSelector, { ...props }) });
9
+ //# sourceMappingURL=entitySelectorPropertyLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitySelectorPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/entitySelectorPropertyLine.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,KAAC,YAAY,OAAK,KAAK,EAAE,QAAQ,EAAE,KAAC,YAAY,OAAK,KAAK,GAAI,GAAI,CAAC;AACrJ,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAwC,EAAE,EAAE,CAAC,KAAC,YAAY,OAAK,KAAK,EAAE,QAAQ,EAAE,KAAC,gBAAgB,OAAK,KAAK,GAAI,GAAI,CAAC;AACjK,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAuC,EAAE,EAAE,CAAC,KAAC,YAAY,OAAK,KAAK,EAAE,QAAQ,EAAE,KAAC,eAAe,OAAK,KAAK,GAAI,GAAI,CAAC","sourcesContent":["import type { Node } from \"core/node\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { NodeSelectorProps } from \"../../primitives/nodeSelector\";\r\nimport type { MaterialSelectorProps } from \"../../primitives/materialSelector\";\r\nimport type { TextureSelectorProps } from \"../../primitives/textureSelector\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\nimport { MaterialSelector } from \"../../primitives/materialSelector\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport { NodeSelector } from \"../../primitives/nodeSelector\";\r\nimport { TextureSelector } from \"../../primitives/textureSelector\";\r\ntype NodeSelectorPropertyLineProps = PropertyLineProps<Nullable<Node>> & NodeSelectorProps;\r\ntype MaterialSelectorPropertyLineProps = PropertyLineProps<Nullable<Material>> & MaterialSelectorProps;\r\ntype TextureSelectorPropertyLineProps = PropertyLineProps<Nullable<BaseTexture>> & TextureSelectorProps;\r\n\r\nexport const NodeSelectorPropertyLine = (props: NodeSelectorPropertyLineProps) => <PropertyLine {...props} children={<NodeSelector {...props} />} />;\r\nexport const MaterialSelectorPropertyLine = (props: MaterialSelectorPropertyLineProps) => <PropertyLine {...props} children={<MaterialSelector {...props} />} />;\r\nexport const TextureSelectorPropertyLine = (props: TextureSelectorPropertyLineProps) => <PropertyLine {...props} children={<TextureSelector {...props} />} />;\r\n"]}
@@ -0,0 +1,40 @@
1
+ import type { FunctionComponent } from "react";
2
+ import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
3
+ import type { Scene } from "@babylonjs/core/scene.js";
4
+ type TextureUploadUpdateProps = {
5
+ /**
6
+ * Existing texture to update via updateURL
7
+ */
8
+ texture: BaseTexture;
9
+ /**
10
+ * Callback after texture is updated
11
+ */
12
+ onChange?: (texture: BaseTexture) => void;
13
+ scene?: never;
14
+ cubeOnly?: never;
15
+ };
16
+ type TextureUploadCreateProps = {
17
+ /**
18
+ * The scene to create the texture in
19
+ */
20
+ scene: Scene;
21
+ /**
22
+ * Callback when a new texture is created
23
+ */
24
+ onChange: (texture: BaseTexture) => void;
25
+ /**
26
+ * Whether to create cube textures
27
+ */
28
+ cubeOnly?: boolean;
29
+ texture?: never;
30
+ };
31
+ type TextureUploadProps = TextureUploadUpdateProps | TextureUploadCreateProps;
32
+ /**
33
+ * A button that uploads a file and either:
34
+ * - Updates an existing Texture or CubeTexture via updateURL (if texture prop is provided)
35
+ * - Creates a new Texture or CubeTexture (if scene/onChange props are provided)
36
+ * @param props TextureUploadProps
37
+ * @returns UploadButton component that handles texture upload
38
+ */
39
+ export declare const TextureUpload: FunctionComponent<TextureUploadProps>;
40
+ export {};
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
4
+ import { CubeTexture } from "@babylonjs/core/Materials/Textures/cubeTexture.js";
5
+ import { ReadFile } from "@babylonjs/core/Misc/fileTools.js";
6
+ import { UploadButton } from "../primitives/uploadButton.js";
7
+ /**
8
+ * A button that uploads a file and either:
9
+ * - Updates an existing Texture or CubeTexture via updateURL (if texture prop is provided)
10
+ * - Creates a new Texture or CubeTexture (if scene/onChange props are provided)
11
+ * @param props TextureUploadProps
12
+ * @returns UploadButton component that handles texture upload
13
+ */
14
+ export const TextureUpload = (props) => {
15
+ TextureUpload.displayName = "TextureUpload";
16
+ const label = props.texture ? "Upload Texture" : undefined;
17
+ // TODO: This should probably be dynamically fetching a list of supported texture extensions
18
+ const accept = ".jpg, .png, .tga, .dds, .env, .exr";
19
+ const handleUpload = useCallback((files) => {
20
+ const file = files[0];
21
+ if (!file) {
22
+ return;
23
+ }
24
+ ReadFile(file, (data) => {
25
+ const blob = new Blob([data], { type: "octet/stream" });
26
+ // Update existing texture
27
+ if (props.texture) {
28
+ const { texture, onChange } = props;
29
+ const reader = new FileReader();
30
+ reader.readAsDataURL(blob);
31
+ reader.onloadend = () => {
32
+ const base64data = reader.result;
33
+ if (texture instanceof CubeTexture) {
34
+ let extension = undefined;
35
+ if (file.name.toLowerCase().indexOf(".dds") > 0) {
36
+ extension = ".dds";
37
+ }
38
+ else if (file.name.toLowerCase().indexOf(".env") > 0) {
39
+ extension = ".env";
40
+ }
41
+ texture.updateURL(base64data, extension, () => onChange?.(texture));
42
+ }
43
+ else if (texture instanceof Texture) {
44
+ texture.updateURL(base64data, null, () => onChange?.(texture));
45
+ }
46
+ };
47
+ }
48
+ else {
49
+ // Create new texture
50
+ const { scene, cubeOnly, onChange } = props;
51
+ const url = URL.createObjectURL(blob);
52
+ const extension = file.name.split(".").pop()?.toLowerCase();
53
+ // Revoke the object URL after texture loads to prevent memory leak
54
+ const revokeUrl = () => URL.revokeObjectURL(url);
55
+ const newTexture = cubeOnly
56
+ ? new CubeTexture(url, scene, [], false, undefined, revokeUrl, undefined, undefined, false, extension ? "." + extension : undefined)
57
+ : new Texture(url, scene, false, false, undefined, revokeUrl);
58
+ onChange(newTexture);
59
+ }
60
+ }, undefined, true);
61
+ }, [props]);
62
+ return _jsx(UploadButton, { onUpload: handleUpload, accept: accept, title: "Upload Texture", label: label });
63
+ };
64
+ //# sourceMappingURL=textureUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureUpload.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/textureUpload.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,WAA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KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;gBAElE,QAAQ,CAAC,UAAU,CAAC,CAAC;YACzB,CAAC;QACL,CAAC,EACD,SAAS,EACT,IAAI,CACP,CAAC;IACN,CAAC,EACD,CAAC,KAAK,CAAC,CACV,CAAC;IAEF,OAAO,KAAC,YAAY,IAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;AAC3G,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport { useCallback } from \"react\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { CubeTexture } from \"core/Materials/Textures/cubeTexture\";\r\nimport { ReadFile } from \"core/Misc/fileTools\";\r\nimport { UploadButton } from \"../primitives/uploadButton\";\r\n\r\ntype TextureUploadUpdateProps = {\r\n /**\r\n * Existing texture to update via updateURL\r\n */\r\n texture: BaseTexture;\r\n /**\r\n * Callback after texture is updated\r\n */\r\n onChange?: (texture: BaseTexture) => void;\r\n scene?: never;\r\n cubeOnly?: never;\r\n};\r\n\r\ntype TextureUploadCreateProps = {\r\n /**\r\n * The scene to create the texture in\r\n */\r\n scene: Scene;\r\n /**\r\n * Callback when a new texture is created\r\n */\r\n onChange: (texture: BaseTexture) => void;\r\n /**\r\n * Whether to create cube textures\r\n */\r\n cubeOnly?: boolean;\r\n texture?: never;\r\n};\r\n\r\ntype TextureUploadProps = TextureUploadUpdateProps | TextureUploadCreateProps;\r\n\r\n/**\r\n * A button that uploads a file and either:\r\n * - Updates an existing Texture or CubeTexture via updateURL (if texture prop is provided)\r\n * - Creates a new Texture or CubeTexture (if scene/onChange props are provided)\r\n * @param props TextureUploadProps\r\n * @returns UploadButton component that handles texture upload\r\n */\r\nexport const TextureUpload: FunctionComponent<TextureUploadProps> = (props) => {\r\n TextureUpload.displayName = \"TextureUpload\";\r\n const label = props.texture ? \"Upload Texture\" : undefined;\r\n // TODO: This should probably be dynamically fetching a list of supported texture extensions\r\n const accept = \".jpg, .png, .tga, .dds, .env, .exr\";\r\n const handleUpload = useCallback(\r\n (files: FileList) => {\r\n const file = files[0];\r\n if (!file) {\r\n return;\r\n }\r\n\r\n ReadFile(\r\n file,\r\n (data) => {\r\n const blob = new Blob([data], { type: \"octet/stream\" });\r\n\r\n // Update existing texture\r\n if (props.texture) {\r\n const { texture, onChange } = props;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(blob);\r\n reader.onloadend = () => {\r\n const base64data = reader.result as string;\r\n\r\n if (texture instanceof CubeTexture) {\r\n let extension: string | undefined = undefined;\r\n if (file.name.toLowerCase().indexOf(\".dds\") > 0) {\r\n extension = \".dds\";\r\n } else if (file.name.toLowerCase().indexOf(\".env\") > 0) {\r\n extension = \".env\";\r\n }\r\n texture.updateURL(base64data, extension, () => onChange?.(texture));\r\n } else if (texture instanceof Texture) {\r\n texture.updateURL(base64data, null, () => onChange?.(texture));\r\n }\r\n };\r\n } else {\r\n // Create new texture\r\n const { scene, cubeOnly, onChange } = props;\r\n const url = URL.createObjectURL(blob);\r\n const extension = file.name.split(\".\").pop()?.toLowerCase();\r\n\r\n // Revoke the object URL after texture loads to prevent memory leak\r\n const revokeUrl = () => URL.revokeObjectURL(url);\r\n\r\n const newTexture = cubeOnly\r\n ? new CubeTexture(url, scene, [], false, undefined, revokeUrl, undefined, undefined, false, extension ? \".\" + extension : undefined)\r\n : new Texture(url, scene, false, false, undefined, revokeUrl);\r\n\r\n onChange(newTexture);\r\n }\r\n },\r\n undefined,\r\n true\r\n );\r\n },\r\n [props]\r\n );\r\n\r\n return <UploadButton onUpload={handleUpload} accept={accept} title={\"Upload Texture\"} label={label} />;\r\n};\r\n"]}
@@ -1,10 +1,14 @@
1
- import type { FunctionComponent } from "react";
2
1
  import type { FluentIcon } from "@fluentui/react-icons";
3
2
  import type { BasePrimitiveProps } from "./primitive.js";
4
3
  export type ButtonProps = BasePrimitiveProps & {
5
- onClick: () => void;
4
+ onClick?: () => void;
6
5
  icon?: FluentIcon;
7
6
  appearance?: "subtle" | "transparent" | "primary";
8
7
  label?: string;
9
8
  };
10
- export declare const Button: FunctionComponent<ButtonProps>;
9
+ export declare const Button: import("react").ForwardRefExoticComponent<BasePrimitiveProps & {
10
+ onClick?: () => void;
11
+ icon?: FluentIcon;
12
+ appearance?: "subtle" | "transparent" | "primary";
13
+ label?: string;
14
+ } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Button as FluentButton } from "@fluentui/react-components";
3
- import { useContext } from "react";
3
+ import { forwardRef, useContext } from "react";
4
4
  import { ToolContext } from "../hoc/fluentToolWrapper.js";
5
- export const Button = (props) => {
6
- Button.displayName = "Button";
5
+ export const Button = forwardRef((props, ref) => {
7
6
  const { size } = useContext(ToolContext);
8
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
9
8
  const { icon: Icon, label, ...buttonProps } = props;
10
- return (_jsx(FluentButton, { iconPosition: "after", ...buttonProps, size: size, icon: Icon && _jsx(Icon, {}), children: label && props.label }));
11
- };
9
+ return (_jsx(FluentButton, { ref: ref, iconPosition: "after", ...buttonProps, size: size, icon: Icon && _jsx(Icon, {}), children: label && props.label }));
10
+ });
11
+ Button.displayName = "Button";
12
12
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AASvD,MAAM,CAAC,MAAM,MAAM,GAAmC,CAAC,KAAK,EAAE,EAAE;IAC5D,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,gEAAgE;IAChE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACpD,OAAO,CACH,KAAC,YAAY,IAAC,YAAY,EAAC,OAAO,KAAK,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,KAAC,IAAI,KAAG,YACjF,KAAK,IAAI,KAAK,CAAC,KAAK,GACV,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Button as FluentButton } from \"@fluentui/react-components\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { useContext } from \"react\";\r\nimport type { FluentIcon } from \"@fluentui/react-icons\";\r\nimport type { BasePrimitiveProps } from \"./primitive\";\r\nimport { ToolContext } from \"../hoc/fluentToolWrapper\";\r\n\r\nexport type ButtonProps = BasePrimitiveProps & {\r\n onClick: () => void;\r\n icon?: FluentIcon;\r\n appearance?: \"subtle\" | \"transparent\" | \"primary\";\r\n label?: string;\r\n};\r\n\r\nexport const Button: FunctionComponent<ButtonProps> = (props) => {\r\n Button.displayName = \"Button\";\r\n const { size } = useContext(ToolContext);\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { icon: Icon, label, ...buttonProps } = props;\r\n return (\r\n <FluentButton iconPosition=\"after\" {...buttonProps} size={size} icon={Icon && <Icon />}>\r\n {label && props.label}\r\n </FluentButton>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AASvD,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAiC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC5E,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,gEAAgE;IAChE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACpD,OAAO,CACH,KAAC,YAAY,IAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAC,OAAO,KAAK,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,KAAC,IAAI,KAAG,YAC3F,KAAK,IAAI,KAAK,CAAC,KAAK,GACV,CAClB,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import { Button as FluentButton } from \"@fluentui/react-components\";\r\nimport { forwardRef, useContext } from \"react\";\r\nimport type { FluentIcon } from \"@fluentui/react-icons\";\r\nimport type { BasePrimitiveProps } from \"./primitive\";\r\nimport { ToolContext } from \"../hoc/fluentToolWrapper\";\r\n\r\nexport type ButtonProps = BasePrimitiveProps & {\r\n onClick?: () => void;\r\n icon?: FluentIcon;\r\n appearance?: \"subtle\" | \"transparent\" | \"primary\";\r\n label?: string;\r\n};\r\n\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\r\n const { size } = useContext(ToolContext);\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { icon: Icon, label, ...buttonProps } = props;\r\n return (\r\n <FluentButton ref={ref} iconPosition=\"after\" {...buttonProps} size={size} icon={Icon && <Icon />}>\r\n {label && props.label}\r\n </FluentButton>\r\n );\r\n});\r\n\r\nButton.displayName = \"Button\";\r\n"]}
@@ -4,7 +4,14 @@ import type { PrimitiveProps } from "./primitive.js";
4
4
  export type ColorPickerProps<C extends Color3 | Color4> = {
5
5
  isLinearMode?: boolean;
6
6
  } & PrimitiveProps<C>;
7
- export declare const ColorPickerPopup: FunctionComponent<ColorPickerProps<Color3 | Color4>>;
7
+ export declare const ColorPickerPopup: import("react").ForwardRefExoticComponent<{
8
+ isLinearMode?: boolean;
9
+ } & import("./primitive.js").BasePrimitiveProps & {
10
+ value: Color3 | Color4;
11
+ infoLabel?: import("./infoLabel.js").InfoLabelParentProps;
12
+ } & {
13
+ onChange: (value: Color3 | Color4) => void;
14
+ } & import("react").RefAttributes<HTMLButtonElement>>;
8
15
  export type InputHexProps = PrimitiveProps<Color3 | Color4> & {
9
16
  linearHex?: boolean;
10
17
  isLinearMode?: boolean;