@getorrery/cells 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cells.d.ts +1 -1
- package/dist/el/mod.d.ts +1 -0
- package/dist/el/sessions.d.ts +20 -2
- package/dist/index.js +57 -4
- package/package.json +3 -3
package/dist/cells.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type Seg =
|
|
|
43
43
|
export type Line = Seg[];
|
|
44
44
|
/** What fills a {@link Blk}. */
|
|
45
45
|
export type Fill =
|
|
46
|
-
/** The mark, large (
|
|
46
|
+
/** The mark, large (16 × 8 cells): an animation and a state. */
|
|
47
47
|
{
|
|
48
48
|
k: "pixel";
|
|
49
49
|
anim: string;
|
package/dist/el/mod.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import * as context from "./context";
|
|
|
15
15
|
import * as feedback from "./feedback";
|
|
16
16
|
import * as input from "./input";
|
|
17
17
|
import * as sessions from "./sessions";
|
|
18
|
+
export { stateClass } from "./chrome";
|
|
18
19
|
/** Every element id, in the design's order. */
|
|
19
20
|
export declare const ELEMENTS: readonly string[];
|
|
20
21
|
/** An element's props did not match its view model, or the id is unknown. */
|
package/dist/el/sessions.d.ts
CHANGED
|
@@ -45,11 +45,27 @@ export declare function sessionTree(p: SessionTreeView, w: number, m: boolean):
|
|
|
45
45
|
export interface OAuthView {
|
|
46
46
|
title: string;
|
|
47
47
|
step?: string | null;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
/** Unused with `command`. */
|
|
49
|
+
url?: string;
|
|
50
|
+
/** Unused with `command`. */
|
|
51
|
+
code?: string;
|
|
50
52
|
/** `waiting`, `approved`, `error`, `expired`; `waiting` when absent. */
|
|
51
53
|
state?: string;
|
|
52
54
|
note?: string;
|
|
55
|
+
/** A command the person runs themselves, instead of a URL and a code. */
|
|
56
|
+
command?: string | null;
|
|
57
|
+
/** The title below 64 columns. */
|
|
58
|
+
short_title?: string | null;
|
|
59
|
+
/** The note below 64 columns. */
|
|
60
|
+
short_note?: string | null;
|
|
61
|
+
/** With `command`: what stands first, one paragraph each. */
|
|
62
|
+
lead?: string[];
|
|
63
|
+
/** With `command`: what the person must know before going on. */
|
|
64
|
+
warn?: string | null;
|
|
65
|
+
/** With `command`: the dim line above the keys. */
|
|
66
|
+
foot?: string | null;
|
|
67
|
+
/** With `command`: the key row, when a host binds other keys than the screen's own. */
|
|
68
|
+
keys?: string | null;
|
|
53
69
|
}
|
|
54
70
|
/** The URL, the code large in a heavy box, a spinner with the expiry. */
|
|
55
71
|
export declare function oauth(p: OAuthView, w: number, m: boolean): Item[];
|
|
@@ -111,6 +127,8 @@ export interface WelcomeView {
|
|
|
111
127
|
state?: string;
|
|
112
128
|
selected?: number | null;
|
|
113
129
|
warn?: string | null;
|
|
130
|
+
/** One static line under the warning, as runs of text and class. */
|
|
131
|
+
hint?: Runs;
|
|
114
132
|
}
|
|
115
133
|
/** Three suggestions, tips, and what is missing. */
|
|
116
134
|
export declare function welcome(p: WelcomeView, w: number, m: boolean): Item[];
|
package/dist/index.js
CHANGED
|
@@ -1477,6 +1477,7 @@ function banner(p, w, m) {
|
|
|
1477
1477
|
const state = p.state ?? "idle";
|
|
1478
1478
|
const tl = flag(p.trusted) ? [g(m, "\u2713", "trusted", "ok"), t(" trusted workspace", "d")] : [g(m, "\u25B2", "untrusted", "at"), t(" untrusted \xB7 tools off \xB7 /trust", "at")];
|
|
1479
1479
|
const ml = state === "loading" ? [spin("lv"), t(" resolving model\u2026", "d")] : p.model != null ? [t("model ", "d"), t(p.model, "i"), t(` \xB7 ${p.provider ?? ""}`, "d")] : [g(m, "\u25B2", "no model", "at"), t(" none \xB7 /model to pick one", "at")];
|
|
1480
|
+
const mark2 = state === "idle" ? "static" : state;
|
|
1480
1481
|
const br = p.branch ?? null;
|
|
1481
1482
|
if (w >= 64 && !m) {
|
|
1482
1483
|
const rw = w - 17;
|
|
@@ -1485,7 +1486,7 @@ function banner(p, w, m) {
|
|
|
1485
1486
|
if (br != null) where.push(t(` \u2387 ${br}`, "d"));
|
|
1486
1487
|
const last = p.error != null ? [t(`\u2717 ${p.error}`, "er")] : [t("/help \xB7 /model \xB7 /providers \xB7 ? keys", "d")];
|
|
1487
1488
|
const ls = [[], [t("orrery", "b"), t(` ${p.harness}`, "i")], [t(`harness ${versionLabel(p)}`, "d")], [], where, tl, ml, last];
|
|
1488
|
-
return [{ k: "blk", blk: { w: 17, h: 8, fill: { k: "pixel", anim: "orrery", state }, lines: ls.map((l) => fit(l, rw)) } }];
|
|
1489
|
+
return [{ k: "blk", blk: { w: 17, h: 8, fill: { k: "pixel", anim: "orrery", state: mark2 }, lines: ls.map((l) => fit(l, rw)) } }];
|
|
1489
1490
|
}
|
|
1490
1491
|
const iw = w - 4;
|
|
1491
1492
|
const body2 = [[t(p.harness, "i")], [t(trL(p.path, iw), "d2")]];
|
|
@@ -1493,7 +1494,7 @@ function banner(p, w, m) {
|
|
|
1493
1494
|
body2.push(tl);
|
|
1494
1495
|
body2.push(ml);
|
|
1495
1496
|
if (p.error != null) for (const x of wrap(`\u2717 ${p.error}`, iw)) body2.push([t(x, "er")]);
|
|
1496
|
-
const title = m ? [t("orrery", "b")] : [px(
|
|
1497
|
+
const title = m ? [t("orrery", "b")] : [px(mark2), t(" orrery", "b")];
|
|
1497
1498
|
return out(boxed(body2, w, { t: title, r: [t(versionLabel(p), "d")], c: p.error != null ? "er" : "dd" }));
|
|
1498
1499
|
}
|
|
1499
1500
|
function newPill(n, w) {
|
|
@@ -1979,6 +1980,7 @@ __export(mod_exports, {
|
|
|
1979
1980
|
panelHead: () => panelHead,
|
|
1980
1981
|
render: () => render2,
|
|
1981
1982
|
sessions: () => sessions_exports,
|
|
1983
|
+
stateClass: () => stateClass,
|
|
1982
1984
|
warnLines: () => warnLines
|
|
1983
1985
|
});
|
|
1984
1986
|
|
|
@@ -4336,14 +4338,50 @@ function sessionTree(p, w, m) {
|
|
|
4336
4338
|
else if (p.busy != null) o.push([spin("lv"), t(` ${p.busy}`, "d")]);
|
|
4337
4339
|
return out(o);
|
|
4338
4340
|
}
|
|
4341
|
+
function oauthCommand(p, command2, w, m) {
|
|
4342
|
+
const wide = w >= 64;
|
|
4343
|
+
const iw = w - 4;
|
|
4344
|
+
const state = p.state ?? "waiting";
|
|
4345
|
+
const title = !wide && p.short_title || p.title;
|
|
4346
|
+
const note = !wide && p.short_note || (p.note ?? "");
|
|
4347
|
+
const rows2 = [];
|
|
4348
|
+
const lead = () => {
|
|
4349
|
+
for (const l of p.lead ?? []) rows2.push(...para([], l, iw, "i", null));
|
|
4350
|
+
};
|
|
4351
|
+
if (state === "approved") {
|
|
4352
|
+
rows2.push([g(m, "\u2713", "done", "ok"), t(` ${note}`, "i")], []);
|
|
4353
|
+
lead();
|
|
4354
|
+
if (p.warn != null) rows2.push([], ...warnLines(p.warn, iw, m, "warn"));
|
|
4355
|
+
if (p.foot != null) rows2.push([], ...para([], p.foot, iw, "d", null));
|
|
4356
|
+
rows2.push(keys(p.keys ?? "enter continue|esc cancel", iw, 0));
|
|
4357
|
+
} else if (state === "error") {
|
|
4358
|
+
rows2.push([g(m, "\u2715", "missing", "er"), t(` ${note}`, "i")], []);
|
|
4359
|
+
lead();
|
|
4360
|
+
rows2.push(keys(p.keys ?? "r check now|esc cancel", iw, 0));
|
|
4361
|
+
} else {
|
|
4362
|
+
lead();
|
|
4363
|
+
rows2.push([]);
|
|
4364
|
+
rows2.push(...para([], wide ? "Run this in any terminal, then come back:" : "Run in any terminal, then come back:", iw, "i", null));
|
|
4365
|
+
if (wide) {
|
|
4366
|
+
const c = m ? "i" : "ac";
|
|
4367
|
+
const rule2 = "\u2501".repeat(chars(command2));
|
|
4368
|
+
rows2.push([t(`\u250F\u2501 ${rule2} \u2501\u2513`, c)], [t("\u2503 ", c), t(command2, "b"), t(" \u2503", c)], [t(`\u2517\u2501 ${rule2} \u2501\u251B`, c)]);
|
|
4369
|
+
} else rows2.push([t(command2, "b")]);
|
|
4370
|
+
rows2.push([], [spin("lv"), t(` ${note}`, "d")]);
|
|
4371
|
+
rows2.push(keys(p.keys ?? (wide ? "c copy command|r check now|esc cancel" : "c copy|r check|esc cancel"), iw, 0));
|
|
4372
|
+
}
|
|
4373
|
+
return out(ov(rows2, w, m, title, p.step ?? null));
|
|
4374
|
+
}
|
|
4339
4375
|
function oauth(p, w, m) {
|
|
4376
|
+
if (p.command != null) return oauthCommand(p, p.command, w, m);
|
|
4340
4377
|
const state = p.state ?? "waiting";
|
|
4341
4378
|
const note = p.note ?? "";
|
|
4342
|
-
const
|
|
4379
|
+
const codeText = p.code ?? "";
|
|
4380
|
+
const code = w >= 64 ? Array.from(codeText).join(" ") : codeText;
|
|
4343
4381
|
const expired = state === "expired";
|
|
4344
4382
|
const cw = chars(code) + 4;
|
|
4345
4383
|
const cb = boxed([[t(code, "b")]], cw, { k: "heavy", c: expired ? "dd" : m ? "i" : "ac" });
|
|
4346
|
-
const rows2 = [[t("Open this URL on any device:", "i")], [t(p.url, "u ac")], []];
|
|
4384
|
+
const rows2 = [[t("Open this URL on any device:", "i")], [t(p.url ?? "", "u ac")], []];
|
|
4347
4385
|
rows2.push(...cb.map((l) => center(l, w - 4)));
|
|
4348
4386
|
rows2.push([]);
|
|
4349
4387
|
if (state === "approved") rows2.push([g(m, "\u2713", "done", "ok"), t(` ${note}`, "i")]);
|
|
@@ -4457,6 +4495,20 @@ function trust(p, w, m) {
|
|
|
4457
4495
|
o.push(keys(`1-${opts.length} pick|enter confirm|esc exit`, w, 4));
|
|
4458
4496
|
return out(o);
|
|
4459
4497
|
}
|
|
4498
|
+
function hintLines(hint, w) {
|
|
4499
|
+
const rows2 = [];
|
|
4500
|
+
let row3 = [sp(2)];
|
|
4501
|
+
for (const [text2, cls2] of hint) {
|
|
4502
|
+
if (row3.length > 1 && len(row3) + chars(text2) > w) {
|
|
4503
|
+
rows2.push(row3);
|
|
4504
|
+
row3 = [sp(2), t(text2.trimStart(), cls2)];
|
|
4505
|
+
} else {
|
|
4506
|
+
row3.push(t(text2, cls2));
|
|
4507
|
+
}
|
|
4508
|
+
}
|
|
4509
|
+
rows2.push(row3);
|
|
4510
|
+
return rows2;
|
|
4511
|
+
}
|
|
4460
4512
|
function welcome(p, w, m) {
|
|
4461
4513
|
const state = p.state ?? "ready";
|
|
4462
4514
|
const o = [fit([t("Try", "b")], w)];
|
|
@@ -4478,6 +4530,7 @@ function welcome(p, w, m) {
|
|
|
4478
4530
|
o.push([]);
|
|
4479
4531
|
o.push(...warnLines(p.warn, w, m, "warn"));
|
|
4480
4532
|
}
|
|
4533
|
+
if ((p.hint ?? []).length > 0) o.push(...hintLines(p.hint ?? [], w));
|
|
4481
4534
|
return out(o);
|
|
4482
4535
|
}
|
|
4483
4536
|
function themeSample(w, m) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getorrery/cells",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "The terminal design as cells: every harness element drawn as rows of styled cells, checked against the design's own goldens. A port of the orrery-cells crate.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"directory": "harness/clients/cells-ts"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getorrery/client": "0.3.
|
|
16
|
-
"@getorrery/protocol": "0.3.
|
|
15
|
+
"@getorrery/client": "0.3.4",
|
|
16
|
+
"@getorrery/protocol": "0.3.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"typescript": "^5.9.3",
|