phirepass-widgets 0.0.111 → 0.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/cjs/{index-B8w6l0VL.js → index-CurErEK7.js} +101 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/phirepass-downloader_3.cjs.entry.js +3696 -0
- package/dist/cjs/phirepass-rdp.cjs.entry.js +18 -6
- package/dist/cjs/phirepass-terminal.cjs.entry.js +6 -5
- package/dist/cjs/phirepass-widgets.cjs.js +3 -3
- package/dist/cjs/{protocol-CCD7cbHu.js → protocol-DCBMfc2u.js} +557 -360
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/common/channel.js +21 -1
- package/dist/collection/common/fetch.js +40 -0
- package/dist/collection/components/phirepass-downloader/form.js +69 -0
- package/dist/collection/components/phirepass-downloader/format.js +105 -0
- package/dist/collection/components/phirepass-downloader/jobs.js +370 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +1109 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +1455 -0
- package/dist/collection/components/phirepass-downloader/source.js +106 -0
- package/dist/collection/components/phirepass-downloader/views/dialogs.js +34 -0
- package/dist/collection/components/phirepass-downloader/views/fetch-form.js +65 -0
- package/dist/collection/components/phirepass-downloader/views/icons.js +33 -0
- package/dist/collection/components/phirepass-downloader/views/job-row.js +91 -0
- package/dist/collection/components/phirepass-downloader/views/notices.js +15 -0
- package/dist/collection/components/phirepass-downloader/views/states.js +19 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +216 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +473 -0
- package/dist/collection/components/phirepass-media-player/player.js +94 -0
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +36 -13
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +122 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +35 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +181 -31
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/collection/testing/fixtures.js +219 -0
- package/dist/collection/testing/mock-channel.js +410 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-C4cmk3bS.js +1 -0
- package/dist/components/p-CsYQJXY2.js +1 -0
- package/dist/components/p-D6Geq8Rn.js +1 -0
- package/dist/components/phirepass-downloader.d.ts +11 -0
- package/dist/components/phirepass-downloader.js +1 -0
- package/dist/components/phirepass-media-player.d.ts +11 -0
- package/dist/components/phirepass-media-player.js +1 -0
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +2 -2
- package/dist/esm/{index-DGq2b7rM.js → index-B9qUl6FW.js} +101 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/phirepass-downloader_3.entry.js +3692 -0
- package/dist/esm/phirepass-rdp.entry.js +18 -6
- package/dist/esm/phirepass-terminal.entry.js +6 -5
- package/dist/esm/phirepass-widgets.js +4 -4
- package/dist/esm/{protocol-D4JeTIHt.js → protocol-CsYQJXY2.js} +556 -359
- package/dist/phirepass-widgets/p-1b84c526.entry.js +1 -0
- package/dist/phirepass-widgets/{p-9eebbf05.entry.js → p-41dd1ac9.entry.js} +2 -2
- package/dist/phirepass-widgets/p-614ab3de.entry.js +1 -0
- package/dist/phirepass-widgets/p-B9qUl6FW.js +3 -0
- package/dist/phirepass-widgets/p-CsYQJXY2.js +1 -0
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/channel.d.ts +30 -0
- package/dist/types/common/fetch.d.ts +161 -0
- package/dist/types/components/phirepass-downloader/form.d.ts +54 -0
- package/dist/types/components/phirepass-downloader/format.d.ts +17 -0
- package/dist/types/components/phirepass-downloader/jobs.d.ts +115 -0
- package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +231 -0
- package/dist/types/components/phirepass-downloader/source.d.ts +61 -0
- package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +52 -0
- package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +31 -0
- package/dist/types/components/phirepass-downloader/views/icons.d.ts +5 -0
- package/dist/types/components/phirepass-downloader/views/job-row.d.ts +21 -0
- package/dist/types/components/phirepass-downloader/views/notices.d.ts +18 -0
- package/dist/types/components/phirepass-downloader/views/states.d.ts +38 -0
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +67 -0
- package/dist/types/components/phirepass-media-player/player.d.ts +43 -0
- package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +10 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +30 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +40 -0
- package/dist/types/components.d.ts +426 -34
- package/dist/types/stencil-public-runtime.d.ts +1 -1
- package/dist/types/testing/fixtures.d.ts +25 -0
- package/dist/types/testing/mock-channel.d.ts +132 -0
- package/package.json +26 -12
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +0 -1469
- package/dist/components/p-D4JeTIHt.js +0 -1
- package/dist/esm/phirepass-sftp-client.entry.js +0 -1467
- package/dist/phirepass-widgets/p-401631af.entry.js +0 -1
- package/dist/phirepass-widgets/p-5f27300b.entry.js +0 -1
- package/dist/phirepass-widgets/p-D4JeTIHt.js +0 -1
- package/dist/phirepass-widgets/p-DGq2b7rM.js +0 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { DENIED_AUTH_HEADERS, FETCH_TORRENT_MAX_BYTES } from "../../common/fetch";
|
|
2
|
+
function lastSegment(pathname) {
|
|
3
|
+
const parts = pathname.split('/').filter(Boolean);
|
|
4
|
+
const last = parts[parts.length - 1] ?? '';
|
|
5
|
+
try {
|
|
6
|
+
return decodeURIComponent(last);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return last;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Works out what was pasted into the Fetch field, as the person types.
|
|
14
|
+
*
|
|
15
|
+
* Only `http:`, `https:` and `magnet:` are links here; anything else is
|
|
16
|
+
* `invalid` (B4). The name is a guess for the Save as placeholder and the
|
|
17
|
+
* “Saved under another name” notice. The node has the last word.
|
|
18
|
+
*/
|
|
19
|
+
export function detectSource(text) {
|
|
20
|
+
const value = text.trim();
|
|
21
|
+
if (!value) {
|
|
22
|
+
return { kind: 'empty' };
|
|
23
|
+
}
|
|
24
|
+
if (/^magnet:\?/i.test(value)) {
|
|
25
|
+
const query = value.slice(value.indexOf('?') + 1);
|
|
26
|
+
const params = new URLSearchParams(query);
|
|
27
|
+
const xt = params.getAll('xt').find(x => /^urn:btih:/i.test(x));
|
|
28
|
+
if (!xt) {
|
|
29
|
+
return { kind: 'invalid' };
|
|
30
|
+
}
|
|
31
|
+
const infoHash = xt.slice('urn:btih:'.length);
|
|
32
|
+
const dn = params.get('dn')?.trim();
|
|
33
|
+
return { kind: 'magnet', uri: value, infoHash, ...(dn ? { name: dn } : {}) };
|
|
34
|
+
}
|
|
35
|
+
let url;
|
|
36
|
+
try {
|
|
37
|
+
url = new URL(value);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return { kind: 'invalid' };
|
|
41
|
+
}
|
|
42
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
43
|
+
return { kind: 'invalid' };
|
|
44
|
+
}
|
|
45
|
+
if (!url.hostname) {
|
|
46
|
+
return { kind: 'invalid' };
|
|
47
|
+
}
|
|
48
|
+
// The agent refuses credentials in the URL; say so here instead of after Start.
|
|
49
|
+
if (url.username || url.password) {
|
|
50
|
+
return { kind: 'invalid' };
|
|
51
|
+
}
|
|
52
|
+
const scheme = url.protocol === 'https:' ? 'HTTPS' : 'HTTP';
|
|
53
|
+
const name = lastSegment(url.pathname) || 'download';
|
|
54
|
+
const kind = /\.torrent$/i.test(url.pathname) ? 'torrent-url' : 'http';
|
|
55
|
+
return { kind, url: value, host: url.hostname, name, scheme };
|
|
56
|
+
}
|
|
57
|
+
/** Short form of a magnet for a row title before its metadata arrives: `magnet:?xt=urn:btih:9f2c…a41e`. */
|
|
58
|
+
export function shortMagnet(uri) {
|
|
59
|
+
const m = /urn:btih:([a-z0-9]+)/i.exec(uri);
|
|
60
|
+
if (!m) {
|
|
61
|
+
return uri.length > 40 ? `${uri.slice(0, 37)}…` : uri;
|
|
62
|
+
}
|
|
63
|
+
const hash = m[1];
|
|
64
|
+
return `magnet:?xt=urn:btih:${hash.slice(0, 4)}…${hash.slice(-4)}`;
|
|
65
|
+
}
|
|
66
|
+
/** Refuses a `.torrent` in the browser, before anything is sent (B6). */
|
|
67
|
+
export function checkTorrentFile(file) {
|
|
68
|
+
if (!/\.torrent$/i.test(file.name)) {
|
|
69
|
+
return { ok: false, reason: 'not-torrent' };
|
|
70
|
+
}
|
|
71
|
+
if (file.size > FETCH_TORRENT_MAX_BYTES) {
|
|
72
|
+
return { ok: false, reason: 'too-large' };
|
|
73
|
+
}
|
|
74
|
+
return { ok: true };
|
|
75
|
+
}
|
|
76
|
+
export const EMPTY_AUTH = { mode: 'none', username: '', password: '', token: '', headerName: '', headerValue: '' };
|
|
77
|
+
/**
|
|
78
|
+
* Turns the login fields into the `SourceAuth` the node seals, or explains
|
|
79
|
+
* what is missing. `null` with no error means no login.
|
|
80
|
+
*/
|
|
81
|
+
export function buildSourceAuth(form) {
|
|
82
|
+
switch (form.mode) {
|
|
83
|
+
case 'none':
|
|
84
|
+
return { auth: null };
|
|
85
|
+
case 'basic':
|
|
86
|
+
if (!form.username) {
|
|
87
|
+
return { auth: null, error: 'Enter a username.' };
|
|
88
|
+
}
|
|
89
|
+
return { auth: { Basic: { username: form.username, password: form.password } } };
|
|
90
|
+
case 'bearer':
|
|
91
|
+
if (!form.token.trim()) {
|
|
92
|
+
return { auth: null, error: 'Enter a token.' };
|
|
93
|
+
}
|
|
94
|
+
return { auth: { Bearer: { token: form.token.trim() } } };
|
|
95
|
+
case 'header': {
|
|
96
|
+
const name = form.headerName.trim();
|
|
97
|
+
if (!/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/.test(name)) {
|
|
98
|
+
return { auth: null, error: 'Enter a valid header name.' };
|
|
99
|
+
}
|
|
100
|
+
if (DENIED_AUTH_HEADERS.has(name.toLowerCase())) {
|
|
101
|
+
return { auth: null, error: `${name} cannot be set here.` };
|
|
102
|
+
}
|
|
103
|
+
return { auth: { Header: { name, value: form.headerValue } } };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { formatBytes } from "../format";
|
|
3
|
+
import { folderOf, isFinished } from "../jobs";
|
|
4
|
+
import { Icon } from "./icons";
|
|
5
|
+
export const Modal = ({ label, onClose, wide }, children) => (h("div", { class: "overlay", onClick: e => {
|
|
6
|
+
if (e.target === e.currentTarget) {
|
|
7
|
+
onClose();
|
|
8
|
+
}
|
|
9
|
+
} }, h("div", { class: { modal: true, wide: !!wide }, role: "dialog", "aria-modal": "true", "aria-label": label, tabindex: -1, onKeyDown: e => {
|
|
10
|
+
if (e.key === 'Escape') {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
onClose();
|
|
13
|
+
}
|
|
14
|
+
} }, children)));
|
|
15
|
+
const Footer = ({ cancel, confirm, danger, onCancel, onConfirm }) => (h("div", { class: "dlg-f" }, h("button", { type: "button", class: "btn", onClick: onCancel }, cancel), h("button", { type: "button", class: { btn: true, pri: !danger, dng: !!danger }, onClick: onConfirm }, confirm)));
|
|
16
|
+
/** K1: ✕ on an unfinished row. Unticked → Stopped (resumable); ticked → Cancelled. */
|
|
17
|
+
export const ConfirmStop = ({ row, discard, onDiscard, ...b }) => (h(Modal, { label: "Stop this download?", onClose: b.onCancel }, h("div", { class: "dlg" }, h("h4", null, "Stop this download?"), h("div", { class: "filechip" }, h(Icon, { name: "file", size: 20 }), h("div", null, h("b", null, row.name), h("span", null, row.total_bytes ? `${formatBytes(row.done_bytes)} of ${formatBytes(row.total_bytes)} downloaded` : `${formatBytes(row.done_bytes)} downloaded`))), h("label", { class: "checkline" }, h("input", { type: "checkbox", checked: discard, onChange: e => onDiscard(e.target.checked) }), h("span", null, "Also delete the part already downloaded", h("span", { class: "hint block" }, "Leave this off and Resume continues from here."))), h(Footer, { cancel: "Keep downloading", confirm: "Stop download", danger: true, ...b }))));
|
|
18
|
+
/** K8: Delete on a finished, stopped or seeding row. */
|
|
19
|
+
export const ConfirmDelete = ({ row, deleteFile, onDeleteFile, nodeName, ...b }) => {
|
|
20
|
+
const finished = isFinished(row.state);
|
|
21
|
+
const size = row.files.length > 1 ? `${row.files.length} files · ${formatBytes(row.total_bytes ?? row.done_bytes)}` : formatBytes(row.total_bytes ?? row.done_bytes);
|
|
22
|
+
return (h(Modal, { label: "Delete this download?", onClose: b.onCancel }, h("div", { class: "dlg" }, h("h4", null, "Delete this download?"), h("div", { class: "filechip" }, h(Icon, { name: "file", size: 20 }), h("div", null, h("b", null, row.name), h("span", null, row.state === 'Seeding' ? 'Seeding · ' : '', size, " in ", folderOf(row)))), row.state === 'Seeding' && h("p", { class: "dtx" }, nodeName, " stops sharing it with peers."), finished ? (h("label", { class: "checkline" }, h("input", { type: "checkbox", checked: deleteFile, onChange: e => onDeleteFile(e.target.checked) }), h("span", null, "Also delete the files", h("span", { class: "hint block" }, "Off: the files stay in ", folderOf(row), " and only the download is removed.")))) : (h("p", { class: "dtx" }, "The part already downloaded is deleted.")), h(Footer, { cancel: "Cancel", confirm: "Delete", danger: true, ...b }))));
|
|
23
|
+
};
|
|
24
|
+
/** K9: switching a torrent that is playing to Fastest stops playback. */
|
|
25
|
+
export const ConfirmFastest = ({ row, ...b }) => (h(Modal, { label: "Switch to fastest?", onClose: b.onCancel }, h("div", { class: "dlg" }, h("h4", null, "Switch to fastest?"), h("p", { class: "dtx" }, h("b", null, row.name), " is playing. Fastest downloads pieces in any order, so playback stops until it finishes or you switch back."), h(Footer, { cancel: "Keep in order", confirm: "Switch and stop playback", danger: true, ...b }))));
|
|
26
|
+
/** K2: before the first magnet or .torrent on this browser. */
|
|
27
|
+
export const ConfirmTorrent = ({ nodeName, dontAsk, onDontAsk, ...b }) => (h(Modal, { label: `Start a torrent on ${nodeName}?`, onClose: b.onCancel }, h("div", { class: "dlg" }, h("h4", null, "Start a torrent on ", nodeName, "?"), h("div", { class: "note warn" }, h(Icon, { name: "warn", size: 14 }), h("div", null, "The node will connect to public peers. They can see its internet address, and it uploads to them while it downloads.")), h("p", { class: "dtx" }, "When it finishes, ", nodeName, " keeps sharing it with other peers until you delete it."), h("label", { class: "checkline" }, h("input", { type: "checkbox", checked: dontAsk, onChange: e => onDontAsk(e.target.checked) }), h("span", null, "Do not ask again on this browser")), h(Footer, { cancel: "Cancel", confirm: "Start torrent", ...b }))));
|
|
28
|
+
/** K5: a notice, not a question. The node refused a Start that would not fit. */
|
|
29
|
+
export const NoSpace = ({ reason, onClose }) => (h(Modal, { label: "Not enough space", onClose: onClose }, h("div", { class: "dlg" }, h("h4", null, "Not enough space"), h("p", { class: "dtx" }, reason), h("div", { class: "dlg-f" }, h("button", { type: "button", class: "btn pri", onClick: onClose }, "OK")))));
|
|
30
|
+
/** H6: folders inside the node's download folder, listed by the agent. */
|
|
31
|
+
export const FolderPicker = (p) => (h(Modal, { label: "Save downloads to", onClose: p.onCancel, wide: true }, h("div", { class: "dlg" }, h("h4", null, "Save downloads to"), h("nav", { class: "crumbs", "aria-label": "Folder" }, h("button", { type: "button", class: "lnk", onClick: () => p.onUp(0) }, p.root), p.path.map((seg, i) => [
|
|
32
|
+
h("span", { class: "sep" }, "/"),
|
|
33
|
+
h("button", { type: "button", class: "lnk", onClick: () => p.onUp(i + 1) }, seg),
|
|
34
|
+
])), h("div", { class: "folders", role: "list" }, p.folders === null && h("div", { class: "muted" }, "Loading\u2026"), p.folders?.length === 0 && h("div", { class: "muted" }, "No folders here."), p.folders?.map(name => (h("button", { type: "button", class: "folder-row", role: "listitem", onClick: () => p.onOpen(name) }, h(Icon, { name: "folder", size: 14 }), h("span", null, name))))), p.error && h("div", { class: "note err" }, p.error), p.newName !== null && (h("input", { class: "inp", type: "text", "aria-label": "New folder name", placeholder: "New folder name", value: p.newName, onInput: e => p.onNewName(e.target.value) })), h("p", { class: "hint" }, "Folders only, and only inside the node's download folder. A new folder is created by the node when the first download lands in it."), h("div", { class: "dlg-f" }, h("button", { type: "button", class: "btn left", onClick: () => p.onNewName(p.newName === null ? '' : null) }, h(Icon, { name: "plus", size: 12 }), " New folder"), h("button", { type: "button", class: "btn", onClick: p.onCancel }, "Cancel"), h("button", { type: "button", class: "btn pri", disabled: p.newName !== null && !/^[^/\\\0]+$/.test(p.newName.trim()), onClick: p.onSave }, "Save here")))));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { formatBytes } from "../format";
|
|
3
|
+
import { Icon } from "./icons";
|
|
4
|
+
export const NoteLine = ({ note }) => (h("div", { class: `note ${note.tone}`, role: note.tone === 'err' ? 'alert' : 'status' }, h(Icon, { name: "warn", size: 14 }), h("div", null, h("b", null, note.title), " ", note.body)));
|
|
5
|
+
function Detect({ model }) {
|
|
6
|
+
const d = model.detected;
|
|
7
|
+
if (d.kind === 'http' || d.kind === 'torrent-url') {
|
|
8
|
+
return (h("div", { class: "detect", "data-kind": d.kind }, h("span", { class: "pill meta" }, d.kind === 'torrent-url' ? '.torrent link' : d.scheme), h("span", { class: "host" }, d.host)));
|
|
9
|
+
}
|
|
10
|
+
if (d.kind === 'magnet') {
|
|
11
|
+
return (h("div", { class: "detect", "data-kind": "magnet" }, h("span", { class: "pill meta" }, "Magnet"), h("span", { class: "host" }, d.name ?? 'name arrives with the metadata')));
|
|
12
|
+
}
|
|
13
|
+
return h("div", { class: "detect" });
|
|
14
|
+
}
|
|
15
|
+
const AuthFields = ({ auth, onChange }) => {
|
|
16
|
+
const set = onChange;
|
|
17
|
+
const field = (label, key, type = 'text') => (h("label", { class: "fld" }, h("span", null, label), h("input", { class: "inp", type: type, autocomplete: "off", spellcheck: false, value: auth[key], onInput: e => set({ [key]: e.target.value }) })));
|
|
18
|
+
return (h("div", { class: "auth" }, h("div", { class: "seg", role: "radiogroup", "aria-label": "Login for the link" }, [
|
|
19
|
+
['none', 'No login'],
|
|
20
|
+
['basic', 'Username and password'],
|
|
21
|
+
['bearer', 'Bearer token'],
|
|
22
|
+
['header', 'Custom header'],
|
|
23
|
+
].map(([mode, label]) => (h("label", { class: { on: auth.mode === mode } }, h("input", { type: "radio", name: "auth-mode", checked: auth.mode === mode, onChange: () => set({ mode }) }), label)))), auth.mode === 'basic' && [field('Username', 'username'), field('Password', 'password', 'password')], auth.mode === 'bearer' && field('Token', 'token', 'password'), auth.mode === 'header' && [field('Header name', 'headerName'), field('Value', 'headerValue', 'password')], auth.mode !== 'none' && h("p", { class: "hint" }, "Sent only to this link's own site, and dropped if it redirects elsewhere. The node seals it and deletes it when the download finishes.")));
|
|
24
|
+
};
|
|
25
|
+
const OrderChoice = ({ order, onChange }) => (h("fieldset", { class: "order" }, h("legend", null, "How should it download? (required for torrents)"), h("label", { class: { opt: true, on: order === 'in' } }, h("input", { type: "radio", name: "order", value: "in", checked: order === 'in', onChange: () => onChange('in') }), h("span", null, h("b", null, "In order"), " \u00B7 watch while it downloads, a little slower")), h("label", { class: { opt: true, on: order === 'fast' } }, h("input", { type: "radio", name: "order", value: "fast", checked: order === 'fast', onChange: () => onChange('fast') }), h("span", null, h("b", null, "Fastest"), " \u00B7 any order; switch to in order later if you want to watch"))));
|
|
26
|
+
/**
|
|
27
|
+
* The add form: mockup B and its states, used as the SFTP browser's Fetch
|
|
28
|
+
* dialog (`dialog`) and as the top of the standalone downloader (`inline`).
|
|
29
|
+
*/
|
|
30
|
+
export const FetchForm = (p) => {
|
|
31
|
+
const { form, model, caps } = p;
|
|
32
|
+
let fileInput;
|
|
33
|
+
const torrentsOn = !!caps?.torrents;
|
|
34
|
+
const dialog = p.layout === 'dialog';
|
|
35
|
+
const onDrop = (e) => {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
const file = e.dataTransfer?.files?.[0];
|
|
38
|
+
if (file) {
|
|
39
|
+
p.onPickTorrent(file);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const picker = (h("input", { type: "file", accept: ".torrent,application/x-bittorrent", class: "hidden-input", ref: el => (fileInput = el), onChange: e => {
|
|
43
|
+
const input = e.target;
|
|
44
|
+
const file = input.files?.[0];
|
|
45
|
+
if (file) {
|
|
46
|
+
p.onPickTorrent(file);
|
|
47
|
+
}
|
|
48
|
+
input.value = '';
|
|
49
|
+
} }));
|
|
50
|
+
const source = form.torrent ? (h("div", { class: { filechip: true, bad: !!form.torrent.error } }, h(Icon, { name: "torrent", size: 20 }), h("div", null, h("b", null, form.torrent.name), h("span", null, formatBytes(form.torrent.size), " \u00B7 from this computer")), h("button", { type: "button", class: "ib", "aria-label": "Remove the .torrent file", title: "Remove", onClick: () => p.onChange({ torrent: null, order: null }) }, h(Icon, { name: "x", size: 14 })))) : (h("div", { class: "fld" }, h("label", { htmlFor: "fetch-link" }, "Link or magnet"), h("div", { class: "inline-row" }, h("input", { id: "fetch-link", class: "inp", type: "text", inputMode: "url", autocomplete: "off", autocapitalize: "none", spellcheck: false, placeholder: "https://\u2026 or magnet:?xt=\u2026", value: form.text, disabled: p.starting, onInput: e => p.onChange({ text: e.target.value }), onKeyDown: e => {
|
|
51
|
+
if (e.key === 'Enter' && model.canStart) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
p.onStart();
|
|
54
|
+
}
|
|
55
|
+
} }), !dialog && torrentsOn && (h("button", { type: "button", class: "btn", onClick: () => fileInput?.click() }, ".torrent\u2026")), !dialog && (h("button", { type: "button", class: "btn pri", disabled: !model.canStart || p.starting, onClick: () => p.onStart() }, p.starting ? 'Starting…' : 'Download'))), h(Detect, { model: model })));
|
|
56
|
+
return (h("form", { class: { 'fetch-form': true, [p.layout]: true }, onSubmit: e => {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
if (model.canStart) {
|
|
59
|
+
p.onStart();
|
|
60
|
+
}
|
|
61
|
+
}, onDragOver: e => torrentsOn && e.preventDefault(), onDrop: e => torrentsOn && onDrop(e) }, dialog && (h("div", { class: "dlg-h" }, h(Icon, { name: "fetch" }), h("h4", null, p.title))), picker, source, model.note && h(NoteLine, { note: model.note }), p.refusal && h(NoteLine, { note: p.refusal }), model.showSaveAs && (h("div", { class: "fld" }, h("label", { htmlFor: "fetch-save-as" }, "Save as"), h("input", { id: "fetch-save-as", class: "inp", type: "text", autocomplete: "off", spellcheck: false, placeholder: model.askedName, value: form.saveAs, disabled: p.starting, onInput: e => p.onChange({ saveAs: e.target.value }) }), h("span", { class: "hint" }, "Taken from the server's filename when it sends one. An existing file is never overwritten; the new one gets \u201C(1)\u201D added."))), model.showAuth && (h("div", { class: "login" }, h("button", { type: "button", class: "lnk", "aria-expanded": form.authOpen ? 'true' : 'false', onClick: () => p.onChange({ authOpen: !form.authOpen }) }, h(Icon, { name: form.authOpen ? 'up' : 'chevron', size: 12 }), " This link needs a login"), form.authOpen && h(AuthFields, { auth: form.auth, onChange: p.onAuth }), model.authError && (h("span", { class: "hint err", role: "alert" }, model.authError)))), model.needsOrder && h(OrderChoice, { order: form.order, onChange: order => p.onChange({ order }) }), (model.detected.kind === 'http' || model.detected.kind === 'torrent-url') && h("p", { class: "hint" }, "A link always downloads in order, so you can watch while it arrives."), dialog && torrentsOn && !form.torrent && [
|
|
62
|
+
h("div", { class: "or" }, "or"),
|
|
63
|
+
h("button", { type: "button", class: "drop", onClick: () => fileInput?.click() }, h(Icon, { name: "torrent", size: 22 }), h("span", null, h("b", null, "Choose a .torrent file"), " or drop it here", h("br", null), h("span", { class: "hint" }, "Up to 2 MB, read in the browser and sent to the node"))),
|
|
64
|
+
], p.destination && (h("div", { class: "fld" }, dialog && h("label", null, "Destination"), h("div", { class: "dest-row" }, h("div", { class: "dest", title: p.destination.path }, h(Icon, { name: "folder", size: 14 }), h("span", null, p.destination.path)), p.onChooseFolder && (h("button", { type: "button", class: "btn", onClick: () => p.onChooseFolder?.() }, "Choose folder\u2026"))), p.destination.hint && h("span", { class: "hint where" }, p.destination.hint))), dialog && (h("div", { class: "dlg-f" }, h("button", { type: "button", class: "btn", onClick: () => p.onCancel?.() }, "Cancel"), h("button", { type: "submit", class: "btn pri", disabled: !model.canStart || p.starting }, p.starting ? 'Starting…' : 'Start download')))));
|
|
65
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/** Line icons shared by the downloader and the SFTP client's Fetch button. 16px, `currentColor`. */
|
|
3
|
+
// Functions, not arrays: a vnode is bound to the element it rendered, so each
|
|
4
|
+
// icon needs fresh ones.
|
|
5
|
+
const paths = {
|
|
6
|
+
fetch: () => [h("path", { d: "M17.5 19a4.5 4.5 0 1 0-1.4-8.8A6 6 0 0 0 4.3 12.7 4 4 0 0 0 6 19.9" }), h("path", { d: "M12 12v8" }), h("path", { d: "m8.5 16.5 3.5 3.5 3.5-3.5" })],
|
|
7
|
+
magnet: () => [h("path", { d: "M6 3v8a6 6 0 0 0 12 0V3" }), h("path", { d: "M6 7h4M14 7h4" }), h("path", { d: "M10 3v8a2 2 0 0 0 4 0V3" })],
|
|
8
|
+
globe: () => [h("circle", { cx: "12", cy: "12", r: "9" }), h("path", { d: "M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18" })],
|
|
9
|
+
torrent: () => [h("path", { d: "M6 3h8l4 4v14H6z" }), h("path", { d: "M14 3v4h4" }), h("path", { d: "M9.5 11.5 12 14l2.5-2.5M12 14v3" })],
|
|
10
|
+
node: () => [h("rect", { x: "3", y: "4", width: "18", height: "7", rx: "1.5" }), h("rect", { x: "3", y: "13", width: "18", height: "7", rx: "1.5" }), h("path", { d: "M7 7.5h.01M7 16.5h.01" })],
|
|
11
|
+
x: () => [h("path", { d: "M6 6l12 12M18 6 6 18" })],
|
|
12
|
+
retry: () => [h("path", { d: "M3 12a9 9 0 0 0 15.4 6.4L21 16" }), h("path", { d: "M21 21v-5h-5" }), h("path", { d: "M21 12A9 9 0 0 0 5.6 5.6L3 8" }), h("path", { d: "M3 3v5h5" })],
|
|
13
|
+
check: () => [h("circle", { cx: "12", cy: "12", r: "9.5" }), h("path", { d: "m8 12.5 2.7 2.7L16.5 9.5" })],
|
|
14
|
+
locate: () => [h("path", { d: "M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z" }), h("path", { d: "m11 13 2 2 3-3" })],
|
|
15
|
+
file: () => [h("path", { d: "M6 3h8l4 4v14H6z" }), h("path", { d: "M14 3v4h4" })],
|
|
16
|
+
folder: () => [h("path", { d: "M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z" })],
|
|
17
|
+
warn: () => [h("path", { d: "M12 3 2.5 20h19z" }), h("path", { d: "M12 10v4.5" }), h("path", { d: "M12 17.5v.01" })],
|
|
18
|
+
trash: () => [h("path", { d: "M3 6h18" }), h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" })],
|
|
19
|
+
chevron: () => [h("path", { d: "m6 9 6 6 6-6" })],
|
|
20
|
+
up: () => [h("path", { d: "m6 15 6-6 6 6" })],
|
|
21
|
+
cast: () => [h("path", { d: "M3 8V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-5" }), h("path", { d: "M3 12a8 8 0 0 1 8 8" }), h("path", { d: "M3 16a4 4 0 0 1 4 4" }), h("path", { d: "M3 20h.01" })],
|
|
22
|
+
lock: () => [h("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2" }), h("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })],
|
|
23
|
+
signal: () => [h("path", { d: "M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 4v16" })],
|
|
24
|
+
plus: () => [h("path", { d: "M12 5v14M5 12h14" })],
|
|
25
|
+
};
|
|
26
|
+
const filled = {
|
|
27
|
+
pause: () => [h("rect", { x: "6", y: "5", width: "4", height: "14", rx: "1" }), h("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1" })],
|
|
28
|
+
play: () => [h("path", { d: "M7 5v14l12-7z" })],
|
|
29
|
+
};
|
|
30
|
+
export const Icon = ({ name, size = 16, label }) => {
|
|
31
|
+
const fill = filled[name];
|
|
32
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: fill ? 'currentColor' : 'none', stroke: fill ? 'none' : 'currentColor', "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": label ? undefined : 'true', role: label ? 'img' : undefined, "aria-label": label }, (fill ?? paths[name])?.() ?? null));
|
|
33
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { percent } from "../format";
|
|
3
|
+
import { isFinished, orderPill, playCheck, statePill, statsLine } from "../jobs";
|
|
4
|
+
import { Icon } from "./icons";
|
|
5
|
+
function kindIcon(row) {
|
|
6
|
+
if (row.kind === 'Torrent') {
|
|
7
|
+
return { icon: row.name.startsWith('magnet:') ? 'magnet' : 'torrent', tone: 't' };
|
|
8
|
+
}
|
|
9
|
+
if (row.kind === 'Node') {
|
|
10
|
+
return { icon: 'node', tone: 'n' };
|
|
11
|
+
}
|
|
12
|
+
return { icon: 'globe', tone: 'h' };
|
|
13
|
+
}
|
|
14
|
+
function barClass(row) {
|
|
15
|
+
if (row.state === 'FetchingMetadata' || row.state === 'Resolving') {
|
|
16
|
+
return 'bar indet';
|
|
17
|
+
}
|
|
18
|
+
if (row.state === 'Retrying' || row.state === 'Paused') {
|
|
19
|
+
return 'bar moving';
|
|
20
|
+
}
|
|
21
|
+
if (row.state === 'Stopped' || row.state === 'Queued' || row.state === 'Scheduled' || row.deleting) {
|
|
22
|
+
return 'bar paused';
|
|
23
|
+
}
|
|
24
|
+
if (row.state === 'Cancelled') {
|
|
25
|
+
return 'bar fail';
|
|
26
|
+
}
|
|
27
|
+
if (row.state === 'Seeding') {
|
|
28
|
+
return 'bar seed';
|
|
29
|
+
}
|
|
30
|
+
return 'bar';
|
|
31
|
+
}
|
|
32
|
+
const Btn = ({ icon, label, onClick, primary }) => (h("button", { type: "button", class: { ib: true, new: !!primary }, title: label, "aria-label": label, onClick: onClick }, h(Icon, { name: icon, size: 14 })));
|
|
33
|
+
/**
|
|
34
|
+
* One download, in any state (mockups R and R2). Which buttons show is decided
|
|
35
|
+
* by the state alone; what a button sends is the host's business.
|
|
36
|
+
*/
|
|
37
|
+
export const JobRow = ({ row, actions, running, source, compact }) => {
|
|
38
|
+
const { icon, tone } = kindIcon(row);
|
|
39
|
+
const pill = statePill(row);
|
|
40
|
+
const order = orderPill(row);
|
|
41
|
+
const play = playCheck(row);
|
|
42
|
+
const stats = statsLine(row, { running, source });
|
|
43
|
+
const value = row.state === 'Completed' || row.state === 'Seeding' ? 100 : percent(row.done_bytes, row.total_bytes);
|
|
44
|
+
const buttons = [];
|
|
45
|
+
if (!row.deleting) {
|
|
46
|
+
if (play.play) {
|
|
47
|
+
buttons.push(h(Btn, { icon: "play", label: isFinished(row.state) ? 'Play' : 'Play while downloading', primary: true, onClick: () => actions.play(row) }));
|
|
48
|
+
}
|
|
49
|
+
switch (row.state) {
|
|
50
|
+
case 'Downloading':
|
|
51
|
+
case 'Verifying':
|
|
52
|
+
case 'Resolving':
|
|
53
|
+
case 'FetchingMetadata':
|
|
54
|
+
case 'Queued':
|
|
55
|
+
if (row.state === 'Downloading' || row.state === 'Verifying') {
|
|
56
|
+
buttons.push(h(Btn, { icon: "pause", label: "Pause", onClick: () => actions.pause(row) }));
|
|
57
|
+
}
|
|
58
|
+
buttons.push(h(Btn, { icon: "x", label: "Stop", onClick: () => actions.stop(row) }));
|
|
59
|
+
break;
|
|
60
|
+
case 'Scheduled':
|
|
61
|
+
case 'Paused':
|
|
62
|
+
if (row.state === 'Scheduled' || row.pause_reason === 'Window') {
|
|
63
|
+
buttons.push(h(Btn, { icon: "play", label: "Start now", onClick: () => actions.resume(row, true) }));
|
|
64
|
+
}
|
|
65
|
+
buttons.push(h(Btn, { icon: "x", label: "Stop", onClick: () => actions.stop(row) }));
|
|
66
|
+
break;
|
|
67
|
+
case 'Retrying':
|
|
68
|
+
buttons.push(h(Btn, { icon: "retry", label: "Try now", onClick: () => actions.resume(row) }));
|
|
69
|
+
buttons.push(h(Btn, { icon: "x", label: "Stop", onClick: () => actions.stop(row) }));
|
|
70
|
+
break;
|
|
71
|
+
case 'Stopped':
|
|
72
|
+
buttons.push(h(Btn, { icon: "play", label: "Resume", onClick: () => actions.resume(row) }));
|
|
73
|
+
buttons.push(h(Btn, { icon: "trash", label: "Delete", onClick: () => actions.remove(row) }));
|
|
74
|
+
break;
|
|
75
|
+
case 'Seeding':
|
|
76
|
+
buttons.push(h(Btn, { icon: "pause", label: "Pause seeding", onClick: () => actions.pause(row) }));
|
|
77
|
+
buttons.push(h(Btn, { icon: "locate", label: "Show in folder", onClick: () => actions.showInFolder(row) }));
|
|
78
|
+
buttons.push(h(Btn, { icon: "trash", label: "Delete", onClick: () => actions.remove(row) }));
|
|
79
|
+
break;
|
|
80
|
+
case 'Completed':
|
|
81
|
+
buttons.push(h(Btn, { icon: "locate", label: "Show in folder", onClick: () => actions.showInFolder(row) }));
|
|
82
|
+
buttons.push(h(Btn, { icon: "x", label: "Remove from list", onClick: () => actions.remove(row) }));
|
|
83
|
+
break;
|
|
84
|
+
case 'Cancelled':
|
|
85
|
+
buttons.push(h(Btn, { icon: "retry", label: "Start again", onClick: () => actions.resume(row) }));
|
|
86
|
+
buttons.push(h(Btn, { icon: "x", label: "Remove from list", onClick: () => actions.remove(row) }));
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return (h("div", { key: row.download_id, class: { job: true, compact: !!compact }, "data-state": row.deleting ? 'Deleting' : row.state, "data-id": row.download_id, role: "listitem", "aria-label": `${row.name}, ${pill.text}` }, h("span", { class: `kind ${tone}` }, h(Icon, { name: icon, size: 15 })), h("div", { class: "title" }, h("span", { class: "nm", title: row.name }, row.name), h("span", { class: `pill ${pill.tone}` }, pill.text), order && h("span", { class: "pill meta" }, order)), h("div", { class: "acts" }, buttons), h("div", { class: barClass(row), role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(value), "aria-label": `${row.name} progress` }, h("i", { style: { width: `${value}%` } })), h("div", { class: "stats" }, stats.map(s => (s.strong ? h("b", null, s.text) : h("span", { class: { err: !!s.error } }, s.text))), !play.play && play.switchToInOrder && (h("button", { type: "button", class: "lnk inline", onClick: () => actions.setOrder(row, true) }, "Switch to in order to watch")), play.play && row.kind === 'Torrent' && row.in_order && !isFinished(row.state) && (h("button", { type: "button", class: "lnk inline", onClick: () => actions.setOrder(row, false) }, "Switch to fastest")))));
|
|
91
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Icon } from "./icons";
|
|
3
|
+
const ICON = {
|
|
4
|
+
started: 'fetch',
|
|
5
|
+
queued: 'fetch',
|
|
6
|
+
stuck: 'warn',
|
|
7
|
+
renamed: 'file',
|
|
8
|
+
completed: 'check',
|
|
9
|
+
error: 'warn',
|
|
10
|
+
};
|
|
11
|
+
/** Small, self-dismissing notices at the bottom of the widget (N1–N4, D). */
|
|
12
|
+
export const Notices = ({ notices, onDismiss }) => notices.length ? (h("div", { class: "toasts", "aria-live": "polite" }, notices.map(n => (h("div", { class: { toast: true, bad: n.kind === 'stuck' || n.kind === 'error' }, "data-notice": n.kind, key: n.id }, h(Icon, { name: ICON[n.kind], size: 18 }), h("div", { class: "t" }, h("b", null, n.title), h("span", { title: n.detail }, n.detail)), n.action && (h("button", { type: "button", class: "btn", onClick: () => {
|
|
13
|
+
n.action.run();
|
|
14
|
+
onDismiss(n.id);
|
|
15
|
+
} }, n.action.label)), h("button", { type: "button", class: "ib", "aria-label": "Dismiss", onClick: () => onDismiss(n.id) }, h(Icon, { name: "x", size: 12 }))))))) : null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Icon } from "./icons";
|
|
3
|
+
export const Empty = ({ icon, title, body, action }) => (h("div", { class: "empty", role: "status" }, h(Icon, { name: icon, size: 28 }), h("b", null, title), h("span", null, body), action && (h("button", { type: "button", class: "btn pri", onClick: action.onClick }, action.label))));
|
|
4
|
+
/** X1: embedded drawer with nothing in it. */
|
|
5
|
+
export const DrawerEmpty = () => (h(Empty, { icon: "fetch", title: "No downloads yet", body: "Press Fetch and paste a link. Downloads keep running after you close this tab, and they show here when you come back." }));
|
|
6
|
+
/** X2: standalone, first open. */
|
|
7
|
+
export const StandaloneEmpty = ({ nodeName, folder }) => (h(Empty, { icon: "fetch", title: "Nothing downloading", body: `Paste a link above. It downloads onto ${nodeName}${folder ? `, into ${folder}` : ''}.` }));
|
|
8
|
+
/** X3: no valid session. */
|
|
9
|
+
export const SignedOut = ({ onSignIn }) => (h(Empty, { icon: "lock", title: "Sign in to PhirePass", body: "Your downloads are tied to your account and the nodes you can reach.", action: { label: 'Sign in', onClick: onSignIn } }));
|
|
10
|
+
/** X4: the node (or the server) cannot be reached. */
|
|
11
|
+
export const Unreachable = ({ nodeName, onRetry }) => (h(Empty, { icon: "signal", title: `Can't reach ${nodeName}`, body: "If the machine is still running, its downloads carry on. They will show here when it reconnects.", action: onRetry ? { label: 'Try again', onClick: onRetry } : undefined }));
|
|
12
|
+
/** The channel this page loaded predates Remote Fetch. */
|
|
13
|
+
export const Unsupported = () => (h(Empty, { icon: "warn", title: "Downloads are not available here", body: "This page's connection library is too old to start downloads. Reload after the site updates." }));
|
|
14
|
+
export const Loading = () => (h("div", { class: "empty", role: "status" }, h("span", { class: "spin", "aria-hidden": "true" }), h("span", null, "Loading downloads\u2026")));
|
|
15
|
+
/**
|
|
16
|
+
* Why nothing can be added on this node (B8, B9, L3). Shown in place of the
|
|
17
|
+
* form, in the dialog and in the standalone header alike.
|
|
18
|
+
*/
|
|
19
|
+
export const BlockerView = ({ blocker, onAction, onClose }) => (h("div", { class: "blocker", "data-blocker": blocker.id }, h("div", { class: `note ${blocker.id === 'off' ? 'info' : 'warn'}`, role: "status" }, h(Icon, { name: blocker.id === 'off' ? 'fetch' : 'warn', size: 14 }), h("div", null, h("b", null, blocker.title), " ", blocker.body)), blocker.secondary && h("p", { class: "hint" }, blocker.secondary), (onClose || (blocker.action && onAction)) && (h("div", { class: "dlg-f" }, onClose && (h("button", { type: "button", class: "btn", onClick: onClose }, "Close")), blocker.action && onAction && (h("button", { type: "button", class: "btn pri", onClick: onAction }, blocker.action))))));
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--card: 220 18% 10%;
|
|
3
|
+
--bg: 216 18% 7%;
|
|
4
|
+
--border: 220 15% 18%;
|
|
5
|
+
--primary: 160 60% 45%;
|
|
6
|
+
--primary-foreground: 220 20% 7%;
|
|
7
|
+
--muted: 220 15% 13%;
|
|
8
|
+
--muted-foreground: 215 10% 52%;
|
|
9
|
+
--foreground: 210 20% 90%;
|
|
10
|
+
--amber: 38 75% 55%;
|
|
11
|
+
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
background: hsl(var(--card));
|
|
15
|
+
color: hsl(var(--foreground));
|
|
16
|
+
border: 1px solid hsl(var(--border));
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
line-height: 1.45;
|
|
22
|
+
box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
* {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button,
|
|
30
|
+
a.btn {
|
|
31
|
+
font: inherit;
|
|
32
|
+
color: inherit;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:focus-visible {
|
|
37
|
+
outline: 2px solid hsl(var(--primary));
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.bar {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: 8px;
|
|
45
|
+
padding: 8px 10px;
|
|
46
|
+
border-bottom: 1px solid hsl(var(--border));
|
|
47
|
+
min-width: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nm {
|
|
51
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pill {
|
|
60
|
+
font-size: 10px;
|
|
61
|
+
font-weight: 600;
|
|
62
|
+
text-transform: uppercase;
|
|
63
|
+
letter-spacing: 0.05em;
|
|
64
|
+
padding: 2px 7px;
|
|
65
|
+
border-radius: 3px;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
background: hsl(var(--primary) / 0.18);
|
|
68
|
+
color: hsl(var(--primary));
|
|
69
|
+
flex: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.sp {
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ib {
|
|
77
|
+
width: 28px;
|
|
78
|
+
height: 28px;
|
|
79
|
+
display: inline-grid;
|
|
80
|
+
place-items: center;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
border: 1px solid transparent;
|
|
83
|
+
background: transparent;
|
|
84
|
+
color: hsl(var(--muted-foreground));
|
|
85
|
+
padding: 0;
|
|
86
|
+
flex: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ib:hover:not(:disabled) {
|
|
90
|
+
background: hsl(var(--muted));
|
|
91
|
+
color: hsl(var(--foreground));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ib:disabled {
|
|
95
|
+
opacity: 0.4;
|
|
96
|
+
cursor: not-allowed;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.btn {
|
|
100
|
+
border-radius: 4px;
|
|
101
|
+
padding: 7px 14px;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
border: 1px solid hsl(var(--border));
|
|
105
|
+
background: hsl(var(--muted));
|
|
106
|
+
text-decoration: none;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.btn.pri {
|
|
112
|
+
background: hsl(var(--primary));
|
|
113
|
+
border-color: hsl(var(--primary));
|
|
114
|
+
color: hsl(var(--primary-foreground));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.stage {
|
|
118
|
+
position: relative;
|
|
119
|
+
background: #000;
|
|
120
|
+
min-height: 220px;
|
|
121
|
+
display: grid;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.stage.audio {
|
|
125
|
+
min-height: 0;
|
|
126
|
+
background: hsl(var(--bg));
|
|
127
|
+
padding: 14px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.stage > video,
|
|
131
|
+
.stage > audio {
|
|
132
|
+
grid-area: 1 / 1;
|
|
133
|
+
width: 100%;
|
|
134
|
+
max-height: 70vh;
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.stage > audio {
|
|
139
|
+
align-self: center;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.stage > .hidden {
|
|
143
|
+
visibility: hidden;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.stage-msg {
|
|
147
|
+
grid-area: 1 / 1;
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
text-align: center;
|
|
153
|
+
gap: 8px;
|
|
154
|
+
padding: 22px;
|
|
155
|
+
z-index: 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.stage.audio .stage-msg {
|
|
159
|
+
padding: 8px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.overlay-msg {
|
|
163
|
+
background: rgba(0, 0, 0, 0.55);
|
|
164
|
+
pointer-events: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.stage-msg > svg {
|
|
168
|
+
color: hsl(var(--amber));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.stage-msg[data-phase='casting'] > svg {
|
|
172
|
+
color: hsl(var(--primary));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.stage-msg b {
|
|
176
|
+
font-size: 14px;
|
|
177
|
+
font-weight: 600;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.stage-msg span {
|
|
181
|
+
color: hsl(var(--muted-foreground));
|
|
182
|
+
font-size: 12px;
|
|
183
|
+
max-width: 44ch;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.stage-msg .clock {
|
|
187
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
188
|
+
font-variant-numeric: tabular-nums;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.stage-msg .row {
|
|
192
|
+
display: flex;
|
|
193
|
+
gap: 8px;
|
|
194
|
+
margin-top: 4px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.spin {
|
|
198
|
+
width: 26px;
|
|
199
|
+
height: 26px;
|
|
200
|
+
border-radius: 50%;
|
|
201
|
+
border: 3px solid hsl(var(--border));
|
|
202
|
+
border-top-color: hsl(var(--primary));
|
|
203
|
+
animation: spin 1s linear infinite;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@keyframes spin {
|
|
207
|
+
to {
|
|
208
|
+
transform: rotate(360deg);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@media (prefers-reduced-motion: reduce) {
|
|
213
|
+
.spin {
|
|
214
|
+
animation: none;
|
|
215
|
+
}
|
|
216
|
+
}
|