newtil-css 0.2.43 → 0.2.45
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/types/n-layout.d.ts +4 -0
- package/package.json +1 -1
- package/dist/js/n-layout.ts +0 -32
package/package.json
CHANGED
package/dist/js/n-layout.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export default function initializeLayout(): void {
|
|
2
|
-
const layout = window.document.querySelector(".n-layout") as HTMLElement | null;
|
|
3
|
-
const aside = window.document.querySelector(".n-layout>.n-aside") as HTMLElement | null;
|
|
4
|
-
|
|
5
|
-
if (!layout || !aside) return;
|
|
6
|
-
|
|
7
|
-
let isResizing = false;
|
|
8
|
-
|
|
9
|
-
aside.addEventListener("mousedown", (e: MouseEvent) => {
|
|
10
|
-
if (e.offsetX > aside.offsetWidth - 5) {
|
|
11
|
-
isResizing = true;
|
|
12
|
-
window.document.body.style.cursor = "ew-resize";
|
|
13
|
-
window.document.body.style.userSelect = "none"; // Disable text selection
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
window.document.addEventListener("mousemove", (e: MouseEvent) => {
|
|
18
|
-
if (isResizing) {
|
|
19
|
-
const newWidth = e.clientX - aside.getBoundingClientRect().left;
|
|
20
|
-
aside.style.width = `${Math.max(80, Math.min(newWidth, 500))}px`; // Min 80px, Max 500px
|
|
21
|
-
layout.style.setProperty("--aside-width", `${aside.offsetWidth}px`);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
window.document.addEventListener("mouseup", () => {
|
|
26
|
-
if (isResizing) {
|
|
27
|
-
isResizing = false;
|
|
28
|
-
window.document.body.style.cursor = "default";
|
|
29
|
-
window.document.body.style.userSelect = ""; // Re-enable text selection
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|