feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
This commit is contained in:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
+43
@@ -0,0 +1,43 @@
|
||||
// Reproduce the chart scales' reference without adding an app dependency:
|
||||
// npm install --prefix /tmp/mygo-chart-reference --ignore-scripts --no-audit --no-fund d3-scale@4.0.2
|
||||
// node scripts/chart-scales-golden.ts /tmp/mygo-chart-reference
|
||||
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
||||
import { resolve, join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { gzipSync } from "node:zlib";
|
||||
|
||||
const root = process.argv[2];
|
||||
if (!root) throw new Error("Pass the directory containing node_modules/d3-scale@4.0.2");
|
||||
const pkg = resolve(root, "node_modules/d3-scale");
|
||||
const { version } = JSON.parse(await readFile(join(pkg, "package.json"), "utf8"));
|
||||
if (version !== "4.0.2") throw new Error(`Expected d3-scale 4.0.2, found ${version}`);
|
||||
const { scaleLog, scaleSymlog } = await import(pathToFileURL(join(pkg, "src/index.js")).href);
|
||||
const fractions = [-0.5, 0, 0.1, 0.25, 0.5, 0.75, 0.9, 1, 1.5].map(Math.fround);
|
||||
const cases: object[] = [];
|
||||
const logDomains = [[1, 1000], [0.001, 1], [0.3, 1.2], [30, 90], [1, 1], [1e-12, 1e12], [1e6, 3.4e6],
|
||||
[Number.MIN_VALUE, 1], [1e-320, 1e-300]];
|
||||
const domains = (ds: number[][]) => ds.flatMap(([lo, hi]) => [[lo!, hi!], [hi!, lo!]]);
|
||||
for (const kind of ["log", "symlog"]) {
|
||||
const ranges = kind === "log" ? domains(logDomains.flatMap(([lo, hi]) => [[lo!, hi!], [-hi!, -lo!]]))
|
||||
: domains([[0, 100], [-100, 100], [-100, -1], [-1e6, 1e6], [3.2, 7.9], [0, 0]]);
|
||||
for (const domain of ranges) for (const parameter of kind === "log" ? [2, Math.E, 10, 16, 100] : [0.01, 1, 10, 100]) {
|
||||
for (const count of [1, 2, 5, 10]) for (const clamp of [false, true]) {
|
||||
const scale = kind === "log" ? scaleLog().base(parameter) : scaleSymlog().constant(parameter);
|
||||
scale.domain(domain).clamp(clamp);
|
||||
const raw = scale.copy().clamp(false);
|
||||
// Extrapolating subnormal domains can underflow or overflow. Keep
|
||||
// these reference samples inside the representable domain.
|
||||
const fs = domain.some((v) => Math.abs(v) < 1e-300 && v !== 0)
|
||||
? fractions.filter((f) => f >= 0 && f <= 1) : fractions;
|
||||
const values = fs.map((f) => raw.invert(f));
|
||||
cases.push({ kind, domain, parameter, count, clamp,
|
||||
values, positions: values.map((v) => scale(v)),
|
||||
fractions: fs, inversions: fs.map((f) => scale.invert(f)),
|
||||
ticks: scale.ticks(count), nice: scale.copy().nice(count).domain() });
|
||||
}
|
||||
}
|
||||
}
|
||||
const dir = resolve(import.meta.dirname, "../ui/chart/testdata");
|
||||
await mkdir(dir, { recursive: true });
|
||||
await writeFile(join(dir, "nonlinear_d3.json.gz"), gzipSync(JSON.stringify({ version, cases }) + "\n", { level: 9 }));
|
||||
console.log(`${cases.length} cases from d3-scale ${version}`);
|
||||
Reference in new issue
Block a user