@arbidocs/blocks 0.5.38 → 0.5.39

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 (147) hide show
  1. package/README.md +10 -0
  2. package/dist/{ConnectedCallDock-V7DPSE6X.cjs → ConnectedCallDock-NGHSDLJS.cjs} +4 -4
  3. package/dist/{ConnectedCallDock-V7DPSE6X.cjs.map → ConnectedCallDock-NGHSDLJS.cjs.map} +1 -1
  4. package/dist/{ConnectedCallDock-CT3D6LLI.js → ConnectedCallDock-YJSO52N4.js} +4 -4
  5. package/dist/{ConnectedCallDock-CT3D6LLI.js.map → ConnectedCallDock-YJSO52N4.js.map} +1 -1
  6. package/dist/{ConnectedCallRoom-TNOCSTX2.cjs → ConnectedCallRoom-4XGFFYHE.cjs} +4 -4
  7. package/dist/{ConnectedCallRoom-TNOCSTX2.cjs.map → ConnectedCallRoom-4XGFFYHE.cjs.map} +1 -1
  8. package/dist/{ConnectedCallRoom-A27AM7IQ.js → ConnectedCallRoom-T6NS2MY4.js} +4 -4
  9. package/dist/{ConnectedCallRoom-A27AM7IQ.js.map → ConnectedCallRoom-T6NS2MY4.js.map} +1 -1
  10. package/dist/{ConnectedNativeDocxComparison-RWKFPJPJ.js → ConnectedNativeDocxComparison-52KQKJGY.js} +7 -7
  11. package/dist/{ConnectedNativeDocxComparison-RWKFPJPJ.js.map → ConnectedNativeDocxComparison-52KQKJGY.js.map} +1 -1
  12. package/dist/{ConnectedNativeDocxComparison-H2OZMWHT.cjs → ConnectedNativeDocxComparison-UVLZGS2V.cjs} +8 -8
  13. package/dist/{ConnectedNativeDocxComparison-H2OZMWHT.cjs.map → ConnectedNativeDocxComparison-UVLZGS2V.cjs.map} +1 -1
  14. package/dist/{ConnectedNativeDocxEditor-43BI5LN6.js → ConnectedNativeDocxEditor-BRBL3MOV.js} +6 -6
  15. package/dist/{ConnectedNativeDocxEditor-43BI5LN6.js.map → ConnectedNativeDocxEditor-BRBL3MOV.js.map} +1 -1
  16. package/dist/{ConnectedNativeDocxEditor-6DQEM6SD.cjs → ConnectedNativeDocxEditor-KHR5I7W6.cjs} +8 -8
  17. package/dist/{ConnectedNativeDocxEditor-6DQEM6SD.cjs.map → ConnectedNativeDocxEditor-KHR5I7W6.cjs.map} +1 -1
  18. package/dist/{ConnectedStreamedWordArtifact-3VKYIG6C.cjs → ConnectedStreamedWordArtifact-DSVFI7BX.cjs} +8 -8
  19. package/dist/ConnectedStreamedWordArtifact-DSVFI7BX.cjs.map +1 -0
  20. package/dist/{ConnectedStreamedWordArtifact-TEB332E3.js → ConnectedStreamedWordArtifact-EQUE6WT5.js} +7 -7
  21. package/dist/ConnectedStreamedWordArtifact-EQUE6WT5.js.map +1 -0
  22. package/dist/{WorkspaceTableView-KG546U7M.cjs → WorkspaceTableView-2CGEO5KK.cjs} +6 -6
  23. package/dist/{WorkspaceTableView-KG546U7M.cjs.map → WorkspaceTableView-2CGEO5KK.cjs.map} +1 -1
  24. package/dist/{WorkspaceTableView-OSFIWJ5C.js → WorkspaceTableView-3ARFQYNO.js} +4 -4
  25. package/dist/{WorkspaceTableView-OSFIWJ5C.js.map → WorkspaceTableView-3ARFQYNO.js.map} +1 -1
  26. package/dist/agents/index.cjs +376 -376
  27. package/dist/agents/index.js +2 -2
  28. package/dist/calls/index.cjs +35 -35
  29. package/dist/calls/index.js +7 -7
  30. package/dist/chat/index.cjs +89 -89
  31. package/dist/chat/index.js +2 -2
  32. package/dist/{chunk-BRYRZOS3.cjs → chunk-3YZ3RUSB.cjs} +4 -4
  33. package/dist/{chunk-BRYRZOS3.cjs.map → chunk-3YZ3RUSB.cjs.map} +1 -1
  34. package/dist/{chunk-VPWCARVO.js → chunk-4DDPMLGU.js} +4 -4
  35. package/dist/{chunk-VPWCARVO.js.map → chunk-4DDPMLGU.js.map} +1 -1
  36. package/dist/{chunk-24H5WTGM.js → chunk-4U4NXFV5.js} +4 -4
  37. package/dist/{chunk-24H5WTGM.js.map → chunk-4U4NXFV5.js.map} +1 -1
  38. package/dist/{chunk-6EQSP77K.cjs → chunk-5ZHAHJ4H.cjs} +5 -5
  39. package/dist/{chunk-6EQSP77K.cjs.map → chunk-5ZHAHJ4H.cjs.map} +1 -1
  40. package/dist/{chunk-BIWPXSGS.cjs → chunk-6AJJJ5HR.cjs} +7 -7
  41. package/dist/{chunk-BIWPXSGS.cjs.map → chunk-6AJJJ5HR.cjs.map} +1 -1
  42. package/dist/{chunk-2YCCCXYV.js → chunk-7LN3ISPG.js} +3 -3
  43. package/dist/{chunk-2YCCCXYV.js.map → chunk-7LN3ISPG.js.map} +1 -1
  44. package/dist/{chunk-5NTSJV5H.cjs → chunk-BY2EW2QU.cjs} +16 -91
  45. package/dist/chunk-BY2EW2QU.cjs.map +1 -0
  46. package/dist/{chunk-FHB4G77H.js → chunk-CEO7YI7I.js} +3 -3
  47. package/dist/{chunk-FHB4G77H.js.map → chunk-CEO7YI7I.js.map} +1 -1
  48. package/dist/{chunk-LTO4JYU3.cjs → chunk-DWWRLKEZ.cjs} +188 -2
  49. package/dist/chunk-DWWRLKEZ.cjs.map +1 -0
  50. package/dist/chunk-E3IEZMRK.cjs +507 -0
  51. package/dist/chunk-E3IEZMRK.cjs.map +1 -0
  52. package/dist/{chunk-MLHOG7YH.js → chunk-EFDZRAW6.js} +3 -3
  53. package/dist/{chunk-MLHOG7YH.js.map → chunk-EFDZRAW6.js.map} +1 -1
  54. package/dist/chunk-FOIDBAZB.js +497 -0
  55. package/dist/chunk-FOIDBAZB.js.map +1 -0
  56. package/dist/{chunk-MB3S2ETI.cjs → chunk-G2BKHCI2.cjs} +2 -2
  57. package/dist/chunk-G2BKHCI2.cjs.map +1 -0
  58. package/dist/{chunk-EFSL4O3B.cjs → chunk-GT5FCYV5.cjs} +7 -7
  59. package/dist/{chunk-EFSL4O3B.cjs.map → chunk-GT5FCYV5.cjs.map} +1 -1
  60. package/dist/{chunk-QWKT4DO6.cjs → chunk-GX5MKJ3F.cjs} +433 -2
  61. package/dist/chunk-GX5MKJ3F.cjs.map +1 -0
  62. package/dist/{chunk-C3YIVBTU.cjs → chunk-HDEOORSV.cjs} +9 -9
  63. package/dist/{chunk-C3YIVBTU.cjs.map → chunk-HDEOORSV.cjs.map} +1 -1
  64. package/dist/{chunk-T4P237N6.js → chunk-ILBBV2ZY.js} +2 -2
  65. package/dist/chunk-ILBBV2ZY.js.map +1 -0
  66. package/dist/{chunk-XFSEPGF7.cjs → chunk-K53QRFPJ.cjs} +4 -4
  67. package/dist/{chunk-XFSEPGF7.cjs.map → chunk-K53QRFPJ.cjs.map} +1 -1
  68. package/dist/{chunk-NOKTUWTN.cjs → chunk-K7S5BMAB.cjs} +7 -7
  69. package/dist/{chunk-NOKTUWTN.cjs.map → chunk-K7S5BMAB.cjs.map} +1 -1
  70. package/dist/{chunk-FY4C7HU5.cjs → chunk-O3MRE2HL.cjs} +2233 -8
  71. package/dist/chunk-O3MRE2HL.cjs.map +1 -0
  72. package/dist/{chunk-N3HVTMQK.js → chunk-OPZBIGW4.js} +3 -3
  73. package/dist/{chunk-N3HVTMQK.js.map → chunk-OPZBIGW4.js.map} +1 -1
  74. package/dist/{chunk-JVXHVFUA.cjs → chunk-P6HVJP6Z.cjs} +4 -4
  75. package/dist/{chunk-JVXHVFUA.cjs.map → chunk-P6HVJP6Z.cjs.map} +1 -1
  76. package/dist/{chunk-PXYP3DM5.js → chunk-PD4AKBYZ.js} +432 -6
  77. package/dist/chunk-PD4AKBYZ.js.map +1 -0
  78. package/dist/{chunk-VKY4SQMH.js → chunk-REHG7VRQ.js} +5 -5
  79. package/dist/{chunk-VKY4SQMH.js.map → chunk-REHG7VRQ.js.map} +1 -1
  80. package/dist/{chunk-M4MZPH2S.js → chunk-SEZEEHLU.js} +190 -6
  81. package/dist/chunk-SEZEEHLU.js.map +1 -0
  82. package/dist/{chunk-5JEM3BWT.js → chunk-SYP2A4GQ.js} +4 -4
  83. package/dist/{chunk-5JEM3BWT.js.map → chunk-SYP2A4GQ.js.map} +1 -1
  84. package/dist/{chunk-QFYRXQTD.js → chunk-TTPXMCJL.js} +6 -80
  85. package/dist/chunk-TTPXMCJL.js.map +1 -0
  86. package/dist/{chunk-VMLEISRZ.cjs → chunk-UZVXVTTB.cjs} +17 -17
  87. package/dist/{chunk-VMLEISRZ.cjs.map → chunk-UZVXVTTB.cjs.map} +1 -1
  88. package/dist/{chunk-YDY4GIC2.cjs → chunk-V7JDMKNQ.cjs} +4 -4
  89. package/dist/{chunk-YDY4GIC2.cjs.map → chunk-V7JDMKNQ.cjs.map} +1 -1
  90. package/dist/{chunk-YPR4FSDJ.js → chunk-VA3YYR7R.js} +8 -192
  91. package/dist/chunk-VA3YYR7R.js.map +1 -0
  92. package/dist/{chunk-NUV5F6MM.js → chunk-WAIHNFUH.js} +3 -3
  93. package/dist/{chunk-NUV5F6MM.js.map → chunk-WAIHNFUH.js.map} +1 -1
  94. package/dist/{chunk-H5BFOVVL.cjs → chunk-WRERJFEV.cjs} +2 -188
  95. package/dist/chunk-WRERJFEV.cjs.map +1 -0
  96. package/dist/{chunk-4DKI37QQ.js → chunk-YAGSGBVM.js} +2213 -13
  97. package/dist/chunk-YAGSGBVM.js.map +1 -0
  98. package/dist/{chunk-K6W2GWCN.js → chunk-ZAYUJFPI.js} +3 -3
  99. package/dist/{chunk-K6W2GWCN.js.map → chunk-ZAYUJFPI.js.map} +1 -1
  100. package/dist/connect/docx.cjs +10 -10
  101. package/dist/connect/docx.js +6 -6
  102. package/dist/connect/index.cjs +1237 -591
  103. package/dist/connect/index.cjs.map +1 -1
  104. package/dist/connect/index.d.ts +3 -0
  105. package/dist/connect/index.js +665 -23
  106. package/dist/connect/index.js.map +1 -1
  107. package/dist/connect/viewer.cjs +27 -27
  108. package/dist/connect/viewer.js +10 -10
  109. package/dist/connection/panels/ConnectedPanelHost.d.ts +48 -0
  110. package/dist/connection/panels/useSessionPanelMode.d.ts +18 -0
  111. package/dist/connection/threads-page/ConnectedThreadsPage.d.ts +14 -0
  112. package/dist/connection/threads-page/ThreadSearch.d.ts +24 -0
  113. package/dist/connection/workflows/index.d.ts +1 -0
  114. package/dist/connection/workflows/useWorkflowsPageState.d.ts +134 -0
  115. package/dist/index.cjs +601 -585
  116. package/dist/index.js +8 -8
  117. package/dist/provider/host.d.ts +3 -0
  118. package/dist/shell/PanelPortal.d.ts +30 -0
  119. package/dist/shell/index.cjs +78 -61
  120. package/dist/shell/index.d.ts +3 -0
  121. package/dist/shell/index.js +3 -2
  122. package/dist/shell/panel-host.d.ts +8 -0
  123. package/dist/shell/panel-windows.d.ts +33 -0
  124. package/dist/studio/index.cjs +5 -5
  125. package/dist/studio/index.js +3 -3
  126. package/dist/workflow-canvas/index.cjs +21 -21
  127. package/dist/workflow-canvas/index.js +5 -5
  128. package/node_modules/@arbidocs/coedit/package.json +1 -1
  129. package/package.json +5 -5
  130. package/dist/ConnectedStreamedWordArtifact-3VKYIG6C.cjs.map +0 -1
  131. package/dist/ConnectedStreamedWordArtifact-TEB332E3.js.map +0 -1
  132. package/dist/chunk-4DKI37QQ.js.map +0 -1
  133. package/dist/chunk-5NTSJV5H.cjs.map +0 -1
  134. package/dist/chunk-EZSYYENN.js +0 -2700
  135. package/dist/chunk-EZSYYENN.js.map +0 -1
  136. package/dist/chunk-FY4C7HU5.cjs.map +0 -1
  137. package/dist/chunk-H5BFOVVL.cjs.map +0 -1
  138. package/dist/chunk-LTO4JYU3.cjs.map +0 -1
  139. package/dist/chunk-M4MZPH2S.js.map +0 -1
  140. package/dist/chunk-MB3S2ETI.cjs.map +0 -1
  141. package/dist/chunk-PUX4M22Q.cjs +0 -2735
  142. package/dist/chunk-PUX4M22Q.cjs.map +0 -1
  143. package/dist/chunk-PXYP3DM5.js.map +0 -1
  144. package/dist/chunk-QFYRXQTD.js.map +0 -1
  145. package/dist/chunk-QWKT4DO6.cjs.map +0 -1
  146. package/dist/chunk-T4P237N6.js.map +0 -1
  147. package/dist/chunk-YPR4FSDJ.js.map +0 -1
