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.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;
@@ -31870,6 +31876,24 @@ const rows = [
31870
31876
  this.notifyListeners();
31871
31877
  return true;
31872
31878
  }
31879
+ /**
31880
+ * Update window size
31881
+ */
31882
+ updateWindowSize(windowId, size) {
31883
+ const window2 = this.windows.get(windowId);
31884
+ if (!window2) return false;
31885
+ const minWidth = 200;
31886
+ const minHeight = 150;
31887
+ const maxWidth = this.desktopSize.width;
31888
+ const maxHeight = this.desktopSize.height;
31889
+ const constrainedSize = {
31890
+ width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
31891
+ height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
31892
+ };
31893
+ window2.size = { ...window2.size, ...constrainedSize };
31894
+ this.notifyListeners();
31895
+ return true;
31896
+ }
31873
31897
  /**
31874
31898
  * Get all windows
31875
31899
  */
@@ -31897,7 +31921,7 @@ const rows = [
31897
31921
  this.windows.forEach((window2) => {
31898
31922
  if (window2.maximized) return;
31899
31923
  const maxX = this.desktopSize.width - window2.size.width;
31900
- const maxY = this.desktopSize.height - window2.size.height - 50;
31924
+ const maxY = this.desktopSize.height - window2.size.height;
31901
31925
  if (window2.position.x > maxX) {
31902
31926
  window2.position.x = Math.max(0, maxX);
31903
31927
  }
@@ -31932,7 +31956,7 @@ const rows = [
31932
31956
  const cols = Math.ceil(Math.sqrt(visibleWindows.length));
31933
31957
  const rows = Math.ceil(visibleWindows.length / cols);
31934
31958
  const windowWidth = Math.floor(this.desktopSize.width / cols);
31935
- const windowHeight = Math.floor((this.desktopSize.height - 80) / rows);
31959
+ const windowHeight = Math.floor(this.desktopSize.height / rows);
31936
31960
  visibleWindows.forEach((window2, index) => {
31937
31961
  const col = index % cols;
31938
31962
  const row = Math.floor(index / cols);
@@ -31957,8 +31981,8 @@ const rows = [
31957
31981
  if (!window2 || window2.maximized) return false;
31958
31982
  window2.position = {
31959
31983
  x: (this.desktopSize.width - window2.size.width) / 2,
31960
- y: (this.desktopSize.height - window2.size.height - 50) / 2
31961
- // Space for taskbar
31984
+ y: (this.desktopSize.height - window2.size.height) / 2
31985
+ // Workspace center
31962
31986
  };
31963
31987
  this.notifyListeners();
31964
31988
  return true;
@@ -31971,7 +31995,7 @@ const rows = [
31971
31995
  const offsetStep = 20;
31972
31996
  visibleWindows.forEach((window2, index) => {
31973
31997
  const baseX = (this.desktopSize.width - window2.size.width) / 2;
31974
- const baseY = (this.desktopSize.height - window2.size.height - 50) / 2;
31998
+ const baseY = (this.desktopSize.height - window2.size.height) / 2;
31975
31999
  window2.position = {
31976
32000
  x: baseX + index * offsetStep,
31977
32001
  y: baseY + index * offsetStep
@@ -31992,6 +32016,19 @@ const rows = [
31992
32016
  desktopSize: this.desktopSize
31993
32017
  };
31994
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
+ }
31995
32032
  }
31996
32033
  const WindowContext = React.createContext(null);
31997
32034
  const WindowProvider = ({ children, desktopSize }) => {
@@ -32016,8 +32053,10 @@ const rows = [
32016
32053
  }
32017
32054
  }, [desktopSize]);
32018
32055
  if (!state || !windowManagerRef.current) {
32056
+ console.log("WindowProvider not ready - state:", state, "windowManager:", windowManagerRef.current);
32019
32057
  return null;
32020
32058
  }
32059
+ console.log("WindowProvider ready - providing context");
32021
32060
  const value = {
32022
32061
  // Current state
32023
32062
  windows: state.windows,
@@ -32032,6 +32071,7 @@ const rows = [
32032
32071
  minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
32033
32072
  maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
32034
32073
  updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
32074
+ updateWindowSize: (id, size) => windowManagerRef.current.updateWindowSize(id, size),
32035
32075
  // Window queries
32036
32076
  getWindow: (id) => windowManagerRef.current.getWindow(id),
32037
32077
  getAllWindows: () => windowManagerRef.current.getAllWindows(),
@@ -32094,11 +32134,16 @@ const rows = [
32094
32134
  }) => {
32095
32135
  const windowRef = React.useRef(null);
32096
32136
  const headerRef = React.useRef(null);
32097
- const { getWindow, updateWindowPosition, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
32137
+ const { getWindow, updateWindowPosition, updateWindowSize, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
32098
32138
  const windowData = getWindow(id);
32099
32139
  const [isDragging, setIsDragging] = React.useState(false);
32100
32140
  const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
32101
32141
  const [dragStartPosition, setDragStartPosition] = React.useState({ x: 0, y: 0 });
32142
+ const [isResizing, setIsResizing] = React.useState(false);
32143
+ const [resizeDirection, setResizeDirection] = React.useState("");
32144
+ const [resizeStartSize, setResizeStartSize] = React.useState({ width: 0, height: 0 });
32145
+ const [resizeStartPosition, setResizeStartPosition] = React.useState({ x: 0, y: 0 });
32146
+ const [resizeStartMouse, setResizeStartMouse] = React.useState({ x: 0, y: 0 });
32102
32147
  if (!windowData) {
32103
32148
  return null;
32104
32149
  }
@@ -32153,6 +32198,86 @@ const rows = [
32153
32198
  };
32154
32199
  updateWindowPosition(id, finalPosition);
32155
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
+ };
32156
32281
  React.useEffect(() => {
32157
32282
  if (isDragging) {
32158
32283
  document.addEventListener("mousemove", handleMouseMove);
@@ -32167,6 +32292,18 @@ const rows = [
32167
32292
  };
32168
32293
  }
32169
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]);
32170
32307
  const handleMinimize = (e) => {
32171
32308
  e.stopPropagation();
32172
32309
  minimizeWindow(id, !minimized);
@@ -32201,6 +32338,7 @@ const rows = [
32201
32338
  "window",
32202
32339
  maximized && "window--maximized",
32203
32340
  isDragging && "window--dragging",
32341
+ isResizing && "window--resizing",
32204
32342
  className
32205
32343
  ].filter(Boolean).join(" ");
32206
32344
  return /* @__PURE__ */ React.createElement(
@@ -32250,10 +32388,60 @@ const rows = [
32250
32388
  ),
32251
32389
  toolbar && /* @__PURE__ */ React.createElement("div", { className: "window__toolbar" }, toolbar),
32252
32390
  /* @__PURE__ */ React.createElement("div", { className: "window__content" }, content || children),
32253
- 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
+ ))
32254
32441
  );
32255
32442
  };
32256
32443
  const ApplicationMenu = ({ isOpen, onClose }) => {
32444
+ console.log("ApplicationMenu render - isOpen:", isOpen, "onClose:", onClose);
32257
32445
  const appManager = useAppManager();
32258
32446
  const [searchTerm, setSearchTerm] = React.useState("");
32259
32447
  const [selectedCategory, setSelectedCategory] = React.useState("all");
@@ -32338,14 +32526,14 @@ const rows = [
32338
32526
  onChange: (e) => setSearchTerm(e.target.value),
32339
32527
  className: "application-menu__search-input"
32340
32528
  }
32341
- )), /* @__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(
32342
32530
  "button",
32343
32531
  {
32344
32532
  className: `application-menu__category ${selectedCategory === "all" ? "active" : ""}`,
32345
32533
  onClick: () => handleCategorySelect("all")
32346
32534
  },
32347
32535
  /* @__PURE__ */ React.createElement("span", { className: "category-icon" }, "📱"),
32348
- "All Apps"
32536
+ /* @__PURE__ */ React.createElement("span", { className: "category-name" }, "All Apps")
32349
32537
  ), categories.map((category) => /* @__PURE__ */ React.createElement(
32350
32538
  "button",
32351
32539
  {
@@ -32354,8 +32542,8 @@ const rows = [
32354
32542
  onClick: () => handleCategorySelect(category.id)
32355
32543
  },
32356
32544
  /* @__PURE__ */ React.createElement("span", { className: "category-icon" }, category.icon),
32357
- category.name
32358
- ))), /* @__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(
32359
32547
  "div",
32360
32548
  {
32361
32549
  key: app.id,
@@ -32375,7 +32563,7 @@ const rows = [
32375
32563
  },
32376
32564
  /* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
32377
32565
  /* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
32378
- )))))), 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."))))));
32379
32567
  };
32380
32568
  class AppManager {
32381
32569
  constructor() {
@@ -32633,14 +32821,14 @@ const rows = [
32633
32821
  };
32634
32822
  return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
32635
32823
  };
32636
- const DesktopLayout = ({ children, className = "", ...props }) => {
32824
+ const DesktopLayout = ({ children, className = "", theme = "windows", workspaceRef, ...props }) => {
32637
32825
  const desktopRef = React.useRef(null);
32638
32826
  const { windowManager } = useWindows();
32639
32827
  React.useEffect(() => {
32640
- let currentSize = { width: 1200, height: 800 };
32641
- const measureDesktop = () => {
32642
- if (desktopRef.current) {
32643
- 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();
32644
32832
  const newSize = {
32645
32833
  width: rect.width,
32646
32834
  height: rect.height
@@ -32651,10 +32839,10 @@ const rows = [
32651
32839
  }
32652
32840
  }
32653
32841
  };
32654
- measureDesktop();
32655
- const resizeObserver = new ResizeObserver(measureDesktop);
32656
- if (desktopRef.current) {
32657
- resizeObserver.observe(desktopRef.current);
32842
+ measureWorkspace();
32843
+ const resizeObserver = new ResizeObserver(measureWorkspace);
32844
+ if (workspaceRef.current) {
32845
+ resizeObserver.observe(workspaceRef.current);
32658
32846
  }
32659
32847
  return () => {
32660
32848
  resizeObserver.disconnect();
@@ -32664,11 +32852,12 @@ const rows = [
32664
32852
  e.preventDefault();
32665
32853
  console.log("Desktop context menu at:", e.clientX, e.clientY);
32666
32854
  };
32855
+ const themeClass = `desktop--${theme}`;
32667
32856
  return /* @__PURE__ */ React.createElement(
32668
32857
  "div",
32669
32858
  {
32670
32859
  ref: desktopRef,
32671
- className: `desktop ${className}`,
32860
+ className: `desktop ${themeClass} ${className}`,
32672
32861
  onContextMenu: handleContextMenu,
32673
32862
  ...props
32674
32863
  },
@@ -32678,7 +32867,7 @@ const rows = [
32678
32867
  };
32679
32868
  const Workspace = ({ children }) => {
32680
32869
  const { windows } = useWindows();
32681
- 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(
32682
32871
  Window,
32683
32872
  {
32684
32873
  key: window2.id,
@@ -32692,6 +32881,9 @@ const rows = [
32692
32881
  )));
32693
32882
  };
32694
32883
  const DesktopTaskbar = () => {
32884
+ console.log("DesktopTaskbar render");
32885
+ const windowsContext = useWindows();
32886
+ console.log("useWindows result:", windowsContext);
32695
32887
  const {
32696
32888
  createWindow,
32697
32889
  windows,
@@ -32699,26 +32891,14 @@ const rows = [
32699
32891
  activeWindowId,
32700
32892
  focusWindow,
32701
32893
  minimizeWindow,
32702
- closeWindow
32703
- } = useWindows();
32704
- const { open: openApplicationMenu } = useApplicationMenu();
32705
- const handleCreateWindow = () => {
32706
- const windowTypes = [
32707
- { title: "File Explorer", icon: "📁", size: { width: 600, height: 400 } },
32708
- { title: "Text Editor", icon: "📝", size: { width: 500, height: 350 } },
32709
- { title: "Calculator", icon: "🧮", size: { width: 300, height: 400 } },
32710
- { title: "Settings", icon: "⚙️", size: { width: 450, height: 300 } },
32711
- { title: "Browser", icon: "🌐", size: { width: 800, height: 500 } }
32712
- ];
32713
- const randomType = windowTypes[Math.floor(Math.random() * windowTypes.length)];
32714
- createWindow({
32715
- title: randomType.title,
32716
- icon: randomType.icon,
32717
- size: randomType.size,
32718
- 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,
32719
- statusBar: randomType.title === "Text Editor" ? /* @__PURE__ */ React.createElement("span", null, "Ready | Line 1, Column 1") : null
32720
- });
32721
- };
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);
32722
32902
  const handleWindowClick = (window2) => {
32723
32903
  if (window2.minimized) {
32724
32904
  minimizeWindow(window2.id, false);
@@ -32741,11 +32921,7 @@ const rows = [
32741
32921
  closeWindow(window2.id);
32742
32922
  }
32743
32923
  };
32744
- return /* @__PURE__ */ React.createElement("div", { style: {
32745
- position: "absolute",
32746
- bottom: 0,
32747
- left: 0,
32748
- right: 0,
32924
+ return /* @__PURE__ */ React.createElement("div", { className: "desktop-taskbar", style: {
32749
32925
  height: "50px",
32750
32926
  background: "rgba(0,0,0,0.8)",
32751
32927
  display: "flex",
@@ -32753,44 +32929,16 @@ const rows = [
32753
32929
  padding: "0 16px",
32754
32930
  gap: "8px"
32755
32931
  } }, /* @__PURE__ */ React.createElement(
32756
- "button",
32932
+ ToggleButton,
32757
32933
  {
32758
- onClick: openApplicationMenu,
32759
- style: {
32760
- padding: "8px 16px",
32761
- background: "#1976d2",
32762
- color: "white",
32763
- border: "none",
32764
- borderRadius: "4px",
32765
- cursor: "pointer",
32766
- fontSize: "14px",
32767
- fontWeight: "bold",
32768
- flexShrink: 0,
32769
- display: "flex",
32770
- alignItems: "center",
32771
- gap: "6px"
32772
- },
32773
- title: "Open application menu"
32774
- },
32775
- /* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px" } }, "🚀"),
32776
- "Start"
32777
- ), /* @__PURE__ */ React.createElement(
32778
- "button",
32779
- {
32780
- onClick: handleCreateWindow,
32781
- style: {
32782
- padding: "8px 12px",
32783
- background: "#666",
32784
- color: "white",
32785
- border: "none",
32786
- borderRadius: "4px",
32787
- cursor: "pointer",
32788
- fontSize: "12px",
32789
- flexShrink: 0
32934
+ checked: isOpen,
32935
+ onToggle: () => {
32936
+ console.log("Start button toggled, current state:", isOpen);
32937
+ toggle();
32790
32938
  },
32791
- title: "Create random window (for testing)"
32792
- },
32793
- "+"
32939
+ icon: "start",
32940
+ label: "Start"
32941
+ }
32794
32942
  ), /* @__PURE__ */ React.createElement("div", { style: {
32795
32943
  width: "1px",
32796
32944
  height: "30px",
@@ -32851,6 +32999,60 @@ Middle click: Close`
32851
32999
  borderRadius: "1px"
32852
33000
  } })
32853
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: {
32854
33056
  color: "rgba(255,255,255,0.7)",
32855
33057
  fontSize: "11px",
32856
33058
  fontFamily: "monospace",
@@ -32860,13 +33062,14 @@ Middle click: Close`
32860
33062
  };
32861
33063
  const DesktopInternal = ({ desktopSize, children, ...props }) => {
32862
33064
  const { isOpen, close } = useApplicationMenu();
32863
- 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(
32864
33067
  ApplicationMenu,
32865
33068
  {
32866
33069
  isOpen,
32867
33070
  onClose: close
32868
33071
  }
32869
- )));
33072
+ )), /* @__PURE__ */ React.createElement(DesktopTaskbar, null)));
32870
33073
  };
32871
33074
  const Desktop = ({ desktopSize, children, ...props }) => {
32872
33075
  return /* @__PURE__ */ React.createElement(AppProvider, null, /* @__PURE__ */ React.createElement(DesktopInternal, { desktopSize, ...props }, children));