From f18923ff1451b227ce77b2ba076e8b23698f5594 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Fri, 8 Dec 2023 11:38:01 +0000 Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9F=92=84]=20Added=20window=20resizing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/style.less | 8 +++++++- src/structures/FlowWindow.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/assets/style.less b/src/assets/style.less index a0956c6..3418b8c 100644 --- a/src/assets/style.less +++ b/src/assets/style.less @@ -104,6 +104,11 @@ window-area { margin: 10px; window { + resize: both; + max-width: 100%; + max-height: 100%; + min-height: 35px; + min-width: calc(35px * 6); background: var(--base); display: flex; flex-direction: column; @@ -112,7 +117,7 @@ window-area { overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); background: var(--crust); - transition: 0.2s opacity, 0.2s width, 0.2s height; + transition: 0.2s opacity, 0.2s transform; window-header { height: 35px; @@ -120,6 +125,7 @@ window-area { display: flex; align-items: center; gap: 7.5px; + user-select: none; img { aspect-ratio: 1 / 1; diff --git a/src/structures/FlowWindow.ts b/src/structures/FlowWindow.ts index 97fb99d..dff5c78 100644 --- a/src/structures/FlowWindow.ts +++ b/src/structures/FlowWindow.ts @@ -174,9 +174,11 @@ class FlowWindow { if (this.isMinimized) { this.element.style.pointerEvents = 'all' this.element.style.opacity = '1' + this.element.style.transform = 'translateY(0)' } else { this.element.style.pointerEvents = 'none' this.element.style.opacity = '0' + this.element.style.transform = 'translateY(10px)' } this.isMinimized = !this.isMinimized @@ -228,9 +230,14 @@ class FlowWindow { * Closes the window. */ close (): void { - this.element.remove() + this.element.style.pointerEvents = 'none' + this.element.style.opacity = '0' + this.element.style.transform = 'translateY(10px)' const event = new CustomEvent('app_closed', { detail: { win: this } }) window.dispatchEvent(event) + setTimeout(() => { + this.element.remove() + }, 200) } /** From bdf8d6008dae2f9b7b47494ce5dca4b204367016 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Fri, 8 Dec 2023 11:40:50 +0000 Subject: [PATCH 2/4] =?UTF-8?q?[=E2=9A=A1]=20Stopped=20resize=20according?= =?UTF-8?q?=20to=20`canResize`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structures/FlowWindow.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/structures/FlowWindow.ts b/src/structures/FlowWindow.ts index dff5c78..680844a 100644 --- a/src/structures/FlowWindow.ts +++ b/src/structures/FlowWindow.ts @@ -106,6 +106,10 @@ class FlowWindow { if (config.canResize === undefined || config.canResize === null) config.canResize = true + if (config.canResize === false) { + this.element.style.resize = 'none'; + } + this.element.style.width = `${config.width ?? 300}px` this.element.style.height = `${config.height ?? 200}px` From 1ecd91b8cb544c2ce156a89297d49f112b541eef Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Fri, 8 Dec 2023 11:42:11 +0000 Subject: [PATCH 3/4] =?UTF-8?q?[=E2=9C=94=EF=B8=8F]=20Follow=20ts-standard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structures/FlowWindow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/FlowWindow.ts b/src/structures/FlowWindow.ts index 680844a..f43672f 100644 --- a/src/structures/FlowWindow.ts +++ b/src/structures/FlowWindow.ts @@ -107,7 +107,7 @@ class FlowWindow { if (config.canResize === undefined || config.canResize === null) config.canResize = true if (config.canResize === false) { - this.element.style.resize = 'none'; + this.element.style.resize = 'none' } this.element.style.width = `${config.width ?? 300}px` From 0bb3f1c757869e0a393df002b15229f9d3b3baf3 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Fri, 8 Dec 2023 11:44:29 +0000 Subject: [PATCH 4/4] =?UTF-8?q?[=E2=9C=94=EF=B8=8F]=20Follow=20ts-standard?= =?UTF-8?q?=20again...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structures/FlowWindow.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/structures/FlowWindow.ts b/src/structures/FlowWindow.ts index f43672f..7c4b13e 100644 --- a/src/structures/FlowWindow.ts +++ b/src/structures/FlowWindow.ts @@ -106,9 +106,7 @@ class FlowWindow { if (config.canResize === undefined || config.canResize === null) config.canResize = true - if (config.canResize === false) { - this.element.style.resize = 'none' - } + if (!config.canResize) this.element.style.resize = 'none' this.element.style.width = `${config.width ?? 300}px` this.element.style.height = `${config.height ?? 200}px`