[web] Domi UI: the web UI on @domi/ui v1.0.4, vendored (CPAL-1.0), with the Built on Domi credit (PR #14, squashed)

@domi/ui v1.0.4 vendored unchanged in packages/domi-ui by domi-design's tools/vendor.mjs and used as workspace:*, so
the Nix build fetches nothing from Gitea (web.nix sources the folder; fetchPnpmDeps hash from the NixOS runner).
Its fonts, roles (data-domi-room="ianitor", the same hex) and controls replace Ianitor's copies: Button through
Ianitor's adapter (desktop sizes kept), every text field a TextField with its seal, Checkbox, Select, Segmented.
Ianitor's 22 role names renamed to --domi-*. <DomiCredit /> on every screen and in About, with the CPAL section 15
note beside the source link; the README names the vendored package. Disabled buttons are natively disabled.
This commit was merged in pull request #14.
This commit is contained in:
2026-11-23 00:52:19 +01:00
parent 0934bb3419
commit c9aa55ec99
83 changed files with 8528 additions and 396 deletions
+6 -6
View File
@@ -69,12 +69,12 @@
<style>
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: center; }
.steps li.pending { color: var(--muted); }
.steps li.running { color: var(--text); }
.steps li.running :global(svg) { color: var(--accent); }
.steps li.done { color: var(--text-2); }
.steps li.pending { color: var(--domi-muted); }
.steps li.running { color: var(--domi-fg); }
.steps li.running :global(svg) { color: var(--domi-accent); }
.steps li.done { color: var(--domi-fg-2); }
.steps li.done :global(svg) { color: var(--kept); }
.steps li.failed :global(svg) { color: var(--down); }
.steps li.skipped { color: var(--muted); }
.hollow { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); margin: 2px; }
.steps li.skipped { color: var(--domi-muted); }
.hollow { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--domi-muted); margin: 2px; }
</style>
+2 -2
View File
@@ -136,7 +136,7 @@
<Progress label="Health watch" max={total} now={total - watchLeft} text="{watchLeft} seconds left" />
{/if}
</div>
{#if active.state === "queued"}<Button onclick={() => cancel(active.id)}>Cancel</Button>{:else}<button type="button" class="domi-btn link" onclick={() => onshowsteps(active.id)}>Show steps</button>{/if}
{#if active.state === "queued"}<Button onclick={() => cancel(active.id)}>Cancel</Button>{:else}<button type="button" class="ia-link" onclick={() => onshowsteps(active.id)}>Show steps</button>{/if}
{:else if last}
<div class="grow">
{#if last.state === "kept"}
@@ -161,5 +161,5 @@
{/if}
<style>
.warn { color: var(--degraded); }
.warn { color: var(--domi-warning); }
</style>
+1 -1
View File
@@ -117,5 +117,5 @@
</Dialog>
<style>
ul { margin: 6px 0 0; padding-left: 1.1rem; color: var(--text-2); }
ul { margin: 6px 0 0; padding-left: 1.1rem; color: var(--domi-fg-2); }
</style>
+2 -2
View File
@@ -116,7 +116,7 @@
{#if h.certificate.state === "pending"}<span class="ia-sub" style="display:block">Waiting for Let's Encrypt to issue the certificate.</span>{/if}
{#if h.certificate.state === "failed"}
<span class="ia-sub" style="display:block;color:var(--down)">Let's Encrypt could not confirm <strong>{h.hostname}</strong>. The name must point to this server, and port 80 must be open from the internet.
<button type="button" class="domi-btn link" onclick={() => onretry(h.hostname)}>Try again</button></span>
<button type="button" class="ia-link" onclick={() => onretry(h.hostname)}>Try again</button></span>
{/if}
</span>
<span role="cell">
@@ -133,7 +133,7 @@
<style>
.phone, .phone-dot { display: none; }
.problem { color: var(--text-2) !important; }
.problem { color: var(--domi-fg-2) !important; }
@media (max-width: 719.98px) {
.desktop { display: none !important; }
.phone { display: block; padding-left: 22px; }
+71 -58
View File
@@ -5,6 +5,7 @@
// Handoff §6 and §7: the add/edit panel, its validation on blur, Apply, and the progress and
// outcome of the apply it starts. Every decision comes from control; the form only carries it.
import { onDestroy, onMount } from "svelte";
import { Checkbox, Select, TextField } from "@domi/ui";
import { Banner, Button, Details, Dialog, Icon, Segmented } from "@ianitor/ui";
import ApplyProgress from "./ApplyProgress.svelte";
import { ApiError, call, del, get, newKey, sentence } from "../lib/api";
@@ -60,6 +61,24 @@
let idem = newKey();
let lastBody = "";
// Every text field carries its seal (domi-design TextField): `next` moves to the next field, and the last text
// field of the form applies it, as the Apply button does. The last one depends on what is shown.
const lastField = $derived.by(() => {
const keys = ["hostname", ...host.upstreams.map((_, i) => `upstreams[${i}]`)];
if (more) {
if (host.hc) keys.push("health_check.path");
for (const [list, rules, secrets] of [["request_headers", host.req, true], ["response_headers", host.resp, false]] as const) {
rules.forEach((r, i) => {
keys.push(`${list}[${i}].name`);
if (r.action === "set" && !(secrets && r.kind === "secret")) keys.push(`${list}[${i}].value`);
});
}
}
return keys.at(-1);
});
const seal = (key: string) =>
key === lastField ? { action: "save" as const, actionLabel: "Apply this host" } : { action: "next" as const, actionLabel: undefined };
// ---- the apply
let apply = $state<ApplyView | null>(null);
let restoring = $state(false);
@@ -392,43 +411,36 @@
{#if topError.body.detail}<Details detail={topError.body.detail} reference={topError.requestId} />{/if}
{/if}
<div class="domi-field">
<label class="domi-field-label" for={fieldId("hostname")}>Hostname</label>
<input id={fieldId("hostname")} class="domi-input" bind:value={host.hostname} readonly={!!hostname}
autocapitalize="none" spellcheck="false" inputmode="url" autocomplete="off"
aria-invalid={errAt("hostname") && touched["hostname"] ? "true" : undefined}
aria-describedby="{fieldId('hostname')}-e {fieldId('hostname')}-h" onblur={() => blur("hostname")} />
{#if errAt("hostname") && touched["hostname"]}
<p class="domi-error" id="{fieldId('hostname')}-e"><Icon name="ring" />{errAt("hostname").message}
{#if errAt("hostname").params?.suggestion}
<button type="button" class="domi-btn link" onclick={() => { host.hostname = errAt("hostname").params.suggestion; blur("hostname"); }}>Use {errAt("hostname").params.suggestion}</button>
{/if}
</p>
<div class="ia-field" onfocusout={() => blur("hostname")}>
<TextField id={fieldId("hostname")} label="Hostname" bind:value={host.hostname} readonly={!!hostname}
spellcheck={false} inputmode="url" autocomplete="off" {...seal("hostname")}
error={errAt("hostname") && touched["hostname"] ? errAt("hostname").message : undefined}
hint={hostname ? "To use another address, add a new host and remove this one." : undefined} />
{#if errAt("hostname") && touched["hostname"] && errAt("hostname").params?.suggestion}
<div><button type="button" class="ia-link" onclick={() => { host.hostname = errAt("hostname").params.suggestion; blur("hostname"); }}>Use {errAt("hostname").params.suggestion}</button></div>
{/if}
{#if hostname}<p class="ia-hint" id="{fieldId('hostname')}-h">To use another address, add a new host and remove this one.</p>{/if}
</div>
{#each host.upstreams as _, i (i)}
{@const f = `upstreams[${i}]`}
{@const err = errAt(f) ?? (i === 0 ? errAt("upstreams") : undefined)}
<div class="domi-field">
{#if i === 0}<label class="domi-field-label" for={fieldId(f)}>Send traffic to</label>{/if}
{@const shown = err && (touched[f] || touched["upstreams"])}
<div class="ia-field" onfocusout={() => blur(f)}>
<div class="row">
<input id={fieldId(f)} class="domi-input" bind:value={host.upstreams[i]} autocapitalize="none" spellcheck="false" inputmode="url" autocomplete="off"
aria-label={i === 0 ? undefined : `Also send traffic to, address ${i + 1}`}
aria-invalid={err && (touched[f] || touched["upstreams"]) ? "true" : undefined}
aria-describedby="{fieldId(f)}-e" onblur={() => blur(f)} />
<div class="grow">
<TextField id={fieldId(f)} label={i === 0 ? "Send traffic to" : `Also send traffic to, address ${i + 1}`} hideLabel={i > 0}
bind:value={host.upstreams[i]} spellcheck={false} inputmode="url" autocomplete="off" {...seal(f)}
error={shown ? err.message : undefined}
hint={i === 0 && host.upstreams.length === 1 ? "Add another address later for a second server." : undefined} />
</div>
{#if i > 0}<button type="button" class="ia-icon-btn" aria-label="Remove this address" onclick={() => host.upstreams.splice(i, 1)}><Icon name="trash" /></button>{/if}
</div>
{#if err && (touched[f] || touched["upstreams"])}
<p class="domi-error" id="{fieldId(f)}-e"><Icon name="ring" />{err.message}
{#if err.params?.suggestion}<button type="button" class="domi-btn link" onclick={() => { host.upstreams[i] = err.params.suggestion; blur(f); }}>Use {err.params.suggestion}</button>{/if}
</p>
{#if shown && err.params?.suggestion}
<div><button type="button" class="ia-link" onclick={() => { host.upstreams[i] = err.params.suggestion; blur(f); }}>Use {err.params.suggestion}</button></div>
{/if}
{#if i === 0 && host.upstreams.length === 1}<p class="ia-hint">Add another address later for a second server.</p>{/if}
</div>
{/each}
<div><button type="button" class="domi-btn link" onclick={() => host.upstreams.push("")}>Add another address</button></div>
<div><button type="button" class="ia-link" onclick={() => host.upstreams.push("")}>Add another address</button></div>
<Segmented legend="Certificate" name="tls" bind:value={host.tls}
options={[{ value: "domi", label: "Domi certificate" }, { value: "letsencrypt", label: "Let's Encrypt" }]} />
@@ -437,77 +449,77 @@
<Segmented legend="Who can open it" name="auth" bind:value={host.auth} disabled={signinOk ? [] : ["forward-auth"]}
options={[{ value: "forward-auth", label: "Sign in first" }, { value: "none", label: "Anyone" }]} />
{#if !signinOk}<p class="ia-hint">Sign-in is not set up on this server yet, so choose Anyone for now. To set it up, add the Authelia address to ianitor.toml in the routes repository.</p>{/if}
{#if errAt("auth")}<p class="domi-error"><Icon name="ring" />{errAt("auth").message}</p>{/if}
{#if errAt("auth")}<p class="ia-error"><Icon name="ring" />{errAt("auth").message}</p>{/if}
<div>
<button type="button" class="domi-btn link" aria-expanded={more} aria-controls="more-options" onclick={() => (more = !more)}>
<button type="button" class="ia-link" aria-expanded={more} aria-controls="more-options" onclick={() => (more = !more)}>
More options: headers, websockets, health check, share links, visit log
</button>
</div>
{#if more}
<div id="more-options" class="more">
<div class="domi-field">
<span class="domi-field-label">Health check</span>
<label class="ia-check"><input type="checkbox" bind:checked={host.hc} /> Check that it answers</label>
<div class="ia-field">
<span class="ia-field-label">Health check</span>
<Checkbox bind:checked={host.hc} label="Check that it answers" />
<p class="ia-hint">Ianitor asks this address regularly and shows the result on the main screen.</p>
</div>
{#if host.hc}
<div class="domi-field">
<label class="domi-field-label" for={fieldId("health_check.path")}>Health check address</label>
<input id={fieldId("health_check.path")} class="domi-input" bind:value={host.hcPath} aria-invalid={errAt("health_check.path") ? "true" : undefined} onblur={() => blur("health_check.path")} />
{#if errAt("health_check.path")}<p class="domi-error"><Icon name="ring" />{errAt("health_check.path").message}</p>{/if}
<p class="ia-hint">Use an address that answers without signing in, like /health.</p>
<div class="ia-field" onfocusout={() => blur("health_check.path")}>
<TextField id={fieldId("health_check.path")} label="Health check address" bind:value={host.hcPath} spellcheck={false}
autocomplete="off" {...seal("health_check.path")} error={errAt("health_check.path")?.message}
hint="Use an address that answers without signing in, like /health." />
</div>
<div class="domi-field">
<label class="domi-field-label" for={fieldId("health_check.interval_secs")}>Checks every</label>
<div class="row"><input id={fieldId("health_check.interval_secs")} class="domi-input narrow" type="number" min="1" max="3600" bind:value={host.hcEvery} onblur={() => blur("health_check.interval_secs")} /> <span class="ia-text2">seconds</span></div>
{#if errAt("health_check.interval_secs")}<p class="domi-error"><Icon name="ring" />{errAt("health_check.interval_secs").message}</p>{/if}
<div class="ia-field">
<label class="ia-field-label" for={fieldId("health_check.interval_secs")}>Checks every</label>
<div class="row"><input id={fieldId("health_check.interval_secs")} class="ia-input narrow" type="number" min="1" max="3600" bind:value={host.hcEvery} onblur={() => blur("health_check.interval_secs")} /> <span class="ia-text2">seconds</span></div>
{#if errAt("health_check.interval_secs")}<p class="ia-error"><Icon name="ring" />{errAt("health_check.interval_secs").message}</p>{/if}
</div>
{/if}
<div class="domi-field">
<span class="domi-field-label">Websockets</span>
<label class="ia-check"><input type="checkbox" bind:checked={host.websockets} /> Allow websockets</label>
<div class="ia-field">
<span class="ia-field-label">Websockets</span>
<Checkbox bind:checked={host.websockets} label="Allow websockets" />
<p class="ia-hint">Live updates for apps like Home Assistant. Leave on unless you know the app does not need them.</p>
</div>
<div class="domi-field">
<span class="domi-field-label">Share links</span>
<label class="ia-check"><input type="checkbox" bind:checked={host.share_links} /> Allow share links</label>
<div class="ia-field">
<span class="ia-field-label">Share links</span>
<Checkbox bind:checked={host.share_links} label="Allow share links" />
<p class="ia-hint">Lets you make links that open this host without signing in, until they expire.</p>
{#if shareWarning}<p class="ia-hint">Anyone can already open {name}, so a share link changes nothing.</p>{/if}
</div>
<div class="domi-field">
<span class="domi-field-label">Device certificates</span>
<label class="ia-check"><input type="checkbox" bind:checked={host.device_certs} /> Only devices with a Domi device certificate</label>
<div class="ia-field">
<span class="ia-field-label">Device certificates</span>
<Checkbox bind:checked={host.device_certs} label="Only devices with a Domi device certificate" />
<p class="ia-hint">Phones, computers and apps need a certificate from Certificates before they can open it.</p>
</div>
<Segmented legend="Visit log" name="access_log" bind:value={host.access_log} options={[{ value: "off", label: "Off" }, { value: "truncated", label: "On" }]} />
<p class="ia-hint">On keeps a log on this server, with visitor addresses shortened.</p>
{#each [{ list: "request_headers", rules: host.req, title: "Header rules sent to your service", secrets: true }, { list: "response_headers", rules: host.resp, title: "Header rules sent back to visitors", secrets: false }] as group (group.list)}
<div class="domi-field">
<span class="domi-field-label">{group.title}</span>
<div class="ia-field">
<span class="ia-field-label">{group.title}</span>
{#each group.rules as r, i (i)}
{@const p = `${group.list}[${i}]`}
<div class="rule ia-card">
<Segmented legend="Rule {i + 1}" name="{p}-action" bind:value={r.action} options={[{ value: "set", label: "Set" }, { value: "remove", label: "Remove" }]} />
<label class="domi-field-label" for={fieldId(p + ".name")}>Header name</label>
<input id={fieldId(p + ".name")} class="domi-input" bind:value={r.name} onblur={() => blur(p + ".name")} />
<div onfocusout={() => blur(p + ".name")}>
<TextField id={fieldId(p + ".name")} label="Header name" bind:value={r.name} spellcheck={false} autocomplete="off" {...seal(p + ".name")} />
</div>
{#if r.action === "set"}
{#if group.secrets}
<Segmented legend="Value" name="{p}-kind" bind:value={r.kind} disabled={(site?.secrets.length ?? 0) === 0 ? ["secret"] : []} options={[{ value: "value", label: "Fixed value" }, { value: "secret", label: "Secret" }]} />
{/if}
{#if r.kind === "secret" && group.secrets}
<select class="domi-input" bind:value={r.secret} aria-label="Secret">
{#each site?.secrets ?? [] as s (s)}<option value={s}>{s}</option>{/each}
</select>
<Select label="Secret" bind:value={r.secret} options={(site?.secrets ?? []).map((s) => ({ value: s, label: s }))} />
{:else}
<input class="domi-input" bind:value={r.value} aria-label="Value" onblur={() => blur(p + ".value")} />
<div onfocusout={() => blur(p + ".value")}>
<TextField label="Value" hideLabel bind:value={r.value} spellcheck={false} autocomplete="off" {...seal(p + ".value")} />
</div>
{/if}
{/if}
{#each Object.entries(errors).filter(([k]) => k.startsWith(p)) as [, e] (e.code + e.field)}<p class="domi-error"><Icon name="ring" />{e.message}</p>{/each}
{#each Object.entries(errors).filter(([k]) => k.startsWith(p)) as [, e] (e.code + e.field)}<p class="ia-error"><Icon name="ring" />{e.message}</p>{/each}
<button type="button" class="ia-icon-btn" aria-label="Remove this rule" onclick={() => group.rules.splice(i, 1)}><Icon name="trash" /></button>
</div>
{/each}
<div><button type="button" class="domi-btn link" onclick={() => group.rules.push({ action: "set", name: "", kind: "value", value: "", secret: site?.secrets[0] ?? "" })}>Add a rule</button></div>
<div><button type="button" class="ia-link" onclick={() => group.rules.push({ action: "set", name: "", kind: "value", value: "", secret: site?.secrets[0] ?? "" })}>Add a rule</button></div>
{#if group.secrets && (site?.secrets.length ?? 0) === 0}<p class="ia-hint">No secrets are listed in ianitor.toml.</p>{/if}
</div>
{/each}
@@ -531,6 +543,7 @@
<style>
form { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.more { display: flex; flex-direction: column; gap: 16px; }
.rule { display: flex; flex-direction: column; gap: 8px; }
.narrow { max-width: 8rem; }
+21 -16
View File
@@ -7,6 +7,7 @@
// Links off: "Turn on share links" applies the change, then Copy link (4 clicks: open
// question Q1 is not decided, so this is the fallback path the design allows).
import { onDestroy, onMount } from "svelte";
import { DomiError, TextField } from "@domi/ui";
import { Banner, Button, Dialog, Icon, Segmented } from "@ianitor/ui";
import ApplyProgress from "./ApplyProgress.svelte";
import { ApiError, call, del, newKey, patch, sentence } from "../lib/api";
@@ -64,6 +65,12 @@
}
}
// The seals of the two fields (domi-design TextField): a new link with this prefix or password, or the reason not.
async function remint(field: "path_prefix" | "password") {
await mint();
if (fieldErr?.field === field) throw new DomiError(fieldErr.message);
}
async function copy() {
if (!link) return;
try {
@@ -111,7 +118,7 @@
{:else}
<p><strong>Share links are off for {hostname}.</strong></p>
<p class="ia-text2">Turning them on is a change to the host, checked like any other.</p>
{#if problem}<p class="domi-error" role="alert"><Icon name="ring" />{problem}</p>{/if}
{#if problem}<p class="ia-error" role="alert"><Icon name="ring" />{problem}</p>{/if}
<div><Button variant="outline" onclick={turnOn} disabled={!!app.overview?.paused}>Turn on share links</Button></div>
{/if}
{:else}
@@ -130,34 +137,32 @@
<p class="ia-status" data-s="kept" role="status"><Icon name="check" /><span>Copied</span></p>
<p class="ia-hint">Expires on {longDate(link?.expires_at)}. To stop it sooner: Settings, Share links, Stop this link.</p>
{:else}
<Button variant="primary" full icon="copy" onclick={copy} disabled={!link || minting} data-autofocus>Copy link</Button>
<Button variant="primary" full icon="copy" onclick={copy} pending={minting || (!link && !problem && !fieldErr)} disabled={!link && !minting && !!(problem || fieldErr)} data-autofocus>Copy link</Button>
{/if}
{#if refused}<p class="ia-hint" role="alert">Your browser did not allow copying. Press Ctrl+C to copy the selected link.</p>{/if}
{#if copiedBefore && !copied}<p class="ia-hint">The link you copied before is stopped. Copy this one.</p>{/if}
<Segmented legend="Expires after" name="expiry" bind:value={days} onchange={() => mint()}
options={[{ value: "1", label: "1 day" }, { value: "7", label: "7 days" }, { value: "30", label: "30 days" }]} />
<div class="domi-field">
<label class="domi-field-label" for="share-prefix">Only addresses starting with</label>
<input id="share-prefix" class="domi-input" bind:value={prefix} onblur={() => mint()} onkeydown={(e) => { if (e.key === "Enter") { e.preventDefault(); void mint(); } }}
aria-invalid={fieldErr?.field === "path_prefix" ? "true" : undefined} />
{#if fieldErr?.field === "path_prefix"}<p class="domi-error"><Icon name="ring" />{fieldErr.message}</p>{/if}
<p class="ia-hint">/ shares the whole site. Try /share/summer-2026 for one album.</p>
<div class="ia-field" onfocusout={(e) => { if (!e.currentTarget.contains(e.relatedTarget as Node | null)) void mint(); }}>
<TextField id="share-prefix" label="Only addresses starting with" bind:value={prefix} spellcheck={false} autocomplete="off"
action="save" actionLabel="Make the link for these addresses" onsend={() => remint("path_prefix")}
error={fieldErr?.field === "path_prefix" ? fieldErr.message : undefined}
hint="/ shares the whole site. Try /share/summer-2026 for one album." />
</div>
{#if usingPassword}
<p class="ia-hint">This link asks for the password.</p>
<div><button type="button" class="domi-btn link" onclick={() => { usingPassword = false; password = ""; void mint(); }}>Remove the password</button></div>
<div><button type="button" class="ia-link" onclick={() => { usingPassword = false; password = ""; void mint(); }}>Remove the password</button></div>
{:else if showPassword}
<div class="domi-field">
<label class="domi-field-label" for="share-password">Password</label>
<input id="share-password" class="domi-input" type="password" autocomplete="new-password" bind:value={password}
aria-invalid={fieldErr?.field === "password" ? "true" : undefined} />
{#if fieldErr?.field === "password"}<p class="domi-error"><Icon name="ring" />{fieldErr.message}</p>{/if}
<p class="ia-hint">At least 8 characters. Send it to them separately.</p>
<div class="ia-field">
<TextField id="share-password" label="Password" type="password" autocomplete="new-password" bind:value={password}
action="save" actionLabel="Ask for this password on the link" onsend={() => { usingPassword = true; return remint("password"); }}
error={fieldErr?.field === "password" ? fieldErr.message : undefined}
hint="At least 8 characters. Send it to them separately." />
<div><Button onclick={() => { usingPassword = true; void mint(); }}>Use this password</Button></div>
</div>
{:else}
<div><button type="button" class="domi-btn link" onclick={() => (showPassword = true)}>Add a password</button></div>
<div><button type="button" class="ia-link" onclick={() => (showPassword = true)}>Add a password</button></div>
{/if}
{/if}
</Dialog>