@@ -1,10 +1,14 @@
1
1
  "use client";
2
+ import { useHost } from './chunk-ILBBV2ZY.js';
3
+ import { DEFAULT_OVERLAY_ZONE_ID } from './chunk-7XF5SFJ2.js';
4
+ import { useIsPhone, useMediaQuery } from './chunk-SLSBJRWW.js';
2
5
  import { testIdOr, prefixedTestId } from './chunk-7F6CBP3Z.js';
3
- import { createContext, forwardRef, useContext, useId } from 'react';
4
- import { cn, Tooltip, TooltipTrigger, TooltipContent, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuLabel } from '@arbidocs/react/ui';
6
+ import { createContext, forwardRef, useContext, useId, useState, useRef, useEffect, useCallback } from 'react';
7
+ import { cn, Tooltip, TooltipTrigger, TooltipContent, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuLabel, PortalContainerProvider, Button } from '@arbidocs/react/ui';
5
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
- import { Globe, Users, Lock, ChevronDown, LayoutGrid, Plus } from 'lucide-react';
9
+ import { Globe, Users, Lock, ChevronDown, LayoutGrid, Plus, ExternalLink, PanelRight, PictureInPicture2, X } from 'lucide-react';
7
10
  import { notify } from '@arbidocs/react/shell';
