Files
piik/src/client/ui/native-window-caption.html
T
AAA a86620ec6f fix(runtime): preserve source intent and isolate scoped failures
Keep media selections explicit across refreshed catalogs and let page playback commands progress while buffering. Align file availability with eligible sources, restore independent rooms after policy refusal, and retain pending Unicode releases. Correct Android root failure reporting, bookmark refresh, lazy-module guidance and compact playback feedback; use the shared native modal backdrop for the title bar.
2026-11-22 11:08:50 -05:00

71 lines
3.6 KiB
HTML

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'">
<title>Piik</title>
<style>
__PIIK_PALETTE__
__PIIK_MODAL_BACKDROP__
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--wall); color: var(--ink); font: 12px system-ui; display: flex; align-items: center; user-select: none; }
body[data-standalone] { app-region: drag; }
.title { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 16px 8px; font-weight: 600; }
body[data-standalone] .title { display: block; flex: 1; }
/* The integrated caption already sits above the workspace's dialog backdrop. */
html[data-modal-material] body:not([data-standalone]) { background: transparent; }
html[data-modal-material] body[data-standalone]::before { content: ""; position: fixed; inset: 0; pointer-events: none; }
.controls { position: relative; display: flex; flex: none; gap: 3px; padding: 0 7px; app-region: no-drag; }
html[data-modal-material="image"] .controls { color: var(--primary-ink); }
button { app-region: no-drag; width: 38px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; }
button:hover { background: var(--control-hover); }
button:active { background: var(--control-selected); color: var(--control-selected-ink); }
button:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; }
button:last-child:hover { background: var(--danger); color: var(--primary-ink); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
</style>
<span class="title"></span><div class="controls"></div>
<script>
const controls = __PIIK_WINDOW_CONTROLS__;
let language = 'en';
let maximized = false;
if (window.piikCaptionStandalone) document.body.dataset.standalone = '';
const actions = ['minimize', 'maximize', 'close'];
if (!window.piikCaptionStandalone) actions.unshift('bookmarks');
for (const action of actions) {
const button = document.createElement('button');
button.dataset.action = action;
button.onclick = () => window.ipc.postMessage(action);
document.querySelector('.controls').append(button);
}
function render() {
document.documentElement.lang = language;
for (const button of document.querySelectorAll('button')) {
const name = button.dataset.action === 'maximize' && maximized ? 'restore' : button.dataset.action;
button.title = controls.labels[language][name === 'close' && window.piikCaptionStandalone ? 'closeWindow' : name];
button.setAttribute('aria-label', button.title);
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('viewBox', '0 0 24 24');
svg.setAttribute('aria-hidden', 'true');
for (const geometry of controls.icons[name]) {
const path = document.createElementNS(svg.namespaceURI, 'path');
path.setAttribute('d', geometry);
svg.append(path);
}
button.replaceChildren(svg);
}
}
window.updateAppearance = (theme, lang, material) => {
if (material) document.documentElement.dataset.modalMaterial = material;
else delete document.documentElement.dataset.modalMaterial;
document.documentElement.dataset.theme = theme;
language = lang;
render();
};
window.updateMaximized = value => { maximized = value; render(); };
window.updateTitle = value => { document.querySelector('.title').textContent = value; };
render();
window.ipc.postMessage('ready');
</script>
</html>