Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af545597c3 | |||
| d0c1ac2548 | |||
| be7a805ef2 | |||
| 85a61e531d | |||
| 54e186f332 | |||
| 3bf4a4f4d2 | |||
| 5ea0bc1581 | |||
| d6d1f8d36d | |||
| 97e5db3c08 | |||
| 525596a56c | |||
| 43230be026 | |||
| c9aa55ec99 |
@@ -13,6 +13,11 @@ runner: nixos
|
|||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: "never"
|
CARGO_TERM_COLOR: "never"
|
||||||
CARGO_BUILD_JOBS: "8"
|
CARGO_BUILD_JOBS: "8"
|
||||||
|
# Each of control's integration tests starts its own edge, Caddy and upstreams, and the tests give edge a 2 s
|
||||||
|
# margin to hear control's confirmation (production: 30 s). Run all at once on the shared runner, a status call
|
||||||
|
# can take longer than that and edge reverts the trial by itself, as designed (runs rc344zj96yjz1 and
|
||||||
|
# rqzephjsp7983, 2026-12-02). Four at a time keeps the runner within the margin.
|
||||||
|
RUST_TEST_THREADS: "4"
|
||||||
steps:
|
steps:
|
||||||
- id: workspace-tests
|
- id: workspace-tests
|
||||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"commit": "d0c1ac2548224aa9c7b4d3a5586a0bc6f74beb78",
|
||||||
|
"nixpkgs": "c56a87d8e41ce69bd2af57eb35dcc117a9dfca33",
|
||||||
|
"outputs": {
|
||||||
|
"ianitor": {
|
||||||
|
"narHash": "sha256-hlX5oiJQPTieETbjojaZnPUGcSgPrKqO2vPsr2o2Xok=",
|
||||||
|
"narSize": 24455232,
|
||||||
|
"storePath": "/nix/store/p1fjjxz514ccaqyvzag43mpagj0akiqk-ianitor-1.0.0"
|
||||||
|
},
|
||||||
|
"ianitor-web": {
|
||||||
|
"narHash": "sha256-cR8Lq5LNQoQ7xWa40jpjmRybUC8tS9XuXAtojDmCg2c=",
|
||||||
|
"narSize": 598000,
|
||||||
|
"storePath": "/nix/store/vsrm3326zm440gwp17nqg3g3bixb3cmm-ianitor-web-1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceTree": "bf05c78a942bb6915c588760eef97a97ddf4efc0644c73f6ea2941bb9fde97f5",
|
||||||
|
"system": "x86_64-linux",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Ianitor 1.0.0 is the first version meant to run beside Caddy on a real server.
|
||||||
|
|
||||||
|
- **Hardened edge.** A 60-second deadline for request headers (slow clients cannot hold a connection open), DNS
|
||||||
|
lookups on their own bounded threads, pipelined requests on both listeners, and a Unix socket for running beside
|
||||||
|
Caddy, on which edge trusts only Caddy's forwarded address.
|
||||||
|
- **The control plane on its own socket.** The web UI reaches control through a socket that only edge can use; the
|
||||||
|
sign-in proof is honoured only there.
|
||||||
|
- **Five test layers.** The same requests against Ianitor and Caddy with the answers compared, h2spec and testssl.sh,
|
||||||
|
fuzzing of the config, header rules and share tokens, NixOS VM tests, and load and soak runs against Caddy, with
|
||||||
|
the results kept as data, including where Caddy is faster (plain HTTP/1.1 under heavy load, new TLS connections).
|
||||||
|
- **A verifiable build.** The release publishes the Nix build's hashes. Anyone can rebuild the tag and compare.
|
||||||
|
- **The shared Domi design system.** The web UI's buttons, text fields, checkboxes and choices come from @domi/ui;
|
||||||
|
Settings, About shows the running version.
|
||||||
|
- **A new licence.** From this version Ianitor is under CPAL-1.0 and shows the Built on Domi credit. 0.2.0 and
|
||||||
|
earlier stay MPL-2.0.
|
||||||
|
|
||||||
|
Updates stay a deploy. Fabrica's Deploy moves the server to the new commit and switches back if the health check
|
||||||
|
does not answer.
|
||||||
Generated
+8
-8
@@ -861,8 +861,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "domi-pki"
|
name = "domi-pki"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "git+https://gitea.marek-novak.cz/mnovak/domi-pki?tag=v1.0.0#b1ec5b3196fc22355270f381e5a7748c50e3380d"
|
source = "git+https://gitea.marek-novak.cz/mnovak/domi-pki?tag=v1.0.1#801dfbdc75cff8ea545422b9ada2fa4a3b6693f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"rcgen",
|
"rcgen",
|
||||||
@@ -1304,7 +1304,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-control"
|
name = "ianitor-control"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -1331,7 +1331,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-core"
|
name = "ianitor-core"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"domi-pki",
|
"domi-pki",
|
||||||
@@ -1348,7 +1348,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-diff"
|
name = "ianitor-diff"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
@@ -1366,7 +1366,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-edge"
|
name = "ianitor-edge"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -1394,7 +1394,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-fuzz"
|
name = "ianitor-fuzz"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ianitor-core",
|
"ianitor-core",
|
||||||
"ianitor-edge",
|
"ianitor-edge",
|
||||||
@@ -1403,7 +1403,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ianitor-testkit"
|
name = "ianitor-testkit"
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ members = [
|
|||||||
exclude = ["tests/fuzz/fuzz"]
|
exclude = ["tests/fuzz/fuzz"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.2.0"
|
version = "1.0.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.89"
|
rust-version = "1.89"
|
||||||
license = "CPAL-1.0"
|
license = "CPAL-1.0"
|
||||||
@@ -23,7 +23,7 @@ ianitor-core = { path = "crates/core" }
|
|||||||
ianitor-edge = { path = "crates/edge" }
|
ianitor-edge = { path = "crates/edge" }
|
||||||
ianitor-testkit = { path = "tests/support" }
|
ianitor-testkit = { path = "tests/support" }
|
||||||
# The Domi CA, shared with Fabrica (docs/32_coherence.md T3a); pinned by tag.
|
# The Domi CA, shared with Fabrica (docs/32_coherence.md T3a); pinned by tag.
|
||||||
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.0" }
|
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.1" }
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
serde_json = "1.0.145"
|
serde_json = "1.0.145"
|
||||||
toml = "1.2.1"
|
toml = "1.2.1"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.2.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "CPAL-1.0",
|
"license": "CPAL-1.0",
|
||||||
"description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.",
|
"description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.",
|
||||||
|
|||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: CPAL-1.0
|
||||||
|
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
|
||||||
|
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
|
||||||
|
|
||||||
|
/** Ianitor's version, from apps/web/package.json at build time (vite.config.ts `define`). */
|
||||||
|
declare const __IANITOR_VERSION__: string;
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
import type { CreatedToken, ShareLink, TokenRow } from "../lib/types";
|
import type { CreatedToken, ShareLink, TokenRow } from "../lib/types";
|
||||||
|
|
||||||
let { tab }: { tab: string } = $props();
|
let { tab }: { tab: string } = $props();
|
||||||
|
const version = __IANITOR_VERSION__;
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ id: "general", label: "General" },
|
{ id: "general", label: "General" },
|
||||||
{ id: "api", label: "API" },
|
{ id: "api", label: "API" },
|
||||||
@@ -241,7 +242,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<p>Ianitor Domi 0.1.0</p>
|
<p>Ianitor Domi {version}</p>
|
||||||
<p>CPAL-1.0 (Common Public Attribution License 1.0). Ianitor 0.2.0 and earlier stay MPL-2.0.</p>
|
<p>CPAL-1.0 (Common Public Attribution License 1.0). Ianitor 0.2.0 and earlier stay MPL-2.0.</p>
|
||||||
<div class="about-credit"><DomiCredit /></div>
|
<div class="about-credit"><DomiCredit /></div>
|
||||||
<p>Built, tested and signed by Fabrica Domi</p>
|
<p>Built, tested and signed by Fabrica Domi</p>
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"allowJs": true,
|
|
||||||
"checkJs": false,
|
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
|
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
|
||||||
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
|
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
|
||||||
|
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
@@ -11,9 +12,12 @@ import { defineConfig } from "vitest/config";
|
|||||||
// $IANITOR_DEV_TOKEN, which `ianitor-control --dev` prints.
|
// $IANITOR_DEV_TOKEN, which `ianitor-control --dev` prints.
|
||||||
const control = process.env.IANITOR_CONTROL ?? "http://127.0.0.1:7878";
|
const control = process.env.IANITOR_CONTROL ?? "http://127.0.0.1:7878";
|
||||||
const token = process.env.IANITOR_DEV_TOKEN;
|
const token = process.env.IANITOR_DEV_TOKEN;
|
||||||
|
// The version Settings, About shows: package.json's, which scripts/check-version.mjs keeps equal to Cargo.toml's.
|
||||||
|
const version: string = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [svelte()],
|
plugins: [svelte()],
|
||||||
|
define: { __IANITOR_VERSION__: JSON.stringify(version) },
|
||||||
server: {
|
server: {
|
||||||
host: "127.0.0.1",
|
host: "127.0.0.1",
|
||||||
port: 5173,
|
port: 5173,
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ rustPlatform.buildRustPackage {
|
|||||||
|
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = ../../Cargo.lock;
|
lockFile = ../../Cargo.lock;
|
||||||
# domi-pki, the shared Domi CA (Cargo.toml pins tag v1.0.0): the NAR hash of its tree at that tag.
|
# domi-pki, the shared Domi CA (Cargo.toml pins tag v1.0.1, CPAL-1.0): the NAR hash of its tree at that tag.
|
||||||
outputHashes."domi-pki-1.0.0" = "sha256-JdknFJ5cxsI1/MtWmvsItoE6f7znJjUr4C/rwUEz9i4=";
|
outputHashes."domi-pki-1.0.1" = "sha256-C3l3Iqo1pFn/k977Y6TMGdh4aRDU76+W4/kyxv+1mXw=";
|
||||||
};
|
};
|
||||||
# libz-ng-sys (Pingora's compression) builds zlib-ng with CMake.
|
# libz-ng-sys (Pingora's compression) builds zlib-ng with CMake.
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|||||||
+2
-3
@@ -182,12 +182,11 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit
|
|||||||
- **Deployed:** nothing. **Not verified:** the phone layout of the credit by eye; the Nix build (`cpal10`).
|
- **Deployed:** nothing. **Not verified:** the phone layout of the credit by eye; the Nix build (`cpal10`).
|
||||||
|
|
||||||
**2026-11-23: the web UI on @domi/ui, the shared Domi design system (docs/domi-ui.md); PR 14, squash-merged.**
|
**2026-11-23: the web UI on @domi/ui, the shared Domi design system (docs/domi-ui.md); PR 14, squash-merged.**
|
||||||
- **Changed:** `@domi/ui` v1.0.3 vendored in packages/domi-ui (domi-design tools/vendor.mjs; CPAL-1.0, unedited) and used as `workspace:*`; `<DomiCredit />` is the credit on every screen; its fonts, roles (`data-domi-room="ianitor"`,
|
- **Changed:** `@domi/ui` v1.0.4 (then v1.1.0) vendored in packages/domi-ui (domi-design tools/vendor.mjs; CPAL-1.0, unedited) and used as `workspace:*`; `<DomiCredit />` is the credit on every screen; its fonts, roles (`data-domi-room="ianitor"`,
|
||||||
the same hex) and controls replace Ianitor's copies. Buttons are its Button through Ianitor's adapter (desktop sizes
|
the same hex) and controls replace Ianitor's copies. Buttons are its Button through Ianitor's adapter (desktop sizes
|
||||||
kept); every text field is its TextField with a seal; checkboxes, the secret picker and segmented controls are its
|
kept); every text field is its TextField with a seal; checkboxes, the secret picker and segmented controls are its
|
||||||
components. Ianitor's 22 role names are renamed to `--domi-*`; its own tokens and components stay in packages/ui.
|
components. Ianitor's 22 role names are renamed to `--domi-*`; its own tokens and components stay in packages/ui.
|
||||||
Disabled buttons are natively disabled now (their reasons are visible text). apps/web's tsconfig sets `allowJs`
|
Disabled buttons are natively disabled now (their reasons are visible text).
|
||||||
for @domi/ui's script-less Strike.svelte.
|
|
||||||
- **Tests:** vitest 23; svelte-check clean; Playwright web 6/6 (the Apply lookup is exact now), aula 5/5; 13 screens
|
- **Tests:** vitest 23; svelte-check clean; Playwright web 6/6 (the Apply lookup is exact now), aula 5/5; 13 screens
|
||||||
compared before and after (in the PR). No Rust change.
|
compared before and after (in the PR). No Rust change.
|
||||||
- **Deployed:** nothing.
|
- **Deployed:** nothing.
|
||||||
|
|||||||
+8
-9
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The web UI's controls and roles come from **@domi/ui**, the shared Domi design system (Gitea `mnovak/domi-design`,
|
The web UI's controls and roles come from **@domi/ui**, the shared Domi design system (Gitea `mnovak/domi-design`,
|
||||||
its `docs/INTEGRATE.md` §6a and `docs/MIGRATION.md`). It is **vendored** at a tag in `packages/domi-ui` (CPAL-1.0,
|
its `docs/INTEGRATE.md` §6a and `docs/MIGRATION.md`). It is **vendored** at a tag in `packages/domi-ui` (CPAL-1.0,
|
||||||
like Ianitor; `VERSION` names the tag, v1.0.3; `LICENSE`, `NOTICE` and `VERSION` there stay unchanged) and used as a
|
like Ianitor; `VERSION` names the tag, v1.1.0; `LICENSE`, `NOTICE` and `VERSION` there stay unchanged) and used as a
|
||||||
workspace package by `apps/web` and `packages/ui`:
|
workspace package by `apps/web` and `packages/ui`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -66,12 +66,6 @@ share dialog still opens with the focus on it.
|
|||||||
|
|
||||||
The host form still checks a field when the focus leaves it, now when it leaves the field and its seal.
|
The host form still checks a field when the focus leaves it, now when it leaves the field and its seal.
|
||||||
|
|
||||||
## Type checking
|
|
||||||
|
|
||||||
@domi/ui's `Strike.svelte` has no `<script lang="ts">`, so TypeScript reads it as JavaScript. `apps/web/tsconfig.json`
|
|
||||||
sets `allowJs` (with `checkJs` off), as domi-design's own tsconfig does; without it a strict svelte-check refuses the
|
|
||||||
import (implicit any).
|
|
||||||
|
|
||||||
## The credit
|
## The credit
|
||||||
|
|
||||||
@domi/ui and Ianitor are both CPAL-1.0 with the same Exhibit B, so one credit covers both: `<DomiCredit />` renders
|
@domi/ui and Ianitor are both CPAL-1.0 with the same Exhibit B, so one credit covers both: `<DomiCredit />` renders
|
||||||
@@ -81,12 +75,17 @@ plain data for the e2e real-data check, and a unit test keeps them equal to @dom
|
|||||||
contains @domi/ui in `packages/domi-ui` (INTEGRATE.md §6a).
|
contains @domi/ui in `packages/domi-ui` (INTEGRATE.md §6a).
|
||||||
|
|
||||||
History: the first pins were v1.0.0 and v1.0.1 (a git dependency), then v1.0.2 was vendored (MPL-2.0). That copy
|
History: the first pins were v1.0.0 and v1.0.1 (a git dependency), then v1.0.2 was vendored (MPL-2.0). That copy
|
||||||
stays in this PR's branch history by Mark's choice; the PR is squash-merged, so main only ever holds v1.0.3.
|
stays in this PR's branch history by Mark's choice; PR 14 was squash-merged with v1.0.4 (c9aa55e), so main never held it. v1.1.0 followed (2026-11-23).
|
||||||
|
|
||||||
|
v1.1.0 adds TextField `as="editable" | "auto"`, a contenteditable field, because an Android **WebView** sends an
|
||||||
|
Autofill request to Google whenever a native text field gets focus. Ianitor keeps the default native fields
|
||||||
|
(`as="input"`): it runs in a browser, not a WebView, and native fields keep the browser's own password and form
|
||||||
|
handling.
|
||||||
|
|
||||||
## Risks
|
## Risks
|
||||||
|
|
||||||
- **The Nix hash** in `deploy/nixos/web.nix` is the one Fabrica's NixOS runner reported for this lockfile (run
|
- **The Nix hash** in `deploy/nixos/web.nix` is the one Fabrica's NixOS runner reported for this lockfile (run
|
||||||
`rp8rw56wvg5k2`, 2026-11-23); v1.0.3 left the lockfile byte-identical. A verify-nix run on the branch confirms it.
|
`rp8rw56wvg5k2`, 2026-11-23); v1.0.3, v1.0.4 and v1.1.0 left the lockfile byte-identical. A verify-nix run on the branch confirms it.
|
||||||
- A visual change Mark has not seen beyond the asked-for controls: the field labels are @domi/ui's (13 px, 600),
|
- A visual change Mark has not seen beyond the asked-for controls: the field labels are @domi/ui's (13 px, 600),
|
||||||
and Ianitor's group labels (Certificate, Visit log, What is it) follow them so a form reads as one; the
|
and Ianitor's group labels (Certificate, Visit log, What is it) follow them so a form reads as one; the
|
||||||
segmented controls are as wide as their choices, not the panel.
|
segmented controls are as wide as their choices, not the panel.
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ discovery (ROADMAP §1.9). When it is time:
|
|||||||
X.Y.Z` must pass. Write `.fabrica/notes/X.Y.Z.md`. Commit.
|
X.Y.Z` must pass. Write `.fabrica/notes/X.Y.Z.md`. Commit.
|
||||||
1a. Pin: run `scripts/nix-pin.sh` on Linux with Nix at that clean commit and commit `.fabrica/nix/pin.json`
|
1a. Pin: run `scripts/nix-pin.sh` on Linux with Nix at that clean commit and commit `.fabrica/nix/pin.json`
|
||||||
([verify.md](verify.md)). The `pin` step refuses a missing pin and one made from other code than the tag's.
|
([verify.md](verify.md)). The `pin` step refuses a missing pin and one made from other code than the tag's.
|
||||||
|
Without Nix here: start `verify-nix` on the hub at that commit (`POST /api/runs`, pipeline `verify-nix`, the
|
||||||
|
branch as ref). Its `pin` step fails for want of a pin and logs the pin it would write as one
|
||||||
|
`pin.json: {…}` line; save that JSON, formatted by `jq -S .`, as `.fabrica/nix/pin.json` and commit only it.
|
||||||
|
Then run `verify-nix` again: `pin` must say `matches .fabrica/nix/pin.json`.
|
||||||
2. Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`.
|
2. Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`.
|
||||||
3. Start the `release` pipeline at `vX.Y.Z` from Fabrica. No Gitea webhook reaches the hub yet, so use the hub's
|
3. Start the `release` pipeline at `vX.Y.Z` from Fabrica. No Gitea webhook reaches the hub yet, so use the hub's
|
||||||
`POST /api/runs` with ref `vX.Y.Z`.
|
`POST /api/runs` with ref `vX.Y.Z`.
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
pkg-config
|
pkg-config
|
||||||
git
|
git
|
||||||
jq
|
jq
|
||||||
|
# control's pki tests sign an intermediate the way Mark does by hand (docs/pki.md)
|
||||||
|
openssl
|
||||||
caddy
|
caddy
|
||||||
pebble
|
pebble
|
||||||
h2spec
|
h2spec
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.1.0 (2026-11-23)
|
||||||
|
|
||||||
|
- **TextField `as="editable" | "auto"`**: the field drawn with a contenteditable `role="textbox"` instead of a native
|
||||||
|
`<input>`/`<textarea>`, because on Android the WebView sends an Autofill request to Google whenever a native text
|
||||||
|
field gets focus (found by Amicitia). Same look, seal, keys and states; plain-text paste; label by
|
||||||
|
`aria-labelledby`; `inputmode` from the type; a hidden input for `name`. `auto` = editable on Android only.
|
||||||
|
Passwords always stay native. New `editor` binding; `input` keeps its type. `isAndroid()` exported.
|
||||||
|
- Docs: the credit goes by repo visibility (Mark): apps whose own repo is public, and public repos carrying a copy,
|
||||||
|
show it; apps built from a private repo show none, paid or free.
|
||||||
|
|
||||||
|
## 1.0.4 (2026-11-23)
|
||||||
|
|
||||||
|
- Fix: `Strike.svelte` had no `<script>` block, so a consumer whose tsconfig has `allowJs` off (Ludus) got "Could not
|
||||||
|
find a declaration file" from svelte-check for it and for Button, TextField and index.ts. It now has
|
||||||
|
`<script lang="ts">`. `pnpm check` also runs svelte-check the way a consumer does (`tsconfig.consumer.json`).
|
||||||
|
- Docs: the credit is for free and public apps and public repos carrying a copy; paid apps show none (Mark).
|
||||||
|
pnpm 9 and the `#` in a git dependency's store folder: `virtual-store-dir-max-length=60` (INTEGRATE.md §1).
|
||||||
|
|
||||||
## 1.0.3 (2026-11-23)
|
## 1.0.3 (2026-11-23)
|
||||||
|
|
||||||
- **Licence: CPAL-1.0** (Common Public Attribution License), Mark's licence for @domi/ui and every public Domi repo.
|
- **Licence: CPAL-1.0** (Common Public Attribution License), Mark's licence for @domi/ui and every public Domi repo.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
This folder is @domi/ui v1.0.3, copied unchanged from domi-design by tools/vendor.mjs.
|
This folder is @domi/ui v1.1.0, copied unchanged from domi-design by tools/vendor.mjs.
|
||||||
Licence: Common Public Attribution License 1.0 (LICENSE). Original Code: @domi/ui. Initial Developer: Marek Novák.
|
Licence: Common Public Attribution License 1.0 (LICENSE). Original Code: @domi/ui. Initial Developer: Marek Novák.
|
||||||
|
|
||||||
Attribution Information (Exhibit B). Any app built with this code shows, prominently in its user interface when
|
Attribution Information (Exhibit B). Any app built with this code shows, prominently in its user interface when
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v1.0.3
|
v1.1.0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@domi/ui",
|
"name": "@domi/ui",
|
||||||
"version": "1.0.3",
|
"version": "1.1.0",
|
||||||
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.0.3: do not edit here; change domi-design and vendor the next tag.",
|
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.1.0: do not edit here; change domi-design and vendor the next tag.",
|
||||||
"license": "CPAL-1.0",
|
"license": "CPAL-1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"svelte": "./src/index.ts",
|
"svelte": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,2 +1,6 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// No props. The script block makes this a typed component for consumers whose tsconfig has allowJs off.
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- The loading mark: three Roman interpuncts struck in turn. Decorative; the state is announced in words. -->
|
<!-- The loading mark: three Roman interpuncts struck in turn. Decorative; the state is announced in words. -->
|
||||||
<span class="domi-strike" aria-hidden="true"><i></i><i></i><i></i></span>
|
<span class="domi-strike" aria-hidden="true"><i></i><i></i><i></i></span>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import { strike } from '../lib/strike';
|
import { strike } from '../lib/strike';
|
||||||
import { canSend, enterAction, failureText, isSoftKeyboard, type FieldState } from '../lib/keys';
|
import { canSend, enterAction, failureText, isSoftKeyboard, type FieldState } from '../lib/keys';
|
||||||
import type { IconName } from '../lib/icons';
|
import type { IconName } from '../lib/icons';
|
||||||
|
import { caretToEnd, inputmodeFor, insertPlainText, isAndroid, readText, writeText } from '../lib/editable';
|
||||||
|
|
||||||
type Action = 'send' | 'search' | 'next' | 'save';
|
type Action = 'send' | 'search' | 'next' | 'save';
|
||||||
|
|
||||||
@@ -55,8 +56,16 @@
|
|||||||
force?: string;
|
force?: string;
|
||||||
sendForce?: string;
|
sendForce?: string;
|
||||||
class?: string;
|
class?: string;
|
||||||
/** The input element, for focusing it from outside. */
|
/** The input element, for focusing it from outside (null in editable mode: see editor). */
|
||||||
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
||||||
|
/**
|
||||||
|
* input (default): a native <input>/<textarea>. editable: a contenteditable box with role="textbox": on Android
|
||||||
|
* the WebView sends an Autofill request to Google whenever a native text field gets focus; an editable box does
|
||||||
|
* not. auto: editable on Android, native elsewhere. Passwords are always native (masking, password managers).
|
||||||
|
*/
|
||||||
|
as?: 'input' | 'editable' | 'auto';
|
||||||
|
/** The editable box in editable mode, for focusing it from outside. */
|
||||||
|
editor?: HTMLElement | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -94,12 +103,16 @@
|
|||||||
sendForce,
|
sendForce,
|
||||||
class: cls = '',
|
class: cls = '',
|
||||||
input = $bindable(null),
|
input = $bindable(null),
|
||||||
|
as = 'input',
|
||||||
|
editor = $bindable(null),
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
const uid = $props.id();
|
const uid = $props.id();
|
||||||
const fieldId = $derived(id ?? `domi-field-${uid}`);
|
const fieldId = $derived(id ?? `domi-field-${uid}`);
|
||||||
const hintId = `domi-hint-${uid}`;
|
const hintId = `domi-hint-${uid}`;
|
||||||
const errorId = `domi-error-${uid}`;
|
const errorId = `domi-error-${uid}`;
|
||||||
|
const labelId = `domi-label-${uid}`;
|
||||||
|
const android = isAndroid();
|
||||||
|
|
||||||
const words: Record<Action, { label: string; icon: IconName; key: 'send' | 'search' | 'next' | 'done'; busy: string; done: string; fail: string }> = {
|
const words: Record<Action, { label: string; icon: IconName; key: 'send' | 'search' | 'next' | 'done'; busy: string; done: string; fail: string }> = {
|
||||||
send: { label: 'Send', icon: 'send', key: 'send', busy: 'Sending', done: 'Sent', fail: 'Could not send. Try again.' },
|
send: { label: 'Send', icon: 'send', key: 'send', busy: 'Sending', done: 'Sent', fail: 'Could not send. Try again.' },
|
||||||
@@ -124,6 +137,10 @@
|
|||||||
const described = $derived([hint && hintId, message && errorId].filter(Boolean).join(' ') || undefined);
|
const described = $derived([hint && hintId, message && errorId].filter(Boolean).join(' ') || undefined);
|
||||||
const inputType = $derived(type === 'password' && revealed ? 'text' : type);
|
const inputType = $derived(type === 'password' && revealed ? 'text' : type);
|
||||||
const clears = $derived(clearOnSend ?? action === 'send');
|
const clears = $derived(clearOnSend ?? action === 'send');
|
||||||
|
const editable = $derived(type !== 'password' && (as === 'editable' || (as === 'auto' && android)));
|
||||||
|
/** The element that takes the text, whichever kind it is. */
|
||||||
|
const box = $derived<HTMLElement | null>(editable ? editor : input);
|
||||||
|
const locked = $derived(disabled || readonly || shown === 'sending');
|
||||||
|
|
||||||
function hold(): number {
|
function hold(): number {
|
||||||
const v = getComputedStyle(document.documentElement).getPropertyValue('--domi-dur-hold');
|
const v = getComputedStyle(document.documentElement).getPropertyValue('--domi-dur-hold');
|
||||||
@@ -133,22 +150,22 @@
|
|||||||
function nextField(from: HTMLElement) {
|
function nextField(from: HTMLElement) {
|
||||||
const scope = from.closest('form') ?? document;
|
const scope = from.closest('form') ?? document;
|
||||||
const all = [...scope.querySelectorAll<HTMLElement>('.domi-field__input, input, textarea, select')].filter(
|
const all = [...scope.querySelectorAll<HTMLElement>('.domi-field__input, input, textarea, select')].filter(
|
||||||
(el) => !el.hasAttribute('disabled') && el.getAttribute('type') !== 'hidden',
|
(el) => !el.hasAttribute('disabled') && el.getAttribute('aria-disabled') !== 'true' && el.getAttribute('type') !== 'hidden',
|
||||||
);
|
);
|
||||||
const i = all.indexOf(from);
|
const i = all.indexOf(from);
|
||||||
all[i + 1]?.focus();
|
all[i + 1]?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (!sendable || !input) return;
|
if (!sendable || !box) return;
|
||||||
const el = input;
|
const el = box;
|
||||||
const text = value;
|
const text = value;
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
failure = '';
|
failure = '';
|
||||||
if (!onsend) {
|
if (!onsend) {
|
||||||
// No handler: behave like the form's own submit (or, for next, move on).
|
// No handler: behave like the form's own submit (or, for next, move on).
|
||||||
if (action === 'next') nextField(el);
|
if (action === 'next') nextField(el);
|
||||||
else el.form?.requestSubmit();
|
else el.closest('form')?.requestSubmit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = onsend(text);
|
const result = onsend(text);
|
||||||
@@ -168,7 +185,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function done(el: HTMLInputElement | HTMLTextAreaElement) {
|
function done(el: HTMLElement) {
|
||||||
if (clears) value = '';
|
if (clears) value = '';
|
||||||
if (action === 'next') {
|
if (action === 'next') {
|
||||||
auto = 'idle';
|
auto = 'idle';
|
||||||
@@ -194,6 +211,9 @@
|
|||||||
} else if (r === 'ignore' && e.key === 'Enter' && e.altKey && !multiline) {
|
} else if (r === 'ignore' && e.key === 'Enter' && e.altKey && !multiline) {
|
||||||
// Alt+Enter must not submit the form. An Enter that ends an input method's composition is left alone.
|
// Alt+Enter must not submit the form. An Enter that ends an input method's composition is left alone.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
} else if (editable && !multiline && e.key === 'Enter' && !e.isComposing && e.keyCode !== 229) {
|
||||||
|
// A single-line editable box never takes a line break.
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,10 +226,55 @@
|
|||||||
grow();
|
grow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Editable mode: the box's text is the value. Typing, paste and drop bring plain text only.
|
||||||
|
function edited() {
|
||||||
|
if (!editor) return;
|
||||||
|
let t = readText(editor);
|
||||||
|
let rewrite = false;
|
||||||
|
if (!multiline && /\n/.test(t)) {
|
||||||
|
t = t.replace(/\r?\n/g, ' ');
|
||||||
|
rewrite = true;
|
||||||
|
}
|
||||||
|
if (maxlength !== undefined && t.length > maxlength) {
|
||||||
|
t = t.slice(0, maxlength);
|
||||||
|
rewrite = true;
|
||||||
|
}
|
||||||
|
if (t === '' && editor.childNodes.length > 0) rewrite = true; // a stray <br> would hide the placeholder
|
||||||
|
if (rewrite) {
|
||||||
|
writeText(editor, t);
|
||||||
|
if (t) caretToEnd(editor);
|
||||||
|
}
|
||||||
|
value = t;
|
||||||
|
typed();
|
||||||
|
}
|
||||||
|
function pasted(e: ClipboardEvent) {
|
||||||
|
if (!editor) return;
|
||||||
|
e.preventDefault();
|
||||||
|
if (locked) return;
|
||||||
|
let t = e.clipboardData?.getData('text/plain') ?? '';
|
||||||
|
if (!multiline) t = t.replace(/\r?\n/g, ' ');
|
||||||
|
insertPlainText(editor, t);
|
||||||
|
edited();
|
||||||
|
}
|
||||||
|
function dropped(e: DragEvent) {
|
||||||
|
if (!editor) return;
|
||||||
|
e.preventDefault();
|
||||||
|
const t = e.dataTransfer?.getData('text/plain') ?? '';
|
||||||
|
if (!t || locked) return;
|
||||||
|
editor.focus();
|
||||||
|
insertPlainText(editor, multiline ? t : t.replace(/\r?\n/g, ' '));
|
||||||
|
edited();
|
||||||
|
}
|
||||||
|
// A value set from outside (bind:value, a field cleared after sending) is written into the box.
|
||||||
|
$effect(() => {
|
||||||
|
const v = value;
|
||||||
|
if (editable && editor && readText(editor) !== v) writeText(editor, v);
|
||||||
|
});
|
||||||
|
|
||||||
// field-sizing: content grows the textarea in Chromium (WebView2, Android WebView); elsewhere, grow it here.
|
// field-sizing: content grows the textarea in Chromium (WebView2, Android WebView); elsewhere, grow it here.
|
||||||
const sizesItself = typeof CSS !== 'undefined' && CSS.supports?.('field-sizing', 'content');
|
const sizesItself = typeof CSS !== 'undefined' && CSS.supports?.('field-sizing', 'content');
|
||||||
function grow() {
|
function grow() {
|
||||||
if (!multiline || sizesItself || !input) return;
|
if (!multiline || sizesItself || !(input instanceof HTMLTextAreaElement)) return;
|
||||||
input.style.height = 'auto';
|
input.style.height = 'auto';
|
||||||
input.style.height = `${input.scrollHeight}px`;
|
input.style.height = `${input.scrollHeight}px`;
|
||||||
}
|
}
|
||||||
@@ -219,11 +284,16 @@
|
|||||||
});
|
});
|
||||||
$effect(() => () => clearTimeout(timer));
|
$effect(() => () => clearTimeout(timer));
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (autofocus) input?.focus();
|
if (autofocus) box?.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function focusBox() {
|
||||||
|
if (!box) return;
|
||||||
|
box.focus();
|
||||||
|
if (editable) caretToEnd(box);
|
||||||
|
}
|
||||||
function focusInput(e: MouseEvent) {
|
function focusInput(e: MouseEvent) {
|
||||||
if (e.target === e.currentTarget) input?.focus();
|
if (e.target === e.currentTarget) focusBox();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -233,12 +303,47 @@
|
|||||||
data-empty={empty ? '' : undefined}
|
data-empty={empty ? '' : undefined}
|
||||||
data-disabled={disabled ? '' : undefined}
|
data-disabled={disabled ? '' : undefined}
|
||||||
>
|
>
|
||||||
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={fieldId}>
|
{#if editable}
|
||||||
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
|
<!-- An editable box is not a labelable element: the label names it through aria-labelledby; a click focuses it. -->
|
||||||
</label>
|
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||||
|
<span class={['domi-field__label', hideLabel && 'domi-sr']} id={labelId} role="presentation" onclick={focusBox}>
|
||||||
|
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
|
||||||
|
</span>
|
||||||
|
{:else}
|
||||||
|
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={fieldId} id={labelId}>
|
||||||
|
{label}{#if optional}<span class="domi-field__optional">{" (optional)"}</span>{/if}
|
||||||
|
</label>
|
||||||
|
{/if}
|
||||||
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||||
<div class="domi-field__well" role="presentation" data-force={force} onclick={focusInput}>
|
<div class="domi-field__well" role="presentation" data-force={force} onclick={focusInput}>
|
||||||
{#if multiline}
|
{#if editable}
|
||||||
|
<div
|
||||||
|
bind:this={editor}
|
||||||
|
class={['domi-field__input', 'domi-field__input--editable', multiline && 'domi-field__input--lines']}
|
||||||
|
id={fieldId}
|
||||||
|
role="textbox"
|
||||||
|
tabindex={disabled ? -1 : 0}
|
||||||
|
contenteditable={locked ? 'false' : 'plaintext-only'}
|
||||||
|
aria-labelledby={labelId}
|
||||||
|
aria-multiline={multiline ? 'true' : 'false'}
|
||||||
|
aria-describedby={described}
|
||||||
|
aria-invalid={message ? 'true' : undefined}
|
||||||
|
aria-required={required ? 'true' : undefined}
|
||||||
|
aria-readonly={readonly || shown === 'sending' ? 'true' : undefined}
|
||||||
|
aria-disabled={disabled ? 'true' : undefined}
|
||||||
|
aria-placeholder={placeholder}
|
||||||
|
data-placeholder={placeholder}
|
||||||
|
inputmode={inputmode ?? inputmodeFor(type)}
|
||||||
|
enterkeyhint={multiline ? (w.key === 'done' ? 'done' : 'enter') : w.key === 'done' ? 'done' : w.key}
|
||||||
|
spellcheck={spellcheck ?? true}
|
||||||
|
style:--_rows-max={rows}
|
||||||
|
onkeydown={keydown}
|
||||||
|
oninput={edited}
|
||||||
|
onpaste={pasted}
|
||||||
|
ondrop={dropped}
|
||||||
|
></div>
|
||||||
|
{#if name}<input type="hidden" {name} {value} />{/if}
|
||||||
|
{:else if multiline}
|
||||||
<textarea
|
<textarea
|
||||||
bind:this={input}
|
bind:this={input}
|
||||||
bind:value
|
bind:value
|
||||||
|
|||||||
@@ -512,6 +512,43 @@ textarea.domi-field__input {
|
|||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Editable mode (as="editable"): a contenteditable box in place of <input>/<textarea>, so an Android WebView sends no
|
||||||
|
* Autofill request. One line: centred, no wrap, scrolls sideways. Several lines: grows to --_rows-max, then scrolls.
|
||||||
|
*/
|
||||||
|
.domi-field__input--editable {
|
||||||
|
align-self: center;
|
||||||
|
min-height: var(--domi-leading-md);
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
white-space: pre;
|
||||||
|
cursor: text;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
.domi-field__input--editable::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.domi-field__input--lines {
|
||||||
|
align-self: stretch;
|
||||||
|
padding-top: 8px;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
min-height: calc(var(--domi-leading-md) + 16px);
|
||||||
|
max-height: calc(var(--domi-leading-md) * var(--_rows-max, 8) + 16px);
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
}
|
||||||
|
.domi-field__input--editable:empty::before {
|
||||||
|
content: attr(data-placeholder);
|
||||||
|
color: var(--domi-muted);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.domi-field__input--editable[contenteditable='false'] {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
/* The seal: the send button set into the right end of the field. */
|
/* The seal: the send button set into the right end of the field. */
|
||||||
.domi-send {
|
.domi-send {
|
||||||
--_s: max(var(--domi-size-send-md), var(--domi-send-target));
|
--_s: max(var(--domi-size-send-md), var(--domi-send-target));
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export { default as Icon } from './components/Icon.svelte';
|
|||||||
export { default as Strike } from './components/Strike.svelte';
|
export { default as Strike } from './components/Strike.svelte';
|
||||||
export { default as DomiCredit } from './components/DomiCredit.svelte';
|
export { default as DomiCredit } from './components/DomiCredit.svelte';
|
||||||
export { DOMI_ATTRIBUTION, DOMI_ATTRIBUTION_TEXT } from './lib/credit';
|
export { DOMI_ATTRIBUTION, DOMI_ATTRIBUTION_TEXT } from './lib/credit';
|
||||||
|
export { isAndroid } from './lib/editable';
|
||||||
|
|
||||||
export { strike } from './lib/strike';
|
export { strike } from './lib/strike';
|
||||||
export { icons, type IconName } from './lib/icons';
|
export { icons, type IconName } from './lib/icons';
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
// SPDX-License-Identifier: CPAL-1.0
|
||||||
|
/**
|
||||||
|
* Helpers for TextField's editable mode: a contenteditable box with role="textbox" in place of <input>/<textarea>.
|
||||||
|
* Why: on Android the WebView asks Google's Autofill service (a network request) as soon as a text <input> or
|
||||||
|
* <textarea> gets focus, and no attribute stops it (found by Amicitia). A contenteditable box is not an autofill
|
||||||
|
* target. Plain text only: paste and drop never bring markup.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** True in an Android WebView or browser, where editable mode avoids the Autofill request. Safe during SSR. */
|
||||||
|
export function isAndroid(): boolean {
|
||||||
|
return typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The box's text, with line breaks as \n. An emptied box that only holds a stray line break reads as ''. */
|
||||||
|
export function readText(el: HTMLElement): string {
|
||||||
|
const raw = typeof el.innerText === 'string' ? el.innerText : (el.textContent ?? '');
|
||||||
|
return raw === '\n' ? '' : raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Replaces the box's content with plain text (no markup can enter). */
|
||||||
|
export function writeText(el: HTMLElement, text: string): void {
|
||||||
|
el.textContent = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Puts the caret after the last character. */
|
||||||
|
export function caretToEnd(el: HTMLElement): void {
|
||||||
|
const sel = typeof getSelection === 'function' ? getSelection() : null;
|
||||||
|
if (!sel || typeof document.createRange !== 'function') return;
|
||||||
|
const range = document.createRange();
|
||||||
|
range.selectNodeContents(el);
|
||||||
|
range.collapse(false);
|
||||||
|
sel.removeAllRanges();
|
||||||
|
sel.addRange(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts plain text at the caret. Uses the browser's own insertion where it exists, so undo keeps working;
|
||||||
|
* otherwise inserts a text node at the selection.
|
||||||
|
*/
|
||||||
|
export function insertPlainText(el: HTMLElement, text: string): void {
|
||||||
|
try {
|
||||||
|
if (typeof document.execCommand === 'function' && document.execCommand('insertText', false, text)) return;
|
||||||
|
} catch {
|
||||||
|
// Fall through to the Range insertion.
|
||||||
|
}
|
||||||
|
const sel = typeof getSelection === 'function' ? getSelection() : null;
|
||||||
|
const node = document.createTextNode(text);
|
||||||
|
if (!sel || sel.rangeCount === 0 || !el.contains(sel.getRangeAt(0).commonAncestorContainer)) {
|
||||||
|
el.append(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const range = sel.getRangeAt(0);
|
||||||
|
range.deleteContents();
|
||||||
|
range.insertNode(node);
|
||||||
|
range.setStartAfter(node);
|
||||||
|
range.collapse(true);
|
||||||
|
sel.removeAllRanges();
|
||||||
|
sel.addRange(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The soft keyboard a type asks for, as inputmode (an editable box has no type attribute). */
|
||||||
|
export function inputmodeFor(type: string): 'text' | 'email' | 'url' | 'tel' | 'decimal' | 'search' {
|
||||||
|
const map: Record<string, 'email' | 'url' | 'tel' | 'decimal' | 'search'> = {
|
||||||
|
email: 'email',
|
||||||
|
url: 'url',
|
||||||
|
tel: 'tel',
|
||||||
|
number: 'decimal',
|
||||||
|
search: 'search',
|
||||||
|
};
|
||||||
|
return map[type] ?? 'text';
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export const tokens = {
|
export const tokens = {
|
||||||
"name": "@domi/ui",
|
"name": "@domi/ui",
|
||||||
"version": "1.0.3",
|
"version": "1.1.0",
|
||||||
"note": "GENERATED by tools/build-tokens.mjs. Colours are sRGB hex. Use roles, never the hex in a component.",
|
"note": "GENERATED by tools/build-tokens.mjs. Colours are sRGB hex. Use roles, never the hex in a component.",
|
||||||
"themes": {
|
"themes": {
|
||||||
"dark": {
|
"dark": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ianitor/ui",
|
"name": "@ianitor/ui",
|
||||||
"version": "0.2.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "CPAL-1.0",
|
"license": "CPAL-1.0",
|
||||||
"description": "Ianitor's own components on top of @domi/ui (the shared Domi design system): banners, dialogs, status, and adapters for Button and Segmented.",
|
"description": "Ianitor's own components on top of @domi/ui (the shared Domi design system): banners, dialogs, status, and adapters for Button and Segmented.",
|
||||||
|
|||||||
+7
-1
@@ -59,7 +59,13 @@ new=$(printf '%s\n' "${entries[@]}" | jq -s --arg v "$version" --arg sys "$syste
|
|||||||
'{version: $v, system: $sys, commit: $c, sourceTree: $t, nixpkgs: $n, outputs: add}')
|
'{version: $v, system: $sys, commit: $c, sourceTree: $t, nixpkgs: $n, outputs: add}')
|
||||||
|
|
||||||
if [ "$mode" = --check ]; then
|
if [ "$mode" = --check ]; then
|
||||||
[ -f "$pin" ] || { echo "no $pin to check" >&2; exit 1; }
|
# With no pin yet, print the one this build would write: the NixOS runner has no commit rights, so its
|
||||||
|
# log is how the first pin of a release reaches the repo (docs/release.md, Handover 1a).
|
||||||
|
if [ ! -f "$pin" ]; then
|
||||||
|
echo "no $pin to check; this build's pin would be:" >&2
|
||||||
|
jq -S -c . <<<"$new" | sed 's/^/pin.json: /' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# At a tag the commit is the pin's child (only pin.json differs), so the commit itself is not
|
# At a tag the commit is the pin's child (only pin.json differs), so the commit itself is not
|
||||||
# compared; the source tree, nixpkgs and every hash are.
|
# compared; the source tree, nixpkgs and every hash are.
|
||||||
if [ "$(jq -S 'del(.commit)' "$pin")" != "$(jq -S 'del(.commit)' <<<"$new")" ]; then
|
if [ "$(jq -S 'del(.commit)' "$pin")" != "$(jq -S 'del(.commit)' <<<"$new")" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user