@ai-matrx/summon 0.1.16 → 0.1.18
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/CHANGELOG.md +14 -1
- package/dist/chunk-server-C4KQZFIN.js +411 -0
- package/dist/chunk-server-C4KQZFIN.js.map +1 -0
- package/dist/chunk-server-H7NUWPEM.js +94 -0
- package/dist/chunk-server-H7NUWPEM.js.map +1 -0
- package/dist/chunk-server-WP7NOTZQ.js +208 -0
- package/dist/chunk-server-WP7NOTZQ.js.map +1 -0
- package/dist/dock.cjs +41 -112
- package/dist/dock.cjs.map +1 -1
- package/dist/dock.js +42 -113
- package/dist/dock.js.map +1 -1
- package/dist/handles.cjs +63 -50
- package/dist/handles.cjs.map +1 -1
- package/dist/handles.d.cts +2 -5
- package/dist/handles.d.ts +2 -5
- package/dist/handles.js +9 -259
- package/dist/handles.js.map +1 -1
- package/dist/{helpers-2NY1ha0V.d.cts → ids-83h05Ed-.d.cts} +4 -1
- package/dist/{helpers-2NY1ha0V.d.ts → ids-83h05Ed-.d.ts} +4 -1
- package/dist/index.cjs +63 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +350 -797
- package/dist/index.js.map +1 -1
- package/dist/lite.cjs +16 -76
- package/dist/lite.cjs.map +1 -1
- package/dist/lite.js +17 -77
- package/dist/lite.js.map +1 -1
- package/dist/open.cjs +86 -2
- package/dist/open.cjs.map +1 -1
- package/dist/open.d.cts +22 -2
- package/dist/open.d.ts +22 -2
- package/dist/open.js +78 -359
- package/dist/open.js.map +1 -1
- package/dist/window.cjs +167 -238
- package/dist/window.cjs.map +1 -1
- package/dist/window.d.cts +3 -1
- package/dist/window.d.ts +3 -1
- package/dist/window.js +55 -126
- package/dist/window.js.map +1 -1
- package/package.json +5 -5
package/dist/window.cjs
CHANGED
|
@@ -100,14 +100,14 @@ __export(window_exports, {
|
|
|
100
100
|
module.exports = __toCommonJS(window_exports);
|
|
101
101
|
|
|
102
102
|
// src/window/WindowPanel.tsx
|
|
103
|
-
var
|
|
103
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
104
104
|
var import_design_system7 = require("@ai-matrx/design-system");
|
|
105
105
|
var import_design_system8 = require("@ai-matrx/design-system");
|
|
106
106
|
var import_cn9 = require("@ai-matrx/design-system/cn");
|
|
107
107
|
var import_media_query = require("@ai-matrx/kit/media-query");
|
|
108
108
|
var import_react_dom3 = require("react-dom");
|
|
109
109
|
var import_summon10 = require("@ai-matrx/summon");
|
|
110
|
-
var
|
|
110
|
+
var import_react18 = require("@ai-matrx/summon/react");
|
|
111
111
|
|
|
112
112
|
// src/window/icons.tsx
|
|
113
113
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -467,16 +467,6 @@ var MIN_WIDTH = 180;
|
|
|
467
467
|
var MIN_HEIGHT = 80;
|
|
468
468
|
var DEFAULT_WIDTH = 320;
|
|
469
469
|
var DEFAULT_HEIGHT = 400;
|
|
470
|
-
var RESIZE_CURSOR = {
|
|
471
|
-
e: "ew-resize",
|
|
472
|
-
w: "ew-resize",
|
|
473
|
-
n: "ns-resize",
|
|
474
|
-
s: "ns-resize",
|
|
475
|
-
se: "nwse-resize",
|
|
476
|
-
nw: "nwse-resize",
|
|
477
|
-
ne: "nesw-resize",
|
|
478
|
-
sw: "nesw-resize"
|
|
479
|
-
};
|
|
480
470
|
function resolveSize(value, fallback) {
|
|
481
471
|
if (value === void 0) return fallback;
|
|
482
472
|
if (typeof value === "number") return value;
|
|
@@ -674,86 +664,53 @@ function useWindowPanel(opts = {}) {
|
|
|
674
664
|
dispatch((0, import_summon.updateWindowTitle)({ id, title: opts.title }));
|
|
675
665
|
}
|
|
676
666
|
}, [id, opts.title, dispatch]);
|
|
677
|
-
const dragStart = (0, import_react.useRef)(null);
|
|
678
667
|
const onTriggerPopout = opts.onTriggerPopout;
|
|
679
668
|
const onTriggerPopoutRef = (0, import_react.useRef)(onTriggerPopout);
|
|
680
669
|
(0, import_react.useEffect)(() => {
|
|
681
670
|
onTriggerPopoutRef.current = onTriggerPopout;
|
|
682
671
|
}, [onTriggerPopout]);
|
|
672
|
+
const gestureRef = (0, import_react.useRef)(null);
|
|
673
|
+
(0, import_react.useEffect)(() => () => gestureRef.current?.cancel(), []);
|
|
683
674
|
const onDragStart = (0, import_react.useCallback)(
|
|
684
675
|
(e) => {
|
|
685
676
|
e.preventDefault();
|
|
686
677
|
dispatch((0, import_summon.focusWindow)(id));
|
|
687
678
|
if (!entry || entry.state === "maximized") return;
|
|
688
|
-
|
|
689
|
-
mx: e.clientX,
|
|
690
|
-
my: e.clientY,
|
|
691
|
-
wx: entry.windowed.x,
|
|
692
|
-
wy: entry.windowed.y
|
|
693
|
-
};
|
|
694
|
-
setIsInteracting(true);
|
|
695
|
-
const releaseCursor = (0, import_design_system.holdDragCursor)();
|
|
679
|
+
const origin = { x: entry.windowed.x, y: entry.windowed.y };
|
|
696
680
|
let dragOutState = INITIAL_DRAG_OUT_STATE;
|
|
697
|
-
let lastClientX = e.clientX;
|
|
698
|
-
let lastClientY = e.clientY;
|
|
699
681
|
const popoutEnabled = onTriggerPopoutRef.current !== void 0;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
window.innerHeight,
|
|
714
|
-
performance.now()
|
|
715
|
-
);
|
|
716
|
-
if (result.state.isCandidate !== dragOutState.isCandidate) {
|
|
717
|
-
dispatch(
|
|
718
|
-
(0, import_summon.setPopoutCandidate)({ id: result.state.isCandidate ? id : null })
|
|
682
|
+
gestureRef.current?.cancel();
|
|
683
|
+
gestureRef.current = (0, import_design_system.startPointerDrag)(e, {
|
|
684
|
+
onStart: () => setIsInteracting(true),
|
|
685
|
+
onMove: ({ dx, dy }, ev) => {
|
|
686
|
+
dispatch((0, import_summon.updateWindowRect)({ id, rect: { x: origin.x + dx, y: origin.y + dy } }));
|
|
687
|
+
if (!popoutEnabled) return;
|
|
688
|
+
const result = evaluateDragOut(
|
|
689
|
+
{ clientX: ev.clientX, clientY: ev.clientY },
|
|
690
|
+
dragOutState,
|
|
691
|
+
DEFAULT_DRAG_OUT_CONFIG,
|
|
692
|
+
window.innerWidth,
|
|
693
|
+
window.innerHeight,
|
|
694
|
+
performance.now()
|
|
719
695
|
);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
};
|
|
723
|
-
const onUp = () => {
|
|
724
|
-
const wasCandidate = dragOutState.isCandidate;
|
|
725
|
-
const dragOrigin = dragStart.current;
|
|
726
|
-
dragStart.current = null;
|
|
727
|
-
setIsInteracting(false);
|
|
728
|
-
releaseCursor();
|
|
729
|
-
document.removeEventListener("pointermove", onMove);
|
|
730
|
-
document.removeEventListener("pointerup", onUp);
|
|
731
|
-
document.removeEventListener("pointercancel", onUp);
|
|
732
|
-
if (popoutEnabled && dragOutState.isCandidate) {
|
|
733
|
-
dispatch((0, import_summon.setPopoutCandidate)({ id: null }));
|
|
734
|
-
}
|
|
735
|
-
if (wasCandidate && onTriggerPopoutRef.current && entry) {
|
|
736
|
-
const lastRect = {
|
|
737
|
-
x: dragOrigin?.wx ?? entry.windowed.x,
|
|
738
|
-
y: dragOrigin?.wy ?? entry.windowed.y,
|
|
739
|
-
width: entry.windowed.width,
|
|
740
|
-
height: entry.windowed.height
|
|
741
|
-
};
|
|
742
|
-
onTriggerPopoutRef.current(lastRect);
|
|
743
|
-
} else {
|
|
744
|
-
const { vw, vh, degenerate } = (0, import_summon2.safeViewportDims)();
|
|
745
|
-
if (!degenerate) {
|
|
746
|
-
dispatch(
|
|
747
|
-
(0, import_summon.clampWindowRect)({ id, viewportWidth: vw, viewportHeight: vh })
|
|
748
|
-
);
|
|
696
|
+
if (result.state.isCandidate !== dragOutState.isCandidate) {
|
|
697
|
+
dispatch((0, import_summon.setPopoutCandidate)({ id: result.state.isCandidate ? id : null }));
|
|
749
698
|
}
|
|
699
|
+
dragOutState = result.state;
|
|
700
|
+
},
|
|
701
|
+
onEnd: () => {
|
|
702
|
+
gestureRef.current = null;
|
|
703
|
+
const wasCandidate = dragOutState.isCandidate;
|
|
704
|
+
setIsInteracting(false);
|
|
705
|
+
if (popoutEnabled && wasCandidate) dispatch((0, import_summon.setPopoutCandidate)({ id: null }));
|
|
706
|
+
if (wasCandidate && onTriggerPopoutRef.current) {
|
|
707
|
+
onTriggerPopoutRef.current({ x: origin.x, y: origin.y, width: entry.windowed.width, height: entry.windowed.height });
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const { vw, vh, degenerate } = (0, import_summon2.safeViewportDims)();
|
|
711
|
+
if (!degenerate) dispatch((0, import_summon.clampWindowRect)({ id, viewportWidth: vw, viewportHeight: vh }));
|
|
750
712
|
}
|
|
751
|
-
|
|
752
|
-
void lastClientY;
|
|
753
|
-
};
|
|
754
|
-
document.addEventListener("pointermove", onMove);
|
|
755
|
-
document.addEventListener("pointerup", onUp);
|
|
756
|
-
document.addEventListener("pointercancel", onUp);
|
|
713
|
+
});
|
|
757
714
|
},
|
|
758
715
|
[dispatch, id, entry]
|
|
759
716
|
);
|
|
@@ -763,44 +720,21 @@ function useWindowPanel(opts = {}) {
|
|
|
763
720
|
e.stopPropagation();
|
|
764
721
|
dispatch((0, import_summon.focusWindow)(id));
|
|
765
722
|
if (!entry || entry.state !== "windowed") return;
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
if (edge.includes("w")) {
|
|
780
|
-
nw = Math.min(maxWidth, Math.max(minWidth, width - dx));
|
|
781
|
-
nx = x + (width - nw);
|
|
782
|
-
}
|
|
783
|
-
if (edge.includes("n")) {
|
|
784
|
-
nh = Math.min(maxHeight, Math.max(minHeight, height - dy));
|
|
785
|
-
ny = y + (height - nh);
|
|
723
|
+
const origin = { ...entry.windowed };
|
|
724
|
+
gestureRef.current?.cancel();
|
|
725
|
+
gestureRef.current = (0, import_design_system.startPointerDrag)(e, {
|
|
726
|
+
// THE CURSOR LAW: the edge's resize cursor holds on <html> until release.
|
|
727
|
+
cursor: import_design_system.RESIZE_EDGE_CURSOR[edge],
|
|
728
|
+
onStart: () => setIsInteracting(true),
|
|
729
|
+
onMove: ({ dx, dy }) => {
|
|
730
|
+
const rect2 = (0, import_design_system.resizeRect)(origin, edge, dx, dy, { minWidth, minHeight, maxWidth, maxHeight });
|
|
731
|
+
dispatch((0, import_summon.updateWindowRect)({ id, rect: { x: rect2.x, y: rect2.y, width: rect2.width, height: rect2.height } }));
|
|
732
|
+
},
|
|
733
|
+
onEnd: () => {
|
|
734
|
+
gestureRef.current = null;
|
|
735
|
+
setIsInteracting(false);
|
|
786
736
|
}
|
|
787
|
-
|
|
788
|
-
(0, import_summon.updateWindowRect)({
|
|
789
|
-
id,
|
|
790
|
-
rect: { x: nx, y: ny, width: nw, height: nh }
|
|
791
|
-
})
|
|
792
|
-
);
|
|
793
|
-
};
|
|
794
|
-
const onUp = () => {
|
|
795
|
-
setIsInteracting(false);
|
|
796
|
-
releaseCursor();
|
|
797
|
-
document.removeEventListener("pointermove", onMove);
|
|
798
|
-
document.removeEventListener("pointerup", onUp);
|
|
799
|
-
document.removeEventListener("pointercancel", onUp);
|
|
800
|
-
};
|
|
801
|
-
document.addEventListener("pointermove", onMove);
|
|
802
|
-
document.addEventListener("pointerup", onUp);
|
|
803
|
-
document.addEventListener("pointercancel", onUp);
|
|
737
|
+
});
|
|
804
738
|
},
|
|
805
739
|
[dispatch, id, entry, minWidth, minHeight, maxWidth, maxHeight]
|
|
806
740
|
);
|
|
@@ -845,20 +779,15 @@ function useWindowPanel(opts = {}) {
|
|
|
845
779
|
};
|
|
846
780
|
}
|
|
847
781
|
|
|
848
|
-
// src/window/
|
|
849
|
-
var
|
|
850
|
-
var subscribe = () => () => {
|
|
851
|
-
};
|
|
852
|
-
function useIsClient() {
|
|
853
|
-
return (0, import_react3.useSyncExternalStore)(subscribe, () => true, () => false);
|
|
854
|
-
}
|
|
782
|
+
// src/window/WindowPanel.tsx
|
|
783
|
+
var import_client_lazy = require("@ai-matrx/kit/client-lazy");
|
|
855
784
|
|
|
856
785
|
// src/window/utils/useDebugFlag.ts
|
|
857
|
-
var
|
|
786
|
+
var import_react3 = require("react");
|
|
858
787
|
var noSubscribe = () => () => {
|
|
859
788
|
};
|
|
860
789
|
function useDebugFlag(debug) {
|
|
861
|
-
return (0,
|
|
790
|
+
return (0, import_react3.useSyncExternalStore)(
|
|
862
791
|
debug.subscribe ? (listener) => debug.subscribe?.(listener) ?? (() => {
|
|
863
792
|
}) : noSubscribe,
|
|
864
793
|
() => debug.enabled(),
|
|
@@ -867,7 +796,7 @@ function useDebugFlag(debug) {
|
|
|
867
796
|
}
|
|
868
797
|
|
|
869
798
|
// src/window/WindowPanel.tsx
|
|
870
|
-
var
|
|
799
|
+
var import_react19 = require("@ai-matrx/summon/react");
|
|
871
800
|
|
|
872
801
|
// src/window/utils/urlSyncIdentity.ts
|
|
873
802
|
function resolveWindowUrlSyncKey(registryKey, explicitKey) {
|
|
@@ -925,7 +854,7 @@ function sanitizeWindowData(value, allowedKeys) {
|
|
|
925
854
|
var import_window_host3 = require("@ai-matrx/summon/window-host");
|
|
926
855
|
|
|
927
856
|
// src/window/mobile/MobileDrawerSurface.tsx
|
|
928
|
-
var
|
|
857
|
+
var import_react4 = require("react");
|
|
929
858
|
var import_design_system2 = require("@ai-matrx/design-system");
|
|
930
859
|
var import_design_system3 = require("@ai-matrx/design-system");
|
|
931
860
|
var import_cn3 = require("@ai-matrx/design-system/cn");
|
|
@@ -1002,7 +931,7 @@ function MobileDrawerSurface({
|
|
|
1002
931
|
hideClose = false,
|
|
1003
932
|
sidebarAs = "drawer"
|
|
1004
933
|
}) {
|
|
1005
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
934
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react4.useState)(false);
|
|
1006
935
|
const hasSidebar = !!sidebar;
|
|
1007
936
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1008
937
|
import_design_system2.Drawer,
|
|
@@ -1119,7 +1048,7 @@ function MobileDrawerSurface({
|
|
|
1119
1048
|
}
|
|
1120
1049
|
|
|
1121
1050
|
// src/window/mobile/MobileCardSurface.tsx
|
|
1122
|
-
var
|
|
1051
|
+
var import_react5 = require("react");
|
|
1123
1052
|
var import_react_dom = require("react-dom");
|
|
1124
1053
|
var import_design_system4 = require("@ai-matrx/design-system");
|
|
1125
1054
|
var import_design_system5 = require("@ai-matrx/design-system");
|
|
@@ -1136,8 +1065,8 @@ function MobileCardSurface({
|
|
|
1136
1065
|
surfaceLayer,
|
|
1137
1066
|
maxHeight = "60dvh"
|
|
1138
1067
|
}) {
|
|
1139
|
-
const cardRef = (0,
|
|
1140
|
-
(0,
|
|
1068
|
+
const cardRef = (0, import_react5.useRef)(null);
|
|
1069
|
+
(0, import_react5.useEffect)(() => {
|
|
1141
1070
|
if (!isOpen) return void 0;
|
|
1142
1071
|
const onKey = (e) => {
|
|
1143
1072
|
if (e.key === "Escape" && !e.defaultPrevented) onClose();
|
|
@@ -1198,10 +1127,10 @@ function MobileCardSurface({
|
|
|
1198
1127
|
}
|
|
1199
1128
|
|
|
1200
1129
|
// src/window/chrome/DebugStrip.tsx
|
|
1201
|
-
var
|
|
1130
|
+
var import_react6 = require("react");
|
|
1202
1131
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1203
1132
|
function DebugStrip({ rect, zIndex }) {
|
|
1204
|
-
const [vp, setVp] = (0,
|
|
1133
|
+
const [vp, setVp] = (0, import_react6.useState)(
|
|
1205
1134
|
() => typeof window === "undefined" ? { vw: 0, vh: 0, sw: 0, sh: 0, dpr: 1 } : {
|
|
1206
1135
|
vw: window.innerWidth,
|
|
1207
1136
|
vh: window.innerHeight,
|
|
@@ -1210,7 +1139,7 @@ function DebugStrip({ rect, zIndex }) {
|
|
|
1210
1139
|
dpr: window.devicePixelRatio ?? 1
|
|
1211
1140
|
}
|
|
1212
1141
|
);
|
|
1213
|
-
(0,
|
|
1142
|
+
(0, import_react6.useEffect)(() => {
|
|
1214
1143
|
const update = () => setVp({
|
|
1215
1144
|
vw: window.innerWidth,
|
|
1216
1145
|
vh: window.innerHeight,
|
|
@@ -1334,7 +1263,7 @@ function MobileWindowHeader({
|
|
|
1334
1263
|
}
|
|
1335
1264
|
|
|
1336
1265
|
// src/window/chrome/DeprecationBanner.tsx
|
|
1337
|
-
var
|
|
1266
|
+
var import_react7 = require("react");
|
|
1338
1267
|
var import_cn6 = require("@ai-matrx/design-system/cn");
|
|
1339
1268
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1340
1269
|
function DeprecationBanner({
|
|
@@ -1342,7 +1271,7 @@ function DeprecationBanner({
|
|
|
1342
1271
|
note,
|
|
1343
1272
|
className
|
|
1344
1273
|
}) {
|
|
1345
|
-
const [dismissed, setDismissed] = (0,
|
|
1274
|
+
const [dismissed, setDismissed] = (0, import_react7.useState)(false);
|
|
1346
1275
|
if (dismissed) return null;
|
|
1347
1276
|
const message = note ?? (replacedBy ? `Deprecated \u2014 moved to "${replacedBy}". This window will be removed soon.` : "Deprecated \u2014 this window will be removed soon.");
|
|
1348
1277
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
@@ -1429,12 +1358,12 @@ function supportsAnyPopout() {
|
|
|
1429
1358
|
}
|
|
1430
1359
|
|
|
1431
1360
|
// src/window/popout/usePopoutWindow.ts
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1361
|
+
var import_react9 = require("react");
|
|
1362
|
+
var import_react10 = require("@ai-matrx/summon/react");
|
|
1434
1363
|
var import_summon3 = require("@ai-matrx/summon");
|
|
1435
1364
|
|
|
1436
1365
|
// src/window/popout/popoutWindowMap.ts
|
|
1437
|
-
var
|
|
1366
|
+
var import_react8 = require("react");
|
|
1438
1367
|
var import_global_slot3 = require("@ai-matrx/kit/global-slot");
|
|
1439
1368
|
var slot = () => (0, import_global_slot3.globalSlot)("ai-matrx.summon.window.popoutWindows", () => ({ map: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() }));
|
|
1440
1369
|
function notify() {
|
|
@@ -1467,7 +1396,7 @@ function subscribePopoutWindowMap(listener) {
|
|
|
1467
1396
|
};
|
|
1468
1397
|
}
|
|
1469
1398
|
function usePopoutWindowRef(id) {
|
|
1470
|
-
return (0,
|
|
1399
|
+
return (0, import_react8.useSyncExternalStore)(
|
|
1471
1400
|
subscribePopoutWindowMap,
|
|
1472
1401
|
() => getPopoutWindow(id),
|
|
1473
1402
|
// SSR snapshot — popouts are never present during SSR.
|
|
@@ -1721,12 +1650,12 @@ function clearAllPopoutPending() {
|
|
|
1721
1650
|
var import_summon4 = require("@ai-matrx/summon");
|
|
1722
1651
|
var import_outbound = require("@ai-matrx/kit/outbound");
|
|
1723
1652
|
function usePopoutWindow(windowId) {
|
|
1724
|
-
const dispatch = (0,
|
|
1725
|
-
const { notify: notify3 } = (0,
|
|
1726
|
-
const popoutMode = (0,
|
|
1727
|
-
const activePipWindowId = (0,
|
|
1728
|
-
const stylesDisposeRef = (0,
|
|
1729
|
-
const handleClose = (0,
|
|
1653
|
+
const dispatch = (0, import_react10.useSummonDispatch)();
|
|
1654
|
+
const { notify: notify3 } = (0, import_react10.useSummonPorts)();
|
|
1655
|
+
const popoutMode = (0, import_react10.useSummonSelector)((0, import_summon3.selectPopoutMode)(windowId));
|
|
1656
|
+
const activePipWindowId = (0, import_react10.useSummonSelector)(import_summon3.selectActivePipWindowId);
|
|
1657
|
+
const stylesDisposeRef = (0, import_react9.useRef)(null);
|
|
1658
|
+
const handleClose = (0, import_react9.useCallback)(() => {
|
|
1730
1659
|
const win = getPopoutWindow(windowId);
|
|
1731
1660
|
if (!win && process.env.NODE_ENV !== "production") {
|
|
1732
1661
|
}
|
|
@@ -1743,7 +1672,7 @@ function usePopoutWindow(windowId) {
|
|
|
1743
1672
|
console.info(`[popout] closed window for "${windowId}"`);
|
|
1744
1673
|
}
|
|
1745
1674
|
}, [dispatch, windowId]);
|
|
1746
|
-
const openPopout = (0,
|
|
1675
|
+
const openPopout = (0, import_react9.useCallback)(
|
|
1747
1676
|
async (opts) => {
|
|
1748
1677
|
const capability = detectPopoutCapability();
|
|
1749
1678
|
if (capability === "none") {
|
|
@@ -1812,7 +1741,7 @@ function usePopoutWindow(windowId) {
|
|
|
1812
1741
|
},
|
|
1813
1742
|
[activePipWindowId, dispatch, handleClose, notify3, windowId]
|
|
1814
1743
|
);
|
|
1815
|
-
const close = (0,
|
|
1744
|
+
const close = (0, import_react9.useCallback)(() => {
|
|
1816
1745
|
const win = getPopoutWindow(windowId);
|
|
1817
1746
|
if (!win) {
|
|
1818
1747
|
dispatch((0, import_summon3.dockWindow)((0, import_summon4.buildDockWindowPayload)(windowId)));
|
|
@@ -1824,7 +1753,7 @@ function usePopoutWindow(windowId) {
|
|
|
1824
1753
|
handleClose();
|
|
1825
1754
|
}
|
|
1826
1755
|
}, [dispatch, handleClose, windowId]);
|
|
1827
|
-
(0,
|
|
1756
|
+
(0, import_react9.useEffect)(() => {
|
|
1828
1757
|
if (popoutMode === null && getPopoutWindow(windowId) !== null) {
|
|
1829
1758
|
try {
|
|
1830
1759
|
getPopoutWindow(windowId)?.close();
|
|
@@ -1833,7 +1762,7 @@ function usePopoutWindow(windowId) {
|
|
|
1833
1762
|
}
|
|
1834
1763
|
}
|
|
1835
1764
|
}, [popoutMode, windowId, handleClose]);
|
|
1836
|
-
(0,
|
|
1765
|
+
(0, import_react9.useEffect)(() => {
|
|
1837
1766
|
const onBeforeUnload = () => {
|
|
1838
1767
|
try {
|
|
1839
1768
|
getPopoutWindow(windowId)?.close();
|
|
@@ -1849,8 +1778,8 @@ function usePopoutWindow(windowId) {
|
|
|
1849
1778
|
}
|
|
1850
1779
|
|
|
1851
1780
|
// src/window/popout/usePopoutControl.ts
|
|
1852
|
-
var
|
|
1853
|
-
var
|
|
1781
|
+
var import_react11 = require("react");
|
|
1782
|
+
var import_react12 = require("@ai-matrx/summon/react");
|
|
1854
1783
|
var import_summon5 = require("@ai-matrx/summon");
|
|
1855
1784
|
var import_summon6 = require("@ai-matrx/summon");
|
|
1856
1785
|
var import_global_slot4 = require("@ai-matrx/kit/global-slot");
|
|
@@ -1867,8 +1796,8 @@ function getPopoutOpener(windowId) {
|
|
|
1867
1796
|
return openers().get(windowId) ?? null;
|
|
1868
1797
|
}
|
|
1869
1798
|
function usePopoutControl() {
|
|
1870
|
-
const dispatch = (0,
|
|
1871
|
-
const popOut = (0,
|
|
1799
|
+
const dispatch = (0, import_react12.useSummonDispatch)();
|
|
1800
|
+
const popOut = (0, import_react11.useCallback)(
|
|
1872
1801
|
async (windowId, opts) => {
|
|
1873
1802
|
const opener = getPopoutOpener(windowId);
|
|
1874
1803
|
if (!opener) {
|
|
@@ -1878,7 +1807,7 @@ function usePopoutControl() {
|
|
|
1878
1807
|
},
|
|
1879
1808
|
[]
|
|
1880
1809
|
);
|
|
1881
|
-
const dock = (0,
|
|
1810
|
+
const dock = (0, import_react11.useCallback)(
|
|
1882
1811
|
(windowId) => {
|
|
1883
1812
|
const payload = (0, import_summon6.buildDockWindowPayload)(windowId);
|
|
1884
1813
|
dispatch((0, import_summon5.dockWindow)(payload));
|
|
@@ -1897,11 +1826,11 @@ function buildPopoutOpts(rect, opts) {
|
|
|
1897
1826
|
|
|
1898
1827
|
// src/window/popout/PopoutPortal.tsx
|
|
1899
1828
|
var import_react_dom2 = require("react-dom");
|
|
1900
|
-
var
|
|
1829
|
+
var import_react14 = require("@ai-matrx/summon/react");
|
|
1901
1830
|
var import_summon7 = require("@ai-matrx/summon");
|
|
1902
1831
|
|
|
1903
1832
|
// src/window/popout/PopoutShell.tsx
|
|
1904
|
-
var
|
|
1833
|
+
var import_react13 = require("react");
|
|
1905
1834
|
var import_design_system6 = require("@ai-matrx/design-system");
|
|
1906
1835
|
var import_window_host = require("@ai-matrx/summon/window-host");
|
|
1907
1836
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -1910,7 +1839,7 @@ function PopoutShell({
|
|
|
1910
1839
|
mode,
|
|
1911
1840
|
children
|
|
1912
1841
|
}) {
|
|
1913
|
-
const value = (0,
|
|
1842
|
+
const value = (0, import_react13.useMemo)(
|
|
1914
1843
|
() => ({
|
|
1915
1844
|
popoutDocument: popoutWindow.document,
|
|
1916
1845
|
popoutWindow,
|
|
@@ -1926,7 +1855,7 @@ function PopoutShell({
|
|
|
1926
1855
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1927
1856
|
function PopoutPortal({ windowId, children }) {
|
|
1928
1857
|
const popoutWin = usePopoutWindowRef(windowId);
|
|
1929
|
-
const popoutMode = (0,
|
|
1858
|
+
const popoutMode = (0, import_react14.useSummonSelector)((0, import_summon7.selectPopoutMode)(windowId));
|
|
1930
1859
|
if (!popoutWin || popoutMode === null) return null;
|
|
1931
1860
|
return (0, import_react_dom2.createPortal)(
|
|
1932
1861
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoutShell, { popoutWindow: popoutWin, mode: popoutMode, children }),
|
|
@@ -2052,16 +1981,16 @@ async function isFlatImage(blob) {
|
|
|
2052
1981
|
var import_summon9 = require("@ai-matrx/summon");
|
|
2053
1982
|
|
|
2054
1983
|
// src/window/tray/TrayChipPreview.tsx
|
|
2055
|
-
var
|
|
1984
|
+
var import_react15 = require("react");
|
|
2056
1985
|
var import_cn8 = require("@ai-matrx/design-system/cn");
|
|
2057
1986
|
var import_summon8 = require("@ai-matrx/summon");
|
|
2058
|
-
var
|
|
1987
|
+
var import_react16 = require("@ai-matrx/summon/react");
|
|
2059
1988
|
var import_window_host2 = require("@ai-matrx/summon/window-host");
|
|
2060
1989
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2061
1990
|
function isPlainRecord(value) {
|
|
2062
1991
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2063
1992
|
}
|
|
2064
|
-
var TrayChipPreview = (0,
|
|
1993
|
+
var TrayChipPreview = (0, import_react15.memo)(function TrayChipPreview2({
|
|
2065
1994
|
registryKey,
|
|
2066
1995
|
snapshotKey,
|
|
2067
1996
|
overlayInstanceId = import_summon8.DEFAULT_INSTANCE_ID,
|
|
@@ -2070,9 +1999,9 @@ var TrayChipPreview = (0, import_react16.memo)(function TrayChipPreview2({
|
|
|
2070
1999
|
}) {
|
|
2071
2000
|
const meta = (0, import_summon8.getOverlayMeta)(registryKey);
|
|
2072
2001
|
const { Preview } = (0, import_window_host2.getTrayPreviewEntry)(registryKey);
|
|
2073
|
-
const ports = (0,
|
|
2074
|
-
const overlayData = (0,
|
|
2075
|
-
const collectedData = (0,
|
|
2002
|
+
const ports = (0, import_react16.useSummonPorts)();
|
|
2003
|
+
const overlayData = (0, import_react16.useSummonSelector)((state2) => meta ? (0, import_summon8.selectOverlayData)(state2, meta.id, overlayInstanceId) : null);
|
|
2004
|
+
const collectedData = (0, import_react16.useSummonSelector)((state2) => state2.windowManager.windows[snapshotKey]?.persistence?.data);
|
|
2076
2005
|
const registryLabel = meta?.label ?? null;
|
|
2077
2006
|
const fallback = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TraySnapshotImage, { snapshotKey, registryLabel, title });
|
|
2078
2007
|
if (Preview) {
|
|
@@ -2093,7 +2022,7 @@ var TrayChipPreview = (0, import_react16.memo)(function TrayChipPreview2({
|
|
|
2093
2022
|
}
|
|
2094
2023
|
return fallback;
|
|
2095
2024
|
});
|
|
2096
|
-
var PreviewBoundary = class extends
|
|
2025
|
+
var PreviewBoundary = class extends import_react15.Component {
|
|
2097
2026
|
state = { failed: false };
|
|
2098
2027
|
static getDerivedStateFromError() {
|
|
2099
2028
|
return { failed: true };
|
|
@@ -2105,7 +2034,7 @@ var PreviewBoundary = class extends import_react16.Component {
|
|
|
2105
2034
|
return this.state.failed ? this.props.fallback : this.props.children;
|
|
2106
2035
|
}
|
|
2107
2036
|
};
|
|
2108
|
-
var DefaultTrayChipBody = (0,
|
|
2037
|
+
var DefaultTrayChipBody = (0, import_react15.memo)(function DefaultTrayChipBody2({ label }) {
|
|
2109
2038
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-1 flex-col justify-between overflow-hidden bg-gradient-to-br from-muted/45 via-background to-primary/5 px-3 py-2.5", children: [
|
|
2110
2039
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
2111
2040
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
@@ -2128,12 +2057,12 @@ var DefaultTrayChipBody = (0, import_react16.memo)(function DefaultTrayChipBody2
|
|
|
2128
2057
|
] })
|
|
2129
2058
|
] });
|
|
2130
2059
|
});
|
|
2131
|
-
var TraySnapshotImage = (0,
|
|
2060
|
+
var TraySnapshotImage = (0, import_react15.memo)(function TraySnapshotImage2({
|
|
2132
2061
|
snapshotKey,
|
|
2133
2062
|
registryLabel,
|
|
2134
2063
|
title
|
|
2135
2064
|
}) {
|
|
2136
|
-
const snapshot = (0,
|
|
2065
|
+
const snapshot = (0, import_react15.useSyncExternalStore)(
|
|
2137
2066
|
subscribeTraySnapshotMap,
|
|
2138
2067
|
() => getTraySnapshot(snapshotKey),
|
|
2139
2068
|
() => null
|
|
@@ -2305,25 +2234,25 @@ function WindowPanel({
|
|
|
2305
2234
|
hidePopOutButton = false,
|
|
2306
2235
|
...hookOpts
|
|
2307
2236
|
}) {
|
|
2308
|
-
const instance = (0,
|
|
2237
|
+
const instance = (0, import_react18.useOptionalOverlayInstance)();
|
|
2309
2238
|
const instanceMatches = instance !== null && (boundToOverlay === true || instance.overlayId === overlayIdProp);
|
|
2310
2239
|
const overlayId = overlayIdProp ?? (boundToOverlay && instance ? instance.overlayId : void 0);
|
|
2311
2240
|
const overlayInstanceId = overlayInstanceIdProp ?? (instanceMatches ? instance.instanceId : void 0);
|
|
2312
|
-
const ports = (0,
|
|
2241
|
+
const ports = (0, import_react18.useSummonPorts)();
|
|
2313
2242
|
const windowConfig = (0, import_window_host3.useWindowConfig)();
|
|
2314
|
-
const reactId = (0,
|
|
2243
|
+
const reactId = (0, import_react17.useId)();
|
|
2315
2244
|
const id = hookOpts.id ?? reactId;
|
|
2316
2245
|
const trayRegistryKey = overlayId ?? id;
|
|
2317
2246
|
const isMobile = (0, import_media_query.useIsMobile)();
|
|
2318
2247
|
const surfaceLayerAttrs = surfaceLayer ? { "data-surface-layer": surfaceLayer } : void 0;
|
|
2319
|
-
const isMounted = useIsClient();
|
|
2248
|
+
const isMounted = (0, import_client_lazy.useIsClient)();
|
|
2320
2249
|
const registryMeta = overlayId ? (0, import_summon10.getOverlayMeta)(overlayId) : void 0;
|
|
2321
2250
|
const registryEntry = registryMeta?.window;
|
|
2322
2251
|
const effectiveInstanceId = overlayInstanceId ?? import_summon10.DEFAULT_INSTANCE_ID;
|
|
2323
|
-
const [autoOpened] = (0,
|
|
2252
|
+
const [autoOpened] = (0, import_react17.useState)(
|
|
2324
2253
|
() => Boolean(overlayId) && isAutoOpened(overlayId, effectiveInstanceId)
|
|
2325
2254
|
);
|
|
2326
|
-
(0,
|
|
2255
|
+
(0, import_react17.useEffect)(() => {
|
|
2327
2256
|
if (!overlayId) return void 0;
|
|
2328
2257
|
let timer;
|
|
2329
2258
|
return () => {
|
|
@@ -2337,16 +2266,16 @@ function WindowPanel({
|
|
|
2337
2266
|
const preservationEnabled = Boolean(
|
|
2338
2267
|
overlayId && registryEntry?.preservation && !registryEntry.ephemeral && (registryMeta?.instance !== "multi" || overlayInstanceId)
|
|
2339
2268
|
);
|
|
2340
|
-
const overlayLaunchData = (0,
|
|
2269
|
+
const overlayLaunchData = (0, import_react18.useSummonSelector)(
|
|
2341
2270
|
(state2) => overlayId ? (0, import_summon10.selectOverlayData)(state2, overlayId, effectiveInstanceId) : null
|
|
2342
2271
|
);
|
|
2343
2272
|
const initialPreservationData = registryEntry?.preservation ? sanitizeWindowData(overlayLaunchData, registryEntry.preservation.dataKeys) : {};
|
|
2344
2273
|
const popoutCapability = isMounted ? detectPopoutCapability() : null;
|
|
2345
2274
|
const popout = usePopoutWindow(id);
|
|
2346
|
-
(0,
|
|
2275
|
+
(0, import_react17.useEffect)(() => {
|
|
2347
2276
|
return registerPopoutOpener(id, popout.openPopout);
|
|
2348
2277
|
}, [id, popout.openPopout]);
|
|
2349
|
-
const handleDragOutPopout = (0,
|
|
2278
|
+
const handleDragOutPopout = (0, import_react17.useCallback)(
|
|
2350
2279
|
(draggedRect) => {
|
|
2351
2280
|
void popout.openPopout({
|
|
2352
2281
|
width: draggedRect.width,
|
|
@@ -2357,7 +2286,7 @@ function WindowPanel({
|
|
|
2357
2286
|
[popout, title]
|
|
2358
2287
|
);
|
|
2359
2288
|
const onTriggerPopout = !isMobile && popoutCapability !== "none" ? handleDragOutPopout : void 0;
|
|
2360
|
-
const autoDispatch = (0,
|
|
2289
|
+
const autoDispatch = (0, import_react18.useSummonDispatch)();
|
|
2361
2290
|
const {
|
|
2362
2291
|
windowState,
|
|
2363
2292
|
rect,
|
|
@@ -2395,10 +2324,10 @@ function WindowPanel({
|
|
|
2395
2324
|
});
|
|
2396
2325
|
const liftedZIndex = (0, import_design_system7.useFloatingLayerZIndex)(managerZIndex);
|
|
2397
2326
|
const zIndex = windowState === "minimized" ? Math.max(liftedZIndex, MINIMIZED_TILE_Z_FLOOR + managerZIndex) : liftedZIndex;
|
|
2398
|
-
const dispatch = (0,
|
|
2399
|
-
const windowsHidden = (0,
|
|
2327
|
+
const dispatch = (0, import_react18.useSummonDispatch)();
|
|
2328
|
+
const windowsHidden = (0, import_react18.useSummonSelector)(import_summon10.selectWindowsHidden);
|
|
2400
2329
|
const isDebugMode = useDebugFlag(ports.debug);
|
|
2401
|
-
(0,
|
|
2330
|
+
(0, import_react17.useEffect)(() => {
|
|
2402
2331
|
(0, import_design_system7.announceLayerFront)(
|
|
2403
2332
|
document.querySelector(`[data-window-id="${CSS.escape(id)}"]`)
|
|
2404
2333
|
);
|
|
@@ -2406,26 +2335,26 @@ function WindowPanel({
|
|
|
2406
2335
|
const claimFront = (event) => {
|
|
2407
2336
|
(0, import_design_system7.announceLayerFront)(event.currentTarget.closest("[data-window-id]") ?? event.currentTarget);
|
|
2408
2337
|
};
|
|
2409
|
-
const allWindows = (0,
|
|
2338
|
+
const allWindows = (0, import_react18.useSummonSelector)(import_summon10.selectAllWindows);
|
|
2410
2339
|
const isTopWindow = !isMobile ? true : allWindows.find((w) => w.state !== "minimized")?.id === id;
|
|
2411
|
-
const [activePaneMobile, setActivePaneMobile] = (0,
|
|
2340
|
+
const [activePaneMobile, setActivePaneMobile] = (0, import_react17.useState)(
|
|
2412
2341
|
"main"
|
|
2413
2342
|
);
|
|
2414
2343
|
const effectiveUrlSyncKey = resolveWindowUrlSyncKey(registryMeta?.link?.key, urlSyncKey);
|
|
2415
2344
|
const effectiveUrlSyncId = urlSyncId ?? (effectiveUrlSyncKey ? overlayId : void 0);
|
|
2416
|
-
(0,
|
|
2345
|
+
(0, import_react19.useOverlayLink)(effectiveUrlSyncKey, effectiveUrlSyncId, urlSyncArgs);
|
|
2417
2346
|
const deprecation = registryEntry?.deprecated;
|
|
2418
2347
|
const isDeprecated = !!deprecation;
|
|
2419
2348
|
const deprecatedRingClass = isDeprecated ? "ring-2 ring-destructive ring-offset-2 ring-offset-background" : "";
|
|
2420
2349
|
const hasSidebar = !!sidebar;
|
|
2421
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
2422
|
-
const [sidebarSize, setSidebarSize] = (0,
|
|
2350
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react17.useState)(defaultSidebarOpen);
|
|
2351
|
+
const [sidebarSize, setSidebarSize] = (0, import_react17.useState)(
|
|
2423
2352
|
sidebarDefaultSize
|
|
2424
2353
|
);
|
|
2425
|
-
const restoredPersistence = (0,
|
|
2426
|
-
const sidebarPanelRef = (0,
|
|
2427
|
-
const restoredChromeAppliedRef = (0,
|
|
2428
|
-
const handleSaveWindowState = (0,
|
|
2354
|
+
const restoredPersistence = (0, import_react18.useSummonSelector)((0, import_summon10.selectWindowPersistence)(id));
|
|
2355
|
+
const sidebarPanelRef = (0, import_react17.useRef)(null);
|
|
2356
|
+
const restoredChromeAppliedRef = (0, import_react17.useRef)(false);
|
|
2357
|
+
const handleSaveWindowState = (0, import_react17.useCallback)(() => {
|
|
2429
2358
|
if (!overlayId || !preservationEnabled || !registryEntry?.preservation) {
|
|
2430
2359
|
return;
|
|
2431
2360
|
}
|
|
@@ -2457,15 +2386,15 @@ function WindowPanel({
|
|
|
2457
2386
|
ports,
|
|
2458
2387
|
dispatch
|
|
2459
2388
|
]);
|
|
2460
|
-
const saveRef = (0,
|
|
2461
|
-
(0,
|
|
2389
|
+
const saveRef = (0, import_react17.useRef)(handleSaveWindowState);
|
|
2390
|
+
(0, import_react17.useEffect)(() => {
|
|
2462
2391
|
saveRef.current = handleSaveWindowState;
|
|
2463
2392
|
}, [handleSaveWindowState]);
|
|
2464
|
-
(0,
|
|
2393
|
+
(0, import_react17.useEffect)(() => {
|
|
2465
2394
|
if (!preservationEnabled) return;
|
|
2466
2395
|
saveRef.current();
|
|
2467
2396
|
}, [preservationEnabled, overlayLaunchData, onCollectData]);
|
|
2468
|
-
const handleClose = (0,
|
|
2397
|
+
const handleClose = (0, import_react17.useCallback)(() => {
|
|
2469
2398
|
if (instanceMatches && instance && instance.overlayId === overlayId) {
|
|
2470
2399
|
instance.close();
|
|
2471
2400
|
} else if (boundToOverlay) {
|
|
@@ -2480,7 +2409,7 @@ function WindowPanel({
|
|
|
2480
2409
|
}
|
|
2481
2410
|
onClose?.();
|
|
2482
2411
|
}, [boundToOverlay, dispatch, effectiveInstanceId, id, instance, instanceMatches, onClose, overlayId, overlayInstanceId, ports, registryMeta?.instance]);
|
|
2483
|
-
(0,
|
|
2412
|
+
(0, import_react17.useEffect)(() => {
|
|
2484
2413
|
if (!closeOnEscape || isMobile) return void 0;
|
|
2485
2414
|
const onKey = (e) => {
|
|
2486
2415
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -2507,7 +2436,7 @@ function WindowPanel({
|
|
|
2507
2436
|
document.addEventListener("keydown", onKey);
|
|
2508
2437
|
return () => document.removeEventListener("keydown", onKey);
|
|
2509
2438
|
}, [closeOnEscape, isMobile, id, handleClose, windowConfig.escapeYieldSelector]);
|
|
2510
|
-
(0,
|
|
2439
|
+
(0, import_react17.useEffect)(() => {
|
|
2511
2440
|
if (!restoredPersistence || restoredChromeAppliedRef.current) return;
|
|
2512
2441
|
restoredChromeAppliedRef.current = true;
|
|
2513
2442
|
setSidebarOpen(restoredPersistence.sidebarOpen);
|
|
@@ -2518,20 +2447,20 @@ function WindowPanel({
|
|
|
2518
2447
|
sidebarPanelRef.current?.resize(restoredPersistence.sidebarSize);
|
|
2519
2448
|
}
|
|
2520
2449
|
}, [restoredPersistence]);
|
|
2521
|
-
const [fitContentEl, fitContentRef] = (0,
|
|
2522
|
-
const fitContentStore = (0,
|
|
2523
|
-
const fitPlacedRef = (0,
|
|
2524
|
-
const [glideReady, setGlideReady] = (0,
|
|
2525
|
-
(0,
|
|
2450
|
+
const [fitContentEl, fitContentRef] = (0, import_react17.useState)(null);
|
|
2451
|
+
const fitContentStore = (0, import_react18.useSummonStore)();
|
|
2452
|
+
const fitPlacedRef = (0, import_react17.useRef)(false);
|
|
2453
|
+
const [glideReady, setGlideReady] = (0, import_react17.useState)(false);
|
|
2454
|
+
(0, import_react17.useEffect)(() => {
|
|
2526
2455
|
const timer = window.setTimeout(() => setGlideReady(true), GLIDE_SETTLE_MS);
|
|
2527
2456
|
return () => window.clearTimeout(timer);
|
|
2528
2457
|
}, []);
|
|
2529
|
-
(0,
|
|
2458
|
+
(0, import_react17.useEffect)(() => {
|
|
2530
2459
|
if (isInteracting) fitPlacedRef.current = true;
|
|
2531
2460
|
}, [isInteracting]);
|
|
2532
2461
|
const fitPresetPosition = hookOpts.position;
|
|
2533
2462
|
const fitMayReplace = hookOpts.initialRect?.x === void 0 && hookOpts.initialRect?.y === void 0;
|
|
2534
|
-
(0,
|
|
2463
|
+
(0, import_react17.useEffect)(() => {
|
|
2535
2464
|
if (!fitContent || isMobile || windowState !== "windowed") return void 0;
|
|
2536
2465
|
const el2 = fitContentEl;
|
|
2537
2466
|
if (!el2) return void 0;
|
|
@@ -2563,7 +2492,7 @@ function WindowPanel({
|
|
|
2563
2492
|
ro.disconnect();
|
|
2564
2493
|
};
|
|
2565
2494
|
}, [fitContent, fitContentEl, isMobile, windowState, id, dispatch, fitContentStore, fitPresetPosition, fitMayReplace]);
|
|
2566
|
-
const toggleSidebar = (0,
|
|
2495
|
+
const toggleSidebar = (0, import_react17.useCallback)(() => {
|
|
2567
2496
|
const panel = sidebarPanelRef.current;
|
|
2568
2497
|
if (!panel) return;
|
|
2569
2498
|
if (sidebarOpen) {
|
|
@@ -2599,7 +2528,7 @@ function WindowPanel({
|
|
|
2599
2528
|
id,
|
|
2600
2529
|
rect.width
|
|
2601
2530
|
]);
|
|
2602
|
-
const handleSidebarResize = (0,
|
|
2531
|
+
const handleSidebarResize = (0, import_react17.useCallback)(
|
|
2603
2532
|
(panelSize) => {
|
|
2604
2533
|
setSidebarOpen(panelSize.asPercentage > 0);
|
|
2605
2534
|
if (panelSize.inPixels > 0) setSidebarSize(panelSize.inPixels);
|
|
@@ -2616,20 +2545,20 @@ function WindowPanel({
|
|
|
2616
2545
|
[dispatch, id, preservationEnabled, sidebarSize]
|
|
2617
2546
|
);
|
|
2618
2547
|
const portalTarget = isMounted ? document.body : null;
|
|
2619
|
-
const [bodyHost] = (0,
|
|
2548
|
+
const [bodyHost] = (0, import_react17.useState)(() => {
|
|
2620
2549
|
if (typeof document === "undefined") return null;
|
|
2621
2550
|
const host = document.createElement("div");
|
|
2622
2551
|
host.className = "matrx-window-body-host";
|
|
2623
2552
|
host.setAttribute("data-window-body-host", "");
|
|
2624
2553
|
return host;
|
|
2625
2554
|
});
|
|
2626
|
-
(0,
|
|
2555
|
+
(0, import_react17.useEffect)(() => {
|
|
2627
2556
|
if (!overlayId) return void 0;
|
|
2628
2557
|
(0, import_summon10.ackOverlayRender)(overlayId, id);
|
|
2629
2558
|
return () => (0, import_summon10.clearOverlayRender)(overlayId, id);
|
|
2630
2559
|
}, [overlayId, id]);
|
|
2631
2560
|
const resolvedActionsRight = actionsRight ?? actions ?? null;
|
|
2632
|
-
const snapLeft = (0,
|
|
2561
|
+
const snapLeft = (0, import_react17.useCallback)(() => {
|
|
2633
2562
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2634
2563
|
dispatch(
|
|
2635
2564
|
(0, import_summon10.updateWindowRect)({
|
|
@@ -2638,7 +2567,7 @@ function WindowPanel({
|
|
|
2638
2567
|
})
|
|
2639
2568
|
);
|
|
2640
2569
|
}, [dispatch, id]);
|
|
2641
|
-
const snapRight = (0,
|
|
2570
|
+
const snapRight = (0, import_react17.useCallback)(() => {
|
|
2642
2571
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2643
2572
|
const half = Math.round(vw / 2);
|
|
2644
2573
|
dispatch(
|
|
@@ -2648,7 +2577,7 @@ function WindowPanel({
|
|
|
2648
2577
|
})
|
|
2649
2578
|
);
|
|
2650
2579
|
}, [dispatch, id]);
|
|
2651
|
-
const snapTop = (0,
|
|
2580
|
+
const snapTop = (0, import_react17.useCallback)(() => {
|
|
2652
2581
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2653
2582
|
dispatch(
|
|
2654
2583
|
(0, import_summon10.updateWindowRect)({
|
|
@@ -2657,7 +2586,7 @@ function WindowPanel({
|
|
|
2657
2586
|
})
|
|
2658
2587
|
);
|
|
2659
2588
|
}, [dispatch, id]);
|
|
2660
|
-
const snapBottom = (0,
|
|
2589
|
+
const snapBottom = (0, import_react17.useCallback)(() => {
|
|
2661
2590
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2662
2591
|
const half = Math.round(vh / 2);
|
|
2663
2592
|
dispatch(
|
|
@@ -2667,7 +2596,7 @@ function WindowPanel({
|
|
|
2667
2596
|
})
|
|
2668
2597
|
);
|
|
2669
2598
|
}, [dispatch, id]);
|
|
2670
|
-
const snapCentre = (0,
|
|
2599
|
+
const snapCentre = (0, import_react17.useCallback)(() => {
|
|
2671
2600
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2672
2601
|
const w = Math.min(rect.width, vw);
|
|
2673
2602
|
const h = Math.min(rect.height, vh);
|
|
@@ -2683,7 +2612,7 @@ function WindowPanel({
|
|
|
2683
2612
|
})
|
|
2684
2613
|
);
|
|
2685
2614
|
}, [dispatch, id, rect.width, rect.height]);
|
|
2686
|
-
const arrangeAll = (0,
|
|
2615
|
+
const arrangeAll = (0, import_react17.useCallback)(
|
|
2687
2616
|
(layout) => {
|
|
2688
2617
|
const { vw, vh } = (0, import_summon10.safeViewportDims)();
|
|
2689
2618
|
dispatch(
|
|
@@ -2696,36 +2625,36 @@ function WindowPanel({
|
|
|
2696
2625
|
},
|
|
2697
2626
|
[dispatch]
|
|
2698
2627
|
);
|
|
2699
|
-
const popoutMode = (0,
|
|
2628
|
+
const popoutMode = (0, import_react18.useSummonSelector)((0, import_summon10.selectPopoutMode)(id));
|
|
2700
2629
|
const outerPopout = (0, import_window_host4.usePopout)();
|
|
2701
2630
|
const outerPortalContainer = (0, import_design_system7.usePortalContainer)();
|
|
2702
2631
|
const popoutWin = usePopoutWindowRef(id);
|
|
2703
2632
|
const ownPopout = popoutMode !== null && popoutWin !== null;
|
|
2704
|
-
const bodyPopoutValue =
|
|
2633
|
+
const bodyPopoutValue = import_react17.default.useMemo(
|
|
2705
2634
|
() => ownPopout && popoutWin ? { popoutDocument: popoutWin.document, popoutWindow: popoutWin, popoutContainer: popoutWin.document.body, mode: popoutMode } : outerPopout,
|
|
2706
2635
|
[ownPopout, popoutWin, popoutMode, outerPopout]
|
|
2707
2636
|
);
|
|
2708
2637
|
const bodyPortalContainer = ownPopout && popoutWin ? popoutWin.document.body : outerPortalContainer;
|
|
2709
|
-
const popoutCandidateId = (0,
|
|
2638
|
+
const popoutCandidateId = (0, import_react18.useSummonSelector)(import_summon10.selectPopoutCandidateId);
|
|
2710
2639
|
const canShowPopOut = !hidePopOutButton && !isMobile && popoutCapability !== "none" && windowState !== "minimized" && popoutMode === null;
|
|
2711
|
-
const handlePopOut = (0,
|
|
2640
|
+
const handlePopOut = (0, import_react17.useCallback)(() => {
|
|
2712
2641
|
void popout.openPopout({
|
|
2713
2642
|
width: rect.width,
|
|
2714
2643
|
height: rect.height,
|
|
2715
2644
|
title: typeof title === "string" ? title : "Window"
|
|
2716
2645
|
});
|
|
2717
2646
|
}, [popout, rect.width, rect.height, title]);
|
|
2718
|
-
const handleDockBack = (0,
|
|
2647
|
+
const handleDockBack = (0, import_react17.useCallback)(() => {
|
|
2719
2648
|
dispatch((0, import_summon10.dockWindow)((0, import_summon10.buildDockWindowPayload)(id)));
|
|
2720
2649
|
}, [dispatch, id]);
|
|
2721
|
-
const bodyRef = (0,
|
|
2722
|
-
const retainedBodyDimensionsRef = (0,
|
|
2723
|
-
const captureGenerationRef = (0,
|
|
2650
|
+
const bodyRef = (0, import_react17.useRef)(null);
|
|
2651
|
+
const retainedBodyDimensionsRef = (0, import_react17.useRef)(null);
|
|
2652
|
+
const captureGenerationRef = (0, import_react17.useRef)(0);
|
|
2724
2653
|
const trayPreviewEntry = (0, import_window_host5.getTrayPreviewEntry)(trayRegistryKey);
|
|
2725
2654
|
const effectiveTrayCapture = captureTraySnapshot ?? trayPreviewEntry.captureTraySnapshot ?? (trayPreviewEntry.Preview ? void 0 : defaultTraySnapshotCapture);
|
|
2726
|
-
const [pendingTrayCapture, setPendingTrayCapture] = (0,
|
|
2727
|
-
const [trayPreviewData, setTrayPreviewData] = (0,
|
|
2728
|
-
const handleMinimize = (0,
|
|
2655
|
+
const [pendingTrayCapture, setPendingTrayCapture] = (0, import_react17.useState)(null);
|
|
2656
|
+
const [trayPreviewData, setTrayPreviewData] = (0, import_react17.useState)(void 0);
|
|
2657
|
+
const handleMinimize = (0, import_react17.useCallback)(() => {
|
|
2729
2658
|
let collected;
|
|
2730
2659
|
try {
|
|
2731
2660
|
collected = onCollectData?.();
|
|
@@ -2765,7 +2694,7 @@ function WindowPanel({
|
|
|
2765
2694
|
preservationEnabled,
|
|
2766
2695
|
trayRegistryKey
|
|
2767
2696
|
]);
|
|
2768
|
-
(0,
|
|
2697
|
+
(0, import_react17.useEffect)(() => {
|
|
2769
2698
|
if (windowState !== "minimized" || !pendingTrayCapture) return void 0;
|
|
2770
2699
|
const bodyEl = bodyRef.current;
|
|
2771
2700
|
if (!bodyEl) {
|
|
@@ -2797,20 +2726,20 @@ function WindowPanel({
|
|
|
2797
2726
|
if (timeoutId) clearTimeout(timeoutId);
|
|
2798
2727
|
};
|
|
2799
2728
|
}, [id, pendingTrayCapture, ports, windowState]);
|
|
2800
|
-
const handleRestoreClearingSnapshot = (0,
|
|
2729
|
+
const handleRestoreClearingSnapshot = (0, import_react17.useCallback)(() => {
|
|
2801
2730
|
captureGenerationRef.current += 1;
|
|
2802
2731
|
setPendingTrayCapture(null);
|
|
2803
2732
|
clearTraySnapshot(id);
|
|
2804
2733
|
onRestore();
|
|
2805
2734
|
}, [id, onRestore]);
|
|
2806
|
-
(0,
|
|
2735
|
+
(0, import_react17.useEffect)(() => {
|
|
2807
2736
|
return () => {
|
|
2808
2737
|
captureGenerationRef.current += 1;
|
|
2809
2738
|
clearTraySnapshot(id);
|
|
2810
2739
|
};
|
|
2811
2740
|
}, [id]);
|
|
2812
|
-
const previousTrayStateRef = (0,
|
|
2813
|
-
(0,
|
|
2741
|
+
const previousTrayStateRef = (0, import_react17.useRef)(windowState);
|
|
2742
|
+
(0, import_react17.useEffect)(() => {
|
|
2814
2743
|
const wasMinimized = previousTrayStateRef.current === "minimized";
|
|
2815
2744
|
previousTrayStateRef.current = windowState;
|
|
2816
2745
|
if (!wasMinimized || windowState === "minimized") return;
|
|
@@ -2822,9 +2751,9 @@ function WindowPanel({
|
|
|
2822
2751
|
);
|
|
2823
2752
|
});
|
|
2824
2753
|
}, [id, windowState]);
|
|
2825
|
-
const prevStateRef = (0,
|
|
2826
|
-
const prevPopoutModeRef = (0,
|
|
2827
|
-
(0,
|
|
2754
|
+
const prevStateRef = (0, import_react17.useRef)(windowState);
|
|
2755
|
+
const prevPopoutModeRef = (0, import_react17.useRef)(popoutMode);
|
|
2756
|
+
(0, import_react17.useEffect)(() => {
|
|
2828
2757
|
const wasNonWindowed = prevStateRef.current !== "windowed" || prevPopoutModeRef.current !== null;
|
|
2829
2758
|
const isNowWindowed = windowState === "windowed" && popoutMode === null;
|
|
2830
2759
|
prevStateRef.current = windowState;
|
|
@@ -2838,7 +2767,7 @@ function WindowPanel({
|
|
|
2838
2767
|
const isMinimized = windowState === "minimized";
|
|
2839
2768
|
const isMaximized = windowState === "maximized";
|
|
2840
2769
|
const isPopoutCandidate = popoutCandidateId === id;
|
|
2841
|
-
(0,
|
|
2770
|
+
(0, import_react17.useEffect)(() => {
|
|
2842
2771
|
if (!isMobile || !isMinimized) return;
|
|
2843
2772
|
let cancelled = false;
|
|
2844
2773
|
queueMicrotask(() => {
|
|
@@ -3190,8 +3119,8 @@ function WindowPanel({
|
|
|
3190
3119
|
] });
|
|
3191
3120
|
}
|
|
3192
3121
|
function BodyMount({ host }) {
|
|
3193
|
-
const slotRef = (0,
|
|
3194
|
-
(0,
|
|
3122
|
+
const slotRef = (0, import_react17.useRef)(null);
|
|
3123
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
3195
3124
|
const slot2 = slotRef.current;
|
|
3196
3125
|
if (!slot2 || !host) return void 0;
|
|
3197
3126
|
slot2.appendChild(host);
|
|
@@ -3467,9 +3396,9 @@ function GreenTrafficLight({
|
|
|
3467
3396
|
onSaveWindowState,
|
|
3468
3397
|
onPopOut
|
|
3469
3398
|
}) {
|
|
3470
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
3471
|
-
const leaveTimer = (0,
|
|
3472
|
-
const containerRef = (0,
|
|
3399
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react17.useState)(false);
|
|
3400
|
+
const leaveTimer = (0, import_react17.useRef)(null);
|
|
3401
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
3473
3402
|
const openDropdown = () => {
|
|
3474
3403
|
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
3475
3404
|
setDropdownOpen(true);
|
|
@@ -3483,7 +3412,7 @@ function GreenTrafficLight({
|
|
|
3483
3412
|
fn();
|
|
3484
3413
|
setDropdownOpen(false);
|
|
3485
3414
|
};
|
|
3486
|
-
(0,
|
|
3415
|
+
(0, import_react17.useEffect)(() => {
|
|
3487
3416
|
if (!dropdownOpen) return void 0;
|
|
3488
3417
|
const onPointerOutside = (e) => {
|
|
3489
3418
|
const target = e.target;
|