ywana-core8 0.2.5 → 0.2.8
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 +1134 -54
- package/dist/index.js +293 -90
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +293 -90
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +293 -90
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/ApplicationMenu.css +153 -54
- package/src/desktop/ApplicationMenu.js +75 -69
- package/src/desktop/Desktop.stories.jsx +256 -11
- package/src/desktop/WindowContext.js +4 -0
- package/src/desktop/WindowManager.js +54 -9
- package/src/desktop/desktop-linux.css +287 -0
- package/src/desktop/desktop-macos.css +317 -0
- package/src/desktop/desktop-windows.css +244 -0
- package/src/desktop/desktop.css +30 -0
- package/src/desktop/desktop.js +107 -67
- package/src/desktop/window.css +98 -0
- package/src/desktop/window.js +172 -4
- package/src/html/button.css +5 -0
- package/src/html/button.js +2 -1
package/dist/index.js
CHANGED
@@ -1987,7 +1987,9 @@ const Button = (props) => {
|
|
1987
1987
|
icon: loading ? "hourglass_empty" : icon,
|
1988
1988
|
size: size === "small" ? "small" : size === "large" ? "normal" : "small",
|
1989
1989
|
disabled: disabled || loading,
|
1990
|
-
className: loading ? "loading-icon" : ""
|
1990
|
+
className: loading ? "loading-icon" : "",
|
1991
|
+
eventPropagation: true
|
1992
|
+
// Allow click events to bubble up to button
|
1991
1993
|
};
|
1992
1994
|
return /* @__PURE__ */ React.createElement(
|
1993
1995
|
"button",
|
@@ -31710,6 +31712,7 @@ class WindowManager {
|
|
31710
31712
|
this.windows = /* @__PURE__ */ new Map();
|
31711
31713
|
this.activeWindowId = null;
|
31712
31714
|
this.nextZIndex = 1e3;
|
31715
|
+
this.maxZIndex = 9999;
|
31713
31716
|
this.listeners = /* @__PURE__ */ new Set();
|
31714
31717
|
this.desktopSize = desktopSize;
|
31715
31718
|
}
|
@@ -31771,7 +31774,7 @@ class WindowManager {
|
|
31771
31774
|
size,
|
31772
31775
|
minimized: false,
|
31773
31776
|
maximized: false,
|
31774
|
-
zIndex: this.nextZIndex++,
|
31777
|
+
zIndex: Math.min(this.nextZIndex++, this.maxZIndex),
|
31775
31778
|
...config
|
31776
31779
|
};
|
31777
31780
|
this.windows.set(window2.id, window2);
|
@@ -31790,7 +31793,7 @@ class WindowManager {
|
|
31790
31793
|
let x = baseX + existingWindows.length * offsetStep;
|
31791
31794
|
let y = baseY + existingWindows.length * offsetStep;
|
31792
31795
|
const maxX = this.desktopSize.width - windowSize.width - 20;
|
31793
|
-
const maxY = this.desktopSize.height - windowSize.height -
|
31796
|
+
const maxY = this.desktopSize.height - windowSize.height - 20;
|
31794
31797
|
if (x > maxX || y > maxY) {
|
31795
31798
|
const cascadeIndex = existingWindows.length % 8;
|
31796
31799
|
x = baseX + cascadeIndex * 30;
|
@@ -31826,7 +31829,10 @@ class WindowManager {
|
|
31826
31829
|
if (window2.minimized) {
|
31827
31830
|
window2.minimized = false;
|
31828
31831
|
}
|
31829
|
-
|
31832
|
+
if (this.nextZIndex >= this.maxZIndex) {
|
31833
|
+
this.resetZIndexes();
|
31834
|
+
}
|
31835
|
+
window2.zIndex = Math.min(this.nextZIndex++, this.maxZIndex);
|
31830
31836
|
this.activeWindowId = windowId;
|
31831
31837
|
this.notifyListeners();
|
31832
31838
|
return true;
|
@@ -31869,6 +31875,24 @@ class WindowManager {
|
|
31869
31875
|
this.notifyListeners();
|
31870
31876
|
return true;
|
31871
31877
|
}
|
31878
|
+
/**
|
31879
|
+
* Update window size
|
31880
|
+
*/
|
31881
|
+
updateWindowSize(windowId, size) {
|
31882
|
+
const window2 = this.windows.get(windowId);
|
31883
|
+
if (!window2) return false;
|
31884
|
+
const minWidth = 200;
|
31885
|
+
const minHeight = 150;
|
31886
|
+
const maxWidth = this.desktopSize.width;
|
31887
|
+
const maxHeight = this.desktopSize.height;
|
31888
|
+
const constrainedSize = {
|
31889
|
+
width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
|
31890
|
+
height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
|
31891
|
+
};
|
31892
|
+
window2.size = { ...window2.size, ...constrainedSize };
|
31893
|
+
this.notifyListeners();
|
31894
|
+
return true;
|
31895
|
+
}
|
31872
31896
|
/**
|
31873
31897
|
* Get all windows
|
31874
31898
|
*/
|
@@ -31896,7 +31920,7 @@ class WindowManager {
|
|
31896
31920
|
this.windows.forEach((window2) => {
|
31897
31921
|
if (window2.maximized) return;
|
31898
31922
|
const maxX = this.desktopSize.width - window2.size.width;
|
31899
|
-
const maxY = this.desktopSize.height - window2.size.height
|
31923
|
+
const maxY = this.desktopSize.height - window2.size.height;
|
31900
31924
|
if (window2.position.x > maxX) {
|
31901
31925
|
window2.position.x = Math.max(0, maxX);
|
31902
31926
|
}
|
@@ -31931,7 +31955,7 @@ class WindowManager {
|
|
31931
31955
|
const cols = Math.ceil(Math.sqrt(visibleWindows.length));
|
31932
31956
|
const rows = Math.ceil(visibleWindows.length / cols);
|
31933
31957
|
const windowWidth = Math.floor(this.desktopSize.width / cols);
|
31934
|
-
const windowHeight = Math.floor(
|
31958
|
+
const windowHeight = Math.floor(this.desktopSize.height / rows);
|
31935
31959
|
visibleWindows.forEach((window2, index) => {
|
31936
31960
|
const col = index % cols;
|
31937
31961
|
const row = Math.floor(index / cols);
|
@@ -31956,8 +31980,8 @@ class WindowManager {
|
|
31956
31980
|
if (!window2 || window2.maximized) return false;
|
31957
31981
|
window2.position = {
|
31958
31982
|
x: (this.desktopSize.width - window2.size.width) / 2,
|
31959
|
-
y: (this.desktopSize.height - window2.size.height
|
31960
|
-
//
|
31983
|
+
y: (this.desktopSize.height - window2.size.height) / 2
|
31984
|
+
// Workspace center
|
31961
31985
|
};
|
31962
31986
|
this.notifyListeners();
|
31963
31987
|
return true;
|
@@ -31970,7 +31994,7 @@ class WindowManager {
|
|
31970
31994
|
const offsetStep = 20;
|
31971
31995
|
visibleWindows.forEach((window2, index) => {
|
31972
31996
|
const baseX = (this.desktopSize.width - window2.size.width) / 2;
|
31973
|
-
const baseY = (this.desktopSize.height - window2.size.height
|
31997
|
+
const baseY = (this.desktopSize.height - window2.size.height) / 2;
|
31974
31998
|
window2.position = {
|
31975
31999
|
x: baseX + index * offsetStep,
|
31976
32000
|
y: baseY + index * offsetStep
|
@@ -31991,6 +32015,19 @@ class WindowManager {
|
|
31991
32015
|
desktopSize: this.desktopSize
|
31992
32016
|
};
|
31993
32017
|
}
|
32018
|
+
/**
|
32019
|
+
* Reset z-indexes when they reach the maximum
|
32020
|
+
*/
|
32021
|
+
resetZIndexes() {
|
32022
|
+
const windows = Array.from(this.windows.values());
|
32023
|
+
windows.sort((a, b) => a.zIndex - b.zIndex);
|
32024
|
+
this.nextZIndex = 1e3;
|
32025
|
+
windows.forEach((window2, index) => {
|
32026
|
+
window2.zIndex = this.nextZIndex + index;
|
32027
|
+
});
|
32028
|
+
this.nextZIndex = 1e3 + windows.length;
|
32029
|
+
this.notifyListeners();
|
32030
|
+
}
|
31994
32031
|
}
|
31995
32032
|
const WindowContext = React.createContext(null);
|
31996
32033
|
const WindowProvider = ({ children, desktopSize }) => {
|
@@ -32015,8 +32052,10 @@ const WindowProvider = ({ children, desktopSize }) => {
|
|
32015
32052
|
}
|
32016
32053
|
}, [desktopSize]);
|
32017
32054
|
if (!state || !windowManagerRef.current) {
|
32055
|
+
console.log("WindowProvider not ready - state:", state, "windowManager:", windowManagerRef.current);
|
32018
32056
|
return null;
|
32019
32057
|
}
|
32058
|
+
console.log("WindowProvider ready - providing context");
|
32020
32059
|
const value = {
|
32021
32060
|
// Current state
|
32022
32061
|
windows: state.windows,
|
@@ -32031,6 +32070,7 @@ const WindowProvider = ({ children, desktopSize }) => {
|
|
32031
32070
|
minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
|
32032
32071
|
maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
|
32033
32072
|
updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
|
32073
|
+
updateWindowSize: (id, size) => windowManagerRef.current.updateWindowSize(id, size),
|
32034
32074
|
// Window queries
|
32035
32075
|
getWindow: (id) => windowManagerRef.current.getWindow(id),
|
32036
32076
|
getAllWindows: () => windowManagerRef.current.getAllWindows(),
|
@@ -32093,11 +32133,16 @@ const Window = ({
|
|
32093
32133
|
}) => {
|
32094
32134
|
const windowRef = React.useRef(null);
|
32095
32135
|
const headerRef = React.useRef(null);
|
32096
|
-
const { getWindow, updateWindowPosition, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32136
|
+
const { getWindow, updateWindowPosition, updateWindowSize, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32097
32137
|
const windowData = getWindow(id);
|
32098
32138
|
const [isDragging, setIsDragging] = React.useState(false);
|
32099
32139
|
const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
|
32100
32140
|
const [dragStartPosition, setDragStartPosition] = React.useState({ x: 0, y: 0 });
|
32141
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
32142
|
+
const [resizeDirection, setResizeDirection] = React.useState("");
|
32143
|
+
const [resizeStartSize, setResizeStartSize] = React.useState({ width: 0, height: 0 });
|
32144
|
+
const [resizeStartPosition, setResizeStartPosition] = React.useState({ x: 0, y: 0 });
|
32145
|
+
const [resizeStartMouse, setResizeStartMouse] = React.useState({ x: 0, y: 0 });
|
32101
32146
|
if (!windowData) {
|
32102
32147
|
return null;
|
32103
32148
|
}
|
@@ -32152,6 +32197,86 @@ const Window = ({
|
|
32152
32197
|
};
|
32153
32198
|
updateWindowPosition(id, finalPosition);
|
32154
32199
|
};
|
32200
|
+
const handleResizeStart = (e, direction) => {
|
32201
|
+
if (!resizable || maximized) return;
|
32202
|
+
e.preventDefault();
|
32203
|
+
e.stopPropagation();
|
32204
|
+
setIsResizing(true);
|
32205
|
+
setResizeDirection(direction);
|
32206
|
+
setResizeStartSize(size);
|
32207
|
+
setResizeStartPosition(position);
|
32208
|
+
setResizeStartMouse({ x: e.clientX, y: e.clientY });
|
32209
|
+
focusWindow(id);
|
32210
|
+
};
|
32211
|
+
const handleResizeMove = (e) => {
|
32212
|
+
if (!isResizing) return;
|
32213
|
+
e.preventDefault();
|
32214
|
+
const deltaX = e.clientX - resizeStartMouse.x;
|
32215
|
+
const deltaY = e.clientY - resizeStartMouse.y;
|
32216
|
+
let newSize = { ...resizeStartSize };
|
32217
|
+
let newPosition = { ...resizeStartPosition };
|
32218
|
+
switch (resizeDirection) {
|
32219
|
+
case "n":
|
32220
|
+
newSize.height = Math.max(150, resizeStartSize.height - deltaY);
|
32221
|
+
newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
|
32222
|
+
break;
|
32223
|
+
case "s":
|
32224
|
+
newSize.height = Math.max(150, resizeStartSize.height + deltaY);
|
32225
|
+
break;
|
32226
|
+
case "e":
|
32227
|
+
newSize.width = Math.max(200, resizeStartSize.width + deltaX);
|
32228
|
+
break;
|
32229
|
+
case "w":
|
32230
|
+
newSize.width = Math.max(200, resizeStartSize.width - deltaX);
|
32231
|
+
newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
|
32232
|
+
break;
|
32233
|
+
case "ne":
|
32234
|
+
newSize.width = Math.max(200, resizeStartSize.width + deltaX);
|
32235
|
+
newSize.height = Math.max(150, resizeStartSize.height - deltaY);
|
32236
|
+
newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
|
32237
|
+
break;
|
32238
|
+
case "nw":
|
32239
|
+
newSize.width = Math.max(200, resizeStartSize.width - deltaX);
|
32240
|
+
newSize.height = Math.max(150, resizeStartSize.height - deltaY);
|
32241
|
+
newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
|
32242
|
+
newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
|
32243
|
+
break;
|
32244
|
+
case "se":
|
32245
|
+
newSize.width = Math.max(200, resizeStartSize.width + deltaX);
|
32246
|
+
newSize.height = Math.max(150, resizeStartSize.height + deltaY);
|
32247
|
+
break;
|
32248
|
+
case "sw":
|
32249
|
+
newSize.width = Math.max(200, resizeStartSize.width - deltaX);
|
32250
|
+
newSize.height = Math.max(150, resizeStartSize.height + deltaY);
|
32251
|
+
newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
|
32252
|
+
break;
|
32253
|
+
}
|
32254
|
+
if (windowRef.current) {
|
32255
|
+
windowRef.current.style.width = `${newSize.width}px`;
|
32256
|
+
windowRef.current.style.height = `${newSize.height}px`;
|
32257
|
+
windowRef.current.style.left = `${newPosition.x}px`;
|
32258
|
+
windowRef.current.style.top = `${newPosition.y}px`;
|
32259
|
+
}
|
32260
|
+
};
|
32261
|
+
const handleResizeEnd = () => {
|
32262
|
+
if (!isResizing) return;
|
32263
|
+
setIsResizing(false);
|
32264
|
+
setResizeDirection("");
|
32265
|
+
const desktopContainer = windowRef.current?.parentElement;
|
32266
|
+
if (!desktopContainer) return;
|
32267
|
+
const windowRect = windowRef.current.getBoundingClientRect();
|
32268
|
+
const desktopRect = desktopContainer.getBoundingClientRect();
|
32269
|
+
const finalSize = {
|
32270
|
+
width: windowRect.width,
|
32271
|
+
height: windowRect.height
|
32272
|
+
};
|
32273
|
+
const finalPosition = {
|
32274
|
+
x: windowRect.left - desktopRect.left,
|
32275
|
+
y: windowRect.top - desktopRect.top
|
32276
|
+
};
|
32277
|
+
updateWindowSize(id, finalSize);
|
32278
|
+
updateWindowPosition(id, finalPosition);
|
32279
|
+
};
|
32155
32280
|
React.useEffect(() => {
|
32156
32281
|
if (isDragging) {
|
32157
32282
|
document.addEventListener("mousemove", handleMouseMove);
|
@@ -32166,6 +32291,18 @@ const Window = ({
|
|
32166
32291
|
};
|
32167
32292
|
}
|
32168
32293
|
}, [isDragging]);
|
32294
|
+
React.useEffect(() => {
|
32295
|
+
if (isResizing) {
|
32296
|
+
document.addEventListener("mousemove", handleResizeMove);
|
32297
|
+
document.addEventListener("mouseup", handleResizeEnd);
|
32298
|
+
document.body.style.userSelect = "none";
|
32299
|
+
return () => {
|
32300
|
+
document.removeEventListener("mousemove", handleResizeMove);
|
32301
|
+
document.removeEventListener("mouseup", handleResizeEnd);
|
32302
|
+
document.body.style.userSelect = "";
|
32303
|
+
};
|
32304
|
+
}
|
32305
|
+
}, [isResizing]);
|
32169
32306
|
const handleMinimize = (e) => {
|
32170
32307
|
e.stopPropagation();
|
32171
32308
|
minimizeWindow(id, !minimized);
|
@@ -32200,6 +32337,7 @@ const Window = ({
|
|
32200
32337
|
"window",
|
32201
32338
|
maximized && "window--maximized",
|
32202
32339
|
isDragging && "window--dragging",
|
32340
|
+
isResizing && "window--resizing",
|
32203
32341
|
className
|
32204
32342
|
].filter(Boolean).join(" ");
|
32205
32343
|
return /* @__PURE__ */ React.createElement(
|
@@ -32249,10 +32387,60 @@ const Window = ({
|
|
32249
32387
|
),
|
32250
32388
|
toolbar && /* @__PURE__ */ React.createElement("div", { className: "window__toolbar" }, toolbar),
|
32251
32389
|
/* @__PURE__ */ React.createElement("div", { className: "window__content" }, content || children),
|
32252
|
-
statusBar && /* @__PURE__ */ React.createElement("div", { className: "window__status-bar" }, statusBar)
|
32390
|
+
statusBar && /* @__PURE__ */ React.createElement("div", { className: "window__status-bar" }, statusBar),
|
32391
|
+
resizable && !maximized && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
32392
|
+
"div",
|
32393
|
+
{
|
32394
|
+
className: "window__resize-handle window__resize-handle--n",
|
32395
|
+
onMouseDown: (e) => handleResizeStart(e, "n")
|
32396
|
+
}
|
32397
|
+
), /* @__PURE__ */ React.createElement(
|
32398
|
+
"div",
|
32399
|
+
{
|
32400
|
+
className: "window__resize-handle window__resize-handle--s",
|
32401
|
+
onMouseDown: (e) => handleResizeStart(e, "s")
|
32402
|
+
}
|
32403
|
+
), /* @__PURE__ */ React.createElement(
|
32404
|
+
"div",
|
32405
|
+
{
|
32406
|
+
className: "window__resize-handle window__resize-handle--e",
|
32407
|
+
onMouseDown: (e) => handleResizeStart(e, "e")
|
32408
|
+
}
|
32409
|
+
), /* @__PURE__ */ React.createElement(
|
32410
|
+
"div",
|
32411
|
+
{
|
32412
|
+
className: "window__resize-handle window__resize-handle--w",
|
32413
|
+
onMouseDown: (e) => handleResizeStart(e, "w")
|
32414
|
+
}
|
32415
|
+
), /* @__PURE__ */ React.createElement(
|
32416
|
+
"div",
|
32417
|
+
{
|
32418
|
+
className: "window__resize-handle window__resize-handle--ne",
|
32419
|
+
onMouseDown: (e) => handleResizeStart(e, "ne")
|
32420
|
+
}
|
32421
|
+
), /* @__PURE__ */ React.createElement(
|
32422
|
+
"div",
|
32423
|
+
{
|
32424
|
+
className: "window__resize-handle window__resize-handle--nw",
|
32425
|
+
onMouseDown: (e) => handleResizeStart(e, "nw")
|
32426
|
+
}
|
32427
|
+
), /* @__PURE__ */ React.createElement(
|
32428
|
+
"div",
|
32429
|
+
{
|
32430
|
+
className: "window__resize-handle window__resize-handle--se",
|
32431
|
+
onMouseDown: (e) => handleResizeStart(e, "se")
|
32432
|
+
}
|
32433
|
+
), /* @__PURE__ */ React.createElement(
|
32434
|
+
"div",
|
32435
|
+
{
|
32436
|
+
className: "window__resize-handle window__resize-handle--sw",
|
32437
|
+
onMouseDown: (e) => handleResizeStart(e, "sw")
|
32438
|
+
}
|
32439
|
+
))
|
32253
32440
|
);
|
32254
32441
|
};
|
32255
32442
|
const ApplicationMenu = ({ isOpen, onClose }) => {
|
32443
|
+
console.log("ApplicationMenu render - isOpen:", isOpen, "onClose:", onClose);
|
32256
32444
|
const appManager = useAppManager();
|
32257
32445
|
const [searchTerm, setSearchTerm] = React.useState("");
|
32258
32446
|
const [selectedCategory, setSelectedCategory] = React.useState("all");
|
@@ -32337,14 +32525,14 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32337
32525
|
onChange: (e) => setSearchTerm(e.target.value),
|
32338
32526
|
className: "application-menu__search-input"
|
32339
32527
|
}
|
32340
|
-
)), /* @__PURE__ */ React.createElement("div", { className: "application-menu__categories" }, /* @__PURE__ */ React.createElement(
|
32528
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "application-menu__main" }, /* @__PURE__ */ React.createElement("div", { className: "application-menu__sidebar" }, /* @__PURE__ */ React.createElement("div", { className: "application-menu__categories" }, /* @__PURE__ */ React.createElement(
|
32341
32529
|
"button",
|
32342
32530
|
{
|
32343
32531
|
className: `application-menu__category ${selectedCategory === "all" ? "active" : ""}`,
|
32344
32532
|
onClick: () => handleCategorySelect("all")
|
32345
32533
|
},
|
32346
32534
|
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, "📱"),
|
32347
|
-
"All Apps"
|
32535
|
+
/* @__PURE__ */ React.createElement("span", { className: "category-name" }, "All Apps")
|
32348
32536
|
), categories.map((category) => /* @__PURE__ */ React.createElement(
|
32349
32537
|
"button",
|
32350
32538
|
{
|
@@ -32353,8 +32541,8 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32353
32541
|
onClick: () => handleCategorySelect(category.id)
|
32354
32542
|
},
|
32355
32543
|
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, category.icon),
|
32356
|
-
category.name
|
32357
|
-
))), /* @__PURE__ */ React.createElement("div", { className: "application-menu__content" }, searchTerm && /* @__PURE__ */ React.createElement("div", { className: "application-menu__search-results" }, /* @__PURE__ */ React.createElement("h3", null, "Search Results (", filteredApps.length, ")"), /* @__PURE__ */ React.createElement("div", { className: "application-menu__apps-grid" }, filteredApps.map((app) => /* @__PURE__ */ React.createElement(
|
32544
|
+
/* @__PURE__ */ React.createElement("span", { className: "category-name" }, category.name)
|
32545
|
+
)))), /* @__PURE__ */ React.createElement("div", { className: "application-menu__content" }, searchTerm && /* @__PURE__ */ React.createElement("div", { className: "application-menu__search-results" }, /* @__PURE__ */ React.createElement("h3", null, "Search Results (", filteredApps.length, ")"), /* @__PURE__ */ React.createElement("div", { className: "application-menu__apps-grid" }, filteredApps.map((app) => /* @__PURE__ */ React.createElement(
|
32358
32546
|
"div",
|
32359
32547
|
{
|
32360
32548
|
key: app.id,
|
@@ -32374,7 +32562,7 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32374
32562
|
},
|
32375
32563
|
/* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
|
32376
32564
|
/* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
|
32377
|
-
)))))), filteredApps.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "application-menu__no-results" }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: "48px", marginBottom: "16px" } }, "🔍"), /* @__PURE__ */ React.createElement("h3", null, "No applications found"), /* @__PURE__ */ React.createElement("p", null, "Try adjusting your search or category filter.")))));
|
32565
|
+
)))))), filteredApps.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "application-menu__no-results" }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: "48px", marginBottom: "16px" } }, "🔍"), /* @__PURE__ */ React.createElement("h3", null, "No applications found"), /* @__PURE__ */ React.createElement("p", null, "Try adjusting your search or category filter."))))));
|
32378
32566
|
};
|
32379
32567
|
class AppManager {
|
32380
32568
|
constructor() {
|
@@ -32632,14 +32820,14 @@ const AppProvider = ({ children, appManager = defaultAppManager }) => {
|
|
32632
32820
|
};
|
32633
32821
|
return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
|
32634
32822
|
};
|
32635
|
-
const DesktopLayout = ({ children, className = "", ...props }) => {
|
32823
|
+
const DesktopLayout = ({ children, className = "", theme = "windows", workspaceRef, ...props }) => {
|
32636
32824
|
const desktopRef = React.useRef(null);
|
32637
32825
|
const { windowManager } = useWindows();
|
32638
32826
|
React.useEffect(() => {
|
32639
|
-
let currentSize = { width: 1200, height:
|
32640
|
-
const
|
32641
|
-
if (
|
32642
|
-
const rect =
|
32827
|
+
let currentSize = { width: 1200, height: 750 };
|
32828
|
+
const measureWorkspace = () => {
|
32829
|
+
if (workspaceRef.current) {
|
32830
|
+
const rect = workspaceRef.current.getBoundingClientRect();
|
32643
32831
|
const newSize = {
|
32644
32832
|
width: rect.width,
|
32645
32833
|
height: rect.height
|
@@ -32650,10 +32838,10 @@ const DesktopLayout = ({ children, className = "", ...props }) => {
|
|
32650
32838
|
}
|
32651
32839
|
}
|
32652
32840
|
};
|
32653
|
-
|
32654
|
-
const resizeObserver = new ResizeObserver(
|
32655
|
-
if (
|
32656
|
-
resizeObserver.observe(
|
32841
|
+
measureWorkspace();
|
32842
|
+
const resizeObserver = new ResizeObserver(measureWorkspace);
|
32843
|
+
if (workspaceRef.current) {
|
32844
|
+
resizeObserver.observe(workspaceRef.current);
|
32657
32845
|
}
|
32658
32846
|
return () => {
|
32659
32847
|
resizeObserver.disconnect();
|
@@ -32663,11 +32851,12 @@ const DesktopLayout = ({ children, className = "", ...props }) => {
|
|
32663
32851
|
e.preventDefault();
|
32664
32852
|
console.log("Desktop context menu at:", e.clientX, e.clientY);
|
32665
32853
|
};
|
32854
|
+
const themeClass = `desktop--${theme}`;
|
32666
32855
|
return /* @__PURE__ */ React.createElement(
|
32667
32856
|
"div",
|
32668
32857
|
{
|
32669
32858
|
ref: desktopRef,
|
32670
|
-
className: `desktop ${className}`,
|
32859
|
+
className: `desktop ${themeClass} ${className}`,
|
32671
32860
|
onContextMenu: handleContextMenu,
|
32672
32861
|
...props
|
32673
32862
|
},
|
@@ -32677,7 +32866,7 @@ const DesktopLayout = ({ children, className = "", ...props }) => {
|
|
32677
32866
|
};
|
32678
32867
|
const Workspace = ({ children }) => {
|
32679
32868
|
const { windows } = useWindows();
|
32680
|
-
return /* @__PURE__ */ React.createElement(
|
32869
|
+
return /* @__PURE__ */ React.createElement("div", { className: "workspace" }, children, windows.map((window2) => /* @__PURE__ */ React.createElement(
|
32681
32870
|
Window,
|
32682
32871
|
{
|
32683
32872
|
key: window2.id,
|
@@ -32691,6 +32880,9 @@ const Workspace = ({ children }) => {
|
|
32691
32880
|
)));
|
32692
32881
|
};
|
32693
32882
|
const DesktopTaskbar = () => {
|
32883
|
+
console.log("DesktopTaskbar render");
|
32884
|
+
const windowsContext = useWindows();
|
32885
|
+
console.log("useWindows result:", windowsContext);
|
32694
32886
|
const {
|
32695
32887
|
createWindow,
|
32696
32888
|
windows,
|
@@ -32698,26 +32890,14 @@ const DesktopTaskbar = () => {
|
|
32698
32890
|
activeWindowId,
|
32699
32891
|
focusWindow,
|
32700
32892
|
minimizeWindow,
|
32701
|
-
closeWindow
|
32702
|
-
|
32703
|
-
|
32704
|
-
|
32705
|
-
|
32706
|
-
|
32707
|
-
|
32708
|
-
|
32709
|
-
{ title: "Settings", icon: "⚙️", size: { width: 450, height: 300 } },
|
32710
|
-
{ title: "Browser", icon: "🌐", size: { width: 800, height: 500 } }
|
32711
|
-
];
|
32712
|
-
const randomType = windowTypes[Math.floor(Math.random() * windowTypes.length)];
|
32713
|
-
createWindow({
|
32714
|
-
title: randomType.title,
|
32715
|
-
icon: randomType.icon,
|
32716
|
-
size: randomType.size,
|
32717
|
-
toolbar: randomType.title === "Text Editor" ? /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "8px" } }, /* @__PURE__ */ React.createElement("button", { style: { padding: "4px 8px", fontSize: "12px" } }, "File"), /* @__PURE__ */ React.createElement("button", { style: { padding: "4px 8px", fontSize: "12px" } }, "Edit"), /* @__PURE__ */ React.createElement("button", { style: { padding: "4px 8px", fontSize: "12px" } }, "View")) : null,
|
32718
|
-
statusBar: randomType.title === "Text Editor" ? /* @__PURE__ */ React.createElement("span", null, "Ready | Line 1, Column 1") : null
|
32719
|
-
});
|
32720
|
-
};
|
32893
|
+
closeWindow,
|
32894
|
+
cascadeWindows,
|
32895
|
+
tileWindows,
|
32896
|
+
centerAllWindows,
|
32897
|
+
clearAllWindows
|
32898
|
+
} = windowsContext;
|
32899
|
+
const { isOpen, toggle } = useApplicationMenu();
|
32900
|
+
console.log("DesktopTaskbar - isOpen:", isOpen, "toggle:", toggle);
|
32721
32901
|
const handleWindowClick = (window2) => {
|
32722
32902
|
if (window2.minimized) {
|
32723
32903
|
minimizeWindow(window2.id, false);
|
@@ -32740,11 +32920,7 @@ const DesktopTaskbar = () => {
|
|
32740
32920
|
closeWindow(window2.id);
|
32741
32921
|
}
|
32742
32922
|
};
|
32743
|
-
return /* @__PURE__ */ React.createElement("div", { style: {
|
32744
|
-
position: "absolute",
|
32745
|
-
bottom: 0,
|
32746
|
-
left: 0,
|
32747
|
-
right: 0,
|
32923
|
+
return /* @__PURE__ */ React.createElement("div", { className: "desktop-taskbar", style: {
|
32748
32924
|
height: "50px",
|
32749
32925
|
background: "rgba(0,0,0,0.8)",
|
32750
32926
|
display: "flex",
|
@@ -32752,44 +32928,16 @@ const DesktopTaskbar = () => {
|
|
32752
32928
|
padding: "0 16px",
|
32753
32929
|
gap: "8px"
|
32754
32930
|
} }, /* @__PURE__ */ React.createElement(
|
32755
|
-
|
32931
|
+
ToggleButton,
|
32756
32932
|
{
|
32757
|
-
|
32758
|
-
|
32759
|
-
|
32760
|
-
|
32761
|
-
color: "white",
|
32762
|
-
border: "none",
|
32763
|
-
borderRadius: "4px",
|
32764
|
-
cursor: "pointer",
|
32765
|
-
fontSize: "14px",
|
32766
|
-
fontWeight: "bold",
|
32767
|
-
flexShrink: 0,
|
32768
|
-
display: "flex",
|
32769
|
-
alignItems: "center",
|
32770
|
-
gap: "6px"
|
32771
|
-
},
|
32772
|
-
title: "Open application menu"
|
32773
|
-
},
|
32774
|
-
/* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px" } }, "🚀"),
|
32775
|
-
"Start"
|
32776
|
-
), /* @__PURE__ */ React.createElement(
|
32777
|
-
"button",
|
32778
|
-
{
|
32779
|
-
onClick: handleCreateWindow,
|
32780
|
-
style: {
|
32781
|
-
padding: "8px 12px",
|
32782
|
-
background: "#666",
|
32783
|
-
color: "white",
|
32784
|
-
border: "none",
|
32785
|
-
borderRadius: "4px",
|
32786
|
-
cursor: "pointer",
|
32787
|
-
fontSize: "12px",
|
32788
|
-
flexShrink: 0
|
32933
|
+
checked: isOpen,
|
32934
|
+
onToggle: () => {
|
32935
|
+
console.log("Start button toggled, current state:", isOpen);
|
32936
|
+
toggle();
|
32789
32937
|
},
|
32790
|
-
|
32791
|
-
|
32792
|
-
|
32938
|
+
icon: "start",
|
32939
|
+
label: "Start"
|
32940
|
+
}
|
32793
32941
|
), /* @__PURE__ */ React.createElement("div", { style: {
|
32794
32942
|
width: "1px",
|
32795
32943
|
height: "30px",
|
@@ -32850,6 +32998,60 @@ Middle click: Close`
|
|
32850
32998
|
borderRadius: "1px"
|
32851
32999
|
} })
|
32852
33000
|
))), /* @__PURE__ */ React.createElement("div", { style: {
|
33001
|
+
display: "flex",
|
33002
|
+
gap: "4px",
|
33003
|
+
alignItems: "center",
|
33004
|
+
marginLeft: "auto",
|
33005
|
+
marginRight: "8px"
|
33006
|
+
} }, /* @__PURE__ */ React.createElement(
|
33007
|
+
Icon,
|
33008
|
+
{
|
33009
|
+
clickable: true,
|
33010
|
+
size: "small",
|
33011
|
+
action: () => {
|
33012
|
+
console.log("Cascade windows clicked!");
|
33013
|
+
cascadeWindows();
|
33014
|
+
},
|
33015
|
+
icon: "view_stream",
|
33016
|
+
label: "Cascade"
|
33017
|
+
}
|
33018
|
+
), /* @__PURE__ */ React.createElement(
|
33019
|
+
Icon,
|
33020
|
+
{
|
33021
|
+
clickable: true,
|
33022
|
+
size: "small",
|
33023
|
+
action: () => {
|
33024
|
+
console.log("Tile windows clicked!");
|
33025
|
+
tileWindows();
|
33026
|
+
},
|
33027
|
+
icon: "view_module",
|
33028
|
+
label: "Tile"
|
33029
|
+
}
|
33030
|
+
), /* @__PURE__ */ React.createElement(
|
33031
|
+
Icon,
|
33032
|
+
{
|
33033
|
+
clickable: true,
|
33034
|
+
size: "small",
|
33035
|
+
action: () => {
|
33036
|
+
console.log("Center all windows clicked!");
|
33037
|
+
centerAllWindows();
|
33038
|
+
},
|
33039
|
+
icon: "center_focus_strong",
|
33040
|
+
label: "Center"
|
33041
|
+
}
|
33042
|
+
), /* @__PURE__ */ React.createElement(
|
33043
|
+
Icon,
|
33044
|
+
{
|
33045
|
+
clickable: true,
|
33046
|
+
size: "small",
|
33047
|
+
action: () => {
|
33048
|
+
console.log("Clear all windows clicked!");
|
33049
|
+
clearAllWindows();
|
33050
|
+
},
|
33051
|
+
icon: "clear_all",
|
33052
|
+
label: "Clear"
|
33053
|
+
}
|
33054
|
+
)), /* @__PURE__ */ React.createElement("div", { style: {
|
32853
33055
|
color: "rgba(255,255,255,0.7)",
|
32854
33056
|
fontSize: "11px",
|
32855
33057
|
fontFamily: "monospace",
|
@@ -32859,13 +33061,14 @@ Middle click: Close`
|
|
32859
33061
|
};
|
32860
33062
|
const DesktopInternal = ({ desktopSize, children, ...props }) => {
|
32861
33063
|
const { isOpen, close } = useApplicationMenu();
|
32862
|
-
|
33064
|
+
const workspaceRef = React.useRef(null);
|
33065
|
+
return /* @__PURE__ */ React.createElement(WindowProvider, { desktopSize }, /* @__PURE__ */ React.createElement(DesktopLayout, { workspaceRef, ...props }, /* @__PURE__ */ React.createElement("div", { ref: workspaceRef, className: "desktop__workspace-container" }, /* @__PURE__ */ React.createElement(Workspace, null, children), /* @__PURE__ */ React.createElement(
|
32863
33066
|
ApplicationMenu,
|
32864
33067
|
{
|
32865
33068
|
isOpen,
|
32866
33069
|
onClose: close
|
32867
33070
|
}
|
32868
|
-
)));
|
33071
|
+
)), /* @__PURE__ */ React.createElement(DesktopTaskbar, null)));
|
32869
33072
|
};
|
32870
33073
|
const Desktop = ({ desktopSize, children, ...props }) => {
|
32871
33074
|
return /* @__PURE__ */ React.createElement(AppProvider, null, /* @__PURE__ */ React.createElement(DesktopInternal, { desktopSize, ...props }, children));
|