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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Initializes the layout functionality, enabling resizing of the aside element.
3
+ */
4
+ export default function layout(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newtil-css",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "description": "Utility based CSS",
5
5
  "main": "dist/style.css",
6
6
  "type": "module",
@@ -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
- }