@comergehq/studio 0.1.11 → 0.1.12
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/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/studio/ComergeStudio.tsx +12 -0
- package/src/studio/ui/StudioOverlay.tsx +40 -11
package/dist/index.mjs
CHANGED
|
@@ -6471,6 +6471,10 @@ function useOptimisticChatMessages({
|
|
|
6471
6471
|
}
|
|
6472
6472
|
|
|
6473
6473
|
// src/studio/ui/StudioOverlay.tsx
|
|
6474
|
+
import {
|
|
6475
|
+
publishComergeStudioUIState,
|
|
6476
|
+
startStudioControlPolling
|
|
6477
|
+
} from "@comergehq/studio-control";
|
|
6474
6478
|
import { Fragment as Fragment6, jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6475
6479
|
function StudioOverlay({
|
|
6476
6480
|
captureTargetRef,
|
|
@@ -6498,11 +6502,14 @@ function StudioOverlay({
|
|
|
6498
6502
|
chatSending,
|
|
6499
6503
|
chatShowTypingIndicator,
|
|
6500
6504
|
onSendChat,
|
|
6501
|
-
onNavigateHome
|
|
6505
|
+
onNavigateHome,
|
|
6506
|
+
showFloatingButton,
|
|
6507
|
+
studioControlOptions
|
|
6502
6508
|
}) {
|
|
6503
6509
|
const theme = useTheme();
|
|
6504
6510
|
const { width } = useWindowDimensions4();
|
|
6505
6511
|
const [sheetOpen, setSheetOpen] = React41.useState(false);
|
|
6512
|
+
const sheetOpenRef = React41.useRef(sheetOpen);
|
|
6506
6513
|
const [activePage, setActivePage] = React41.useState("preview");
|
|
6507
6514
|
const [drawing, setDrawing] = React41.useState(false);
|
|
6508
6515
|
const [chatAttachments, setChatAttachments] = React41.useState([]);
|
|
@@ -6583,6 +6590,20 @@ function StudioOverlay({
|
|
|
6583
6590
|
},
|
|
6584
6591
|
[closeSheet, onTestMr]
|
|
6585
6592
|
);
|
|
6593
|
+
React41.useEffect(() => {
|
|
6594
|
+
sheetOpenRef.current = sheetOpen;
|
|
6595
|
+
}, [sheetOpen]);
|
|
6596
|
+
React41.useEffect(() => {
|
|
6597
|
+
const poller = startStudioControlPolling((action) => {
|
|
6598
|
+
if (action === "show" && !sheetOpenRef.current) openSheet();
|
|
6599
|
+
if (action === "hide" && sheetOpenRef.current) closeSheet();
|
|
6600
|
+
if (action === "toggle") toggleSheet();
|
|
6601
|
+
}, studioControlOptions);
|
|
6602
|
+
return () => poller.stop();
|
|
6603
|
+
}, [closeSheet, openSheet, studioControlOptions, toggleSheet]);
|
|
6604
|
+
React41.useEffect(() => {
|
|
6605
|
+
void publishComergeStudioUIState(sheetOpen, studioControlOptions);
|
|
6606
|
+
}, [sheetOpen, studioControlOptions]);
|
|
6586
6607
|
return /* @__PURE__ */ jsxs34(Fragment6, { children: [
|
|
6587
6608
|
/* @__PURE__ */ jsx57(EdgeGlowFrame, { visible: isTesting, role: "accent", thickness: 40, intensity: 1 }),
|
|
6588
6609
|
/* @__PURE__ */ jsx57(StudioBottomSheet, { open: sheetOpen, onOpenChange: handleSheetOpenChange, children: /* @__PURE__ */ jsx57(
|
|
@@ -6639,7 +6660,7 @@ function StudioOverlay({
|
|
|
6639
6660
|
)
|
|
6640
6661
|
}
|
|
6641
6662
|
) }),
|
|
6642
|
-
/* @__PURE__ */ jsx57(
|
|
6663
|
+
showFloatingButton && /* @__PURE__ */ jsx57(
|
|
6643
6664
|
FloatingDraggableButton,
|
|
6644
6665
|
{
|
|
6645
6666
|
visible: !sheetOpen && !drawing,
|
|
@@ -6691,7 +6712,9 @@ function ComergeStudio({
|
|
|
6691
6712
|
apiKey,
|
|
6692
6713
|
appKey = "MicroMain",
|
|
6693
6714
|
onNavigateHome,
|
|
6694
|
-
style
|
|
6715
|
+
style,
|
|
6716
|
+
showFloatingButton = true,
|
|
6717
|
+
studioControlOptions
|
|
6695
6718
|
}) {
|
|
6696
6719
|
const [activeAppId, setActiveAppId] = React42.useState(appId);
|
|
6697
6720
|
const [runtimeAppId, setRuntimeAppId] = React42.useState(appId);
|
|
@@ -6717,7 +6740,9 @@ function ComergeStudio({
|
|
|
6717
6740
|
platform,
|
|
6718
6741
|
onNavigateHome,
|
|
6719
6742
|
captureTargetRef,
|
|
6720
|
-
style
|
|
6743
|
+
style,
|
|
6744
|
+
showFloatingButton,
|
|
6745
|
+
studioControlOptions
|
|
6721
6746
|
}
|
|
6722
6747
|
) }) }) });
|
|
6723
6748
|
}
|
|
@@ -6733,7 +6758,9 @@ function ComergeStudioInner({
|
|
|
6733
6758
|
platform,
|
|
6734
6759
|
onNavigateHome,
|
|
6735
6760
|
captureTargetRef,
|
|
6736
|
-
style
|
|
6761
|
+
style,
|
|
6762
|
+
showFloatingButton,
|
|
6763
|
+
studioControlOptions
|
|
6737
6764
|
}) {
|
|
6738
6765
|
const { app, loading: appLoading } = useApp(activeAppId);
|
|
6739
6766
|
const { app: runtimeAppFromHook } = useApp(runtimeAppId, { enabled: runtimeAppId !== activeAppId });
|
|
@@ -6883,7 +6910,9 @@ function ComergeStudioInner({
|
|
|
6883
6910
|
chatSending: actions.sending,
|
|
6884
6911
|
chatShowTypingIndicator,
|
|
6885
6912
|
onSendChat: (text, attachments) => actions.sendEdit({ prompt: text, attachments }),
|
|
6886
|
-
onNavigateHome
|
|
6913
|
+
onNavigateHome,
|
|
6914
|
+
showFloatingButton,
|
|
6915
|
+
studioControlOptions
|
|
6887
6916
|
}
|
|
6888
6917
|
)
|
|
6889
6918
|
] }) });
|