diff --git a/src/app/ApiKeyHeader.js b/src/app/ApiKeyHeader.js index 92962c8..76abf21 100644 --- a/src/app/ApiKeyHeader.js +++ b/src/app/ApiKeyHeader.js @@ -15,15 +15,14 @@ export class ApiKeyHeader extends LitElement { static styles = css` :host { - display: block; - transform: translate3d(0, 0, 0); - backface-visibility: hidden; - transition: opacity 0.25s ease-out; + display: block; + transition: opacity 0.3s ease-in, transform 0.3s ease-in; + will-change: opacity, transform; } :host(.sliding-out) { - animation: slideOutUp 0.3s ease-in forwards; - will-change: opacity, transform; + opacity: 0; + transform: translateY(-20px); } :host(.hidden) { @@ -31,17 +30,6 @@ export class ApiKeyHeader extends LitElement { pointer-events: none; } - @keyframes slideOutUp { - from { - opacity: 1; - transform: translateY(0); - } - to { - opacity: 0; - transform: translateY(-20px); - } - } - * { font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; cursor: default; @@ -50,6 +38,7 @@ export class ApiKeyHeader extends LitElement { } .container { + -webkit-app-region: drag; width: 350px; min-height: 260px; padding: 18px 20px; @@ -79,6 +68,7 @@ export class ApiKeyHeader extends LitElement { } .close-button { + -webkit-app-region: no-drag; position: absolute; top: 10px; right: 10px; @@ -135,6 +125,7 @@ export class ApiKeyHeader extends LitElement { } .api-input { + -webkit-app-region: no-drag; width: 100%; height: 34px; background: rgba(255, 255, 255, 0.1); @@ -162,6 +153,7 @@ export class ApiKeyHeader extends LitElement { .provider-column { flex: 1; display: flex; flex-direction: column; align-items: center; } .provider-label { color: rgba(255, 255, 255, 0.7); font-size: 11px; font-weight: 500; margin-bottom: 6px; } .api-input, .provider-select { + -webkit-app-region: no-drag; width: 100%; height: 34px; text-align: center; @@ -188,6 +180,7 @@ export class ApiKeyHeader extends LitElement { .action-button { + -webkit-app-region: no-drag; width: 100%; height: 34px; background: rgba(255, 255, 255, 0.2); @@ -233,37 +226,10 @@ export class ApiKeyHeader extends LitElement { font-weight: 500; /* Medium */ margin: 10px 0; } - - - /* ────────────────[ GLASS BYPASS ]─────────────── */ - :host-context(body.has-glass) .container, - :host-context(body.has-glass) .api-input, - :host-context(body.has-glass) .provider-select, - :host-context(body.has-glass) .action-button, - :host-context(body.has-glass) .close-button { - background: transparent !important; - border: none !important; - box-shadow: none !important; - filter: none !important; - backdrop-filter: none !important; - } - - :host-context(body.has-glass) .container::after, - :host-context(body.has-glass) .action-button::after { - display: none !important; - } - - :host-context(body.has-glass) .action-button:hover, - :host-context(body.has-glass) .provider-select:hover, - :host-context(body.has-glass) .close-button:hover { - background: transparent !important; - } ` constructor() { super() - this.dragState = null - this.wasJustDragged = false this.isLoading = false this.errorMessage = "" //////// after_modelStateService //////// @@ -275,8 +241,6 @@ export class ApiKeyHeader extends LitElement { this.loadProviderConfig(); //////// after_modelStateService //////// - this.handleMouseMove = this.handleMouseMove.bind(this) - this.handleMouseUp = this.handleMouseUp.bind(this) this.handleKeyPress = this.handleKeyPress.bind(this) this.handleSubmit = this.handleSubmit.bind(this) this.handleInput = this.handleInput.bind(this) @@ -321,61 +285,6 @@ export class ApiKeyHeader extends LitElement { if (sttProviders.length > 0) this.sttProvider = sttProviders[0].id; this.requestUpdate(); -} - - async handleMouseDown(e) { - if (e.target.tagName === "INPUT" || e.target.tagName === "BUTTON" || e.target.tagName === "SELECT") { - return - } - - e.preventDefault() - - const { ipcRenderer } = window.require("electron") - const initialPosition = await ipcRenderer.invoke("get-header-position") - - this.dragState = { - initialMouseX: e.screenX, - initialMouseY: e.screenY, - initialWindowX: initialPosition.x, - initialWindowY: initialPosition.y, - moved: false, - } - - window.addEventListener("mousemove", this.handleMouseMove) - window.addEventListener("mouseup", this.handleMouseUp, { once: true }) - } - - handleMouseMove(e) { - if (!this.dragState) return - - const deltaX = Math.abs(e.screenX - this.dragState.initialMouseX) - const deltaY = Math.abs(e.screenY - this.dragState.initialMouseY) - - if (deltaX > 3 || deltaY > 3) { - this.dragState.moved = true - } - - const newWindowX = this.dragState.initialWindowX + (e.screenX - this.dragState.initialMouseX) - const newWindowY = this.dragState.initialWindowY + (e.screenY - this.dragState.initialMouseY) - - const { ipcRenderer } = window.require("electron") - ipcRenderer.invoke("move-header-to", newWindowX, newWindowY) - } - - handleMouseUp(e) { - if (!this.dragState) return - - const wasDragged = this.dragState.moved - - window.removeEventListener("mousemove", this.handleMouseMove) - this.dragState = null - - if (wasDragged) { - this.wasJustDragged = true - setTimeout(() => { - this.wasJustDragged = false - }, 200) - } } handleInput(e) { @@ -473,7 +382,6 @@ export class ApiKeyHeader extends LitElement { handleUsePicklesKey(e) { e.preventDefault() - if (this.wasJustDragged) return console.log("Requesting Firebase authentication from main process...") if (window.require) { @@ -515,7 +423,7 @@ export class ApiKeyHeader extends LitElement { const isButtonDisabled = this.isLoading || !this.llmApiKey.trim() || !this.sttApiKey.trim(); return html` -