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.umd.js CHANGED
@@ -1988,7 +1988,9 @@
1988
1988
  icon: loading ? "hourglass_empty" : icon,
1989
1989
  size: size === "small" ? "small" : size === "large" ? "normal" : "small",
1990
1990
  disabled: disabled || loading,
1991
- className: loading ? "loading-icon" : ""
1991
+ className: loading ? "loading-icon" : "",
1992
+ eventPropagation: true
1993
+ // Allow click events to bubble up to button
1992
1994
  };
1993
1995
  return /* @__PURE__ */ React.createElement(
1994
1996
  "button",
@@ -31711,6 +31713,7 @@ const rows = [
31711
31713
  this.windows = /* @__PURE__ */ new Map();
31712
31714
  this.activeWindowId = null;
31713
31715
  this.nextZIndex = 1e3;
31716
+ this.maxZIndex = 9999;
31714
31717
  this.listeners = /* @__PURE__ */ new Set();
31715
31718
  this.desktopSize = desktopSize;
31716
31719
  }
@@ -31772,7 +31775,7 @@ const rows = [
31772
31775
  size,
31773
31776
  minimized: false,
31774
31777
  maximized: false,
31775
- zIndex: this.nextZIndex++,
31778
+ zIndex: Math.min(this.nextZIndex++, this.maxZIndex),
31776
31779
  ...config
31777
31780
  };
31778
31781
  this.windows.set(window2.id, window2);
@@ -31791,7 +31794,7 @@ const rows = [
31791
31794
  let x = baseX + existingWindows.length * offsetStep;
31792
31795
  let y = baseY + existingWindows.length * offsetStep;
31793
31796
  const maxX = this.desktopSize.width - windowSize.width - 20;
31794
- const maxY = this.desktopSize.height - windowSize.height - 100;
31797
+ const maxY = this.desktopSize.height - windowSize.height - 20;
31795
31798
  if (x > maxX || y > maxY) {
31796
31799
  const cascadeIndex = existingWindows.length % 8;
31797
31800
  x = baseX + cascadeIndex * 30;
@@ -31827,7 +31830,10 @@ const rows = [
31827
31830
  if (window2.minimized) {
31828
31831
  window2.minimized = false;
31829
31832
  }
31830
- window2.zIndex = this.nextZIndex++;
31833
+ if (this.nextZIndex >= this.maxZIndex) {
31834
+ this.resetZIndexes();
31835
+ }
31836
+ window2.zIndex = Math.min(this.nextZIndex++, this.maxZIndex);
31831
31837
  this.activeWindowId = windowId;
31832
31838
  this.notifyListeners();
31833
31839
  return true;
@@ -31879,7 +31885,7 @@ const rows = [
31879
31885
  const minWidth = 200;
31880
31886
  const minHeight = 150;
31881
31887
  const maxWidth = this.desktopSize.width;
31882
- const maxHeight = this.desktopSize.height - 50;
31888
+ const maxHeight = this.desktopSize.height;
31883
31889
  const constrainedSize = {
31884
31890
  width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
31885
31891
  height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
@@ -31915,7 +31921,7 @@ const rows = [
31915
31921
  this.windows.forEach((window2) => {
31916
31922
  if (window2.maximized) return;
31917
31923
  const maxX = this.desktopSize.width - window2.size.width;
31918
- const maxY = this.desktopSize.height - window2.size.height - 50;
31924
+ const maxY = this.desktopSize.height - window2.size.height;
31919
31925
  if (window2.position.x > maxX) {
31920
31926
  window2.position.x = Math.max(0, maxX);
31921
31927
  }
@@ -31950,7 +31956,7 @@ const rows = [
31950
31956
  const cols = Math.ceil(Math.sqrt(visibleWindows.length));
31951
31957
  const rows = Math.ceil(visibleWindows.length / cols);
31952
31958
  const windowWidth = Math.floor(this.desktopSize.width / cols);
31953
- const windowHeight = Math.floor((this.desktopSize.height - 80) / rows);
31959
+ const windowHeight = Math.floor(this.desktopSize.height / rows);
31954
31960
  visibleWindows.forEach((window2, index) => {
31955
31961
  const col = index % cols;
31956
31962
  const row = Math.floor(index / cols);
@@ -31975,8 +31981,8 @@ const rows = [
31975
31981
  if (!window2 || window2.maximized) return false;
31976
31982
  window2.position = {
31977
31983
  x: (this.desktopSize.width - window2.size.width) / 2,
31978
- y: (this.desktopSize.height - window2.size.height - 50) / 2
31979
- // Space for taskbar
31984
+ y: (this.desktopSize.height - window2.size.height) / 2
31985
+ // Workspace center
31980
31986
  };
31981
31987
  this.notifyListeners();
31982
31988
  return true;
@@ -31989,7 +31995,7 @@ const rows = [
31989
31995
  const offsetStep = 20;
31990
31996
  visibleWindows.forEach((window2, index) => {
31991
31997
  const baseX = (this.desktopSize.width - window2.size.width) / 2;
31992
- const baseY = (this.desktopSize.height - window2.size.height - 50) / 2;
31998
+ const baseY = (this.desktopSize.height - window2.size.height) / 2;
31993
31999
  window2.position = {
31994
32000
  x: baseX + index * offsetStep,
31995
32001
  y: baseY + index * offsetStep
@@ -32010,6 +32016,19 @@ const rows = [
32010
32016
  desktopSize: this.desktopSize
32011
32017
  };
32012
32018
  }
32019
+ /**
32020
+ * Reset z-indexes when they reach the maximum
32021
+ */
32022
+ resetZIndexes() {
32023
+ const windows = Array.from(this.windows.values());
32024
+ windows.sort((a, b) => a.zIndex - b.zIndex);
32025
+ this.nextZIndex = 1e3;
32026
+ windows.forEach((window2, index) => {
32027
+ window2.zIndex = this.nextZIndex + index;
32028
+ });
32029
+ this.nextZIndex = 1e3 + windows.length;
32030
+ this.notifyListeners();
32031
+ }
32013
32032
  }
32014
32033
  const WindowContext = React.createContext(null);
32015
32034
  const WindowProvider = ({ children, desktopSize }) => {
@@ -32034,8 +32053,10 @@ const rows = [
32034
32053
  }
32035
32054
  }, [desktopSize]);
32036
32055
  if (!state || !windowManagerRef.current) {
32056
+ console.log("WindowProvider not ready - state:", state, "windowManager:", windowManagerRef.current);
32037
32057
  return null;
32038
32058
  }
32059
+ console.log("WindowProvider ready - providing context");
32039
32060
  const value = {
32040
32061
  // Current state
32041
32062
  windows: state.windows,
@@ -32177,6 +32198,86 @@ const rows = [
32177
32198
  };
32178
32199
  updateWindowPosition(id, finalPosition);
32179
32200
  };
32201
+ const handleResizeStart = (e, direction) => {
32202
+ if (!resizable || maximized) return;
32203
+ e.preventDefault();
32204
+ e.stopPropagation();
32205
+ setIsResizing(true);
32206
+ setResizeDirection(direction);
32207
+ setResizeStartSize(size);
32208
+ setResizeStartPosition(position);
32209
+ setResizeStartMouse({ x: e.clientX, y: e.clientY });
32210
+ focusWindow(id);
32211
+ };
32212
+ const handleResizeMove = (e) => {
32213
+ if (!isResizing) return;
32214
+ e.preventDefault();
32215
+ const deltaX = e.clientX - resizeStartMouse.x;
32216
+ const deltaY = e.clientY - resizeStartMouse.y;
32217
+ let newSize = { ...resizeStartSize };
32218
+ let newPosition = { ...resizeStartPosition };
32219
+ switch (resizeDirection) {
32220
+ case "n":
32221
+ newSize.height = Math.max(150, resizeStartSize.height - deltaY);
32222
+ newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
32223
+ break;
32224
+ case "s":
32225
+ newSize.height = Math.max(150, resizeStartSize.height + deltaY);
32226
+ break;
32227
+ case "e":
32228
+ newSize.width = Math.max(200, resizeStartSize.width + deltaX);
32229
+ break;
32230
+ case "w":
32231
+ newSize.width = Math.max(200, resizeStartSize.width - deltaX);
32232
+ newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
32233
+ break;
32234
+ case "ne":
32235
+ newSize.width = Math.max(200, resizeStartSize.width + deltaX);
32236
+ newSize.height = Math.max(150, resizeStartSize.height - deltaY);
32237
+ newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
32238
+ break;
32239
+ case "nw":
32240
+ newSize.width = Math.max(200, resizeStartSize.width - deltaX);
32241
+ newSize.height = Math.max(150, resizeStartSize.height - deltaY);
32242
+ newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
32243
+ newPosition.y = resizeStartPosition.y + (resizeStartSize.height - newSize.height);
32244
+ break;
32245
+ case "se":
32246
+ newSize.width = Math.max(200, resizeStartSize.width + deltaX);
32247
+ newSize.height = Math.max(150, resizeStartSize.height + deltaY);
32248
+ break;
32249
+ case "sw":
32250
+ newSize.width = Math.max(200, resizeStartSize.width - deltaX);
32251
+ newSize.height = Math.max(150, resizeStartSize.height + deltaY);
32252
+ newPosition.x = resizeStartPosition.x + (resizeStartSize.width - newSize.width);
32253
+ break;
32254
+ }
32255
+ if (windowRef.current) {
32256
+ windowRef.current.style.width = `${newSize.width}px`;
32257
+ windowRef.current.style.height = `${newSize.height}px`;
32258
+ windowRef.current.style.left = `${newPosition.x}px`;
32259
+ windowRef.current.style.top = `${newPosition.y}px`;
32260
+ }
32261
+ };
32262
+ const handleResizeEnd = () => {
32263
+ if (!isResizing) return;
32264
+ setIsResizing(false);
32265
+ setResizeDirection("");
32266
+ const desktopContainer = windowRef.current?.parentElement;
32267
+ if (!desktopContainer) return;
32268
+ const windowRect = windowRef.current.getBoundingClientRect();
32269
+ const desktopRect = desktopContainer.getBoundingClientRect();
32270
+ const finalSize = {
32271
+ width: windowRect.width,
32272
+ height: windowRect.height
32273
+ };
32274
+ const finalPosition = {
32275
+ x: windowRect.left - desktopRect.left,
32276
+ y: windowRect.top - desktopRect.top
32277
+ };
32278
+ updateWindowSize(id, finalSize);
32279
+ updateWindowPosition(id, finalPosition);
32280
+ };
32180
32281
  React.useEffect(() => {
32181
32282
  if (isDragging) {
32182
32283
  document.addEventListener("mousemove", handleMouseMove);
@@ -32191,6 +32292,18 @@ const rows = [
32191
32292
  };
32192
32293
  }
32193
32294
  }, [isDragging]);
32295
+ React.useEffect(() => {
32296
+ if (isResizing) {
32297
+ document.addEventListener("mousemove", handleResizeMove);
32298
+ document.addEventListener("mouseup", handleResizeEnd);
32299
+ document.body.style.userSelect = "none";
32300
+ return () => {
32301
+ document.removeEventListener("mousemove", handleResizeMove);
32302
+ document.removeEventListener("mouseup", handleResizeEnd);
32303
+ document.body.style.userSelect = "";
32304
+ };
32305
+ }
32306
+ }, [isResizing]);
32194
32307
  const handleMinimize = (e) => {
32195
32308
  e.stopPropagation();
32196
32309
  minimizeWindow(id, !minimized);
@@ -32225,6 +32338,7 @@ const rows = [
32225
32338
  "window",
32226
32339
  maximized && "window--maximized",
32227
32340
  isDragging && "window--dragging",
32341
+ isResizing && "window--resizing",
32228
32342
  className
32229
32343
  ].filter(Boolean).join(" ");
32230
32344
  return /* @__PURE__ */ React.createElement(
@@ -32274,10 +32388,60 @@ const rows = [
32274
32388
  ),
32275
32389
  toolbar && /* @__PURE__ */ React.createElement("div", { className: "window__toolbar" }, toolbar),
32276
32390
  /* @__PURE__ */ React.createElement("div", { className: "window__content" }, content || children),
32277
- statusBar && /* @__PURE__ */ React.createElement("div", { className: "window__status-bar" }, statusBar)
32391
+ statusBar && /* @__PURE__ */ React.createElement("div", { className: "window__status-bar" }, statusBar),
32392
+ resizable && !maximized && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
32393
+ "div",
32394
+ {
32395
+ className: "window__resize-handle window__resize-handle--n",
32396
+ onMouseDown: (e) => handleResizeStart(e, "n")
32397
+ }
32398
+ ), /* @__PURE__ */ React.createElement(
32399
+ "div",
32400
+ {
32401
+ className: "window__resize-handle window__resize-handle--s",
32402
+ onMouseDown: (e) => handleResizeStart(e, "s")
32403
+ }
32404
+ ), /* @__PURE__ */ React.createElement(
32405
+ "div",
32406
+ {
32407
+ className: "window__resize-handle window__resize-handle--e",
32408
+ onMouseDown: (e) => handleResizeStart(e, "e")
32409
+ }
32410
+ ), /* @__PURE__ */ React.createElement(
32411
+ "div",
32412
+ {
32413
+ className: "window__resize-handle window__resize-handle--w",
32414
+ onMouseDown: (e) => handleResizeStart(e, "w")
32415
+ }
32416
+ ), /* @__PURE__ */ React.createElement(
32417
+ "div",
32418
+ {
32419
+ className: "window__resize-handle window__resize-handle--ne",
32420
+ onMouseDown: (e) => handleResizeStart(e, "ne")
32421
+ }
32422
+ ), /* @__PURE__ */ React.createElement(
32423
+ "div",
32424
+ {
32425
+ className: "window__resize-handle window__resize-handle--nw",
32426
+ onMouseDown: (e) => handleResizeStart(e, "nw")
32427
+ }
32428
+ ), /* @__PURE__ */ React.createElement(
32429
+ "div",
32430
+ {
32431
+ className: "window__resize-handle window__resize-handle--se",
32432
+ onMouseDown: (e) => handleResizeStart(e, "se")
32433
+ }
32434
+ ), /* @__PURE__ */ React.createElement(
32435
+ "div",
32436
+ {
32437
+ className: "window__resize-handle window__resize-handle--sw",
32438
+ onMouseDown: (e) => handleResizeStart(e, "sw")
32439
+ }
32440
+ ))
32278
32441
  );
32279
32442
  };
32280
32443
  const ApplicationMenu = ({ isOpen, onClose }) => {
32444
+ console.log("ApplicationMenu render - isOpen:", isOpen, "onClose:", onClose);
32281
32445
  const appManager = useAppManager();
32282
32446
  const [searchTerm, setSearchTerm] = React.useState("");
32283
32447
  const [selectedCategory, setSelectedCategory] = React.useState("all");
@@ -32362,14 +32526,14 @@ const rows = [
32362
32526
  onChange: (e) => setSearchTerm(e.target.value),
32363
32527
  className: "application-menu__search-input"
32364
32528
  }
32365
- )), /* @__PURE__ */ React.createElement("div", { className: "application-menu__categories" }, /* @__PURE__ */ React.createElement(
32529
+ )), /* @__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(
32366
32530
  "button",
32367
32531
  {
32368
32532
  className: `application-menu__category ${selectedCategory === "all" ? "active" : ""}`,
32369
32533
  onClick: () => handleCategorySelect("all")
32370
32534
  },
32371
32535
  /* @__PURE__ */ React.createElement("span", { className: "category-icon" }, "📱"),
32372
- "All Apps"
32536
+ /* @__PURE__ */ React.createElement("span", { className: "category-name" }, "All Apps")
32373
32537
  ), categories.map((category) => /* @__PURE__ */ React.createElement(
32374
32538
  "button",
32375
32539
  {
@@ -32378,8 +32542,8 @@ const rows = [
32378
32542
  onClick: () => handleCategorySelect(category.id)
32379
32543
  },
32380
32544
  /* @__PURE__ */ React.createElement("span", { className: "category-icon" }, category.icon),
32381
- category.name
32382
- ))), /* @__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(
32545
+ /* @__PURE__ */ React.createElement("span", { className: "category-name" }, category.name)
32546
+ )))), /* @__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(
32383
32547
  "div",
32384
32548
  {
32385
32549
  key: app.id,
@@ -32399,7 +32563,7 @@ const rows = [
32399
32563
  },
32400
32564
  /* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
32401
32565
  /* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
32402
- )))))), 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.")))));
32566
+ )))))), 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."))))));
32403
32567
  };
32404
32568
  class AppManager {
32405
32569
  constructor() {
@@ -32657,14 +32821,14 @@ const rows = [
32657
32821
  };
32658
32822
  return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
32659
32823
  };
32660
- const DesktopLayout = ({ children, className = "", theme = "windows", ...props }) => {
32824
+ const DesktopLayout = ({ children, className = "", theme = "windows", workspaceRef, ...props }) => {
32661
32825
  const desktopRef = React.useRef(null);
32662
32826
  const { windowManager } = useWindows();
32663
32827
  React.useEffect(() => {
32664
- let currentSize = { width: 1200, height: 800 };
32665
- const measureDesktop = () => {
32666
- if (desktopRef.current) {
32667
- const rect = desktopRef.current.getBoundingClientRect();
32828
+ let currentSize = { width: 1200, height: 750 };
32829
+ const measureWorkspace = () => {
32830
+ if (workspaceRef.current) {
32831
+ const rect = workspaceRef.current.getBoundingClientRect();
32668
32832
  const newSize = {
32669
32833
  width: rect.width,
32670
32834
  height: rect.height
@@ -32675,10 +32839,10 @@ const rows = [
32675
32839
  }
32676
32840
  }
32677
32841
  };
32678
- measureDesktop();
32679
- const resizeObserver = new ResizeObserver(measureDesktop);
32680
- if (desktopRef.current) {
32681
- resizeObserver.observe(desktopRef.current);
32842
+ measureWorkspace();
32843
+ const resizeObserver = new ResizeObserver(measureWorkspace);
32844
+ if (workspaceRef.current) {
32845
+ resizeObserver.observe(workspaceRef.current);
32682
32846
  }
32683
32847
  return () => {
32684
32848
  resizeObserver.disconnect();
@@ -32703,7 +32867,7 @@ const rows = [
32703
32867
  };
32704
32868
  const Workspace = ({ children }) => {
32705
32869
  const { windows } = useWindows();
32706
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children, windows.map((window2) => /* @__PURE__ */ React.createElement(
32870
+ return /* @__PURE__ */ React.createElement("div", { className: "workspace" }, children, windows.map((window2) => /* @__PURE__ */ React.createElement(
32707
32871
  Window,
32708
32872
  {
32709
32873
  key: window2.id,
@@ -32717,6 +32881,9 @@ const rows = [
32717
32881
  )));
32718
32882
  };
32719
32883
  const DesktopTaskbar = () => {
32884
+ console.log("DesktopTaskbar render");
32885
+ const windowsContext = useWindows();
32886
+ console.log("useWindows result:", windowsContext);
32720
32887
  const {
32721
32888
  createWindow,
32722
32889
  windows,
@@ -32724,26 +32891,14 @@ const rows = [
32724
32891
  activeWindowId,
32725
32892
  focusWindow,
32726
32893
  minimizeWindow,
32727
- closeWindow
32728
- } = useWindows();
32729
- const { open: openApplicationMenu } = useApplicationMenu();
32730
- const handleCreateWindow = () => {
32731
- const windowTypes = [
32732
- { title: "File Explorer", icon: "📁", size: { width: 600, height: 400 } },
32733
- { title: "Text Editor", icon: "📝", size: { width: 500, height: 350 } },
32734
- { title: "Calculator", icon: "🧮", size: { width: 300, height: 400 } },
32735
- { title: "Settings", icon: "⚙️", size: { width: 450, height: 300 } },
32736
- { title: "Browser", icon: "🌐", size: { width: 800, height: 500 } }
32737
- ];
32738
- const randomType = windowTypes[Math.floor(Math.random() * windowTypes.length)];
32739
- createWindow({
32740
- title: randomType.title,
32741
- icon: randomType.icon,
32742
- size: randomType.size,
32743
- 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,
32744
- statusBar: randomType.title === "Text Editor" ? /* @__PURE__ */ React.createElement("span", null, "Ready | Line 1, Column 1") : null
32745
- });
32746
- };
32894
+ closeWindow,
32895
+ cascadeWindows,
32896
+ tileWindows,
32897
+ centerAllWindows,
32898
+ clearAllWindows
32899
+ } = windowsContext;
32900
+ const { isOpen, toggle } = useApplicationMenu();
32901
+ console.log("DesktopTaskbar - isOpen:", isOpen, "toggle:", toggle);
32747
32902
  const handleWindowClick = (window2) => {
32748
32903
  if (window2.minimized) {
32749
32904
  minimizeWindow(window2.id, false);
@@ -32766,11 +32921,7 @@ const rows = [
32766
32921
  closeWindow(window2.id);
32767
32922
  }
32768
32923
  };
32769
- return /* @__PURE__ */ React.createElement("div", { style: {
32770
- position: "absolute",
32771
- bottom: 0,
32772
- left: 0,
32773
- right: 0,
32924
+ return /* @__PURE__ */ React.createElement("div", { className: "desktop-taskbar", style: {
32774
32925
  height: "50px",
32775
32926
  background: "rgba(0,0,0,0.8)",
32776
32927
  display: "flex",
@@ -32778,44 +32929,16 @@ const rows = [
32778
32929
  padding: "0 16px",
32779
32930
  gap: "8px"
32780
32931
  } }, /* @__PURE__ */ React.createElement(
32781
- "button",
32932
+ ToggleButton,
32782
32933
  {
32783
- onClick: openApplicationMenu,
32784
- style: {
32785
- padding: "8px 16px",
32786
- background: "#1976d2",
32787
- color: "white",
32788
- border: "none",
32789
- borderRadius: "4px",
32790
- cursor: "pointer",
32791
- fontSize: "14px",
32792
- fontWeight: "bold",
32793
- flexShrink: 0,
32794
- display: "flex",
32795
- alignItems: "center",
32796
- gap: "6px"
32934
+ checked: isOpen,
32935
+ onToggle: () => {
32936
+ console.log("Start button toggled, current state:", isOpen);
32937
+ toggle();
32797
32938
  },
32798
- title: "Open application menu"
32799
- },
32800
- /* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px" } }, "🚀"),
32801
- "Start"
32802
- ), /* @__PURE__ */ React.createElement(
32803
- "button",
32804
- {
32805
- onClick: handleCreateWindow,
32806
- style: {
32807
- padding: "8px 12px",
32808
- background: "#666",
32809
- color: "white",
32810
- border: "none",
32811
- borderRadius: "4px",
32812
- cursor: "pointer",
32813
- fontSize: "12px",
32814
- flexShrink: 0
32815
- },
32816
- title: "Create random window (for testing)"
32817
- },
32818
- "+"
32939
+ icon: "start",
32940
+ label: "Start"
32941
+ }
32819
32942
  ), /* @__PURE__ */ React.createElement("div", { style: {
32820
32943
  width: "1px",
32821
32944
  height: "30px",
@@ -32876,6 +32999,60 @@ Middle click: Close`
32876
32999
  borderRadius: "1px"
32877
33000
  } })
32878
33001
  ))), /* @__PURE__ */ React.createElement("div", { style: {
33002
+ display: "flex",
33003
+ gap: "4px",
33004
+ alignItems: "center",
33005
+ marginLeft: "auto",
33006
+ marginRight: "8px"
33007
+ } }, /* @__PURE__ */ React.createElement(
33008
+ Icon,
33009
+ {
33010
+ clickable: true,
33011
+ size: "small",
33012
+ action: () => {
33013
+ console.log("Cascade windows clicked!");
33014
+ cascadeWindows();
33015
+ },
33016
+ icon: "view_stream",
33017
+ label: "Cascade"
33018
+ }
33019
+ ), /* @__PURE__ */ React.createElement(
33020
+ Icon,
33021
+ {
33022
+ clickable: true,
33023
+ size: "small",
33024
+ action: () => {
33025
+ console.log("Tile windows clicked!");
33026
+ tileWindows();
33027
+ },
33028
+ icon: "view_module",
33029
+ label: "Tile"
33030
+ }
33031
+ ), /* @__PURE__ */ React.createElement(
33032
+ Icon,
33033
+ {
33034
+ clickable: true,
33035
+ size: "small",
33036
+ action: () => {
33037
+ console.log("Center all windows clicked!");
33038
+ centerAllWindows();
33039
+ },
33040
+ icon: "center_focus_strong",
33041
+ label: "Center"
33042
+ }
33043
+ ), /* @__PURE__ */ React.createElement(
33044
+ Icon,
33045
+ {
33046
+ clickable: true,
33047
+ size: "small",
33048
+ action: () => {
33049
+ console.log("Clear all windows clicked!");
33050
+ clearAllWindows();
33051
+ },
33052
+ icon: "clear_all",
33053
+ label: "Clear"
33054
+ }
33055
+ )), /* @__PURE__ */ React.createElement("div", { style: {
32879
33056
  color: "rgba(255,255,255,0.7)",
32880
33057
  fontSize: "11px",
32881
33058
  fontFamily: "monospace",
@@ -32885,13 +33062,14 @@ Middle click: Close`
32885
33062
  };
32886
33063
  const DesktopInternal = ({ desktopSize, children, ...props }) => {
32887
33064
  const { isOpen, close } = useApplicationMenu();
32888
- return /* @__PURE__ */ React.createElement(WindowProvider, { desktopSize }, /* @__PURE__ */ React.createElement(DesktopLayout, { ...props }, /* @__PURE__ */ React.createElement(Workspace, null, children), /* @__PURE__ */ React.createElement(DesktopTaskbar, null), /* @__PURE__ */ React.createElement(
33065
+ const workspaceRef = React.useRef(null);
33066
+ 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(
32889
33067
  ApplicationMenu,
32890
33068
  {
32891
33069
  isOpen,
32892
33070
  onClose: close
32893
33071
  }
32894
- )));
33072
+ )), /* @__PURE__ */ React.createElement(DesktopTaskbar, null)));
32895
33073
  };
32896
33074
  const Desktop = ({ desktopSize, children, ...props }) => {
32897
33075
  return /* @__PURE__ */ React.createElement(AppProvider, null, /* @__PURE__ */ React.createElement(DesktopInternal, { desktopSize, ...props }, children));