@gustavolmo/react-window-manager 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +220 -55
- package/dist/index.js.map +1 -1
- package/dist/window-manager/internal/features/docking/docking-area-orchestrator.d.ts +1 -0
- package/dist/window-manager/internal/features/docking/docking-area-orchestrator.d.ts.map +1 -0
- package/dist/window-manager/internal/features/docking/docking-controls.d.ts.map +1 -1
- package/dist/window-manager/internal/features/drag/drag-api.d.ts.map +1 -1
- package/dist/window-manager/internal/features/history/history-api.d.ts +6 -0
- package/dist/window-manager/internal/features/history/history-api.d.ts.map +1 -0
- package/dist/window-manager/internal/features/history/history-keys-listener.d.ts +2 -0
- package/dist/window-manager/internal/features/history/history-keys-listener.d.ts.map +1 -0
- package/dist/window-manager/internal/features/resizing/resizing-api.d.ts.map +1 -1
- package/dist/window-manager/internal/features/window-layout.d.ts.map +1 -1
- package/dist/window-manager/internal/features/workspace/workspace-resize-listener.d.ts.map +1 -1
- package/dist/window-manager/internal/runtime/dock-resolver/dock-commands.d.ts.map +1 -1
- package/dist/window-manager/internal/runtime/history-resolver/app-history.d.ts +13 -0
- package/dist/window-manager/internal/runtime/history-resolver/app-history.d.ts.map +1 -0
- package/dist/window-manager/internal/runtime/history-resolver/history-commands.d.ts +6 -0
- package/dist/window-manager/internal/runtime/history-resolver/history-commands.d.ts.map +1 -0
- package/dist/window-manager/internal/runtime/rwm-runtime.d.ts +10 -1
- package/dist/window-manager/internal/runtime/rwm-runtime.d.ts.map +1 -1
- package/dist/window-manager/registration/window-store-factory.d.ts.map +1 -1
- package/dist/window-manager/workspace-layout.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -804,6 +804,117 @@ var getRafResizeDependencies = (winId) => {
|
|
|
804
804
|
return { wsRect, win, winBox, x, y };
|
|
805
805
|
};
|
|
806
806
|
|
|
807
|
+
// src/window-manager/internal/runtime/history-resolver/app-history.ts
|
|
808
|
+
var MAX_HISTORY = 100;
|
|
809
|
+
var excludedCommands = [
|
|
810
|
+
"UPDATE_WORKSPACE_SIZE",
|
|
811
|
+
"SET_RESPONSIVE_BREAK",
|
|
812
|
+
"SET_WORKSPACE_FEATURES",
|
|
813
|
+
"APPLY_PREVIOUS",
|
|
814
|
+
"APPLY_NEXT",
|
|
815
|
+
"ENABLE_DRAG",
|
|
816
|
+
"ENABLE_RESIZE"
|
|
817
|
+
];
|
|
818
|
+
var appHistory = {
|
|
819
|
+
snapshots: [],
|
|
820
|
+
ptr: -1
|
|
821
|
+
};
|
|
822
|
+
function saveSnapshot(cmd) {
|
|
823
|
+
if (excludedCommands.includes(cmd))
|
|
824
|
+
return;
|
|
825
|
+
const snapshot = getSnapshot();
|
|
826
|
+
if (!snapshot)
|
|
827
|
+
return;
|
|
828
|
+
if (appHistory.ptr < appHistory.snapshots.length - 1) {
|
|
829
|
+
appHistory.snapshots = appHistory.snapshots.slice(0, appHistory.ptr + 1);
|
|
830
|
+
}
|
|
831
|
+
appHistory.snapshots.push(snapshot);
|
|
832
|
+
if (appHistory.snapshots.length > MAX_HISTORY) {
|
|
833
|
+
appHistory.snapshots.shift();
|
|
834
|
+
}
|
|
835
|
+
appHistory.ptr = appHistory.snapshots.length - 1;
|
|
836
|
+
}
|
|
837
|
+
var getSnapshot = () => {
|
|
838
|
+
const { wsElement, setWsElement, ...wsSnapshot } = useWorkspaceState.getState();
|
|
839
|
+
const wsUpdate = structuredClone(wsSnapshot);
|
|
840
|
+
const winStateSnapshots = [];
|
|
841
|
+
for (const key of Object.keys(windowRegistry)) {
|
|
842
|
+
const { winElement, setWinElement, isDragging, resizeAction, ...windowSnapshot } = windowRegistry[key].getState();
|
|
843
|
+
winStateSnapshots.push(structuredClone(windowSnapshot));
|
|
844
|
+
}
|
|
845
|
+
if (!isValidSnapshot(winStateSnapshots)) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
ws: wsUpdate,
|
|
850
|
+
winState: winStateSnapshots
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
var isValidSnapshot = (winStateSnapshots) => {
|
|
854
|
+
if (appHistory.ptr < 0)
|
|
855
|
+
return true;
|
|
856
|
+
const prevSnapshot = appHistory.snapshots[appHistory.ptr].winState;
|
|
857
|
+
for (const newWinState of winStateSnapshots) {
|
|
858
|
+
for (const prevWinState of prevSnapshot) {
|
|
859
|
+
if (newWinState.windowId !== prevWinState.windowId)
|
|
860
|
+
continue;
|
|
861
|
+
if (newWinState.zIndex !== prevWinState.zIndex || newWinState.winVisualState !== prevWinState.winVisualState || newWinState.isWindowClosed !== prevWinState.isWindowClosed || newWinState.winCoord?.pointX !== prevWinState.winCoord?.pointX || newWinState.winCoord?.pointY !== prevWinState.winCoord?.pointY || newWinState.winWidth !== prevWinState.winWidth || newWinState.winHeight !== prevWinState.winHeight)
|
|
862
|
+
return true;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return false;
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
// src/window-manager/internal/runtime/history-resolver/history-commands.ts
|
|
869
|
+
var historyCommandResolver = {
|
|
870
|
+
APPLY_PREVIOUS: () => {
|
|
871
|
+
if (appHistory.ptr <= 0)
|
|
872
|
+
return { ws: {}, win: [] };
|
|
873
|
+
appHistory.ptr -= 1;
|
|
874
|
+
const snapshot = appHistory.snapshots[appHistory.ptr];
|
|
875
|
+
const wsUpdate = snapshot.ws;
|
|
876
|
+
const winBatchUpdate = [];
|
|
877
|
+
snapshot.winState.forEach((win) => {
|
|
878
|
+
const { windowId, setWinElement, ...state } = win;
|
|
879
|
+
winBatchUpdate.push({
|
|
880
|
+
winId: windowId,
|
|
881
|
+
patch: { ...state }
|
|
882
|
+
});
|
|
883
|
+
});
|
|
884
|
+
return {
|
|
885
|
+
ws: wsUpdate,
|
|
886
|
+
win: winBatchUpdate
|
|
887
|
+
};
|
|
888
|
+
},
|
|
889
|
+
APPLY_NEXT: () => {
|
|
890
|
+
if (appHistory.ptr >= appHistory.snapshots.length - 1)
|
|
891
|
+
return { ws: {}, win: [] };
|
|
892
|
+
appHistory.ptr += 1;
|
|
893
|
+
const snapshot = appHistory.snapshots[appHistory.ptr];
|
|
894
|
+
const wsUpdate = snapshot.ws;
|
|
895
|
+
const winBatchUpdate = [];
|
|
896
|
+
snapshot.winState.forEach((win) => {
|
|
897
|
+
const { windowId, setWinElement, ...state } = win;
|
|
898
|
+
winBatchUpdate.push({
|
|
899
|
+
winId: windowId,
|
|
900
|
+
patch: { ...state }
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
return {
|
|
904
|
+
ws: wsUpdate,
|
|
905
|
+
win: winBatchUpdate
|
|
906
|
+
};
|
|
907
|
+
},
|
|
908
|
+
CLEAR_HISTORY: () => {
|
|
909
|
+
appHistory.ptr = -1;
|
|
910
|
+
appHistory.snapshots = [];
|
|
911
|
+
return {
|
|
912
|
+
ws: {},
|
|
913
|
+
win: []
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
|
|
807
918
|
// src/window-manager/internal/runtime/rwm-runtime.ts
|
|
808
919
|
var rwmRuntime = {
|
|
809
920
|
dispatch: ({ subsystem, cmd, targetWinId, ctx }) => {
|
|
@@ -836,11 +947,17 @@ var rwmRuntime = {
|
|
|
836
947
|
commitBatch(stagedChanges);
|
|
837
948
|
break;
|
|
838
949
|
}
|
|
950
|
+
case "HISTORY": {
|
|
951
|
+
const stagedChanges = historyCommandResolver[cmd]();
|
|
952
|
+
commitBatch(stagedChanges);
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
839
955
|
default:
|
|
840
956
|
throw new Error(
|
|
841
957
|
`Unregistered rwmRuntime subsystem called: ${{ subsystem, cmd, targetWinId, ctx }}`
|
|
842
958
|
);
|
|
843
959
|
}
|
|
960
|
+
saveSnapshot(cmd);
|
|
844
961
|
}
|
|
845
962
|
};
|
|
846
963
|
var rafRuntime = {
|
|
@@ -1012,7 +1129,7 @@ var rwm = {
|
|
|
1012
1129
|
var rwm_default = rwm;
|
|
1013
1130
|
|
|
1014
1131
|
// src/window-manager/workspace-layout.tsx
|
|
1015
|
-
import { useEffect as
|
|
1132
|
+
import { useEffect as useEffect4, useRef } from "react";
|
|
1016
1133
|
|
|
1017
1134
|
// src/window-manager/internal/features/docking/docking-controls.tsx
|
|
1018
1135
|
import { useState } from "react";
|
|
@@ -1138,6 +1255,9 @@ var resizeApi = {
|
|
|
1138
1255
|
rafRuntime.dispatch({ targetWinId: winId, subsystem: "RAF_RESIZE", cmd: "LOOP_RESIZE" });
|
|
1139
1256
|
},
|
|
1140
1257
|
stopResize: (winId) => {
|
|
1258
|
+
const isNotResizing = !windowRegistry[winId].getState().resizeAction;
|
|
1259
|
+
if (isNotResizing)
|
|
1260
|
+
return;
|
|
1141
1261
|
rwmRuntime.dispatch({
|
|
1142
1262
|
targetWinId: winId,
|
|
1143
1263
|
subsystem: "RESIZE",
|
|
@@ -1164,6 +1284,21 @@ function CursorMoveListener() {
|
|
|
1164
1284
|
|
|
1165
1285
|
// src/window-manager/internal/features/workspace/workspace-resize-listener.tsx
|
|
1166
1286
|
import { useEffect as useEffect2 } from "react";
|
|
1287
|
+
|
|
1288
|
+
// src/window-manager/internal/features/history/history-api.ts
|
|
1289
|
+
var appHistoryApi = {
|
|
1290
|
+
moveToPreviousSnapshot: () => {
|
|
1291
|
+
rwmRuntime.dispatch({ subsystem: "HISTORY", cmd: "APPLY_PREVIOUS" });
|
|
1292
|
+
},
|
|
1293
|
+
moveToNextSnapshot: () => {
|
|
1294
|
+
rwmRuntime.dispatch({ subsystem: "HISTORY", cmd: "APPLY_NEXT" });
|
|
1295
|
+
},
|
|
1296
|
+
clearHistory: () => {
|
|
1297
|
+
rwmRuntime.dispatch({ subsystem: "HISTORY", cmd: "CLEAR_HISTORY" });
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
// src/window-manager/internal/features/workspace/workspace-resize-listener.tsx
|
|
1167
1302
|
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
1168
1303
|
function WorkspaceResizeListener() {
|
|
1169
1304
|
const { wsElement } = useWorkspaceState();
|
|
@@ -1172,6 +1307,7 @@ function WorkspaceResizeListener() {
|
|
|
1172
1307
|
return;
|
|
1173
1308
|
const onResize = () => {
|
|
1174
1309
|
wsApi.updateWsSize();
|
|
1310
|
+
appHistoryApi.clearHistory();
|
|
1175
1311
|
};
|
|
1176
1312
|
onResize();
|
|
1177
1313
|
const observer = new ResizeObserver(onResize);
|
|
@@ -1192,6 +1328,9 @@ var dragApi = {
|
|
|
1192
1328
|
rafRuntime.dispatch({ targetWinId, subsystem: "RAF_DRAG", cmd: "LOOP_DRAG" });
|
|
1193
1329
|
},
|
|
1194
1330
|
stopDrag: (targetWinId) => {
|
|
1331
|
+
const isNotDragging = !windowRegistry[targetWinId].getState().isDragging;
|
|
1332
|
+
if (isNotDragging)
|
|
1333
|
+
return;
|
|
1195
1334
|
rwmRuntime.dispatch({
|
|
1196
1335
|
targetWinId,
|
|
1197
1336
|
subsystem: "DRAG",
|
|
@@ -1200,12 +1339,36 @@ var dragApi = {
|
|
|
1200
1339
|
}
|
|
1201
1340
|
};
|
|
1202
1341
|
|
|
1342
|
+
// src/window-manager/internal/features/history/history-keys-listener.tsx
|
|
1343
|
+
import { useEffect as useEffect3 } from "react";
|
|
1344
|
+
import { Fragment as Fragment4, jsx as jsx4 } from "react/jsx-runtime";
|
|
1345
|
+
function HistoryKeysListener() {
|
|
1346
|
+
useEffect3(() => {
|
|
1347
|
+
const handleKeyDown = (e) => {
|
|
1348
|
+
const ctrlOrCmd = e.metaKey || e.ctrlKey;
|
|
1349
|
+
if (!ctrlOrCmd)
|
|
1350
|
+
return;
|
|
1351
|
+
if (e.key.toLowerCase() === "z" && !e.shiftKey) {
|
|
1352
|
+
e.preventDefault();
|
|
1353
|
+
appHistoryApi.moveToPreviousSnapshot();
|
|
1354
|
+
}
|
|
1355
|
+
if (e.key.toLowerCase() === "z" && e.shiftKey) {
|
|
1356
|
+
e.preventDefault();
|
|
1357
|
+
appHistoryApi.moveToNextSnapshot();
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1361
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1362
|
+
}, []);
|
|
1363
|
+
return /* @__PURE__ */ jsx4(Fragment4, {});
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1203
1366
|
// src/window-manager/workspace-layout.tsx
|
|
1204
|
-
import { jsx as
|
|
1367
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1205
1368
|
function WorkspaceLayout({ children, className }) {
|
|
1206
1369
|
const { setWsElement, wsElement, isBelowBreakPoint, activeWindowId } = useWorkspaceState();
|
|
1207
1370
|
const workspaceRef = useRef(null);
|
|
1208
|
-
|
|
1371
|
+
useEffect4(() => {
|
|
1209
1372
|
if (!workspaceRef.current)
|
|
1210
1373
|
return;
|
|
1211
1374
|
setWsElement(workspaceRef.current);
|
|
@@ -1223,10 +1386,11 @@ function WorkspaceLayout({ children, className }) {
|
|
|
1223
1386
|
onPointerUp: disabledDragAndResize,
|
|
1224
1387
|
className: className ? className : "fixed overflow-hidden h-full w-full touch-none -z-50",
|
|
1225
1388
|
children: [
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ jsx5(WorkspaceResizeListener, {}),
|
|
1390
|
+
/* @__PURE__ */ jsx5(HistoryKeysListener, {}),
|
|
1391
|
+
/* @__PURE__ */ jsx5(CursorMoveListener, {}),
|
|
1228
1392
|
/* @__PURE__ */ jsxs2("div", { className: " w-full h-full relative overflow-hidden", children: [
|
|
1229
|
-
!isBelowBreakPoint && /* @__PURE__ */
|
|
1393
|
+
!isBelowBreakPoint && /* @__PURE__ */ jsx5(DockingControls, {}),
|
|
1230
1394
|
children
|
|
1231
1395
|
] })
|
|
1232
1396
|
]
|
|
@@ -1238,12 +1402,12 @@ function WorkspaceLayout({ children, className }) {
|
|
|
1238
1402
|
import { create as create2 } from "zustand";
|
|
1239
1403
|
|
|
1240
1404
|
// src/window-manager/internal/features/window-layout.tsx
|
|
1241
|
-
import { useEffect as
|
|
1405
|
+
import { useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
1242
1406
|
|
|
1243
1407
|
// src/window-manager/internal/assets/svg-win-icons.tsx
|
|
1244
|
-
import { jsx as
|
|
1408
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1245
1409
|
function IconWinMaximize({ color }) {
|
|
1246
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx6(
|
|
1247
1411
|
"svg",
|
|
1248
1412
|
{
|
|
1249
1413
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1255,7 +1419,7 @@ function IconWinMaximize({ color }) {
|
|
|
1255
1419
|
stroke: color ? color : "#cccccc",
|
|
1256
1420
|
color: color ? color : "#cccccc",
|
|
1257
1421
|
className: "size-6",
|
|
1258
|
-
children: /* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ jsx6(
|
|
1259
1423
|
"path",
|
|
1260
1424
|
{
|
|
1261
1425
|
strokeLinecap: "round",
|
|
@@ -1267,7 +1431,7 @@ function IconWinMaximize({ color }) {
|
|
|
1267
1431
|
);
|
|
1268
1432
|
}
|
|
1269
1433
|
function IconWinDemaximize({ color }) {
|
|
1270
|
-
return /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsx6(
|
|
1271
1435
|
"svg",
|
|
1272
1436
|
{
|
|
1273
1437
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1279,7 +1443,7 @@ function IconWinDemaximize({ color }) {
|
|
|
1279
1443
|
stroke: color ? color : "#cccccc",
|
|
1280
1444
|
color: color ? color : "#cccccc",
|
|
1281
1445
|
className: "size-6",
|
|
1282
|
-
children: /* @__PURE__ */
|
|
1446
|
+
children: /* @__PURE__ */ jsx6(
|
|
1283
1447
|
"path",
|
|
1284
1448
|
{
|
|
1285
1449
|
strokeLinecap: "round",
|
|
@@ -1291,7 +1455,7 @@ function IconWinDemaximize({ color }) {
|
|
|
1291
1455
|
);
|
|
1292
1456
|
}
|
|
1293
1457
|
function IconWinMinimize({ color }) {
|
|
1294
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ jsx6(
|
|
1295
1459
|
"svg",
|
|
1296
1460
|
{
|
|
1297
1461
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1303,7 +1467,7 @@ function IconWinMinimize({ color }) {
|
|
|
1303
1467
|
stroke: color ? color : "#cccccc",
|
|
1304
1468
|
color: color ? color : "#cccccc",
|
|
1305
1469
|
className: "size-6",
|
|
1306
|
-
children: /* @__PURE__ */
|
|
1470
|
+
children: /* @__PURE__ */ jsx6("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18 18 6M6 6l12 12" })
|
|
1307
1471
|
}
|
|
1308
1472
|
);
|
|
1309
1473
|
}
|
|
@@ -1462,7 +1626,7 @@ var getOpenWinCount = () => {
|
|
|
1462
1626
|
};
|
|
1463
1627
|
|
|
1464
1628
|
// src/window-manager/internal/features/resizing/resizing-controls.tsx
|
|
1465
|
-
import { Fragment as
|
|
1629
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1466
1630
|
function ResizingControls({ winId }) {
|
|
1467
1631
|
const { winCoord, winWidth, winHeight, resizeAction } = windowRegistry[winId]();
|
|
1468
1632
|
const startResize = (direction) => {
|
|
@@ -1471,8 +1635,8 @@ function ResizingControls({ winId }) {
|
|
|
1471
1635
|
const stopResize = () => {
|
|
1472
1636
|
resizeApi.stopResize(winId);
|
|
1473
1637
|
};
|
|
1474
|
-
return /* @__PURE__ */ jsxs3(
|
|
1475
|
-
/* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ jsxs3(Fragment5, { children: [
|
|
1639
|
+
/* @__PURE__ */ jsx7(
|
|
1476
1640
|
"span",
|
|
1477
1641
|
{
|
|
1478
1642
|
onPointerUp: stopResize,
|
|
@@ -1484,10 +1648,10 @@ function ResizingControls({ winId }) {
|
|
|
1484
1648
|
left: `${winCoord.pointX + winWidth - 4}px`,
|
|
1485
1649
|
height: `${winHeight}px`
|
|
1486
1650
|
},
|
|
1487
|
-
children: /* @__PURE__ */
|
|
1651
|
+
children: /* @__PURE__ */ jsx7("div", { className: `w-1 h-full bg-zinc-50` })
|
|
1488
1652
|
}
|
|
1489
1653
|
),
|
|
1490
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ jsx7(
|
|
1491
1655
|
"span",
|
|
1492
1656
|
{
|
|
1493
1657
|
onPointerUp: stopResize,
|
|
@@ -1499,10 +1663,10 @@ function ResizingControls({ winId }) {
|
|
|
1499
1663
|
left: `${winCoord.pointX - 4}px`,
|
|
1500
1664
|
height: `${winHeight}px`
|
|
1501
1665
|
},
|
|
1502
|
-
children: /* @__PURE__ */
|
|
1666
|
+
children: /* @__PURE__ */ jsx7("div", { className: `w-1 h-full bg-zinc-50` })
|
|
1503
1667
|
}
|
|
1504
1668
|
),
|
|
1505
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ jsx7(
|
|
1506
1670
|
"span",
|
|
1507
1671
|
{
|
|
1508
1672
|
onPointerUp: stopResize,
|
|
@@ -1514,10 +1678,10 @@ function ResizingControls({ winId }) {
|
|
|
1514
1678
|
left: `${winCoord.pointX}px`,
|
|
1515
1679
|
width: `${winWidth}px`
|
|
1516
1680
|
},
|
|
1517
|
-
children: /* @__PURE__ */
|
|
1681
|
+
children: /* @__PURE__ */ jsx7("div", { className: `w-full h-1 bg-zinc-50` })
|
|
1518
1682
|
}
|
|
1519
1683
|
),
|
|
1520
|
-
/* @__PURE__ */
|
|
1684
|
+
/* @__PURE__ */ jsx7(
|
|
1521
1685
|
"span",
|
|
1522
1686
|
{
|
|
1523
1687
|
onPointerUp: stopResize,
|
|
@@ -1529,10 +1693,10 @@ function ResizingControls({ winId }) {
|
|
|
1529
1693
|
left: `${winCoord.pointX}px`,
|
|
1530
1694
|
width: `${winWidth}px`
|
|
1531
1695
|
},
|
|
1532
|
-
children: /* @__PURE__ */
|
|
1696
|
+
children: /* @__PURE__ */ jsx7("div", { className: `w-full h-1 bg-zinc-50` })
|
|
1533
1697
|
}
|
|
1534
1698
|
),
|
|
1535
|
-
/* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ jsx7(
|
|
1536
1700
|
"span",
|
|
1537
1701
|
{
|
|
1538
1702
|
onPointerUp: stopResize,
|
|
@@ -1545,7 +1709,7 @@ function ResizingControls({ winId }) {
|
|
|
1545
1709
|
}
|
|
1546
1710
|
}
|
|
1547
1711
|
),
|
|
1548
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsx7(
|
|
1549
1713
|
"span",
|
|
1550
1714
|
{
|
|
1551
1715
|
onPointerUp: stopResize,
|
|
@@ -1558,7 +1722,7 @@ function ResizingControls({ winId }) {
|
|
|
1558
1722
|
}
|
|
1559
1723
|
}
|
|
1560
1724
|
),
|
|
1561
|
-
/* @__PURE__ */
|
|
1725
|
+
/* @__PURE__ */ jsx7(
|
|
1562
1726
|
"span",
|
|
1563
1727
|
{
|
|
1564
1728
|
onPointerUp: stopResize,
|
|
@@ -1566,12 +1730,12 @@ function ResizingControls({ winId }) {
|
|
|
1566
1730
|
id: "win-resize-top-right-all",
|
|
1567
1731
|
className: "fixed h-3 w-3 opacity-60 cursor-ne-resize z-20",
|
|
1568
1732
|
style: {
|
|
1569
|
-
top: `${winCoord.pointY -
|
|
1570
|
-
left: `${winCoord.pointX + winWidth -
|
|
1733
|
+
top: `${winCoord.pointY - 8}px`,
|
|
1734
|
+
left: `${winCoord.pointX + winWidth - 8}px`
|
|
1571
1735
|
}
|
|
1572
1736
|
}
|
|
1573
1737
|
),
|
|
1574
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ jsx7(
|
|
1575
1739
|
"span",
|
|
1576
1740
|
{
|
|
1577
1741
|
onPointerUp: stopResize,
|
|
@@ -1579,8 +1743,8 @@ function ResizingControls({ winId }) {
|
|
|
1579
1743
|
id: "win-resize-top-left-all",
|
|
1580
1744
|
className: "fixed h-3 w-3 opacity-60 cursor-nw-resize z-20",
|
|
1581
1745
|
style: {
|
|
1582
|
-
top: `${winCoord.pointY -
|
|
1583
|
-
left: `${winCoord.pointX -
|
|
1746
|
+
top: `${winCoord.pointY - 8}px`,
|
|
1747
|
+
left: `${winCoord.pointX - 8}px`
|
|
1584
1748
|
}
|
|
1585
1749
|
}
|
|
1586
1750
|
)
|
|
@@ -1588,9 +1752,9 @@ function ResizingControls({ winId }) {
|
|
|
1588
1752
|
}
|
|
1589
1753
|
|
|
1590
1754
|
// src/window-manager/internal/features/drag/drag-handle.tsx
|
|
1591
|
-
import { jsx as
|
|
1755
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1592
1756
|
function DragHandle({ winId }) {
|
|
1593
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ jsx8(
|
|
1594
1758
|
"div",
|
|
1595
1759
|
{
|
|
1596
1760
|
onPointerDown: () => dragApi.startDrag(winId),
|
|
@@ -1604,7 +1768,7 @@ function DragHandle({ winId }) {
|
|
|
1604
1768
|
}
|
|
1605
1769
|
|
|
1606
1770
|
// src/window-manager/internal/features/window-layout.tsx
|
|
1607
|
-
import { Fragment as
|
|
1771
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1608
1772
|
function WindowLayout({
|
|
1609
1773
|
children,
|
|
1610
1774
|
windowName,
|
|
@@ -1628,11 +1792,12 @@ function WindowLayout({
|
|
|
1628
1792
|
winWidth,
|
|
1629
1793
|
winHeight
|
|
1630
1794
|
} = windowRegistry[winId]();
|
|
1631
|
-
|
|
1795
|
+
useEffect5(() => {
|
|
1632
1796
|
setWinElement(windowRef.current);
|
|
1633
1797
|
}, [setWinElement]);
|
|
1634
|
-
|
|
1798
|
+
useEffect5(() => {
|
|
1635
1799
|
dockingResolver[defaultDock](winId);
|
|
1800
|
+
appHistoryApi.clearHistory();
|
|
1636
1801
|
}, [wsElement]);
|
|
1637
1802
|
const dockingResolver = {
|
|
1638
1803
|
right: dockApi.dockWindowRight,
|
|
@@ -1646,30 +1811,30 @@ function WindowLayout({
|
|
|
1646
1811
|
"bottom-left": dockApi.dockWindowBottomLeft,
|
|
1647
1812
|
default: dockApi.demaximizeWindow
|
|
1648
1813
|
};
|
|
1649
|
-
const maximizeControl = winVisualState === "maximized" ? /* @__PURE__ */
|
|
1814
|
+
const maximizeControl = winVisualState === "maximized" ? /* @__PURE__ */ jsx9(
|
|
1650
1815
|
"button",
|
|
1651
1816
|
{
|
|
1652
1817
|
className: `block hover:bg-gray-500 hover:bg-opacity-10 px-5 h-full`,
|
|
1653
1818
|
onClick: () => dockApi.demaximizeWindow(winId),
|
|
1654
|
-
children: /* @__PURE__ */
|
|
1819
|
+
children: /* @__PURE__ */ jsx9(IconWinDemaximize, { color: style?.navControlsColor })
|
|
1655
1820
|
}
|
|
1656
|
-
) : /* @__PURE__ */
|
|
1821
|
+
) : /* @__PURE__ */ jsx9(
|
|
1657
1822
|
"button",
|
|
1658
1823
|
{
|
|
1659
1824
|
className: `block hover:bg-gray-500 hover:bg-opacity-10 px-5 h-full`,
|
|
1660
1825
|
onClick: () => dockApi.maximizeWindow(winId),
|
|
1661
|
-
children: /* @__PURE__ */
|
|
1826
|
+
children: /* @__PURE__ */ jsx9(IconWinMaximize, { color: style?.navControlsColor })
|
|
1662
1827
|
}
|
|
1663
1828
|
);
|
|
1664
|
-
const closeControl = /* @__PURE__ */
|
|
1829
|
+
const closeControl = /* @__PURE__ */ jsx9(
|
|
1665
1830
|
"button",
|
|
1666
1831
|
{
|
|
1667
1832
|
className: "hover:bg-red-500 hover:bg-opacity-20 px-5 h-full",
|
|
1668
1833
|
onClick: () => focusApi.closeWindowAndRefocus(winId),
|
|
1669
|
-
children: /* @__PURE__ */
|
|
1834
|
+
children: /* @__PURE__ */ jsx9(IconWinMinimize, { color: style?.navControlsColor })
|
|
1670
1835
|
}
|
|
1671
1836
|
);
|
|
1672
|
-
return /* @__PURE__ */ jsxs4(
|
|
1837
|
+
return /* @__PURE__ */ jsxs4(Fragment6, { children: [
|
|
1673
1838
|
/* @__PURE__ */ jsxs4(
|
|
1674
1839
|
"div",
|
|
1675
1840
|
{
|
|
@@ -1701,16 +1866,16 @@ function WindowLayout({
|
|
|
1701
1866
|
${navbarClassName ? navbarClassName : `bg-neutral-800 ${isActive ? "brightness-100" : "brightness-150"}`}
|
|
1702
1867
|
`,
|
|
1703
1868
|
children: [
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsx9("div", { className: "shrink h-8 px-2 text-white flex items-center text-sm truncate min-w-0", children: windowName }),
|
|
1870
|
+
/* @__PURE__ */ jsx9("div", { className: "h-8 px-2 text-white flex items-center text-sm truncate min-w-0", children: navbarChildren }),
|
|
1871
|
+
/* @__PURE__ */ jsx9(DragHandle, { winId }),
|
|
1707
1872
|
!isBelowBreakPoint && maximizeControl,
|
|
1708
1873
|
closeControl
|
|
1709
1874
|
]
|
|
1710
1875
|
}
|
|
1711
1876
|
),
|
|
1712
|
-
!isBelowBreakPoint && /* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1877
|
+
!isBelowBreakPoint && /* @__PURE__ */ jsx9(ResizingControls, { winId }),
|
|
1878
|
+
/* @__PURE__ */ jsx9("div", { className: `relative w-full h-[calc(100%-32px)] overflow-auto select-text`, children })
|
|
1714
1879
|
]
|
|
1715
1880
|
}
|
|
1716
1881
|
),
|
|
@@ -1719,7 +1884,7 @@ function WindowLayout({
|
|
|
1719
1884
|
}
|
|
1720
1885
|
|
|
1721
1886
|
// src/window-manager/internal/features/window-button.tsx
|
|
1722
|
-
import { jsx as
|
|
1887
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1723
1888
|
function WindowButton({
|
|
1724
1889
|
children,
|
|
1725
1890
|
winId,
|
|
@@ -1736,7 +1901,7 @@ function WindowButton({
|
|
|
1736
1901
|
focusApi.bringWindowToFocus(windowId);
|
|
1737
1902
|
}
|
|
1738
1903
|
};
|
|
1739
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ jsx10(
|
|
1740
1905
|
"button",
|
|
1741
1906
|
{
|
|
1742
1907
|
id: `${windowId}_button`,
|
|
@@ -1751,7 +1916,7 @@ function WindowButton({
|
|
|
1751
1916
|
}
|
|
1752
1917
|
|
|
1753
1918
|
// src/window-manager/registration/window-store-factory.tsx
|
|
1754
|
-
import { jsx as
|
|
1919
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1755
1920
|
var defaultMinWidth = 256;
|
|
1756
1921
|
var defaultMinHeight = 64;
|
|
1757
1922
|
var createWindowStore = () => {
|
|
@@ -1767,8 +1932,8 @@ var createWindowStore = () => {
|
|
|
1767
1932
|
winHeight: defaultMinHeight,
|
|
1768
1933
|
winVisualState: "demaximized",
|
|
1769
1934
|
isActive: false,
|
|
1770
|
-
isDragging: false,
|
|
1771
1935
|
isWindowClosed: true,
|
|
1936
|
+
isDragging: false,
|
|
1772
1937
|
resizeAction: false,
|
|
1773
1938
|
WIN_MIN_WIDTH: defaultMinWidth,
|
|
1774
1939
|
WIN_MIN_HEIGHT: defaultMinHeight
|
|
@@ -1777,8 +1942,8 @@ var createWindowStore = () => {
|
|
|
1777
1942
|
return {
|
|
1778
1943
|
id: storeInstance.getState().windowId,
|
|
1779
1944
|
store: storeInstance,
|
|
1780
|
-
Window: (props) => /* @__PURE__ */
|
|
1781
|
-
Button: (props) => /* @__PURE__ */
|
|
1945
|
+
Window: (props) => /* @__PURE__ */ jsx11(WindowLayout, { ...props, winId: windowInstanceId }),
|
|
1946
|
+
Button: (props) => /* @__PURE__ */ jsx11(WindowButton, { ...props, winId: windowInstanceId })
|
|
1782
1947
|
};
|
|
1783
1948
|
};
|
|
1784
1949
|
export {
|