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.css +682 -0
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +28 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +28 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/Desktop.stories.jsx +170 -0
- package/src/desktop/WindowContext.js +1 -0
- package/src/desktop/WindowManager.js +23 -0
- package/src/desktop/desktop-linux.css +232 -0
- package/src/desktop/desktop-macos.css +260 -0
- package/src/desktop/desktop-windows.css +190 -0
- package/src/desktop/desktop.js +8 -2
- package/src/desktop/window.js +9 -2
package/dist/index.modern.js
CHANGED
@@ -31867,6 +31867,24 @@ class WindowManager {
|
|
31867
31867
|
this.notifyListeners();
|
31868
31868
|
return true;
|
31869
31869
|
}
|
31870
|
+
/**
|
31871
|
+
* Update window size
|
31872
|
+
*/
|
31873
|
+
updateWindowSize(windowId, size) {
|
31874
|
+
const window2 = this.windows.get(windowId);
|
31875
|
+
if (!window2) return false;
|
31876
|
+
const minWidth = 200;
|
31877
|
+
const minHeight = 150;
|
31878
|
+
const maxWidth = this.desktopSize.width;
|
31879
|
+
const maxHeight = this.desktopSize.height - 50;
|
31880
|
+
const constrainedSize = {
|
31881
|
+
width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
|
31882
|
+
height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
|
31883
|
+
};
|
31884
|
+
window2.size = { ...window2.size, ...constrainedSize };
|
31885
|
+
this.notifyListeners();
|
31886
|
+
return true;
|
31887
|
+
}
|
31870
31888
|
/**
|
31871
31889
|
* Get all windows
|
31872
31890
|
*/
|
@@ -32029,6 +32047,7 @@ const WindowProvider = ({ children, desktopSize }) => {
|
|
32029
32047
|
minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
|
32030
32048
|
maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
|
32031
32049
|
updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
|
32050
|
+
updateWindowSize: (id, size) => windowManagerRef.current.updateWindowSize(id, size),
|
32032
32051
|
// Window queries
|
32033
32052
|
getWindow: (id) => windowManagerRef.current.getWindow(id),
|
32034
32053
|
getAllWindows: () => windowManagerRef.current.getAllWindows(),
|
@@ -32091,11 +32110,16 @@ const Window = ({
|
|
32091
32110
|
}) => {
|
32092
32111
|
const windowRef = useRef(null);
|
32093
32112
|
const headerRef = useRef(null);
|
32094
|
-
const { getWindow, updateWindowPosition, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32113
|
+
const { getWindow, updateWindowPosition, updateWindowSize, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32095
32114
|
const windowData = getWindow(id);
|
32096
32115
|
const [isDragging, setIsDragging] = useState(false);
|
32097
32116
|
const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 });
|
32098
32117
|
const [dragStartPosition, setDragStartPosition] = useState({ x: 0, y: 0 });
|
32118
|
+
const [isResizing, setIsResizing] = useState(false);
|
32119
|
+
const [resizeDirection, setResizeDirection] = useState("");
|
32120
|
+
const [resizeStartSize, setResizeStartSize] = useState({ width: 0, height: 0 });
|
32121
|
+
const [resizeStartPosition, setResizeStartPosition] = useState({ x: 0, y: 0 });
|
32122
|
+
const [resizeStartMouse, setResizeStartMouse] = useState({ x: 0, y: 0 });
|
32099
32123
|
if (!windowData) {
|
32100
32124
|
return null;
|
32101
32125
|
}
|
@@ -32630,7 +32654,7 @@ const AppProvider = ({ children, appManager = defaultAppManager }) => {
|
|
32630
32654
|
};
|
32631
32655
|
return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
|
32632
32656
|
};
|
32633
|
-
const DesktopLayout = ({ children, className = "", ...props }) => {
|
32657
|
+
const DesktopLayout = ({ children, className = "", theme = "windows", ...props }) => {
|
32634
32658
|
const desktopRef = useRef(null);
|
32635
32659
|
const { windowManager } = useWindows();
|
32636
32660
|
useEffect(() => {
|
@@ -32661,11 +32685,12 @@ const DesktopLayout = ({ children, className = "", ...props }) => {
|
|
32661
32685
|
e.preventDefault();
|
32662
32686
|
console.log("Desktop context menu at:", e.clientX, e.clientY);
|
32663
32687
|
};
|
32688
|
+
const themeClass = `desktop--${theme}`;
|
32664
32689
|
return /* @__PURE__ */ React.createElement(
|
32665
32690
|
"div",
|
32666
32691
|
{
|
32667
32692
|
ref: desktopRef,
|
32668
|
-
className: `desktop ${className}`,
|
32693
|
+
className: `desktop ${themeClass} ${className}`,
|
32669
32694
|
onContextMenu: handleContextMenu,
|
32670
32695
|
...props
|
32671
32696
|
},
|