@arbidocs/blocks 0.5.38 → 0.5.40

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 +610 -594
  116. package/dist/index.js +9 -9
  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,12 +1,16 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var chunkG2BKHCI2_cjs = require('./chunk-G2BKHCI2.cjs');
5
+ var chunkB6MVQCXW_cjs = require('./chunk-B6MVQCXW.cjs');
6
+ var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
4
7
  var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
5
8
  var react = require('react');
6
9
  var ui = require('@arbidocs/react/ui');
7
10
  var jsxRuntime = require('react/jsx-runtime');
8
11
  var lucideReact = require('lucide-react');
9
12
  var shell = require('@arbidocs/react/shell');
13
+ var reactDom = require('react-dom');
10
14
 
11
15
  var DEFAULT_SIDEBAR_LABELS = {
12
16
  mainNavigation: "Main navigation",
@@ -595,23 +599,450 @@ function ActionCluster({
595
599
  }
596
600
  );
597
601
  }
602
+ var btnClass = "h-7 w-7 p-0 text-muted-foreground hover:text-foreground";
603
+ function SwitcherButton({
604
+ label,
605
+ inPopout = false,
606
+ onClick,
607
+ testId,
608
+ children
609
+ }) {
610
+ const button = /* @__PURE__ */ jsxRuntime.jsx(
611
+ ui.Button,
612
+ {
613
+ variant: "ghost",
614
+ size: "sm",
615
+ className: btnClass,
616
+ "aria-label": label,
617
+ title: inPopout ? label : void 0,
618
+ onClick,
619
+ "data-testid": testId,
620
+ children
621
+ }
622
+ );
623
+ if (inPopout) return button;
624
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
625
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipTrigger, { asChild: true, children: button }),
626
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { children: label })
627
+ ] });
628
+ }
629
+ var TABLET_AND_BELOW_QUERY = "(max-width: 1024px)";
630
+ function PanelModeSwitcher({
631
+ mode,
632
+ onModeChange,
633
+ onClose,
634
+ disablePopout,
635
+ closeTestId = "dialog-close-button"
636
+ }) {
637
+ const isPopout = mode === "popout";
638
+ const isSmallScreen = chunkFX3K6LNZ_cjs.useIsPhone();
639
+ const isTabletAndBelow = chunkFX3K6LNZ_cjs.useMediaQuery(TABLET_AND_BELOW_QUERY);
640
+ const closeButton = onClose && /* @__PURE__ */ jsxRuntime.jsx(SwitcherButton, { label: "Close (Esc)", onClick: onClose, testId: closeTestId, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3.5 h-3.5" }) });
641
+ if (isSmallScreen) {
642
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: closeButton });
643
+ }
644
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
645
+ !disablePopout && !isTabletAndBelow && /* @__PURE__ */ jsxRuntime.jsx(
646
+ SwitcherButton,
647
+ {
648
+ label: isPopout ? "Pop back in" : "Open in new window",
649
+ inPopout: isPopout,
650
+ onClick: () => onModeChange(isPopout ? "docked" : "popout"),
651
+ testId: isPopout ? "pop-into-main-window-button" : "open-in-new-window-button",
652
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "w-3.5 h-3.5" })
653
+ }
654
+ ),
655
+ !isPopout && mode !== "docked" && /* @__PURE__ */ jsxRuntime.jsx(
656
+ SwitcherButton,
657
+ {
658
+ label: "Split screen",
659
+ onClick: () => onModeChange("docked"),
660
+ testId: "dock-panel-button",
661
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRight, { className: "w-3.5 h-3.5" })
662
+ }
663
+ ),
664
+ !isPopout && mode !== "overlay" && !isTabletAndBelow && /* @__PURE__ */ jsxRuntime.jsx(
665
+ SwitcherButton,
666
+ {
667
+ label: "Float as overlay",
668
+ onClick: () => onModeChange("overlay"),
669
+ testId: "overlay-panel-button",
670
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PictureInPicture2, { className: "w-3.5 h-3.5" })
671
+ }
672
+ ),
673
+ !isPopout && closeButton
674
+ ] });
675
+ }
676
+
677
+ // src/shell/panel-windows.ts
678
+ var PanelWindowManager = class {
679
+ constructor(defaultTitle = "Panel") {
680
+ this.defaultTitle = defaultTitle;
681
+ }
682
+ defaultTitle;
683
+ windows = /* @__PURE__ */ new Map();
684
+ createPopupWindow(panelId, onClose, title) {
685
+ const windowId = `panel-window-${panelId}`;
686
+ if (this.windows.has(windowId)) {
687
+ const existing = this.windows.get(windowId);
688
+ if (existing && !existing.window.closed) {
689
+ existing.window.focus();
690
+ return windowId;
691
+ } else {
692
+ this.windows.delete(windowId);
693
+ }
694
+ }
695
+ const currentWidth = window.outerWidth;
696
+ const currentHeight = window.outerHeight;
697
+ const currentLeft = window.screenX ?? window.screenLeft ?? 0;
698
+ const currentTop = window.screenY ?? window.screenTop ?? 0;
699
+ const halfWidth = Math.floor(currentWidth / 2);
700
+ const popupWidth = halfWidth;
701
+ const popupHeight = currentHeight;
702
+ const left = currentLeft + halfWidth;
703
+ const top = currentTop;
704
+ const popup = window.open(
705
+ "",
706
+ windowId,
707
+ `width=${popupWidth},height=${popupHeight},left=${left},top=${top},scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=no`
708
+ );
709
+ if (!popup) {
710
+ console.error("Failed to create popup window - popup blocked?");
711
+ return null;
712
+ }
713
+ const mainDocument = document;
714
+ const stylesheets = Array.from(
715
+ mainDocument.head.querySelectorAll('link[rel="stylesheet"], style')
716
+ ).map((el) => el.outerHTML).join("\n");
717
+ popup.document.write(`
718
+ <!DOCTYPE html>
719
+ <html lang="en">
720
+ <head>
721
+ <meta charset="UTF-8">
722
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
723
+ <title></title>
724
+ <!-- about:blank has no base, so copied @font-face / asset URLs (e.g.
725
+ /assets/font.woff2) would resolve against nothing and render as
726
+ tofu squares. Anchor relative URLs to the app origin. -->
727
+ <base href="${window.location.origin}/">
728
+ ${stylesheets}
729
+ <style>
730
+ body {
731
+ margin: 0;
732
+ padding: 0;
733
+ font-family: system-ui, -apple-system, sans-serif;
734
+ }
735
+ #panel-root {
736
+ width: 100%;
737
+ height: 100vh;
738
+ overflow: hidden;
739
+ }
740
+ * {
741
+ box-sizing: border-box;
742
+ }
743
+ </style>
744
+ </head>
745
+ <body>
746
+ <div id="panel-root"></div>
747
+ </body>
748
+ </html>
749
+ `);
750
+ popup.document.close();
751
+ popup.document.title = title || this.defaultTitle;
752
+ try {
753
+ mainDocument.fonts.forEach((font) => {
754
+ try {
755
+ popup.document.fonts.add(font);
756
+ } catch {
757
+ }
758
+ });
759
+ } catch {
760
+ }
761
+ const rootElement = popup.document.getElementById("panel-root");
762
+ const popupWindow = {
763
+ id: windowId,
764
+ window: popup,
765
+ panelId,
766
+ rootElement,
767
+ onClose
768
+ };
769
+ this.windows.set(windowId, popupWindow);
770
+ const closeCheckInterval = setInterval(() => {
771
+ if (popup.closed) {
772
+ clearInterval(closeCheckInterval);
773
+ const entry = this.windows.get(windowId);
774
+ this.windows.delete(windowId);
775
+ entry?.onClose?.();
776
+ }
777
+ }, 200);
778
+ return windowId;
779
+ }
780
+ getWindow(windowId) {
781
+ const popup = this.windows.get(windowId);
782
+ return popup && !popup.window.closed ? popup.window : null;
783
+ }
784
+ getRootElement(windowId) {
785
+ const popup = this.windows.get(windowId);
786
+ return popup && !popup.window.closed ? popup.rootElement : null;
787
+ }
788
+ /** Focus the popup window for a given panel ID. Returns true if focused. */
789
+ focusPanelWindow(panelId) {
790
+ const windowId = `panel-window-panel-${panelId}`;
791
+ const popup = this.windows.get(windowId);
792
+ if (popup && !popup.window.closed) {
793
+ popup.window.focus();
794
+ return true;
795
+ }
796
+ return false;
797
+ }
798
+ /** Remove the onClose callback so it won't fire when the window is closed programmatically. */
799
+ clearOnClose(windowId) {
800
+ const popup = this.windows.get(windowId);
801
+ if (popup) {
802
+ popup.onClose = void 0;
803
+ }
804
+ }
805
+ closeWindow(windowId) {
806
+ const popup = this.windows.get(windowId);
807
+ if (popup && !popup.window.closed) {
808
+ popup.window.close();
809
+ }
810
+ this.windows.delete(windowId);
811
+ }
812
+ closeAllWindows() {
813
+ for (const [, popup] of this.windows) {
814
+ if (!popup.window.closed) {
815
+ popup.window.close();
816
+ }
817
+ }
818
+ this.windows.clear();
819
+ }
820
+ };
821
+ function createPanelWindowManager(options = {}) {
822
+ return new PanelWindowManager(options.defaultTitle);
823
+ }
824
+
825
+ // src/shell/panel-host.ts
826
+ var defaultWindows = createPanelWindowManager();
827
+ var titleOnly = (title) => title;
828
+ function usePanelHostSupport() {
829
+ const { panels } = chunkG2BKHCI2_cjs.useHost();
830
+ return {
831
+ windows: panels?.windows ?? defaultWindows,
832
+ popoutTitle: panels?.popoutTitle ?? titleOnly
833
+ };
834
+ }
835
+ var OVERLAY_DEFAULT_PX = 544;
836
+ var OVERLAY_MIN_PX = 360;
837
+ function OverlaySheet({
838
+ panelId,
839
+ isExiting,
840
+ onClose,
841
+ defaultWidth,
842
+ scoped,
843
+ children
844
+ }) {
845
+ const [width, setWidth] = react.useState(defaultWidth ?? OVERLAY_DEFAULT_PX);
846
+ const [isResizing, setIsResizing] = react.useState(false);
847
+ const [dragWidth, setDragWidth] = react.useState(null);
848
+ const dragWidthRef = react.useRef(null);
849
+ const [hasEntered, setHasEntered] = react.useState(false);
850
+ const handleResizeStart = react.useCallback((e) => {
851
+ e.preventDefault();
852
+ setHasEntered(true);
853
+ setIsResizing(true);
854
+ setDragWidth(null);
855
+ dragWidthRef.current = null;
856
+ }, []);
857
+ react.useEffect(() => {
858
+ if (!isResizing) return;
859
+ const handleMouseMove = (e) => {
860
+ const max = window.innerWidth * 0.92;
861
+ const next = Math.min(Math.max(window.innerWidth - e.clientX, OVERLAY_MIN_PX), max);
862
+ dragWidthRef.current = next;
863
+ setDragWidth(next);
864
+ };
865
+ const handleMouseUp = () => {
866
+ if (dragWidthRef.current !== null) setWidth(dragWidthRef.current);
867
+ setIsResizing(false);
868
+ setDragWidth(null);
869
+ dragWidthRef.current = null;
870
+ };
871
+ document.addEventListener("mousemove", handleMouseMove);
872
+ document.addEventListener("mouseup", handleMouseUp);
873
+ document.body.style.cursor = "col-resize";
874
+ document.body.style.userSelect = "none";
875
+ return () => {
876
+ document.removeEventListener("mousemove", handleMouseMove);
877
+ document.removeEventListener("mouseup", handleMouseUp);
878
+ document.body.style.cursor = "";
879
+ document.body.style.userSelect = "";
880
+ };
881
+ }, [isResizing]);
882
+ return (
883
+ // Scoped: absolute within the layout's overlay zone (below the topbar).
884
+ // Unscoped fallback: fixed over the whole viewport, as before.
885
+ /* @__PURE__ */ jsxRuntime.jsxs(
886
+ "div",
887
+ {
888
+ className: scoped ? "absolute inset-0 z-40" : "fixed inset-0 z-50",
889
+ "data-testid": `${panelId}-overlay`,
890
+ children: [
891
+ /* @__PURE__ */ jsxRuntime.jsx(
892
+ "div",
893
+ {
894
+ className: `absolute inset-0 bg-black/40 dark:bg-black/20 duration-200 ${// fill-mode-forwards holds the exit end-state — without it the
895
+ // element snaps back fully visible for the frames between the
896
+ // animation finishing and React unmounting it (a flicker).
897
+ isExiting ? "animate-out fade-out fill-mode-forwards" : "animate-in fade-in"}`,
898
+ onClick: onClose,
899
+ "aria-hidden": "true",
900
+ "data-testid": `${panelId}-overlay-backdrop`
901
+ }
902
+ ),
903
+ /* @__PURE__ */ jsxRuntime.jsxs(
904
+ "div",
905
+ {
906
+ style: { width },
907
+ onAnimationEnd: () => !isExiting && setHasEntered(true),
908
+ 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" : (
909
+ // Suppress the slide transform once entered so it doesn't replay.
910
+ hasEntered ? "" : "animate-in slide-in-from-right"
911
+ )}`,
912
+ children: [
913
+ /* @__PURE__ */ jsxRuntime.jsx(
914
+ "div",
915
+ {
916
+ className: "absolute left-0 top-0 bottom-0 z-10 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/40",
917
+ onMouseDown: handleResizeStart,
918
+ "data-testid": `${panelId}-overlay-resize-handle`
919
+ }
920
+ ),
921
+ children
922
+ ]
923
+ }
924
+ ),
925
+ isResizing && dragWidth !== null && /* @__PURE__ */ jsxRuntime.jsx(
926
+ "div",
927
+ {
928
+ className: "absolute top-0 bottom-0 z-[60] w-0.5 bg-primary pointer-events-none",
929
+ style: { right: dragWidth }
930
+ }
931
+ ),
932
+ isResizing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-[55] cursor-col-resize" })
933
+ ]
934
+ }
935
+ )
936
+ );
937
+ }
938
+ function PanelPortal({
939
+ panelId,
940
+ mode,
941
+ isOpen,
942
+ isExiting,
943
+ onPopupClosed,
944
+ onClose,
945
+ popoutTitle,
946
+ defaultWidth,
947
+ children
948
+ }) {
949
+ const { windows: windowManager } = usePanelHostSupport();
950
+ const [popupRoot, setPopupRoot] = react.useState(null);
951
+ const popupWindowIdRef = react.useRef(null);
952
+ react.useEffect(() => {
953
+ if (!isOpen || mode !== "popout") {
954
+ if (popupWindowIdRef.current) {
955
+ windowManager.clearOnClose(popupWindowIdRef.current);
956
+ windowManager.closeWindow(popupWindowIdRef.current);
957
+ popupWindowIdRef.current = null;
958
+ setPopupRoot(null);
959
+ }
960
+ return;
961
+ }
962
+ if (popupWindowIdRef.current) return;
963
+ const windowId = windowManager.createPopupWindow(
964
+ `panel-${panelId}`,
965
+ () => {
966
+ popupWindowIdRef.current = null;
967
+ setPopupRoot(null);
968
+ onPopupClosed?.();
969
+ },
970
+ popoutTitle || panelId
971
+ );
972
+ if (windowId) {
973
+ const rootElement = windowManager.getRootElement(windowId);
974
+ if (rootElement) {
975
+ popupWindowIdRef.current = windowId;
976
+ setPopupRoot(rootElement);
977
+ windowManager.getWindow(windowId)?.focus();
978
+ }
979
+ }
980
+ }, [isOpen, mode, panelId, popoutTitle, onPopupClosed, windowManager]);
981
+ react.useEffect(() => {
982
+ return () => {
983
+ if (popupWindowIdRef.current) {
984
+ windowManager.closeWindow(popupWindowIdRef.current);
985
+ }
986
+ };
987
+ }, [windowManager]);
988
+ if (!isOpen && !isExiting) return null;
989
+ if (mode === "popout" && popupRoot) {
990
+ return reactDom.createPortal(
991
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PortalContainerProvider, { container: popupRoot, children }),
992
+ popupRoot
993
+ );
994
+ }
995
+ if (mode === "overlay") {
996
+ const overlayZone = document.getElementById(chunkB6MVQCXW_cjs.DEFAULT_OVERLAY_ZONE_ID);
997
+ return reactDom.createPortal(
998
+ /* @__PURE__ */ jsxRuntime.jsx(
999
+ OverlaySheet,
1000
+ {
1001
+ panelId,
1002
+ isExiting,
1003
+ onClose,
1004
+ defaultWidth,
1005
+ scoped: overlayZone !== null,
1006
+ children
1007
+ }
1008
+ ),
1009
+ overlayZone ?? document.body
1010
+ );
1011
+ }
1012
+ if (mode === "main") {
1013
+ const mainZone = document.getElementById("main-zone");
1014
+ if (mainZone) {
1015
+ return reactDom.createPortal(children, mainZone);
1016
+ }
1017
+ }
1018
+ const dockZone = document.getElementById("dock-zone");
1019
+ if (dockZone) {
1020
+ return reactDom.createPortal(children, dockZone);
1021
+ }
1022
+ return null;
1023
+ }
598
1024
 
599
1025
  exports.ActionCluster = ActionCluster;
600
1026
  exports.DEFAULT_SIDEBAR_LABELS = DEFAULT_SIDEBAR_LABELS;
601
1027
  exports.DEFAULT_WORKSPACE_KIND_LABELS = DEFAULT_WORKSPACE_KIND_LABELS;
602
1028
  exports.DEFAULT_WORKSPACE_SWITCHER_LABELS = DEFAULT_WORKSPACE_SWITCHER_LABELS;
1029
+ exports.PanelModeSwitcher = PanelModeSwitcher;
1030
+ exports.PanelPortal = PanelPortal;
1031
+ exports.PanelWindowManager = PanelWindowManager;
603
1032
  exports.SidebarBadgeRow = SidebarBadgeRow;
604
1033
  exports.SidebarContext = SidebarContext;
605
1034
  exports.SidebarRowHoverContext = SidebarRowHoverContext;
606
1035
  exports.WorkspaceIdentity = WorkspaceIdentity;
607
1036
  exports.WorkspaceSwitcher = WorkspaceSwitcher;
1037
+ exports.createPanelWindowManager = createPanelWindowManager;
608
1038
  exports.hasUnsavedInput = hasUnsavedInput;
609
1039
  exports.installReloadPolicy = installReloadPolicy;
610
1040
  exports.markBuildStale = markBuildStale;
611
1041
  exports.prefetchChunk = prefetchChunk;
612
1042
  exports.requestReload = requestReload;
1043
+ exports.usePanelHostSupport = usePanelHostSupport;
613
1044
  exports.useSidebarContext = useSidebarContext;
614
1045
  exports.workspaceKindColor = workspaceKindColor;
615
1046
  exports.workspaceKindMeta = workspaceKindMeta;
616
- //# sourceMappingURL=chunk-QWKT4DO6.cjs.map
617
- //# sourceMappingURL=chunk-QWKT4DO6.cjs.map
1047
+ //# sourceMappingURL=chunk-GX5MKJ3F.cjs.map
1048
+ //# sourceMappingURL=chunk-GX5MKJ3F.cjs.map