Files
llama.cpp/ui/apps/chat/tests/debug/ViewportProbe.svelte
T
Aleksander Grygier 3a7660371d ui: move the web UI to ui/apps/chat and call it Llama Chat (#32032)
* ui: move tools/ui to ui/apps/chat

The chat app moves to its own root folder, ui/apps/chat, as the first step of splitting the UI into one library
(ui/lib) and the apps built on it (ui/apps). The code is unchanged; every path that pointed at tools/ui now points at
ui/apps/chat: CMake adds it from tools/, and the Dockerfiles, the Nix package, the workflows, the labeler, CODEOWNERS,
.editorconfig, the git hooks, the dev and demo scripts and the docs follow it.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: name Llama Chat's package @ggml-org/llama-chat

It was still called llama-ui, the name of the library that now sits beside it
in ui/lib (@ggml-org/llama-ui). The package stays private; the app's display name
and the llama-ui.zip build artifact are unchanged.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: call the built-in web UI Llama Chat in docs, help text and comments

The app in tools/ui is Llama Chat; Llama UI is the component library it is
built from. Prose that said "Web UI", "web UI" or "WebUI" for the app now
names it: the READMEs, SECURITY.md, the --ui help text, the CMake option
description, one server log line, code comments and the Storybook intro.

Names that others depend on are unchanged: the deprecated --webui flag
aliases, the LLAMA_*_WEBUI CMake and environment names, the webui_settings
field, the storage migration keys and the Nix attributes.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: name tools/ui as a former path of Llama Chat in the code-review skill

Changes under the old tools/ui path, as well as tools/server/webui, still
get the Llama Chat checklist.

Assisted-by: Claude (Opus 5.5 Medium)

* ui: name Llama Chat's path in the security policy's exclusions

Llama Chat no longer lives under tools/server/, so the exclusion listed
under it now names ui/apps/chat. What is covered stays the same.

Assisted-by: Claude (Opus 5.5 Medium)
2026-11-16 17:23:36 +01:00

75 lines
2.3 KiB
Svelte

<script lang="ts">
/**
* Debug readout of the viewport's heights, for checking layout on a real phone, where each
* browser and the installed app size the viewport units differently. Lists the elements
* that reach past the bottom of the window, which is what makes a page scroll.
* Mounted only in a dev build with VITE_DEBUG set.
*/
import { onMount } from 'svelte';
const REFRESH_MS = 1000;
const OVERFLOW_ROWS = 4;
const CLASS_PREVIEW_LENGTH = 40;
let lines = $state<string[]>([]);
/** Resolves a CSS length to px by laying out a hidden box of that height. */
function toPx(length: string): number {
const el = document.createElement('div');
el.style.cssText = `position: absolute; visibility: hidden; height: ${length}`;
document.body.append(el);
const height = el.getBoundingClientRect().height;
el.remove();
return Math.round(height);
}
/** The deepest elements in the flow that end below the window; fixed ones never scroll it. */
function overflowingElements(): string[] {
const limit = window.innerHeight;
return [...document.querySelectorAll<HTMLElement>('body *')]
.filter(
(el) =>
getComputedStyle(el).position !== 'fixed' &&
el.getBoundingClientRect().bottom > limit + 0.5
)
.slice(-OVERFLOW_ROWS)
.map((el) => {
const { bottom, top } = el.getBoundingClientRect();
const classes = (el.getAttribute('class') ?? '').slice(0, CLASS_PREVIEW_LENGTH);
return `${el.tagName.toLowerCase()} ${Math.round(top)}-${Math.round(bottom)} ${classes}`;
});
}
function measure() {
const root = document.documentElement;
lines = [
`inner ${window.innerHeight} vv ${Math.round(window.visualViewport?.height ?? 0)} screen ${screen.height}`,
`dvh ${toPx('100dvh')} svh ${toPx('100svh')} lvh ${toPx('100lvh')}`,
`safeTop ${toPx('env(safe-area-inset-top, 0px)')} safeBottom ${toPx('env(safe-area-inset-bottom, 0px)')}`,
`html ${root.clientHeight} scroll ${root.scrollHeight}`,
...overflowingElements()
];
}
onMount(() => {
measure();
const id = setInterval(measure, REFRESH_MS);
return () => clearInterval(id);
});
</script>
<pre
aria-hidden="true"
class="pointer-events-none fixed top-1/3 left-2 z-[99999] rounded bg-black/80 p-2 text-[10px] leading-tight whitespace-pre-wrap text-lime-300">{lines.join(
'\n'
)}</pre>