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