From 1caeae9ec96f5e7bdead6365661d33716825766b Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Mon, 14 Jul 2025 15:30:16 +0000 Subject: [PATCH] update --- ts_web/elements/sio-combox.ts | 6 ++- ts_web/elements/sio-conversation-view.ts | 50 +++++++++++++++--------- ts_web/elements/sio-fab.ts | 15 +++++-- ts_web/elements/sio-image-lightbox.ts | 15 +++++-- 4 files changed, 59 insertions(+), 27 deletions(-) diff --git a/ts_web/elements/sio-combox.ts b/ts_web/elements/sio-combox.ts index 1542f80..fed98c4 100644 --- a/ts_web/elements/sio-combox.ts +++ b/ts_web/elements/sio-combox.ts @@ -128,10 +128,13 @@ export class SioCombox extends DeesElement { overflow: hidden; font-family: ${unsafeCSS(fontFamilies.sans)}; position: relative; - animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1); transform-origin: bottom right; } + :host(.animate-in) { + animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1); + } + @keyframes scaleIn { from { opacity: 0; @@ -152,6 +155,7 @@ export class SioCombox extends DeesElement { background: linear-gradient(145deg, ${bdTheme('border')}, transparent 50%); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: exclude; + mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude; opacity: 0.5; pointer-events: none; diff --git a/ts_web/elements/sio-conversation-view.ts b/ts_web/elements/sio-conversation-view.ts index 40712e3..4bf9075 100644 --- a/ts_web/elements/sio-conversation-view.ts +++ b/ts_web/elements/sio-conversation-view.ts @@ -305,6 +305,10 @@ export class SioConversationView extends DeesElement { } /* File drop zone */ + .messages-container { + position: relative; + } + .drop-overlay { position: absolute; inset: 0; @@ -497,19 +501,22 @@ export class SioConversationView extends DeesElement { -
-
- -
Drop files here
-
Images and documents up to 10MB
-
-
-
+
e.preventDefault()} + > +
+ +
Drop files here
+
Images and documents up to 10MB
+
+
${this.conversation.messages.map((msg, index) => html`
@@ -586,7 +593,11 @@ export class SioConversationView extends DeesElement { accept="image/*,.pdf,.doc,.docx,.txt" @change=${this.handleFileSelect} /> - + { + e.preventDefault(); + e.stopPropagation(); + this.openFileSelector(); + }}> = rect.right || - e.clientY <= rect.top || - e.clientY >= rect.bottom - ) { + // Check if we're actually leaving the messages container + const relatedTarget = e.relatedTarget as Node; + const container = e.currentTarget as HTMLElement; + + if (!container.contains(relatedTarget)) { this.isDragging = false; } } @@ -699,12 +707,16 @@ export class SioConversationView extends DeesElement { this.isDragging = false; const files = Array.from(e.dataTransfer?.files || []); - this.processFiles(files); + if (files.length > 0) { + this.processFiles(files); + } } private openFileSelector() { const fileInput = this.shadowRoot?.querySelector('#fileInput') as HTMLInputElement; - fileInput?.click(); + if (fileInput) { + fileInput.click(); + } } private handleFileSelect(e: Event) { diff --git a/ts_web/elements/sio-fab.ts b/ts_web/elements/sio-fab.ts index 018bbe4..140de31 100644 --- a/ts_web/elements/sio-fab.ts +++ b/ts_web/elements/sio-fab.ts @@ -11,6 +11,7 @@ import * as domtools from '@design.estate/dees-domtools'; import { SioCombox } from './sio-combox.js'; import { SioIcon } from './sio-icon.js'; +import { state } from '@design.estate/dees-element'; SioCombox; SioIcon; @@ -30,6 +31,9 @@ export class SioFab extends DeesElement { @property({ type: Boolean }) public showCombox = false; + @state() + private hasShownOnce = false; + public static demo = () => html` `; constructor() { @@ -190,8 +194,10 @@ export class SioFab extends DeesElement {
-
- this.showCombox = false}> +
+ ${this.showCombox || this.hasShownOnce ? html` + this.showCombox = false}> + ` : ''}
`; } @@ -202,6 +208,9 @@ export class SioFab extends DeesElement { public async toggleCombox() { console.log('toggle combox'); this.showCombox = !this.showCombox; + if (this.showCombox) { + this.hasShownOnce = true; + } } public async firstUpdated(args) { @@ -214,7 +223,7 @@ export class SioFab extends DeesElement { domtools.keyboard .on([domtools.keyboard.keyEnum.Ctrl, domtools.keyboard.keyEnum.S]) .subscribe((event) => { - this.showCombox = !this.showCombox; + this.toggleCombox(); }); } } diff --git a/ts_web/elements/sio-image-lightbox.ts b/ts_web/elements/sio-image-lightbox.ts index bb16c1b..3a5fceb 100644 --- a/ts_web/elements/sio-image-lightbox.ts +++ b/ts_web/elements/sio-image-lightbox.ts @@ -279,7 +279,9 @@ export class SioImageLightbox extends DeesElement { : ''; return html` -
+
{ + if (e.target === e.currentTarget) this.close(e); + }}>
${this.image ? html`
@@ -292,7 +294,7 @@ export class SioImageLightbox extends DeesElement {
-
+
this.close(e)}>
@@ -350,12 +352,17 @@ export class SioImageLightbox extends DeesElement { document.addEventListener('keydown', this.handleKeyDown); } - private close = () => { + private close = (e?: Event) => { + if (e) { + e.preventDefault(); + e.stopPropagation(); + } + this.isOpen = false; document.removeEventListener('keydown', this.handleKeyDown); // Dispatch close event - this.dispatchEvent(new CustomEvent('close', { + this.dispatchEvent(new CustomEvent('lightbox-close', { bubbles: true, composed: true }));