11
+ import { createPortal } from 'react-dom';
8
12
 
9
13
  var DEFAULT_SIDEBAR_LABELS = {
10
14
  mainNavigation: "Main navigation",
@@ -593,7 +597,429 @@ function ActionCluster({
593
597
  }
594
598
  );
595
599
  }
600
+ var btnClass = "h-7 w-7 p-0 text-muted-foreground hover:text-foreground";
601
+ function SwitcherButton({
602
+ label,
603
+ inPopout = false,
604
+ onClick,
605
+ testId,
606
+ children
607
+ }) {
608
+ const button = /* @__PURE__ */ jsx(
609
+ Button,
610
+ {
611
+ variant: "ghost",
612
+ size: "sm",
613
+ className: btnClass,
614
+ "aria-label": label,
615
+ title: inPopout ? label : void 0,
616
+ onClick,
617
+ "data-testid": testId,
618
+ children
619
+ }
620
+ );
621
+ if (inPopout) return button;
622
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
623
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
624
+ /* @__PURE__ */ jsx(TooltipContent, { children: label })
625
+ ] });
626
+ }
627
+ var TABLET_AND_BELOW_QUERY = "(max-width: 1024px)";
628
+ function PanelModeSwitcher({
629
+ mode,
630
+ onModeChange,
631
+ onClose,
632
+ disablePopout,
633
+ closeTestId = "dialog-close-button"
634
+ }) {
635
+ const isPopout = mode === "popout";
636
+ const isSmallScreen = useIsPhone();
637
+ const isTabletAndBelow = useMediaQuery(TABLET_AND_BELOW_QUERY);
638
+ const closeButton = onClose && /* @__PURE__ */ jsx(SwitcherButton, { label: "Close (Esc)", onClick: onClose, testId: closeTestId, children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5" }) });
639
+ if (isSmallScreen) {
640
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: closeButton });
641
+ }
642
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
643
+ !disablePopout && !isTabletAndBelow && /* @__PURE__ */ jsx(
644
+ SwitcherButton,
645
+ {
646
+ label: isPopout ? "Pop back in" : "Open in new window",
647
+ inPopout: isPopout,
648
+ onClick: () => onModeChange(isPopout ? "docked" : "popout"),
649
+ testId: isPopout ? "pop-into-main-window-button" : "open-in-new-window-button",
650
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5" })
651
+ }
652
+ ),
653
+ !isPopout && mode !== "docked" && /* @__PURE__ */ jsx(
654
+ SwitcherButton,
655
+ {
656
+ label: "Split screen",
657
+ onClick: () => onModeChange("docked"),
658
+ testId: "dock-panel-button",
659
+ children: /* @__PURE__ */ jsx(PanelRight, { className: "w-3.5 h-3.5" })
660
+ }
661
+ ),
662
+ !isPopout && mode !== "overlay" && !isTabletAndBelow && /* @__PURE__ */ jsx(
663
+ SwitcherButton,
664
+ {
665
+ label: "Float as overlay",
666
+ onClick: () => onModeChange("overlay"),
667
+ testId: "overlay-panel-button",
668
+ children: /* @__PURE__ */ jsx(PictureInPicture2, { className: "w-3.5 h-3.5" })
669
+ }
670
+ ),
671
+ !isPopout && closeButton
672
+ ] });
673
+ }
674
+
675
+ // src/shell/panel-windows.ts
676
+ var PanelWindowManager = class {
677
+ constructor(defaultTitle = "Panel") {
678
+ this.defaultTitle = defaultTitle;
679
+ }
680
+ defaultTitle;
681
+ windows = /* @__PURE__ */ new Map();
682
+ createPopupWindow(panelId, onClose, title) {
683
+ const windowId = `panel-window-${panelId}`;
684
+ if (this.windows.has(windowId)) {
685
+ const existing = this.windows.get(windowId);
686
+ if (existing && !existing.window.closed) {
687
+ existing.window.focus();
688
+ return windowId;
689
+ } else {
690
+ this.windows.delete(windowId);
691
+ }
692
+ }
693
+ const currentWidth = window.outerWidth;
694
+ const currentHeight = window.outerHeight;
695
+ const currentLeft = window.screenX ?? window.screenLeft ?? 0;
696
+ const currentTop = window.screenY ?? window.screenTop ?? 0;
697
+ const halfWidth = Math.floor(currentWidth / 2);
698
+ const popupWidth = halfWidth;
699
+ const popupHeight = currentHeight;
700
+ const left = currentLeft + halfWidth;
701
+ const top = currentTop;
702
+ const popup = window.open(
703
+ "",
704
+ windowId,
705
+ `width=${popupWidth},height=${popupHeight},left=${left},top=${top},scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=no`
706
+ );
707
+ if (!popup) {
708
+ console.error("Failed to create popup window - popup blocked?");
709
+ return null;
710
+ }
711
+ const mainDocument = document;
712
+ const stylesheets = Array.from(
713
+ mainDocument.head.querySelectorAll('link[rel="stylesheet"], style')
714
+ ).map((el) => el.outerHTML).join("\n");
715
+ popup.document.write(`
716
+ <!DOCTYPE html>
717
+ <html lang="en">
718
+ <head>
719
+ <meta charset="UTF-8">
720
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
721
+ <title></title>
722
+ <!-- about:blank has no base, so copied @font-face / asset URLs (e.g.
723
+ /assets/font.woff2) would resolve against nothing and render as
724
+ tofu squares. Anchor relative URLs to the app origin. -->
725
+ <base href="${window.location.origin}/">
726
+ ${stylesheets}
727
+ <style>
728
+ body {
729
+ margin: 0;
730
+ padding: 0;
731
+ font-family: system-ui, -apple-system, sans-serif;
732
+ }
733
+ #panel-root {
734
+ width: 100%;
735
+ height: 100vh;
736
+ overflow: hidden;
737
+ }
738
+ * {
739
+ box-sizing: border-box;
740
+ }
741
+ </style>
742
+ </head>
743
+ <body>
744
+ <div id="panel-root"></div>
745
+ </body>
746
+ </html>
747
+ `);
748
+ popup.document.close();
749
+ popup.document.title = title || this.defaultTitle;
750
+ try {
751
+ mainDocument.fonts.forEach((font) => {
752
+ try {
753
+ popup.document.fonts.add(font);
754
+ } catch {
755
+ }
756
+ });
757
+ } catch {
758
+ }
759
+ const rootElement = popup.document.getElementById("panel-root");
760
+ const popupWindow = {
761
+ id: windowId,
762
+ window: popup,
763
+ panelId,
764
+ rootElement,
765
+ onClose
766
+ };
767
+ this.windows.set(windowId, popupWindow);
768
+ const closeCheckInterval = setInterval(() => {
769
+ if (popup.closed) {
770
+ clearInterval(closeCheckInterval);
771
+ const entry = this.windows.get(windowId);
772
+ this.windows.delete(windowId);
773
+ entry?.onClose?.();
774
+ }
775
+ }, 200);
776
+ return windowId;
777
+ }
778
+ getWindow(windowId) {
779
+ const popup = this.windows.get(windowId);
780
+ return popup && !popup.window.closed ? popup.window : null;
781
+ }
782
+ getRootElement(windowId) {
783
+ const popup = this.windows.get(windowId);
784
+ return popup && !popup.window.closed ? popup.rootElement : null;
785
+ }
786
+ /** Focus the popup window for a given panel ID. Returns true if focused. */
787
+ focusPanelWindow(panelId) {
788
+ const windowId = `panel-window-panel-${panelId}`;
789
+ const popup = this.windows.get(windowId);
790
+ if (popup && !popup.window.closed) {
791
+ popup.window.focus();
792
+ return true;
793
+ }
794
+ return false;
795
+ }
796
+ /** Remove the onClose callback so it won't fire when the window is closed programmatically. */
797
+ clearOnClose(windowId) {
798
+ const popup = this.windows.get(windowId);
799
+ if (popup) {
800
+ popup.onClose = void 0;
801
+ }
802
+ }
803
+ closeWindow(windowId) {
804
+ const popup = this.windows.get(windowId);
805
+ if (popup && !popup.window.closed) {
806
+ popup.window.close();
807
+ }
808
+ this.windows.delete(windowId);
809
+ }
810
+ closeAllWindows() {
811
+ for (const [, popup] of this.windows) {
812
+ if (!popup.window.closed) {
813
+ popup.window.close();
814
+ }
815
+ }
816
+ this.windows.clear();
817
+ }
818
+ };
819
+ function createPanelWindowManager(options = {}) {
820
+ return new PanelWindowManager(options.defaultTitle);
821
+ }
822
+
823
+ // src/shell/panel-host.ts
824
+ var defaultWindows = createPanelWindowManager();
825
+ var titleOnly = (title) => title;
826
+ function usePanelHostSupport() {
827
+ const { panels } = useHost();
828
+ return {
829
+ windows: panels?.windows ?? defaultWindows,
830
+ popoutTitle: panels?.popoutTitle ?? titleOnly
831
+ };
832
+ }
833
+ var OVERLAY_DEFAULT_PX = 544;
834
+ var OVERLAY_MIN_PX = 360;
835
+ function OverlaySheet({
836
+ panelId,
837
+ isExiting,
838
+ onClose,
839
+ defaultWidth,
840
+ scoped,
841
+ children
842
+ }) {
843
+ const [width, setWidth] = useState(defaultWidth ?? OVERLAY_DEFAULT_PX);
844
+ const [isResizing, setIsResizing] = useState(false);
845
+ const [dragWidth, setDragWidth] = useState(null);
846
+ const dragWidthRef = useRef(null);
847
+ const [hasEntered, setHasEntered] = useState(false);
848
+ const handleResizeStart = useCallback((e) => {
849
+ e.preventDefault();
850
+ setHasEntered(true);
851
+ setIsResizing(true);
852
+ setDragWidth(null);
853
+ dragWidthRef.current = null;
854
+ }, []);
855
+ useEffect(() => {
856
+ if (!isResizing) return;
857
+ const handleMouseMove = (e) => {
858
+ const max = window.innerWidth * 0.92;
859
+ const next = Math.min(Math.max(window.innerWidth - e.clientX, OVERLAY_MIN_PX), max);
860
+ dragWidthRef.current = next;
861
+ setDragWidth(next);
862
+ };
863
+ const handleMouseUp = () => {
864
+ if (dragWidthRef.current !== null) setWidth(dragWidthRef.current);
865
+ setIsResizing(false);
866
+ setDragWidth(null);
867
+ dragWidthRef.current = null;
868
+ };
869
+ document.addEventListener("mousemove", handleMouseMove);
870
+ document.addEventListener("mouseup", handleMouseUp);
871
+ document.body.style.cursor = "col-resize";
872
+ document.body.style.userSelect = "none";
873
+ return () => {
874
+ document.removeEventListener("mousemove", handleMouseMove);
875
+ document.removeEventListener("mouseup", handleMouseUp);
876
+ document.body.style.cursor = "";
877
+ document.body.style.userSelect = "";
878
+ };
879
+ }, [isResizing]);
880
+ return (
881
+ // Scoped: absolute within the layout's overlay zone (below the topbar).
882
+ // Unscoped fallback: fixed over the whole viewport, as before.
883
+ /* @__PURE__ */ jsxs(
884
+ "div",
885
+ {
886
+ className: scoped ? "absolute inset-0 z-40" : "fixed inset-0 z-50",
887
+ "data-testid": `${panelId}-overlay`,
888
+ children: [
889
+ /* @__PURE__ */ jsx(
890
+ "div",
891
+ {
892
+ className: `absolute inset-0 bg-black/40 dark:bg-black/20 duration-200 ${// fill-mode-forwards holds the exit end-state — without it the
893
+ // element snaps back fully visible for the frames between the
894
+ // animation finishing and React unmounting it (a flicker).
895
+ isExiting ? "animate-out fade-out fill-mode-forwards" : "animate-in fade-in"}`,
896
+ onClick: onClose,
897
+ "aria-hidden": "true",
898
+ "data-testid": `${panelId}-overlay-backdrop`
899
+ }
900
+ ),
901
+ /* @__PURE__ */ jsxs(
902
+ "div",
903
+ {
904
+ style: { width },
905
+ onAnimationEnd: () => !isExiting && setHasEntered(true),
906
+ className: `absolute right-0 top-0 bottom-0 flex max-w-[92vw] flex-col border-l max-sm:!w-full max-sm:!max-w-full max-sm:border-l-0 border-border bg-muted shadow-2xl duration-200 ${isExiting ? "animate-out slide-out-to-right fill-mode-forwards" : (
907
+ // Suppress the slide transform once entered so it doesn't replay.
908
+ hasEntered ? "" : "animate-in slide-in-from-right"
909
+ )}`,
910
+ children: [
911
+ /* @__PURE__ */ jsx(
912
+ "div",
913
+ {
914
+ className: "absolute left-0 top-0 bottom-0 z-10 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/40",
915
+ onMouseDown: handleResizeStart,
916
+ "data-testid": `${panelId}-overlay-resize-handle`
917
+ }
918
+ ),
919
+ children
920
+ ]
921
+ }
922
+ ),
923
+ isResizing && dragWidth !== null && /* @__PURE__ */ jsx(
924
+ "div",
925
+ {
926
+ className: "absolute top-0 bottom-0 z-[60] w-0.5 bg-primary pointer-events-none",
927
+ style: { right: dragWidth }
928
+ }
929
+ ),
930
+ isResizing && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-[55] cursor-col-resize" })
931
+ ]
932
+ }
933
+ )
934
+ );
935
+ }
936
+ function PanelPortal({
937
+ panelId,
938
+ mode,
939
+ isOpen,
940
+ isExiting,
941
+ onPopupClosed,
942
+ onClose,
943
+ popoutTitle,
944
+ defaultWidth,
945
+ children
946
+ }) {
947
+ const { windows: windowManager } = usePanelHostSupport();
948
+ const [popupRoot, setPopupRoot] = useState(null);
949
+ const popupWindowIdRef = useRef(null);
950
+ useEffect(() => {
951
+ if (!isOpen || mode !== "popout") {
952
+ if (popupWindowIdRef.current) {
953
+ windowManager.clearOnClose(popupWindowIdRef.current);
954
+ windowManager.closeWindow(popupWindowIdRef.current);
955
+ popupWindowIdRef.current = null;
956
+ setPopupRoot(null);
957
+ }
958
+ return;
959
+ }
960
+ if (popupWindowIdRef.current) return;
961
+ const windowId = windowManager.createPopupWindow(
962
+ `panel-${panelId}`,
963
+ () => {
964
+ popupWindowIdRef.current = null;
965
+ setPopupRoot(null);
966
+ onPopupClosed?.();
967
+ },
968
+ popoutTitle || panelId
969
+ );
970
+ if (windowId) {
971
+ const rootElement = windowManager.getRootElement(windowId);
972
+ if (rootElement) {
973
+ popupWindowIdRef.current = windowId;
974
+ setPopupRoot(rootElement);
975
+ windowManager.getWindow(windowId)?.focus();
976
+ }
977
+ }
978
+ }, [isOpen, mode, panelId, popoutTitle, onPopupClosed, windowManager]);
979
+ useEffect(() => {
980
+ return () => {
981
+ if (popupWindowIdRef.current) {
982
+ windowManager.closeWindow(popupWindowIdRef.current);
983
+ }
984
+ };
985
+ }, [windowManager]);
986
+ if (!isOpen && !isExiting) return null;
987
+ if (mode === "popout" && popupRoot) {
988
+ return createPortal(
989
+ /* @__PURE__ */ jsx(PortalContainerProvider, { container: popupRoot, children }),
990
+ popupRoot
991
+ );
992
+ }
993
+ if (mode === "overlay") {
994
+ const overlayZone = document.getElementById(DEFAULT_OVERLAY_ZONE_ID);
995
+ return createPortal(
996
+ /* @__PURE__ */ jsx(
997
+ OverlaySheet,
998
+ {
999
+ panelId,
1000
+ isExiting,
1001
+ onClose,
1002
+ defaultWidth,
1003
+ scoped: overlayZone !== null,
1004
+ children
1005
+ }
1006
+ ),
1007
+ overlayZone ?? document.body
1008
+ );
1009
+ }
1010
+ if (mode === "main") {
1011
+ const mainZone = document.getElementById("main-zone");
1012
+ if (mainZone) {
1013
+ return createPortal(children, mainZone);
1014
+ }
1015
+ }
1016
+ const dockZone = document.getElementById("dock-zone");
1017
+ if (dockZone) {
1018
+ return createPortal(children, dockZone);
1019
+ }
1020
+ return null;
1021
+ }
596
1022
 
