ywana-core8 0.2.6 → 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 +452 -54
- package/dist/index.js +267 -89
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +267 -89
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +267 -89
- 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 +87 -12
- package/src/desktop/WindowContext.js +3 -0
- package/src/desktop/WindowManager.js +32 -10
- package/src/desktop/desktop-linux.css +55 -0
- package/src/desktop/desktop-macos.css +57 -0
- package/src/desktop/desktop-windows.css +54 -0
- package/src/desktop/desktop.css +30 -0
- package/src/desktop/desktop.js +100 -66
- package/src/desktop/window.css +98 -0
- package/src/desktop/window.js +163 -2
- 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;
|
@@ -31878,7 +31884,7 @@ class WindowManager {
|
|
31878
31884
|
const minWidth = 200;
|
31879
31885
|
const minHeight = 150;
|
31880
31886
|
const maxWidth = this.desktopSize.width;
|
31881
|
-
const maxHeight = this.desktopSize.height
|
31887
|
+
const maxHeight = this.desktopSize.height;
|
31882
31888
|
const constrainedSize = {
|
31883
31889
|
width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
|
31884
31890
|
height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
|
@@ -31914,7 +31920,7 @@ class WindowManager {
|
|
31914
31920
|
this.windows.forEach((window2) => {
|
31915
31921
|
if (window2.maximized) return;
|
31916
31922
|
const maxX = this.desktopSize.width - window2.size.width;
|
31917
|
-
const maxY = this.desktopSize.height - window2.size.height
|
31923
|
+
const maxY = this.desktopSize.height - window2.size.height;
|
31918
31924
|
if (window2.position.x > maxX) {
|
31919
31925
|
window2.position.x = Math.max(0, maxX);
|
31920
31926
|
}
|
@@ -31949,7 +31955,7 @@ class WindowManager {
|
|
31949
31955
|
const cols = Math.ceil(Math.sqrt(visibleWindows.length));
|
31950
31956
|
const rows = Math.ceil(visibleWindows.length / cols);
|
31951
31957
|
const windowWidth = Math.floor(this.desktopSize.width / cols);
|
31952
|
-
const windowHeight = Math.floor(
|
31958
|
+
const windowHeight = Math.floor(this.desktopSize.height / rows);
|
31953
31959
|
visibleWindows.forEach((window2, index) => {
|
31954
31960
|
const col = index % cols;
|
31955
31961
|
const row = Math.floor(index / cols);
|
@@ -31974,8 +31980,8 @@ class WindowManager {
|
|
31974
31980
|
if (!window2 || window2.maximized) return false;
|
31975
31981
|
window2.position = {
|
31976
31982
|
x: (this.desktopSize.width - window2.size.width) / 2,
|
31977
|
-
y: (this.desktopSize.height - window2.size.height
|
31978
|
-
//
|
31983
|
+
y: (this.desktopSize.height - window2.size.height) / 2
|
31984
|
+
// Workspace center
|
31979
31985
|
};
|
31980
31986
|
this.notifyListeners();
|
31981
31987
|
return true;
|
@@ -31988,7 +31994,7 @@ class WindowManager {
|
|
31988
31994
|
const offsetStep = 20;
|
31989
31995
|
visibleWindows.forEach((window2, index) => {
|
31990
31996
|
const baseX = (this.desktopSize.width - window2.size.width) / 2;
|
31991
|
-
const baseY = (this.desktopSize.height - window2.size.height
|
31997
|
+
const baseY = (this.desktopSize.height - window2.size.height) / 2;
|
31992
31998
|
window2.position = {
|
31993
31999
|
x: baseX + index * offsetStep,
|
31994
32000
|
y: baseY + index * offsetStep
|
@@ -32009,6 +32015,19 @@ class WindowManager {
|
|
32009
32015
|
desktopSize: this.desktopSize
|
32010
32016
|
};
|
32011
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
|
+
}
|
32012
32031
|
}
|
32013
32032
|
const WindowContext = React.createContext(null);
|
32014
32033
|
const WindowProvider = ({ children, desktopSize }) => {
|
@@ -32033,8 +32052,10 @@ const WindowProvider = ({ children, desktopSize }) => {
|
|
32033
32052
|
}
|
32034
32053
|
}, [desktopSize]);
|
32035
32054
|
if (!state || !windowManagerRef.current) {
|
32055
|
+
console.log("WindowProvider not ready - state:", state, "windowManager:", windowManagerRef.current);
|
32036
32056
|
return null;
|
32037
32057
|
}
|
32058
|
+
console.log("WindowProvider ready - providing context");
|
32038
32059
|
const value = {
|
32039
32060
|
// Current state
|
32040
32061
|
windows: state.windows,
|
@@ -32176,6 +32197,86 @@ const Window = ({
|
|
32176
32197
|
};
|
32177
32198
|
updateWindowPosition(id, finalPosition);
|
32178
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
|
+
};
|
32179
32280
|
React.useEffect(() => {
|
32180
32281
|
if (isDragging) {
|
32181
32282
|
document.addEventListener("mousemove", handleMouseMove);
|
@@ -32190,6 +32291,18 @@ const Window = ({
|
|
32190
32291
|
};
|
32191
32292
|
}
|
32192
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]);
|
32193
32306
|
const handleMinimize = (e) => {
|
32194
32307
|
e.stopPropagation();
|
32195
32308
|
minimizeWindow(id, !minimized);
|
@@ -32224,6 +32337,7 @@ const Window = ({
|
|
32224
32337
|
"window",
|
32225
32338
|
maximized && "window--maximized",
|
32226
32339
|
isDragging && "window--dragging",
|
32340
|
+
isResizing && "window--resizing",
|
32227
32341
|
className
|
32228
32342
|
].filter(Boolean).join(" ");
|
32229
32343
|
return /* @__PURE__ */ React.createElement(
|
@@ -32273,10 +32387,60 @@ const Window = ({
|
|
32273
32387
|
),
|
32274
32388
|
toolbar && /* @__PURE__ */ React.createElement("div", { className: "window__toolbar" }, toolbar),
|
32275
32389
|
/* @__PURE__ */ React.createElement("div", { className: "window__content" }, content || children),
|
32276
|
-
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
|
+
))
|
32277
32440
|
);
|
32278
32441
|
};
|
32279
32442
|
const ApplicationMenu = ({ isOpen, onClose }) => {
|
32443
|
+
console.log("ApplicationMenu render - isOpen:", isOpen, "onClose:", onClose);
|
32280
32444
|
const appManager = useAppManager();
|
32281
32445
|
const [searchTerm, setSearchTerm] = React.useState("");
|
32282
32446
|
const [selectedCategory, setSelectedCategory] = React.useState("all");
|
@@ -32361,14 +32525,14 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32361
32525
|
onChange: (e) => setSearchTerm(e.target.value),
|
32362
32526
|
className: "application-menu__search-input"
|
32363
32527
|
}
|
32364
|
-
)), /* @__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(
|
32365
32529
|
"button",
|
32366
32530
|
{
|
32367
32531
|
className: `application-menu__category ${selectedCategory === "all" ? "active" : ""}`,
|
32368
32532
|
onClick: () => handleCategorySelect("all")
|
32369
32533
|
},
|
32370
32534
|
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, "📱"),
|
32371
|
-
"All Apps"
|
32535
|
+
/* @__PURE__ */ React.createElement("span", { className: "category-name" }, "All Apps")
|
32372
32536
|
), categories.map((category) => /* @__PURE__ */ React.createElement(
|
32373
32537
|
"button",
|
32374
32538
|
{
|
@@ -32377,8 +32541,8 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32377
32541
|
onClick: () => handleCategorySelect(category.id)
|
32378
32542
|
},
|
32379
32543
|
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, category.icon),
|
32380
|
-
category.name
|
32381
|
-
))), /* @__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(
|
32382
32546
|
"div",
|
32383
32547
|
{
|
32384
32548
|
key: app.id,
|
@@ -32398,7 +32562,7 @@ const ApplicationMenu = ({ isOpen, onClose }) => {
|
|
32398
32562
|
},
|
32399
32563
|
/* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
|
32400
32564
|
/* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
|
32401
|
-
)))))), 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."))))));
|
32402
32566
|
};
|
32403
32567
|
class AppManager {
|
32404
32568
|
constructor() {
|
@@ -32656,14 +32820,14 @@ const AppProvider = ({ children, appManager = defaultAppManager }) => {
|
|
32656
32820
|
};
|
32657
32821
|
return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
|
32658
32822
|
};
|
32659
|
-
const DesktopLayout = ({ children, className = "", theme = "windows", ...props }) => {
|
32823
|
+
const DesktopLayout = ({ children, className = "", theme = "windows", workspaceRef, ...props }) => {
|
32660
32824
|
const desktopRef = React.useRef(null);
|
32661
32825
|
const { windowManager } = useWindows();
|
32662
32826
|
React.useEffect(() => {
|
32663
|
-
let currentSize = { width: 1200, height:
|
32664
|
-
const
|
32665
|
-
if (
|
32666
|
-
const rect =
|
32827
|
+
let currentSize = { width: 1200, height: 750 };
|
32828
|
+
const measureWorkspace = () => {
|
32829
|
+
if (workspaceRef.current) {
|
32830
|
+
const rect = workspaceRef.current.getBoundingClientRect();
|
32667
32831
|
const newSize = {
|
32668
32832
|
width: rect.width,
|
32669
32833
|
height: rect.height
|
@@ -32674,10 +32838,10 @@ const DesktopLayout = ({ children, className = "", theme = "windows", ...props }
|
|
32674
32838
|
}
|
32675
32839
|
}
|
32676
32840
|
};
|
32677
|
-
|
32678
|
-
const resizeObserver = new ResizeObserver(
|
32679
|
-
if (
|
32680
|
-
resizeObserver.observe(
|
32841
|
+
measureWorkspace();
|
32842
|
+
const resizeObserver = new ResizeObserver(measureWorkspace);
|
32843
|
+
if (workspaceRef.current) {
|
32844
|
+
resizeObserver.observe(workspaceRef.current);
|
32681
32845
|
}
|
32682
32846
|
return () => {
|
32683
32847
|
resizeObserver.disconnect();
|
@@ -32702,7 +32866,7 @@ const DesktopLayout = ({ children, className = "", theme = "windows", ...props }
|
|
32702
32866
|
};
|
32703
32867
|
const Workspace = ({ children }) => {
|
32704
32868
|
const { windows } = useWindows();
|
32705
|
-
return /* @__PURE__ */ React.createElement(
|
32869
|
+
return /* @__PURE__ */ React.createElement("div", { className: "workspace" }, children, windows.map((window2) => /* @__PURE__ */ React.createElement(
|
32706
32870
|
Window,
|
32707
32871
|
{
|
32708
32872
|
key: window2.id,
|
@@ -32716,6 +32880,9 @@ const Workspace = ({ children }) => {
|
|
32716
32880
|
)));
|
32717
32881
|
};
|
32718
32882
|
const DesktopTaskbar = () => {
|
32883
|
+
console.log("DesktopTaskbar render");
|
32884
|
+
const windowsContext = useWindows();
|
32885
|
+
console.log("useWindows result:", windowsContext);
|
32719
32886
|
const {
|
32720
32887
|
createWindow,
|
32721
32888
|
windows,
|
@@ -32723,26 +32890,14 @@ const DesktopTaskbar = () => {
|
|
32723
32890
|
activeWindowId,
|
32724
32891
|
focusWindow,
|
32725
32892
|
minimizeWindow,
|
32726
|
-
closeWindow
|
32727
|
-
|
32728
|
-
|
32729
|
-
|
32730
|
-
|
32731
|
-
|
32732
|
-
|
32733
|
-
|
32734
|
-
{ title: "Settings", icon: "⚙️", size: { width: 450, height: 300 } },
|
32735
|
-
{ title: "Browser", icon: "🌐", size: { width: 800, height: 500 } }
|
32736
|
-
];
|
32737
|
-
const randomType = windowTypes[Math.floor(Math.random() * windowTypes.length)];
|
32738
|
-
createWindow({
|
32739
|
-
title: randomType.title,
|
32740
|
-
icon: randomType.icon,
|
32741
|
-
size: randomType.size,
|
32742
|
-
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,
|
32743
|
-
statusBar: randomType.title === "Text Editor" ? /* @__PURE__ */ React.createElement("span", null, "Ready | Line 1, Column 1") : null
|
32744
|
-
});
|
32745
|
-
};
|
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);
|
32746
32901
|
const handleWindowClick = (window2) => {
|
32747
32902
|
if (window2.minimized) {
|
32748
32903
|
minimizeWindow(window2.id, false);
|
@@ -32765,11 +32920,7 @@ const DesktopTaskbar = () => {
|
|
32765
32920
|
closeWindow(window2.id);
|
32766
32921
|
}
|
32767
32922
|
};
|
32768
|
-
return /* @__PURE__ */ React.createElement("div", { style: {
|
32769
|
-
position: "absolute",
|
32770
|
-
bottom: 0,
|
32771
|
-
left: 0,
|
32772
|
-
right: 0,
|
32923
|
+
return /* @__PURE__ */ React.createElement("div", { className: "desktop-taskbar", style: {
|
32773
32924
|
height: "50px",
|
32774
32925
|
background: "rgba(0,0,0,0.8)",
|
32775
32926
|
display: "flex",
|
@@ -32777,44 +32928,16 @@ const DesktopTaskbar = () => {
|
|
32777
32928
|
padding: "0 16px",
|
32778
32929
|
gap: "8px"
|
32779
32930
|
} }, /* @__PURE__ */ React.createElement(
|
32780
|
-
|
32931
|
+
ToggleButton,
|
32781
32932
|
{
|
32782
|
-
|
32783
|
-
|
32784
|
-
|
32785
|
-
|
32786
|
-
color: "white",
|
32787
|
-
border: "none",
|
32788
|
-
borderRadius: "4px",
|
32789
|
-
cursor: "pointer",
|
32790
|
-
fontSize: "14px",
|
32791
|
-
fontWeight: "bold",
|
32792
|
-
flexShrink: 0,
|
32793
|
-
display: "flex",
|
32794
|
-
alignItems: "center",
|
32795
|
-
gap: "6px"
|
32933
|
+
checked: isOpen,
|
32934
|
+
onToggle: () => {
|
32935
|
+
console.log("Start button toggled, current state:", isOpen);
|
32936
|
+
toggle();
|
32796
32937
|
},
|
32797
|
-
|
32798
|
-
|
32799
|
-
|
32800
|
-
"Start"
|
32801
|
-
), /* @__PURE__ */ React.createElement(
|
32802
|
-
"button",
|
32803
|
-
{
|
32804
|
-
onClick: handleCreateWindow,
|
32805
|
-
style: {
|
32806
|
-
padding: "8px 12px",
|
32807
|
-
background: "#666",
|
32808
|
-
color: "white",
|
32809
|
-
border: "none",
|
32810
|
-
borderRadius: "4px",
|
32811
|
-
cursor: "pointer",
|
32812
|
-
fontSize: "12px",
|
32813
|
-
flexShrink: 0
|
32814
|
-
},
|
32815
|
-
title: "Create random window (for testing)"
|
32816
|
-
},
|
32817
|
-
"+"
|
32938
|
+
icon: "start",
|
32939
|
+
label: "Start"
|
32940
|
+
}
|
32818
32941
|
), /* @__PURE__ */ React.createElement("div", { style: {
|
32819
32942
|
width: "1px",
|
32820
32943
|
height: "30px",
|
@@ -32875,6 +32998,60 @@ Middle click: Close`
|
|
32875
32998
|
borderRadius: "1px"
|
32876
32999
|
} })
|
32877
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: {
|
32878
33055
|
color: "rgba(255,255,255,0.7)",
|
32879
33056
|
fontSize: "11px",
|
32880
33057
|
fontFamily: "monospace",
|
@@ -32884,13 +33061,14 @@ Middle click: Close`
|
|
32884
33061
|
};
|
32885
33062
|
const DesktopInternal = ({ desktopSize, children, ...props }) => {
|
32886
33063
|
const { isOpen, close } = useApplicationMenu();
|
32887
|
-
|
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(
|
32888
33066
|
ApplicationMenu,
|
32889
33067
|
{
|
32890
33068
|
isOpen,
|
32891
33069
|
onClose: close
|
32892
33070
|
}
|
32893
|
-
)));
|
33071
|
+
)), /* @__PURE__ */ React.createElement(DesktopTaskbar, null)));
|
32894
33072
|
};
|
32895
33073
|
const Desktop = ({ desktopSize, children, ...props }) => {
|
32896
33074
|
return /* @__PURE__ */ React.createElement(AppProvider, null, /* @__PURE__ */ React.createElement(DesktopInternal, { desktopSize, ...props }, children));
|