mirror of
https://github.com/ilyhalight/voice-over-translation.git
synced 2026-07-09 16:00:11 +00:00
Major UI/tooling updates: - Rewrite Tooltip API and internals: accept opts object, use portal parent, simplify positioning logic, improve observers and event handling (pointer-based), stricter typing, and various lifecycle fixes. - Update SubtitlesWidget to use PointerEvent, add global pointerdown to dismiss tooltips, fix tooltip mount/update flows and related event handling. - Style adjustments: .vot-portal display -> contents and simplify overlay pointer-events so interactive controls receive events. - UI tweaks: stopPropagation on dialog backdrop click, remove mousedown listeners where unnecessary, refine overlay view reparenting and menu listeners. - OverlayVisibilityController: improved pointer path checks, immediate hide() method, touch-specific behavior and activity handling fixes. - FullscreenHelper: prefer video rect when determining container size. - Move Vite config files into vite/ subdirectory and update package.json and imports (paths updated and rootDir adjusted). These changes consolidate tooltip/overlay behavior around pointer events, tidy DOM mounting, and reorganize build configs.
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
import { defineConfig } from "vite";
|
|
import {
|
|
createViteConfig,
|
|
defineConstants,
|
|
distDir,
|
|
testsDir,
|
|
} from "./vite.base.config";
|
|
|
|
const headersPath = path.resolve(testsDir, "headers.json");
|
|
|
|
type UserscriptHeader = Record<string, unknown>;
|
|
|
|
const testMeta = JSON.parse(
|
|
fs.readFileSync(headersPath, "utf8"),
|
|
) as UserscriptHeader;
|
|
|
|
function formatUserscriptHeader(header: UserscriptHeader): string {
|
|
const lines = ["// ==UserScript=="];
|
|
|
|
for (const [key, value] of Object.entries(header)) {
|
|
if (value === undefined) continue;
|
|
if (Array.isArray(value)) {
|
|
for (const item of value) {
|
|
lines.push(`// @${key} ${item}`);
|
|
}
|
|
continue;
|
|
}
|
|
|
|
lines.push(`// @${key} ${value}`);
|
|
}
|
|
|
|
lines.push("// ==/UserScript==\n");
|
|
return lines.join("\n");
|
|
}
|
|
|
|
export default defineConfig(() => {
|
|
return createViteConfig({
|
|
define: {
|
|
...defineConstants({
|
|
DEBUG_MODE: true,
|
|
REPO_BRANCH: "master",
|
|
}),
|
|
},
|
|
build: {
|
|
outDir: distDir,
|
|
emptyOutDir: false,
|
|
lib: {
|
|
entry: path.resolve(testsDir, "ui.js"),
|
|
name: "testUi",
|
|
formats: ["iife"],
|
|
fileName: () => "test-ui.user.js",
|
|
},
|
|
minify: false,
|
|
sourcemap: false,
|
|
rolldownOptions: {
|
|
output: {
|
|
postBanner: formatUserscriptHeader(testMeta),
|
|
},
|
|
},
|
|
},
|
|
});
|
|
});
|