597
- export { ActionCluster, DEFAULT_SIDEBAR_LABELS, DEFAULT_WORKSPACE_KIND_LABELS, DEFAULT_WORKSPACE_SWITCHER_LABELS, SidebarBadgeRow, SidebarContext, SidebarRowHoverContext, WorkspaceIdentity, WorkspaceSwitcher, hasUnsavedInput, installReloadPolicy, markBuildStale, prefetchChunk, requestReload, useSidebarContext, workspaceKindColor, workspaceKindMeta };
598
- //# sourceMappingURL=chunk-PXYP3DM5.js.map
599
- //# sourceMappingURL=chunk-PXYP3DM5.js.map
1023
+ export { ActionCluster, DEFAULT_SIDEBAR_LABELS, DEFAULT_WORKSPACE_KIND_LABELS, DEFAULT_WORKSPACE_SWITCHER_LABELS, PanelModeSwitcher, PanelPortal, PanelWindowManager, SidebarBadgeRow, SidebarContext, SidebarRowHoverContext, WorkspaceIdentity, WorkspaceSwitcher, createPanelWindowManager, hasUnsavedInput, installReloadPolicy, markBuildStale, prefetchChunk, requestReload, usePanelHostSupport, useSidebarContext, workspaceKindColor, workspaceKindMeta };
1024
+ //# sourceMappingURL=chunk-PD4AKBYZ.js.map
1025
+ //# sourceMappingURL=chunk-PD4AKBYZ.js.map