Agent Zero AI framework
Align Time Travel modal with settings shell
Alessandro278a696b8ec6
diff --git a/plugins/_time_travel/webui/main.html b/plugins/_time_travel/webui/main.htmlindex 90d5a92bf..313fefc65 100644--- a/plugins/_time_travel/webui/main.html+++ b/plugins/_time_travel/webui/main.html@@ -1,8 +1,8 @@-<html>+<html class="time-travel-modal"><head><title>Time Travel</title></head>-<body>+<body class="time-travel-modal-body"><x-component path="/plugins/_time_travel/webui/time-travel-panel.html" mode="modal"></x-component></body></html>diff --git a/plugins/_time_travel/webui/time-travel-panel.html b/plugins/_time_travel/webui/time-travel-panel.htmlindex d04028a76..c2a46ea8c 100644--- a/plugins/_time_travel/webui/time-travel-panel.html+++ b/plugins/_time_travel/webui/time-travel-panel.html@@ -242,26 +242,15 @@min-height: min(520px, calc(100vh - 16px));max-width: calc(100vw - 16px);max-height: calc(100vh - 16px);- resize: both;border: 1px solid color-mix(in srgb, var(--color-border) 75%, transparent);border-radius: 7px;box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);background: color-mix(in srgb, var(--color-background) 94%, #000 6%);}- .modal.modal-floating {- pointer-events: none;- }-- .modal.modal-floating .modal-inner {- pointer-events: auto;- }-.modal-inner.time-travel-modal .modal-header {- min-height: 34px;- padding: 0.35rem 0.75rem 0.35rem 1rem;- cursor: move;- user-select: none;+ min-height: 42px;+ padding: 0.45rem 0.75rem 0.45rem 1rem;background: color-mix(in srgb, var(--color-background) 92%, #000 8%);border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);}diff --git a/plugins/_time_travel/webui/time-travel-store.js b/plugins/_time_travel/webui/time-travel-store.jsindex 54f02557f..664ba463f 100644--- a/plugins/_time_travel/webui/time-travel-store.js+++ b/plugins/_time_travel/webui/time-travel-store.js@@ -49,7 +49,6 @@ const model = {_mode: "canvas",_refreshTimer: null,_filterTimer: null,- _floatingCleanup: null,_requestSeq: 0,_diffSeq: 0,@@ -60,9 +59,7 @@ const model = {async onMount(element = null, options = {}) {if (element) this._root = element;this._mode = options?.mode === "modal" ? "modal" : "canvas";- if (this._mode === "modal") {- this.setupFloatingModal(element);- } else {+ if (this._mode !== "modal") {this.setupCanvasSurface(element);}this.contextId = this.resolveContextId();@@ -85,103 +82,9 @@ const model = {clearTimeout(this._filterTimer);this._filterTimer = null;}- this._floatingCleanup?.();- this._floatingCleanup = null;- },-- setupFloatingModal(element = null) {- this._floatingCleanup?.();- const root = element || globalThis.document?.querySelector(".time-travel-panel");- const modal = root?.closest?.(".modal");- const inner = modal?.querySelector?.(".modal-inner");- const body = modal?.querySelector?.(".modal-bd");- const header = modal?.querySelector?.(".modal-header");- if (!modal || !inner || !header) return;- modal.classList.add("modal-floating");- inner.classList.add("time-travel-modal", "modal-no-backdrop");- body?.classList?.add("time-travel-modal-body");-- const rect = inner.getBoundingClientRect();- inner.style.left = `${Math.max(8, rect.left)}px`;- inner.style.top = `${Math.max(8, rect.top)}px`;- inner.style.transform = "none";-- let drag = null;- let resizeObserver = null;- const viewportGap = 8;- const clampPosition = (left, top) => {- const bounds = inner.getBoundingClientRect();- const maxLeft = Math.max(viewportGap, globalThis.innerWidth - bounds.width - viewportGap);- const maxTop = Math.max(viewportGap, globalThis.innerHeight - bounds.height - viewportGap);- return {- left: Math.min(Math.max(viewportGap, left), maxLeft),- top: Math.min(Math.max(viewportGap, top), maxTop),- };- };- const clampGeometry = () => {- const bounds = inner.getBoundingClientRect();- const maxWidth = Math.max(360, globalThis.innerWidth - viewportGap * 2);- const maxHeight = Math.max(420, globalThis.innerHeight - viewportGap * 2);- if (bounds.width > maxWidth) inner.style.width = `${maxWidth}px`;- if (bounds.height > maxHeight) inner.style.height = `${maxHeight}px`;- const next = clampPosition(bounds.left, bounds.top);- inner.style.left = `${next.left}px`;- inner.style.top = `${next.top}px`;- inner.style.maxWidth = `${Math.max(360, globalThis.innerWidth - next.left - viewportGap)}px`;- inner.style.maxHeight = `${Math.max(420, globalThis.innerHeight - next.top - viewportGap)}px`;- };- clampGeometry();- globalThis.addEventListener("resize", clampGeometry);- if (globalThis.ResizeObserver) {- resizeObserver = new ResizeObserver(clampGeometry);- resizeObserver.observe(inner);- }-- const onPointerMove = (event) => {- if (!drag) return;- const next = clampPosition(drag.left + event.clientX - drag.x, drag.top + event.clientY - drag.y);- inner.style.left = `${next.left}px`;- inner.style.top = `${next.top}px`;- clampGeometry();- };- const onPointerUp = () => {- drag = null;- globalThis.removeEventListener("pointermove", onPointerMove);- globalThis.removeEventListener("pointerup", onPointerUp);- try {- header.releasePointerCapture?.(header.__timeTravelPanelPointerId || 0);- } catch {}- };- const onPointerDown = (event) => {- if (event.button !== 0) return;- if (event.target?.closest?.("button, input, select, textarea, a")) return;- const current = inner.getBoundingClientRect();- drag = {- x: event.clientX,- y: event.clientY,- left: current.left,- top: current.top,- };- header.__timeTravelPanelPointerId = event.pointerId;- header.setPointerCapture?.(event.pointerId);- globalThis.addEventListener("pointermove", onPointerMove);- globalThis.addEventListener("pointerup", onPointerUp);- event.preventDefault();- };- header.addEventListener("pointerdown", onPointerDown);-- this._floatingCleanup = () => {- header.removeEventListener("pointerdown", onPointerDown);- globalThis.removeEventListener("pointermove", onPointerMove);- globalThis.removeEventListener("pointerup", onPointerUp);- globalThis.removeEventListener("resize", clampGeometry);- resizeObserver?.disconnect?.();- };},setupCanvasSurface(element = null) {- this._floatingCleanup?.();- this._floatingCleanup = null;if (element) this._root = element;},diff --git a/webui/js/modals.js b/webui/js/modals.jsindex 14948de41..2949b8c99 100644--- a/webui/js/modals.js+++ b/webui/js/modals.js@@ -139,8 +139,6 @@ function modalSuppressesBackdrop(modal) {|| path === "plugins/_browser/webui/main.html"|| path === "/plugins/_office/webui/main.html"|| path === "plugins/_office/webui/main.html"- || path === "/plugins/_time_travel/webui/main.html"- || path === "plugins/_time_travel/webui/main.html"|| modal?.element?.classList?.contains("modal-floating")|| modal?.element?.classList?.contains("modal-no-backdrop")|| modal?.inner?.classList?.contains("modal-no-backdrop");