Lint and format with Biome, and retire used share codes
Biome formats and lints the TypeScript, the Vue templates and the CSS: pnpm lint checks, pnpm format fixes. It keeps the existing style, single quotes and 120 columns, and leaves the vendored logo alone. Besides its recommended rules it looks for promises nobody awaits. Rules that only flagged deliberate code are off: non-null assertions that state what the code guarantees, CSS order where no two rules set the same property, and fieldset for role="group". The one-time formatting pass mostly splits long chains. Promises that are deliberately not awaited are marked with void, none of them can reject today. Buttons say type="button", the any for peer messages and the checkbox switch keep their reasons in ignore comments. The sender's code also counts as no longer valid once a transfer started: that closes the trackers, so another receiver would wait for nothing, yet the card still offered the code with Copy. The tracker transfer tests check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2167b528b2
commit
b6b6e7c29b
9 files changed
+371
-122
No files matched your search
+57
-25
@@ -2,17 +2,17 @@
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import {
|
||||
answerOffer,
|
||||
type Check,
|
||||
settings as coreSettings,
|
||||
createOffer,
|
||||
DEFAULT_STUN_SERVERS,
|
||||
DEFAULT_TRACKERS,
|
||||
receiveViaTracker,
|
||||
sendViaTracker,
|
||||
settings as coreSettings,
|
||||
TRACKER_WAIT,
|
||||
type Check,
|
||||
type Events,
|
||||
type Incoming,
|
||||
type ReceiveEvents,
|
||||
receiveViaTracker,
|
||||
sendViaTracker,
|
||||
TRACKER_WAIT,
|
||||
} from './core';
|
||||
|
||||
const SETTINGS_KEY = 'hellcon:settings';
|
||||
@@ -61,7 +61,12 @@ const isTracker = (url: string) =>
|
||||
// A textarea with one URL per line for the list at settings[key], invalid lines are listed and skipped.
|
||||
function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) {
|
||||
const text = ref(settings[key].join('\n'));
|
||||
const lines = computed(() => text.value.split('\n').map((line) => line.trim()).filter(Boolean));
|
||||
const lines = computed(() =>
|
||||
text.value
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean),
|
||||
);
|
||||
const invalid = computed(() => lines.value.filter((line) => !valid(line)));
|
||||
// Immediate, a saved list may hold lines this browser rejects.
|
||||
watch(lines, (lines) => (settings[key] = lines.filter(valid)), { immediate: true });
|
||||
@@ -236,8 +241,9 @@ async function onShare() {
|
||||
sendTimer = window.setTimeout(() => (sendExpired.value = true), TRACKER_WAIT);
|
||||
}
|
||||
|
||||
// Also once the share failed, every error on the tracker ends it.
|
||||
const codeGone = computed(() => sendExpired.value || !!error.value);
|
||||
// Also once the transfer started, which closes the trackers, and once the share failed: every error on
|
||||
// the tracker ends it.
|
||||
const codeGone = computed(() => sendExpired.value || !!sent.value || !!error.value);
|
||||
|
||||
function onReceive() {
|
||||
const signal = begin('receive');
|
||||
@@ -250,6 +256,7 @@ function onReceive() {
|
||||
<img src="/HellNet_alt.png" alt="" width="40" height="40" />
|
||||
<h1>HellCon</h1>
|
||||
<label>
|
||||
<!-- biome-ignore lint/a11y/useAriaPropsForRole: a checkbox reports its own state, aria-checked on it is not allowed -->
|
||||
<input id="stun" v-model="settings.stun" type="checkbox" role="switch" />
|
||||
Use STUN
|
||||
</label>
|
||||
@@ -258,8 +265,8 @@ function onReceive() {
|
||||
<main>
|
||||
<aside v-if="check" role="alert">
|
||||
<p>
|
||||
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is
|
||||
transferred before.
|
||||
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is transferred
|
||||
before.
|
||||
</p>
|
||||
<dl>
|
||||
<dt>You</dt>
|
||||
@@ -268,8 +275,8 @@ function onReceive() {
|
||||
<dd><output id="check-remote">{{ check.remote }}</output></dd>
|
||||
</dl>
|
||||
<div v-if="!confirmed">
|
||||
<button id="confirm" @click="onConfirm">Codes match</button>
|
||||
<button id="reject" @click="check.reject()">Codes don't match</button>
|
||||
<button id="confirm" type="button" @click="onConfirm">Codes match</button>
|
||||
<button id="reject" type="button" @click="check.reject()">Codes don't match</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -296,13 +303,15 @@ function onReceive() {
|
||||
|
||||
<section>
|
||||
<h3>Tracker</h3>
|
||||
<button id="share" :disabled="!file || !settings.trackers.length" @click="onShare">Share via tracker</button>
|
||||
<button id="share" type="button" :disabled="!file || !settings.trackers.length" @click="onShare">
|
||||
Share via tracker
|
||||
</button>
|
||||
<template v-if="sendCode">
|
||||
<label v-if="codeGone" for="send-code">Code, no longer valid:</label>
|
||||
<label v-else for="send-code">Code, give this to the receiver, valid until {{ sendUntil }}:</label>
|
||||
<div role="group">
|
||||
<output id="send-code" :data-expired="codeGone || undefined">{{ sendCode }}</output>
|
||||
<button id="copy-send-code" data-copy :disabled="codeGone" @click="onCopy(sendCode)">
|
||||
<button id="copy-send-code" type="button" data-copy :disabled="codeGone" @click="onCopy(sendCode)">
|
||||
{{ copied === sendCode ? 'Copied' : 'Copy' }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -312,14 +321,18 @@ function onReceive() {
|
||||
<details id="send-manual">
|
||||
<summary>Manual</summary>
|
||||
<section>
|
||||
<button id="create-offer" :disabled="!file" @click="onCreateOffer">Create offer</button>
|
||||
<button id="create-offer" type="button" :disabled="!file" @click="onCreateOffer">Create offer</button>
|
||||
<template v-if="offer">
|
||||
<label for="offer">Offer, send this to the receiver:</label>
|
||||
<textarea id="offer" readonly :value="offer"></textarea>
|
||||
<button id="copy-offer" data-copy @click="onCopy(offer)">{{ copied === offer ? 'Copied' : 'Copy' }}</button>
|
||||
<button id="copy-offer" type="button" data-copy @click="onCopy(offer)">
|
||||
{{ copied === offer ? 'Copied' : 'Copy' }}
|
||||
</button>
|
||||
<label for="answer-input">Answer from the receiver:</label>
|
||||
<textarea id="answer-input" v-model="answerInput"></textarea>
|
||||
<button id="accept-answer" :disabled="!answerInput.trim()" @click="onAcceptAnswer">Connect</button>
|
||||
<button id="accept-answer" type="button" :disabled="!answerInput.trim()" @click="onAcceptAnswer">
|
||||
Connect
|
||||
</button>
|
||||
</template>
|
||||
</section>
|
||||
</details>
|
||||
@@ -331,7 +344,7 @@ function onReceive() {
|
||||
<template v-if="incoming">
|
||||
<strong>{{ incoming.name }}</strong>
|
||||
{{ formatSize(incoming.size) }}
|
||||
<button v-if="!received" id="download" @click="incoming.download()">Download</button>
|
||||
<button v-if="!received" id="download" type="button" @click="incoming.download()">Download</button>
|
||||
</template>
|
||||
<template v-else>The sender's file shows up here after the security check</template>
|
||||
</div>
|
||||
@@ -353,7 +366,14 @@ function onReceive() {
|
||||
autocorrect="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
<button id="receive" :disabled="!settings.trackers.length || !receiveCode.trim()" @click="onReceive">Receive</button>
|
||||
<button
|
||||
id="receive"
|
||||
type="button"
|
||||
:disabled="!settings.trackers.length || !receiveCode.trim()"
|
||||
@click="onReceive"
|
||||
>
|
||||
Receive
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -362,11 +382,15 @@ function onReceive() {
|
||||
<section>
|
||||
<label for="offer-input">Offer from the sender:</label>
|
||||
<textarea id="offer-input" v-model="offerInput"></textarea>
|
||||
<button id="create-answer" :disabled="!offerInput.trim()" @click="onCreateAnswer">Create answer</button>
|
||||
<button id="create-answer" type="button" :disabled="!offerInput.trim()" @click="onCreateAnswer">
|
||||
Create answer
|
||||
</button>
|
||||
<template v-if="answer">
|
||||
<label for="answer">Answer, send this back to the sender:</label>
|
||||
<textarea id="answer" readonly :value="answer"></textarea>
|
||||
<button id="copy-answer" data-copy @click="onCopy(answer)">{{ copied === answer ? 'Copied' : 'Copy' }}</button>
|
||||
<button id="copy-answer" type="button" data-copy @click="onCopy(answer)">
|
||||
{{ copied === answer ? 'Copied' : 'Copy' }}
|
||||
</button>
|
||||
</template>
|
||||
</section>
|
||||
</details>
|
||||
@@ -378,16 +402,24 @@ function onReceive() {
|
||||
<section>
|
||||
<h3>STUN</h3>
|
||||
<label for="stun-servers">Tell each side its public address, one URL per line:</label>
|
||||
<textarea id="stun-servers" v-model="stunServers.text" :aria-invalid="!!stunServers.invalid.length"></textarea>
|
||||
<p v-if="stunServers.invalid.length">Skipped, not a STUN URL this browser accepts: {{ stunServers.invalid.join(', ') }}</p>
|
||||
<textarea
|
||||
id="stun-servers"
|
||||
v-model="stunServers.text"
|
||||
:aria-invalid="!!stunServers.invalid.length"
|
||||
></textarea>
|
||||
<p v-if="stunServers.invalid.length">
|
||||
Skipped, not a STUN URL this browser accepts: {{ stunServers.invalid.join(', ') }}
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Trackers</h3>
|
||||
<label for="trackers">WebTorrent trackers for the code exchange, one URL per line:</label>
|
||||
<textarea id="trackers" v-model="trackers.text" :aria-invalid="!!trackers.invalid.length"></textarea>
|
||||
<p v-if="trackers.invalid.length">Skipped, not a ws: or wss: URL without #: {{ trackers.invalid.join(', ') }}</p>
|
||||
<p v-if="trackers.invalid.length">
|
||||
Skipped, not a ws: or wss: URL without #: {{ trackers.invalid.join(', ') }}
|
||||
</p>
|
||||
</section>
|
||||
<button id="reset-servers" @click="onResetServers">Reset to defaults</button>
|
||||
<button id="reset-servers" type="button" @click="onResetServers">Reset to defaults</button>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
|
||||
+71
-55
@@ -106,6 +106,7 @@ function createPeerConnection(signal: AbortSignal) {
|
||||
|
||||
// Peers and trackers send JSON objects. Anything else, malformed or not an object, counts as nothing.
|
||||
// Whatever is read from one has to be checked, the any only saves the casts for that.
|
||||
// biome-ignore lint/suspicious/noExplicitAny: checked field by field, see above
|
||||
type Message = Record<string, any>;
|
||||
|
||||
function parse(data: unknown): Message | undefined {
|
||||
@@ -185,7 +186,12 @@ async function gatherIce(pc: RTCPeerConnection) {
|
||||
// versa, otherwise someone interposed on the signaling.
|
||||
function securityCheck(pc: RTCPeerConnection) {
|
||||
const short = (sdp = '') =>
|
||||
sdp.match(/a=fingerprint:\S+ ([0-9A-F:]+)/i)?.[1]?.toUpperCase().split(':').slice(0, 8).join(' ') ?? '?';
|
||||
sdp
|
||||
.match(/a=fingerprint:\S+ ([0-9A-F:]+)/i)?.[1]
|
||||
?.toUpperCase()
|
||||
.split(':')
|
||||
.slice(0, 8)
|
||||
.join(' ') ?? '?';
|
||||
return { local: short(pc.localDescription?.sdp), remote: short(pc.remoteDescription?.sdp) };
|
||||
}
|
||||
|
||||
@@ -308,7 +314,10 @@ async function sendFile(
|
||||
await new Promise<void>((resolve) => (wake = resolve));
|
||||
}
|
||||
// E.g. the file was changed or deleted since it was picked.
|
||||
const chunk = await file.slice(offset, offset + CHUNK_SIZE).arrayBuffer().catch(() => undefined);
|
||||
const chunk = await file
|
||||
.slice(offset, offset + CHUNK_SIZE)
|
||||
.arrayBuffer()
|
||||
.catch(() => undefined);
|
||||
if (!chunk) return stop(`could not read ${file.name} anymore`);
|
||||
if (!open()) return;
|
||||
channel.send(chunk);
|
||||
@@ -381,9 +390,9 @@ function receiveFile(
|
||||
let complete = false;
|
||||
let ended = false;
|
||||
// Chunks can arrive before the worker is held, chaining every post on this keeps them in order.
|
||||
let worker: Promise<ServiceWorker | void> = Promise.resolve();
|
||||
let worker: Promise<ServiceWorker | undefined> = Promise.resolve(undefined);
|
||||
const post = (message: object, transfer: Transferable[] = []) =>
|
||||
worker.then((worker) => worker?.postMessage({ id, ...message }, transfer));
|
||||
void worker.then((worker) => worker?.postMessage({ id, ...message }, transfer));
|
||||
// To the sender, see sendFile.
|
||||
const reply = (message: object) => channel.readyState === 'open' && channel.send(JSON.stringify(message));
|
||||
// A data channel closes only after sending what it buffered, so the last reply still arrives.
|
||||
@@ -409,51 +418,54 @@ function receiveFile(
|
||||
}
|
||||
|
||||
function startDownload() {
|
||||
worker = holdWorker().then(({ frame, worker }) => {
|
||||
frames.push(frame);
|
||||
keepalive = setInterval(() => post({ ping: true }), KEEPALIVE);
|
||||
// Only if something else than an update stops it, e.g. clearing the site data. It can't answer.
|
||||
worker.addEventListener('statechange', () => {
|
||||
if (worker.state !== 'redundant') return;
|
||||
fail('service worker stopped');
|
||||
release();
|
||||
});
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
port1.onmessage = ({ data }) => {
|
||||
if (typeof data === 'number') {
|
||||
read = data;
|
||||
events.progress(read, meta!.size);
|
||||
return reply({ read });
|
||||
}
|
||||
if (data === 'ready' && !ended) {
|
||||
// A navigation, not fetch(): only navigations hand the response to the download manager.
|
||||
const download = document.createElement('iframe');
|
||||
download.hidden = true;
|
||||
download.src = `download/${id}`;
|
||||
document.body.append(download);
|
||||
frames.push(download);
|
||||
return;
|
||||
}
|
||||
if (data === 'failed') fail('the service worker refused it');
|
||||
if (data === 'finished') {
|
||||
events.log('download complete');
|
||||
events.progress(meta!.size, meta!.size);
|
||||
reply({ done: true });
|
||||
}
|
||||
if (data === 'cancelled' && !ended) {
|
||||
events.log('download cancelled');
|
||||
reply({ error: 'download cancelled' });
|
||||
}
|
||||
ended = true;
|
||||
channel.close();
|
||||
release();
|
||||
};
|
||||
worker.postMessage({ id, ...meta }, [port2]);
|
||||
return worker;
|
||||
}, (error) => fail(String(error)));
|
||||
worker = holdWorker().then(
|
||||
({ frame, worker }) => {
|
||||
frames.push(frame);
|
||||
keepalive = setInterval(() => post({ ping: true }), KEEPALIVE);
|
||||
// Only if something else than an update stops it, e.g. clearing the site data. It can't answer.
|
||||
worker.addEventListener('statechange', () => {
|
||||
if (worker.state !== 'redundant') return;
|
||||
fail('service worker stopped');
|
||||
release();
|
||||
});
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
port1.onmessage = ({ data }) => {
|
||||
if (typeof data === 'number') {
|
||||
read = data;
|
||||
events.progress(read, meta!.size);
|
||||
return reply({ read });
|
||||
}
|
||||
if (data === 'ready' && !ended) {
|
||||
// A navigation, not fetch(): only navigations hand the response to the download manager.
|
||||
const download = document.createElement('iframe');
|
||||
download.hidden = true;
|
||||
download.src = `download/${id}`;
|
||||
document.body.append(download);
|
||||
frames.push(download);
|
||||
return;
|
||||
}
|
||||
if (data === 'failed') fail('the service worker refused it');
|
||||
if (data === 'finished') {
|
||||
events.log('download complete');
|
||||
events.progress(meta!.size, meta!.size);
|
||||
reply({ done: true });
|
||||
}
|
||||
if (data === 'cancelled' && !ended) {
|
||||
events.log('download cancelled');
|
||||
reply({ error: 'download cancelled' });
|
||||
}
|
||||
ended = true;
|
||||
channel.close();
|
||||
release();
|
||||
};
|
||||
worker.postMessage({ id, ...meta }, [port2]);
|
||||
return worker;
|
||||
},
|
||||
(error) => void fail(String(error)),
|
||||
);
|
||||
}
|
||||
|
||||
handshake.checked.then(() => {
|
||||
void handshake.checked.then(() => {
|
||||
confirmed = true;
|
||||
reply({ ok: true });
|
||||
events.log('waiting for the sender');
|
||||
@@ -528,8 +540,7 @@ export async function createOffer(file: File, events: Events, signal: AbortSigna
|
||||
events = live(events, signal);
|
||||
const pc = createPeerConnection(signal);
|
||||
const channel = pc.createDataChannel('file');
|
||||
channel.onopen = () =>
|
||||
sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
|
||||
channel.onopen = () => sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
|
||||
failUnconnected(pc, () => channel.readyState !== 'connecting', events);
|
||||
await pc.setLocalDescription();
|
||||
await gatherIce(pc);
|
||||
@@ -655,7 +666,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
let shared = false;
|
||||
let expired = false;
|
||||
// The latest offer that came while busy, answered once that peer is out.
|
||||
let waiting: (() => void) | undefined;
|
||||
let waiting: (() => Promise<void>) | undefined;
|
||||
|
||||
// Without a tracker no further receiver can find the share.
|
||||
const stranded = () => !shared && !busy && !trackers.some((tracker) => tracker.alive());
|
||||
@@ -678,10 +689,14 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
events.log('waiting for the next receiver');
|
||||
const offer = waiting;
|
||||
waiting = undefined;
|
||||
offer?.();
|
||||
void offer?.();
|
||||
}
|
||||
|
||||
async function answer(ws: WebSocket, url: string, msg: { offer: { sdp: string }; peer_id: string; offer_id: string }) {
|
||||
async function answer(
|
||||
ws: WebSocket,
|
||||
url: string,
|
||||
msg: { offer: { sdp: string }; peer_id: string; offer_id: string },
|
||||
) {
|
||||
busy = true;
|
||||
events.log(`offer via ${url}`);
|
||||
const pc = createPeerConnection(signal);
|
||||
@@ -708,7 +723,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
expiry.close();
|
||||
for (const tracker of trackers) tracker.close();
|
||||
};
|
||||
sendFile(pc, channel, file, events, { ...handshake, start }, signal);
|
||||
void sendFile(pc, channel, file, events, { ...handshake, start }, signal);
|
||||
};
|
||||
pc.addEventListener('connectionstatechange', () => {
|
||||
if (pc.connectionState === 'failed') giveUp('receiver did not connect');
|
||||
@@ -740,7 +755,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
if (typeof msg.offer_id !== 'string') return;
|
||||
const offer = { offer: { sdp: msg.offer.sdp }, peer_id: msg.peer_id, offer_id: msg.offer_id };
|
||||
if (busy) waiting = () => answer(tracker.ws, url, offer);
|
||||
else answer(tracker.ws, url, offer);
|
||||
else void answer(tracker.ws, url, offer);
|
||||
},
|
||||
() => stranded() && end(noTracker(trackers)),
|
||||
() => announce(tracker.ws, hash, peerId, { left: 0 }),
|
||||
@@ -830,7 +845,8 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
|
||||
receiveFile(pc, channel, events, { ...handshake, start }, signal);
|
||||
};
|
||||
pc.addEventListener('connectionstatechange', () => {
|
||||
if (pc.connectionState === 'failed' && channel.readyState === 'connecting') retry(`sender via ${url} did not connect`);
|
||||
if (pc.connectionState === 'failed' && channel.readyState === 'connecting')
|
||||
retry(`sender via ${url} did not connect`);
|
||||
});
|
||||
|
||||
pc.setLocalDescription()
|
||||
|
||||
+53
-18
@@ -1,4 +1,6 @@
|
||||
*, *::before, *::after {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -17,16 +19,29 @@ body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
img, picture, video, canvas, svg {
|
||||
img,
|
||||
picture,
|
||||
video,
|
||||
canvas,
|
||||
svg {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
input, button, textarea, select {
|
||||
input,
|
||||
button,
|
||||
textarea,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
p, h1, h2, h3, h4, h5, h6 {
|
||||
p,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
@@ -34,7 +49,12 @@ p {
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
@@ -85,7 +105,9 @@ body {
|
||||
|
||||
/* Layout */
|
||||
|
||||
header, main, footer {
|
||||
header,
|
||||
main,
|
||||
footer {
|
||||
max-width: 64rem;
|
||||
margin-inline: auto;
|
||||
padding-inline: var(--space-4);
|
||||
@@ -114,13 +136,15 @@ main {
|
||||
padding-bottom: var(--space-8);
|
||||
}
|
||||
|
||||
main > aside, main > details {
|
||||
main > aside,
|
||||
main > details {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
|
||||
article, details {
|
||||
article,
|
||||
details {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
@@ -147,7 +171,8 @@ section {
|
||||
border-top: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
h3, article summary {
|
||||
h3,
|
||||
article summary {
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
@@ -155,7 +180,8 @@ h3, article summary {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
label, section p {
|
||||
label,
|
||||
section p {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
@@ -166,7 +192,8 @@ header label {
|
||||
|
||||
/* Forms */
|
||||
|
||||
input, textarea {
|
||||
input,
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
background: var(--color-input);
|
||||
@@ -176,12 +203,14 @@ input, textarea {
|
||||
transition: border-color var(--transition);
|
||||
}
|
||||
|
||||
input:focus, textarea:focus {
|
||||
input:focus,
|
||||
textarea:focus {
|
||||
border-color: var(--color-secondary);
|
||||
}
|
||||
|
||||
/* Text fields show focus with their border, everything else, the switch too, with :focus-visible */
|
||||
input:not([type='checkbox'], [type='file']):focus-visible, textarea:focus-visible {
|
||||
input:not([type='checkbox'], [type='file']):focus-visible,
|
||||
textarea:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -229,7 +258,8 @@ button:disabled {
|
||||
}
|
||||
|
||||
/* The tracker code on both sides. The sender's is read only like an input, one click selects it. */
|
||||
#send-code, #receive-code {
|
||||
#send-code,
|
||||
#receive-code {
|
||||
color: var(--color-secondary-text);
|
||||
font-family: ui-monospace, monospace;
|
||||
font-size: var(--text-lg);
|
||||
@@ -286,7 +316,8 @@ article details section {
|
||||
|
||||
/* Drop zone, the invisible file input covers the whole label. The incoming file looks alike. */
|
||||
|
||||
label:has(> [type='file']), #incoming {
|
||||
label:has(> [type='file']),
|
||||
#incoming {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -297,10 +328,13 @@ label:has(> [type='file']), #incoming {
|
||||
border: 2px dashed var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
text-align: center;
|
||||
transition: border-color var(--transition), background-color var(--transition);
|
||||
transition:
|
||||
border-color var(--transition),
|
||||
background-color var(--transition);
|
||||
}
|
||||
|
||||
label:has(> [type='file']):hover, label[data-dragging] {
|
||||
label:has(> [type='file']):hover,
|
||||
label[data-dragging] {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
@@ -330,7 +364,8 @@ label:has(> [type='file']:focus-visible) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label strong, #incoming strong {
|
||||
label strong,
|
||||
#incoming strong {
|
||||
color: var(--color-text);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user