ywana-core8 0.2.5 → 0.2.6

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
@@ -31870,6 +31870,24 @@ const rows = [
31870
31870
  this.notifyListeners();
31871
31871
  return true;
31872
31872
  }
31873
+ /**
31874
+ * Update window size
31875
+ */
31876
+ updateWindowSize(windowId, size) {
31877
+ const window2 = this.windows.get(windowId);
31878
+ if (!window2) return false;
31879
+ const minWidth = 200;
31880
+ const minHeight = 150;
31881
+ const maxWidth = this.desktopSize.width;
31882
+ const maxHeight = this.desktopSize.height - 50;
31883
+ const constrainedSize = {
31884
+ width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
31885
+ height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
31886
+ };
31887
+ window2.size = { ...window2.size, ...constrainedSize };
31888
+ this.notifyListeners();
31889
+ return true;
31890
+ }
31873
31891
  /**
31874
31892
  * Get all windows
31875
31893
  */
@@ -32032,6 +32050,7 @@ const rows = [
32032
32050
  minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
32033
32051
  maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
32034
32052
  updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
32053
+ updateWindowSize: (id, size) => windowManagerRef.current.updateWindowSize(id, size),
32035
32054
  // Window queries
32036
32055
  getWindow: (id) => windowManagerRef.current.getWindow(id),
32037
32056
  getAllWindows: () => windowManagerRef.current.getAllWindows(),
@@ -32094,11 +32113,16 @@ const rows = [
32094
32113
  }) => {
32095
32114
  const windowRef = React.useRef(null);
32096
32115
  const headerRef = React.useRef(null);
32097
- const { getWindow, updateWindowPosition, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
32116
+ const { getWindow, updateWindowPosition, updateWindowSize, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
32098
32117
  const windowData = getWindow(id);
32099
32118
  const [isDragging, setIsDragging] = React.useState(false);
32100
32119
  const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
32101
32120
  const [dragStartPosition, setDragStartPosition] = React.useState({ x: 0, y: 0 });
32121
+ const [isResizing, setIsResizing] = React.useState(false);
32122
+ const [resizeDirection, setResizeDirection] = React.useState("");
32123
+ const [resizeStartSize, setResizeStartSize] = React.useState({ width: 0, height: 0 });
32124
+ const [resizeStartPosition, setResizeStartPosition] = React.useState({ x: 0, y: 0 });
32125
+ const [resizeStartMouse, setResizeStartMouse] = React.useState({ x: 0, y: 0 });
32102
32126
  if (!windowData) {
32103
32127
  return null;
32104
32128
  }
@@ -32633,7 +32657,7 @@ const rows = [
32633
32657
  };
32634
32658
  return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
32635
32659
  };
32636
- const DesktopLayout = ({ children, className = "", ...props }) => {
32660
+ const DesktopLayout = ({ children, className = "", theme = "windows", ...props }) => {
32637
32661
  const desktopRef = React.useRef(null);
32638
32662
  const { windowManager } = useWindows();
32639
32663
  React.useEffect(() => {
@@ -32664,11 +32688,12 @@ const rows = [
32664
32688
  e.preventDefault();
32665
32689
  console.log("Desktop context menu at:", e.clientX, e.clientY);
32666
32690
  };
32691
+ const themeClass = `desktop--${theme}`;
32667
32692
  return /* @__PURE__ */ React.createElement(
32668
32693
  "div",
32669
32694
  {
32670
32695
  ref: desktopRef,
32671
- className: `desktop ${className}`,
32696
+ className: `desktop ${themeClass} ${className}`,
32672
32697
  onContextMenu: handleContextMenu,
32673
32698
  ...props
32674
32699
  },