@celljs/ta-glance 4.11.0 → 4.13.0
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/README.en.md +1 -0
- package/README.md +1 -0
- package/extension/index.mjs +425 -3
- package/package.json +3 -3
- package/web/index.js +272 -124
package/README.en.md
CHANGED
|
@@ -4,6 +4,7 @@ A pi package that comes with Ta (on by default; Settings → Extensions of the w
|
|
|
4
4
|
|
|
5
5
|
- **The answer first, little of the process**: under the Ta service, every turn's system prompt gets a `<ta-glance>` section: the first line is the conclusion in one sentence, what matters in bold; then only what the user needs to act or decide; a short question gets one to three sentences.
|
|
6
6
|
- **Results as a card**: when a reply reports work done, results, a comparison, choices to make, or several facts or relations, Ta writes a `ta-glance` block (JSON) after the first line, which the web client draws as a card: key numbers, files changed (opened by a click), steps, before and after, bars, a flow, a Mermaid diagram, a table, choices to tap, risks and to-dos, buttons of what to ask next, folded details. The card grows as the reply streams.
|
|
7
|
+
- **Waiting for you**: a turn whose reply ends with a card of choices (`options`) or `status: "blocked"` is marked in the session with a `ta-ask` entry (`TA_ASK_ENTRY`, which the model never reads): the list of chats, its tab, the double's tasks and Quick open show that the conversation waits for you to decide, until you answer, by a tap or in words. Until then the card is framed in blue with a ?; once answered it shows the choice on every device, after a reload too (`WebCodeRendererProps.answer`).
|
|
7
8
|
- **Elsewhere**: the preview of the list of conversations shows the first line; replies to WeChat and WeCom bots draw no card and stay short paragraphs; `ta` in a terminal replies as before. External agents (ta-agents) get the section too.
|
|
8
9
|
|
|
9
10
|
The card's format is in `web-src/glance-protocol.ts`, the prompt in `web-src/glance-prompt.ts`. Other packages draw cards for fenced blocks of their own languages with `registerCodeRenderer`.
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 扩展
|
|
|
4
4
|
|
|
5
5
|
- **先说结论、少说过程**:在 Ta 服务下,每一轮的系统提示里多一段 `<ta-glance>`:第一行一句话结论、关键词加粗;只写你要行动或决定的东西;小问题一到三句。
|
|
6
6
|
- **结果画成卡片**:汇报完成的工作、结果、对比、要你选的方案、多个事实或关系时,Ta 在第一行之后写一个 `ta-glance` 代码块(JSON),Web 把它画成卡片:关键数字、改了的文件(点开)、步骤、前后对比、横条、流程、Mermaid 关系图、表格、可点选的方案、风险与待办、下一步按钮、折叠的细节。卡片随回复流式长出来。
|
|
7
|
+
- **待你决定**:一轮回复以带选项(`options`)或 `status: "blocked"` 的卡片结束时,pi 扩展在会话里记一条 `ta-ask`(`TA_ASK_ENTRY`,模型读不到),对话列表、标签、分身任务和快捷打开就显示这个对话在等你决定,直到你回答(点选或打字都算)。卡片在你回答前用蓝框和问号标出;回答后各设备都显示已选,刷新也保留(`WebCodeRendererProps.answer`)。
|
|
7
8
|
- **别处**:对话列表的预览显示第一行结论;发到微信、企业微信机器人的回复不画卡片,照常是短段落;终端里的 `ta` 回复照旧。外部 Agent(ta-agents)也会拿到这段写法。
|
|
8
9
|
|
|
9
10
|
卡片的格式见 `web-src/glance-protocol.ts`,提示词见 `web-src/glance-prompt.ts`。别的包也能用 `registerCodeRenderer` 为自己的代码块语言画卡片。
|
package/extension/index.mjs
CHANGED
|
@@ -5,24 +5,440 @@ var TaHostUtil;
|
|
|
5
5
|
TaHostUtil2.WAIT_MS = 1000;
|
|
6
6
|
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
7
7
|
return new Promise((resolve) => {
|
|
8
|
+
let heard = false;
|
|
9
|
+
let answered = false;
|
|
8
10
|
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
9
11
|
const request = {
|
|
10
12
|
name,
|
|
13
|
+
heard: () => {
|
|
14
|
+
heard = true;
|
|
15
|
+
},
|
|
11
16
|
resolve: (answer) => {
|
|
17
|
+
answered = true;
|
|
12
18
|
clearTimeout(timer);
|
|
13
19
|
resolve(answer);
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
22
|
events.emit(TA_HOST_EVENT, request);
|
|
23
|
+
if (!heard && !answered) {
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
resolve(undefined);
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
28
|
}
|
|
19
29
|
TaHostUtil2.reach = reach;
|
|
20
30
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
31
|
+
var TA_ASK_ENTRY = "ta-ask";
|
|
32
|
+
var TaAskUtil;
|
|
33
|
+
(function(TaAskUtil2) {
|
|
34
|
+
const LENGTH = 120;
|
|
35
|
+
function entry(question) {
|
|
36
|
+
const line = question.replace(/\s+/g, " ").trim();
|
|
37
|
+
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
38
|
+
}
|
|
39
|
+
TaAskUtil2.entry = entry;
|
|
40
|
+
function asking(entries) {
|
|
41
|
+
var _a;
|
|
42
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
43
|
+
const entry2 = entries[i];
|
|
44
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
48
|
+
return read(entry2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
TaAskUtil2.asking = asking;
|
|
54
|
+
function next(asked, entry2) {
|
|
55
|
+
var _a;
|
|
56
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
60
|
+
}
|
|
61
|
+
TaAskUtil2.next = next;
|
|
62
|
+
function read(found) {
|
|
63
|
+
var _a;
|
|
64
|
+
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
65
|
+
if (typeof question !== "string" || !question.trim()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
69
|
+
return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
|
|
70
|
+
}
|
|
71
|
+
})(TaAskUtil || (TaAskUtil = {}));
|
|
72
|
+
|
|
73
|
+
// web-src/glance-json.ts
|
|
74
|
+
var GlanceJson;
|
|
75
|
+
((GlanceJson) => {
|
|
76
|
+
const TRIES = 40;
|
|
77
|
+
function parse(text, partial) {
|
|
78
|
+
const source = text.trim().replace(/,\s*([}\]])/g, "$1");
|
|
79
|
+
if (!source) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
return JSON.parse(source);
|
|
84
|
+
} catch {
|
|
85
|
+
if (!partial) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
let end = source.length;
|
|
90
|
+
for (let tries = 0;tries < TRIES && end > 0; tries++) {
|
|
91
|
+
const closed = close(source.slice(0, end));
|
|
92
|
+
if (closed !== undefined) {
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(closed);
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
end = Math.max(source.lastIndexOf(",", end - 1), source.lastIndexOf("{", end - 1) + 1, source.lastIndexOf("[", end - 1) + 1);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
GlanceJson.parse = parse;
|
|
102
|
+
function close(text) {
|
|
103
|
+
const open = [];
|
|
104
|
+
let inString = false;
|
|
105
|
+
let escaped = false;
|
|
106
|
+
for (const char of text) {
|
|
107
|
+
if (inString) {
|
|
108
|
+
if (escaped) {
|
|
109
|
+
escaped = false;
|
|
110
|
+
} else if (char === "\\") {
|
|
111
|
+
escaped = true;
|
|
112
|
+
} else if (char === '"') {
|
|
113
|
+
inString = false;
|
|
114
|
+
}
|
|
115
|
+
} else if (char === '"') {
|
|
116
|
+
inString = true;
|
|
117
|
+
} else if (char === "{" || char === "[") {
|
|
118
|
+
open.push(char === "{" ? "}" : "]");
|
|
119
|
+
} else if (char === "}" || char === "]") {
|
|
120
|
+
open.pop();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!open.length && !inString) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let body = text;
|
|
127
|
+
if (inString) {
|
|
128
|
+
body = `${escaped ? body.slice(0, -1) : body}"`;
|
|
129
|
+
}
|
|
130
|
+
body = body.replace(/[\s,:]+$/, "");
|
|
131
|
+
if (open[open.length - 1] === "}" && /[{,]\s*"(?:[^"\\]|\\.)*"$/.test(body)) {
|
|
132
|
+
body = body.replace(/,?\s*"(?:[^"\\]|\\.)*"$/, "");
|
|
133
|
+
}
|
|
134
|
+
return body + open.reverse().join("");
|
|
135
|
+
}
|
|
136
|
+
})(GlanceJson ||= {});
|
|
21
137
|
|
|
22
138
|
// web-src/glance-protocol.ts
|
|
23
139
|
var NAME = "@celljs/ta-glance";
|
|
24
140
|
var LANGUAGE = "ta-glance";
|
|
25
141
|
|
|
142
|
+
// web-src/glance-spec.ts
|
|
143
|
+
var ITEMS = 12;
|
|
144
|
+
var BLOCKS = 8;
|
|
145
|
+
var TEXT = 400;
|
|
146
|
+
var MARKDOWN = 8000;
|
|
147
|
+
var STATUSES = ["done", "partial", "failed", "blocked", "info"];
|
|
148
|
+
var TONES = ["good", "bad", "warn", "neutral"];
|
|
149
|
+
var STEPS = ["done", "doing", "todo", "failed", "skipped"];
|
|
150
|
+
var NOTES = ["risk", "info", "todo"];
|
|
151
|
+
function object(value) {
|
|
152
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
153
|
+
}
|
|
154
|
+
function text(value, max = TEXT) {
|
|
155
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
156
|
+
return String(value);
|
|
157
|
+
}
|
|
158
|
+
if (typeof value !== "string") {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const trimmed = value.trim();
|
|
162
|
+
return trimmed ? trimmed.slice(0, max) : undefined;
|
|
163
|
+
}
|
|
164
|
+
function number(value) {
|
|
165
|
+
const parsed = typeof value === "string" ? Number.parseFloat(value.replace(/[^\d.eE+-]/g, "")) : value;
|
|
166
|
+
return typeof parsed === "number" && Number.isFinite(parsed) ? parsed : undefined;
|
|
167
|
+
}
|
|
168
|
+
function oneOf(value, values) {
|
|
169
|
+
const lower = typeof value === "string" ? value.trim().toLowerCase() : undefined;
|
|
170
|
+
return values.find((candidate) => candidate === lower);
|
|
171
|
+
}
|
|
172
|
+
function items(value, read) {
|
|
173
|
+
if (!Array.isArray(value)) {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
const out = [];
|
|
177
|
+
for (const item of value) {
|
|
178
|
+
const made = read(item);
|
|
179
|
+
if (made !== undefined) {
|
|
180
|
+
out.push(made);
|
|
181
|
+
}
|
|
182
|
+
if (out.length === ITEMS) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
function strings(value, max = ITEMS) {
|
|
189
|
+
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text)).slice(0, max);
|
|
190
|
+
}
|
|
191
|
+
function stat(item) {
|
|
192
|
+
const value = object(item);
|
|
193
|
+
const label = text(value?.label);
|
|
194
|
+
const shown = text(value?.value);
|
|
195
|
+
if (!label || shown === undefined) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const tone = oneOf(value?.tone, TONES);
|
|
199
|
+
const delta = text(value?.delta);
|
|
200
|
+
return { label, value: shown, ...tone ? { tone } : {}, ...delta ? { delta } : {} };
|
|
201
|
+
}
|
|
202
|
+
function change(item) {
|
|
203
|
+
const value = object(item);
|
|
204
|
+
const path = text(value?.path ?? item);
|
|
205
|
+
if (!path) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const kind = oneOf(value?.kind, ["add", "edit", "delete"]) ?? "edit";
|
|
209
|
+
const add = number(value?.add);
|
|
210
|
+
const del = number(value?.del);
|
|
211
|
+
const note = text(value?.note);
|
|
212
|
+
return {
|
|
213
|
+
path,
|
|
214
|
+
kind,
|
|
215
|
+
...add !== undefined ? { add: Math.max(0, Math.round(add)) } : {},
|
|
216
|
+
...del !== undefined ? { del: Math.max(0, Math.round(del)) } : {},
|
|
217
|
+
...note ? { note } : {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function step(item, partial) {
|
|
221
|
+
const value = object(item);
|
|
222
|
+
const shown = text(value?.text ?? value?.label ?? value?.title ?? item);
|
|
223
|
+
return shown ? { text: shown, status: oneOf(value?.status, STEPS) ?? (partial ? "todo" : "done") } : undefined;
|
|
224
|
+
}
|
|
225
|
+
function option(item) {
|
|
226
|
+
const value = object(item);
|
|
227
|
+
const label = text(value?.label ?? item);
|
|
228
|
+
if (!label) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const detail = text(value?.detail);
|
|
232
|
+
return {
|
|
233
|
+
label,
|
|
234
|
+
...detail ? { detail } : {},
|
|
235
|
+
pros: strings(value?.pros, 4),
|
|
236
|
+
cons: strings(value?.cons, 4),
|
|
237
|
+
...value?.recommended === true ? { recommended: true } : {}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function note(item) {
|
|
241
|
+
const value = object(item);
|
|
242
|
+
const shown = text(value?.text ?? item);
|
|
243
|
+
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
244
|
+
}
|
|
245
|
+
function isPath(value) {
|
|
246
|
+
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
247
|
+
}
|
|
248
|
+
var LABELS = { before: "Before", after: "After" };
|
|
249
|
+
function block(item, partial, labels) {
|
|
250
|
+
const value = object(item);
|
|
251
|
+
const type = typeof value?.type === "string" ? value.type.trim().toLowerCase() : undefined;
|
|
252
|
+
const unit = text(value?.unit, 16);
|
|
253
|
+
switch (type) {
|
|
254
|
+
case "stats": {
|
|
255
|
+
const list = items(value?.items, stat).slice(0, 6);
|
|
256
|
+
return list.length ? { type, items: list } : undefined;
|
|
257
|
+
}
|
|
258
|
+
case "changes": {
|
|
259
|
+
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
260
|
+
if (raw.length && raw.every((entry) => typeof entry === "string" && !isPath(entry))) {
|
|
261
|
+
const list2 = items(raw, note);
|
|
262
|
+
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
263
|
+
}
|
|
264
|
+
const list = items(value?.items, change);
|
|
265
|
+
return list.length ? { type, items: list } : undefined;
|
|
266
|
+
}
|
|
267
|
+
case "steps": {
|
|
268
|
+
const list = items(value?.items, (entry) => step(entry, partial));
|
|
269
|
+
return list.length ? { type, items: list } : undefined;
|
|
270
|
+
}
|
|
271
|
+
case "compare": {
|
|
272
|
+
const list = items(value?.items, (entry) => {
|
|
273
|
+
const measure = object(entry);
|
|
274
|
+
const label = text(measure?.label);
|
|
275
|
+
const before = number(measure?.before);
|
|
276
|
+
const after = number(measure?.after);
|
|
277
|
+
return label && before !== undefined && after !== undefined ? { label, before, after } : undefined;
|
|
278
|
+
});
|
|
279
|
+
const better = oneOf(value?.better, ["lower", "higher"]) ?? "lower";
|
|
280
|
+
if (list.length) {
|
|
281
|
+
return { type, better, items: list, ...unit ? { unit } : {} };
|
|
282
|
+
}
|
|
283
|
+
const rows = items(value?.items, (entry) => {
|
|
284
|
+
const measure = object(entry);
|
|
285
|
+
const label = text(measure?.label);
|
|
286
|
+
const before = text(measure?.before);
|
|
287
|
+
const after = text(measure?.after);
|
|
288
|
+
return label && (before || after) ? [label, before ?? "", after ?? ""] : undefined;
|
|
289
|
+
});
|
|
290
|
+
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
291
|
+
}
|
|
292
|
+
case "bars": {
|
|
293
|
+
const list = items(value?.items, (entry) => {
|
|
294
|
+
const amount = object(entry);
|
|
295
|
+
const label = text(amount?.label);
|
|
296
|
+
const shown = number(amount?.value);
|
|
297
|
+
return label && shown !== undefined ? { label, value: shown } : undefined;
|
|
298
|
+
});
|
|
299
|
+
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
300
|
+
}
|
|
301
|
+
case "flow": {
|
|
302
|
+
const list = strings(value?.items);
|
|
303
|
+
return list.length ? { type, items: list } : undefined;
|
|
304
|
+
}
|
|
305
|
+
case "diagram": {
|
|
306
|
+
const mermaid = text(value?.mermaid, MARKDOWN);
|
|
307
|
+
return mermaid ? { type, mermaid } : undefined;
|
|
308
|
+
}
|
|
309
|
+
case "table": {
|
|
310
|
+
const columns = strings(value?.columns, 6);
|
|
311
|
+
const rows = items(value?.rows, (row) => Array.isArray(row) ? columns.map((_, index) => text(row[index]) ?? "") : undefined);
|
|
312
|
+
return columns.length && rows.length ? { type, columns, rows } : undefined;
|
|
313
|
+
}
|
|
314
|
+
case "options": {
|
|
315
|
+
const list = items(value?.items, option).slice(0, 5);
|
|
316
|
+
const question = text(value?.question);
|
|
317
|
+
return list.length ? { type, items: list, ...question ? { question } : {} } : undefined;
|
|
318
|
+
}
|
|
319
|
+
case "notes": {
|
|
320
|
+
const list = items(value?.items, note);
|
|
321
|
+
return list.length ? { type, items: list } : undefined;
|
|
322
|
+
}
|
|
323
|
+
case "next": {
|
|
324
|
+
const list = strings(value?.items, 3);
|
|
325
|
+
return list.length ? { type, items: list } : undefined;
|
|
326
|
+
}
|
|
327
|
+
case "details": {
|
|
328
|
+
const markdown = text(value?.markdown, MARKDOWN);
|
|
329
|
+
const title = text(value?.title);
|
|
330
|
+
return markdown ? { type, markdown, ...title ? { title } : {} } : undefined;
|
|
331
|
+
}
|
|
332
|
+
default:
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function loose(card) {
|
|
337
|
+
const out = [];
|
|
338
|
+
for (const [key, entries] of Object.entries(card)) {
|
|
339
|
+
const type = key === "files" ? "changes" : key;
|
|
340
|
+
if (Array.isArray(entries) && LISTS.includes(type)) {
|
|
341
|
+
out.push({ type, items: entries, ...type === "options" ? { question: card.question } : {} });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
var LISTS = ["stats", "changes", "steps", "flow", "options", "notes", "next"];
|
|
347
|
+
var GlanceSpec;
|
|
348
|
+
((GlanceSpec) => {
|
|
349
|
+
function read(value, partial = false, labels = LABELS) {
|
|
350
|
+
const card = object(value);
|
|
351
|
+
if (!card) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const status = oneOf(card.status, STATUSES);
|
|
355
|
+
const title = text(card.title);
|
|
356
|
+
const blocks = items(Array.isArray(card.blocks) ? card.blocks : loose(card), (entry) => block(entry, partial, labels)).slice(0, BLOCKS);
|
|
357
|
+
if (!blocks.length && !title) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
return { blocks, ...status ? { status } : {}, ...title ? { title } : {} };
|
|
361
|
+
}
|
|
362
|
+
GlanceSpec.read = read;
|
|
363
|
+
})(GlanceSpec ||= {});
|
|
364
|
+
|
|
365
|
+
// web-src/glance-ask.ts
|
|
366
|
+
var GlanceAsk;
|
|
367
|
+
((GlanceAsk) => {
|
|
368
|
+
function ofRun(messages) {
|
|
369
|
+
for (let i = messages.length - 1;i >= 0; i--) {
|
|
370
|
+
const message = messages[i];
|
|
371
|
+
if (message.role === "assistant") {
|
|
372
|
+
return message.stopReason === "aborted" || message.stopReason === "error" ? undefined : question(text2(message.content));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
GlanceAsk.ofRun = ofRun;
|
|
378
|
+
function question(reply) {
|
|
379
|
+
let asked;
|
|
380
|
+
let asks = false;
|
|
381
|
+
for (const code of cards(reply)) {
|
|
382
|
+
const card = GlanceSpec.read(GlanceJson.parse(code, false));
|
|
383
|
+
if (!card) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const options = card.blocks.find((block2) => block2.type === "options");
|
|
387
|
+
if (options || card.status === "blocked") {
|
|
388
|
+
asks = true;
|
|
389
|
+
asked = (options?.type === "options" ? options.question : undefined) ?? card.title ?? asked;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return asks ? asked ?? firstLine(reply) : undefined;
|
|
393
|
+
}
|
|
394
|
+
GlanceAsk.question = question;
|
|
395
|
+
function text2(content) {
|
|
396
|
+
if (typeof content === "string") {
|
|
397
|
+
return content;
|
|
398
|
+
}
|
|
399
|
+
return Array.isArray(content) ? content.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
|
|
400
|
+
`) : "";
|
|
401
|
+
}
|
|
402
|
+
function cards(reply) {
|
|
403
|
+
const found = [];
|
|
404
|
+
let fence;
|
|
405
|
+
for (const line of reply.split(`
|
|
406
|
+
`)) {
|
|
407
|
+
const opening = /^\s*(`{3,}|~{3,})\s*([\w-]*)/.exec(line);
|
|
408
|
+
if (!fence) {
|
|
409
|
+
if (opening) {
|
|
410
|
+
fence = { mark: opening[1], lines: [], card: opening[2] === LANGUAGE };
|
|
411
|
+
}
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const mark = /^\s*(`{3,}|~{3,})\s*$/.exec(line)?.[1];
|
|
415
|
+
if (mark && mark[0] === fence.mark[0] && mark.length >= fence.mark.length) {
|
|
416
|
+
if (fence.card) {
|
|
417
|
+
found.push(fence.lines.join(`
|
|
418
|
+
`));
|
|
419
|
+
}
|
|
420
|
+
fence = undefined;
|
|
421
|
+
} else {
|
|
422
|
+
fence.lines.push(line);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return found;
|
|
426
|
+
}
|
|
427
|
+
function firstLine(reply) {
|
|
428
|
+
for (const line of reply.split(`
|
|
429
|
+
`)) {
|
|
430
|
+
if (/^\s*(`{3,}|~{3,})/.test(line)) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const said = line.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+\.\s+)/, "").replace(/[*_`]{1,3}/g, "").trim();
|
|
434
|
+
if (said) {
|
|
435
|
+
return said;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
})(GlanceAsk ||= {});
|
|
441
|
+
|
|
26
442
|
// web-src/glance-prompt.ts
|
|
27
443
|
var GLANCE_PROMPT = `The user reads your replies in Ta, often on a phone, and wants to take in the result at a glance, not read long text.
|
|
28
444
|
|
|
@@ -35,11 +451,11 @@ How to reply:
|
|
|
35
451
|
|
|
36
452
|
The card: {"status": "done" | "partial" | "failed" | "blocked" | "info", "title"?: string, "blocks": [...]}
|
|
37
453
|
status: done = finished, partial = done in part, failed, blocked = waiting for the user, info = an answer, no work. Leave out title: the first line already says it.
|
|
38
|
-
Blocks, 1 to 4 of them, the most important first. Every text a few words, in the user's language; inline Markdown works (**bold**, \`path/to/file\` opens the file).
|
|
454
|
+
Blocks, 1 to 4 of them, the most important first, each with only the fields shown. Every text a few words, in the user's language; inline Markdown works (**bold**, \`path/to/file\` opens the file).
|
|
39
455
|
- {"type":"stats","items":[{"label":"Tests","value":"128/128","tone":"good"},{"label":"Startup","value":"210 ms","delta":"-34%","tone":"good"}]}: key numbers, at most 6; tone good | bad | warn.
|
|
40
|
-
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed; kind add | edit | delete.
|
|
456
|
+
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed, a path each (points go in notes); kind add | edit | delete.
|
|
41
457
|
- {"type":"steps","items":[{"text":"...","status":"done"}]}: progress or a plan; status done | doing | todo | failed | skipped.
|
|
42
|
-
- {"type":"compare","unit":"ms","better":"lower","items":[{"label":"Startup","before":320,"after":210}]}: before and after, numbers only.
|
|
458
|
+
- {"type":"compare","unit":"ms","better":"lower","items":[{"label":"Startup","before":320,"after":210}]}: before and after, numbers only (words go in a table).
|
|
43
459
|
- {"type":"bars","unit":"MB","items":[{"label":"ta","value":66},{"label":"pi","value":129}]}: amounts side by side.
|
|
44
460
|
- {"type":"flow","items":["Request","Gateway","Session","Model"]}: a sequence or a path.
|
|
45
461
|
- {"type":"diagram","mermaid":"graph LR; A-->B"}: relations a flow cannot show, under 12 nodes.
|
|
@@ -61,6 +477,12 @@ function activate(pi) {
|
|
|
61
477
|
event.systemPromptOptions.sections = { ...event.systemPromptOptions.sections, [LANGUAGE]: GLANCE_PROMPT };
|
|
62
478
|
}
|
|
63
479
|
});
|
|
480
|
+
pi.on("agent_end", async (event) => {
|
|
481
|
+
const question = GlanceAsk.ofRun(event.messages ?? []);
|
|
482
|
+
if (question && await underServe()) {
|
|
483
|
+
pi.appendEntry(TA_ASK_ENTRY, TaAskUtil.entry(question));
|
|
484
|
+
}
|
|
485
|
+
});
|
|
64
486
|
}
|
|
65
487
|
export {
|
|
66
488
|
activate as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-glance",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "A pi package for Ta: replies lead with the answer, short, and show results as cards (key numbers, files, steps, comparisons, choices) rather than paragraphs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@celljs/ta-protocol": "4.
|
|
30
|
-
"@celljs/ta-web": "4.
|
|
29
|
+
"@celljs/ta-protocol": "4.13.0",
|
|
30
|
+
"@celljs/ta-web": "4.13.0",
|
|
31
31
|
"@types/react": "^19.3.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -141,10 +141,10 @@ function change(item) {
|
|
|
141
141
|
...note ? { note } : {}
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function step(item) {
|
|
144
|
+
function step(item, partial) {
|
|
145
145
|
const value = object(item);
|
|
146
|
-
const shown = text(value?.text ?? value?.label ?? item);
|
|
147
|
-
return shown ? { text: shown, status: oneOf(value?.status, STEPS) ?? "done" } : undefined;
|
|
146
|
+
const shown = text(value?.text ?? value?.label ?? value?.title ?? item);
|
|
147
|
+
return shown ? { text: shown, status: oneOf(value?.status, STEPS) ?? (partial ? "todo" : "done") } : undefined;
|
|
148
148
|
}
|
|
149
149
|
function option(item) {
|
|
150
150
|
const value = object(item);
|
|
@@ -166,7 +166,11 @@ function note(item) {
|
|
|
166
166
|
const shown = text(value?.text ?? item);
|
|
167
167
|
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function isPath(value) {
|
|
170
|
+
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
171
|
+
}
|
|
172
|
+
var LABELS = { before: "Before", after: "After" };
|
|
173
|
+
function block(item, partial, labels) {
|
|
170
174
|
const value = object(item);
|
|
171
175
|
const type = typeof value?.type === "string" ? value.type.trim().toLowerCase() : undefined;
|
|
172
176
|
const unit = text(value?.unit, 16);
|
|
@@ -176,11 +180,16 @@ function block(item) {
|
|
|
176
180
|
return list.length ? { type, items: list } : undefined;
|
|
177
181
|
}
|
|
178
182
|
case "changes": {
|
|
183
|
+
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
184
|
+
if (raw.length && raw.every((entry) => typeof entry === "string" && !isPath(entry))) {
|
|
185
|
+
const list2 = items(raw, note);
|
|
186
|
+
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
187
|
+
}
|
|
179
188
|
const list = items(value?.items, change);
|
|
180
189
|
return list.length ? { type, items: list } : undefined;
|
|
181
190
|
}
|
|
182
191
|
case "steps": {
|
|
183
|
-
const list = items(value?.items, step);
|
|
192
|
+
const list = items(value?.items, (entry) => step(entry, partial));
|
|
184
193
|
return list.length ? { type, items: list } : undefined;
|
|
185
194
|
}
|
|
186
195
|
case "compare": {
|
|
@@ -192,7 +201,17 @@ function block(item) {
|
|
|
192
201
|
return label && before !== undefined && after !== undefined ? { label, before, after } : undefined;
|
|
193
202
|
});
|
|
194
203
|
const better = oneOf(value?.better, ["lower", "higher"]) ?? "lower";
|
|
195
|
-
|
|
204
|
+
if (list.length) {
|
|
205
|
+
return { type, better, items: list, ...unit ? { unit } : {} };
|
|
206
|
+
}
|
|
207
|
+
const rows = items(value?.items, (entry) => {
|
|
208
|
+
const measure = object(entry);
|
|
209
|
+
const label = text(measure?.label);
|
|
210
|
+
const before = text(measure?.before);
|
|
211
|
+
const after = text(measure?.after);
|
|
212
|
+
return label && (before || after) ? [label, before ?? "", after ?? ""] : undefined;
|
|
213
|
+
});
|
|
214
|
+
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
196
215
|
}
|
|
197
216
|
case "bars": {
|
|
198
217
|
const list = items(value?.items, (entry) => {
|
|
@@ -238,16 +257,27 @@ function block(item) {
|
|
|
238
257
|
return;
|
|
239
258
|
}
|
|
240
259
|
}
|
|
260
|
+
function loose(card) {
|
|
261
|
+
const out = [];
|
|
262
|
+
for (const [key, entries] of Object.entries(card)) {
|
|
263
|
+
const type = key === "files" ? "changes" : key;
|
|
264
|
+
if (Array.isArray(entries) && LISTS.includes(type)) {
|
|
265
|
+
out.push({ type, items: entries, ...type === "options" ? { question: card.question } : {} });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
var LISTS = ["stats", "changes", "steps", "flow", "options", "notes", "next"];
|
|
241
271
|
var GlanceSpec;
|
|
242
272
|
((GlanceSpec) => {
|
|
243
|
-
function read(value) {
|
|
273
|
+
function read(value, partial = false, labels = LABELS) {
|
|
244
274
|
const card = object(value);
|
|
245
275
|
if (!card) {
|
|
246
276
|
return;
|
|
247
277
|
}
|
|
248
278
|
const status = oneOf(card.status, STATUSES);
|
|
249
279
|
const title = text(card.title);
|
|
250
|
-
const blocks = items(card.blocks, block).slice(0, BLOCKS);
|
|
280
|
+
const blocks = items(Array.isArray(card.blocks) ? card.blocks : loose(card), (entry) => block(entry, partial, labels)).slice(0, BLOCKS);
|
|
251
281
|
if (!blocks.length && !title) {
|
|
252
282
|
return;
|
|
253
283
|
}
|
|
@@ -298,6 +328,11 @@ var GlanceWords;
|
|
|
298
328
|
return language === "zh-CN" ? ZH : EN;
|
|
299
329
|
}
|
|
300
330
|
GlanceWords.of = of;
|
|
331
|
+
function picked(answer, labels) {
|
|
332
|
+
const said = answer.trim();
|
|
333
|
+
return labels.find((label) => said === label || said === format(EN.pick, { label }) || said === format(ZH.pick, { label }));
|
|
334
|
+
}
|
|
335
|
+
GlanceWords.picked = picked;
|
|
301
336
|
function format(text2, values) {
|
|
302
337
|
return text2.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
303
338
|
}
|
|
@@ -327,6 +362,8 @@ function count(value) {
|
|
|
327
362
|
function glanceCard(pi) {
|
|
328
363
|
const icons = pi.ui.icons;
|
|
329
364
|
const Markdown = pi.ui.Markdown;
|
|
365
|
+
const Reply = React.createContext(undefined);
|
|
366
|
+
const Answer = React.createContext({ known: false });
|
|
330
367
|
function Text({ text: text2 }) {
|
|
331
368
|
return MARKS.test(text2) ? /* @__PURE__ */ React.createElement("span", {
|
|
332
369
|
className: "tag-inline"
|
|
@@ -355,7 +392,9 @@ function glanceCard(pi) {
|
|
|
355
392
|
text: item.value
|
|
356
393
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
357
394
|
className: "tag-stat-label"
|
|
358
|
-
}, /* @__PURE__ */ React.createElement(
|
|
395
|
+
}, item.tone && !item.delta && /* @__PURE__ */ React.createElement("i", {
|
|
396
|
+
className: "tag-tone-dot"
|
|
397
|
+
}), /* @__PURE__ */ React.createElement(Text, {
|
|
359
398
|
text: item.label
|
|
360
399
|
}), item.delta && /* @__PURE__ */ React.createElement("span", {
|
|
361
400
|
className: "tag-delta"
|
|
@@ -447,7 +486,7 @@ function glanceCard(pi) {
|
|
|
447
486
|
return /* @__PURE__ */ React.createElement("div", {
|
|
448
487
|
className: "tag-compare"
|
|
449
488
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
450
|
-
className: "tag-legend"
|
|
489
|
+
className: "tag-section-head tag-legend"
|
|
451
490
|
}, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("i", {
|
|
452
491
|
"data-bar": "before"
|
|
453
492
|
}), words.before), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("i", {
|
|
@@ -506,8 +545,9 @@ function glanceCard(pi) {
|
|
|
506
545
|
function Flow({ block: block2 }) {
|
|
507
546
|
return /* @__PURE__ */ React.createElement("div", {
|
|
508
547
|
className: "tag-flow"
|
|
509
|
-
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement(
|
|
510
|
-
key: index
|
|
548
|
+
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement("span", {
|
|
549
|
+
key: index,
|
|
550
|
+
className: "tag-flow-step"
|
|
511
551
|
}, index > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
512
552
|
className: "tag-flow-arrow",
|
|
513
553
|
"aria-hidden": "true"
|
|
@@ -536,16 +576,26 @@ function glanceCard(pi) {
|
|
|
536
576
|
}))))))));
|
|
537
577
|
}
|
|
538
578
|
function Options({ block: block2, words, closed }) {
|
|
539
|
-
const [
|
|
579
|
+
const [tapped, setChosen] = React.useState();
|
|
580
|
+
const send = React.useContext(Reply);
|
|
581
|
+
const answer = React.useContext(Answer);
|
|
582
|
+
const said = answer.text === undefined ? undefined : GlanceWords.picked(answer.text, block2.items.map((item) => item.label));
|
|
583
|
+
const chosen = tapped ?? said;
|
|
584
|
+
const done = chosen !== undefined || answer.text !== undefined;
|
|
585
|
+
const pending = answer.known && closed && !done;
|
|
540
586
|
const choose = (label) => {
|
|
587
|
+
if (!send) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
541
590
|
setChosen(label);
|
|
542
|
-
|
|
591
|
+
send(GlanceWords.format(words.pick, { label })).catch((error) => {
|
|
543
592
|
setChosen(undefined);
|
|
544
593
|
pi.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
545
594
|
});
|
|
546
595
|
};
|
|
547
596
|
return /* @__PURE__ */ React.createElement("div", {
|
|
548
|
-
className: "tag-options-block"
|
|
597
|
+
className: "tag-options-block",
|
|
598
|
+
"data-pending": pending || undefined
|
|
549
599
|
}, block2.question && /* @__PURE__ */ React.createElement("div", {
|
|
550
600
|
className: "tag-question"
|
|
551
601
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
@@ -559,7 +609,7 @@ function glanceCard(pi) {
|
|
|
559
609
|
className: "tag-option",
|
|
560
610
|
"data-recommended": item.recommended || undefined,
|
|
561
611
|
"data-chosen": picked || undefined,
|
|
562
|
-
"data-other":
|
|
612
|
+
"data-other": done && !picked || undefined
|
|
563
613
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
564
614
|
className: "tag-option-main"
|
|
565
615
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -588,8 +638,8 @@ function glanceCard(pi) {
|
|
|
588
638
|
text: point
|
|
589
639
|
}))))), /* @__PURE__ */ React.createElement("button", {
|
|
590
640
|
type: "button",
|
|
591
|
-
className: `ta-button tag-choose${item.recommended && !
|
|
592
|
-
disabled: !closed ||
|
|
641
|
+
className: `ta-button tag-choose${item.recommended && !done ? " ta-primary" : ""}`,
|
|
642
|
+
disabled: !closed || !send || done,
|
|
593
643
|
onClick: () => choose(item.label)
|
|
594
644
|
}, picked && /* @__PURE__ */ React.createElement(Icon, {
|
|
595
645
|
name: "Check",
|
|
@@ -614,14 +664,15 @@ function glanceCard(pi) {
|
|
|
614
664
|
})))));
|
|
615
665
|
}
|
|
616
666
|
function Next({ block: block2, closed }) {
|
|
667
|
+
const send = React.useContext(Reply);
|
|
617
668
|
return /* @__PURE__ */ React.createElement("div", {
|
|
618
669
|
className: "tag-next"
|
|
619
670
|
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement("button", {
|
|
620
671
|
key: index,
|
|
621
672
|
type: "button",
|
|
622
673
|
className: "tag-chip",
|
|
623
|
-
disabled: !closed,
|
|
624
|
-
onClick: () => void pi.
|
|
674
|
+
disabled: !closed || !send,
|
|
675
|
+
onClick: () => void send?.(item).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"))
|
|
625
676
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
626
677
|
name: "CornerDownRight",
|
|
627
678
|
size: 13
|
|
@@ -637,7 +688,7 @@ function glanceCard(pi) {
|
|
|
637
688
|
"aria-expanded": open,
|
|
638
689
|
onClick: () => setOpen(!open)
|
|
639
690
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
640
|
-
name:
|
|
691
|
+
name: "ChevronRight",
|
|
641
692
|
size: 14
|
|
642
693
|
}), /* @__PURE__ */ React.createElement("span", null, block2.title ?? words.details)), open && /* @__PURE__ */ React.createElement("div", {
|
|
643
694
|
className: "tag-details-body"
|
|
@@ -721,9 +772,13 @@ ${block2.mermaid}
|
|
|
721
772
|
text: card.title
|
|
722
773
|
})));
|
|
723
774
|
}
|
|
724
|
-
return function GlanceCard(
|
|
775
|
+
return function GlanceCard(props) {
|
|
776
|
+
const { code, closed } = props;
|
|
777
|
+
const send = "send" in props ? props.send : pi.sendUserMessage;
|
|
778
|
+
const known = "answer" in props;
|
|
779
|
+
const answer = React.useMemo(() => ({ known, text: props.answer }), [known, props.answer]);
|
|
725
780
|
const words = GlanceWords.of(pi.ui.language);
|
|
726
|
-
const card = React.useMemo(() => GlanceSpec.read(GlanceJson.parse(code, !closed)), [code, closed]);
|
|
781
|
+
const card = React.useMemo(() => GlanceSpec.read(GlanceJson.parse(code, !closed), !closed, words), [code, closed, words]);
|
|
727
782
|
if (!card) {
|
|
728
783
|
return closed ? /* @__PURE__ */ React.createElement(Markdown, {
|
|
729
784
|
text: `\`\`\`json
|
|
@@ -735,7 +790,11 @@ ${code}
|
|
|
735
790
|
className: "ta-spinner"
|
|
736
791
|
}), /* @__PURE__ */ React.createElement("span", null, words.writing));
|
|
737
792
|
}
|
|
738
|
-
return /* @__PURE__ */ React.createElement(
|
|
793
|
+
return /* @__PURE__ */ React.createElement(Reply.Provider, {
|
|
794
|
+
value: send
|
|
795
|
+
}, /* @__PURE__ */ React.createElement(Answer.Provider, {
|
|
796
|
+
value: answer
|
|
797
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
739
798
|
className: "tag-card",
|
|
740
799
|
"data-streaming": !closed || undefined
|
|
741
800
|
}, /* @__PURE__ */ React.createElement(Head, {
|
|
@@ -749,164 +808,250 @@ ${code}
|
|
|
749
808
|
block: block2,
|
|
750
809
|
words,
|
|
751
810
|
closed
|
|
752
|
-
}))));
|
|
811
|
+
}))))));
|
|
753
812
|
};
|
|
754
813
|
}
|
|
755
814
|
|
|
756
815
|
// web-src/glance-protocol.ts
|
|
757
816
|
var LANGUAGE = "ta-glance";
|
|
817
|
+
var ALIASES = ["glance", "glance-choice"];
|
|
758
818
|
|
|
759
819
|
// web-src/style.ts
|
|
760
820
|
var STYLE = `
|
|
761
|
-
/*
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
821
|
+
/*
|
|
822
|
+
* A card of a reply (\`\`\`ta-glance): parts one under another, a hairline between them. Its sizes follow the font
|
|
823
|
+
* scale of the conversation, and its layout the width of the card itself (a container), not the screen's, so that it
|
|
824
|
+
* reads the same in a phone, in the workbench and in a wide window.
|
|
825
|
+
* --tag-x / --tag-y the padding of a part (12 / 10 when narrow); tables and diagrams reach the edges with them
|
|
826
|
+
* --tag-lh the line of body text; marks (kinds, steps, notes) are centred on its first line
|
|
827
|
+
* --tag-mark the size of those marks
|
|
828
|
+
* Radii: the card 12, a box in it 8, a node 6, a letter 4, chips and pills round.
|
|
829
|
+
*/
|
|
830
|
+
.tag-card {
|
|
831
|
+
--tag-s: var(--ta-font-scale, 1);
|
|
832
|
+
--tag-x: 14px;
|
|
833
|
+
--tag-y: 12px;
|
|
834
|
+
--tag-text: calc(13px * var(--tag-s));
|
|
835
|
+
--tag-small: calc(12px * var(--tag-s));
|
|
836
|
+
--tag-tiny: calc(11px * var(--tag-s));
|
|
837
|
+
--tag-lh: calc(19.5px * var(--tag-s));
|
|
838
|
+
--tag-mark: calc(16px * var(--tag-s));
|
|
839
|
+
--tag-mark-top: calc((var(--tag-lh) - var(--tag-mark)) / 2);
|
|
840
|
+
--tag-line: var(--ta-border-muted);
|
|
841
|
+
container: tag-card / inline-size;
|
|
842
|
+
position: relative;
|
|
843
|
+
margin: 2px 0 12px;
|
|
844
|
+
border: 1px solid var(--ta-border);
|
|
845
|
+
border-radius: 12px;
|
|
846
|
+
background: var(--ta-card);
|
|
847
|
+
overflow: hidden;
|
|
848
|
+
font-size: var(--tag-text);
|
|
849
|
+
line-height: 1.5;
|
|
850
|
+
color: var(--ta-text);
|
|
851
|
+
overflow-wrap: anywhere;
|
|
852
|
+
text-align: left;
|
|
853
|
+
}
|
|
854
|
+
@container tag-card (max-width: 400px) { .tag-card > * { --tag-x: 12px; --tag-y: 10px; } }
|
|
855
|
+
.tag-card > * + * { border-top: 1px solid var(--tag-line); }
|
|
770
856
|
.tag-card ul, .tag-card ol { margin: 0; padding: 0; list-style: none; }
|
|
771
857
|
.tag-card li { margin: 0; }
|
|
772
|
-
.tag-
|
|
773
|
-
.tag-
|
|
858
|
+
.tag-card button { font-family: inherit; }
|
|
859
|
+
.tag-part { padding: var(--tag-y) var(--tag-x); min-width: 0; }
|
|
860
|
+
.tag-card[data-streaming] > .tag-part:last-child { animation: ta-in 200ms var(--ta-ease, ease) both; }
|
|
861
|
+
.tag-writing { display: flex; align-items: center; gap: 8px; padding: var(--tag-y) var(--tag-x); color: var(--ta-muted); font-size: var(--tag-small); }
|
|
862
|
+
.tag-inline .ta-markdown, .tag-inline .ta-markdown > p { display: inline; margin: 0; }
|
|
863
|
+
.tag-inline .ta-markdown :not(pre) > code { padding: 0 4px; font-size: 0.92em; }
|
|
864
|
+
.tag-num { font-variant-numeric: tabular-nums; }
|
|
865
|
+
|
|
866
|
+
/* The head: how it went, as a pill, and a title beside it that wraps under it when long */
|
|
867
|
+
.tag-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: var(--tag-y) var(--tag-x) 0; }
|
|
868
|
+
.tag-card > .tag-head + .tag-part { border-top: 0; padding-top: 8px; }
|
|
869
|
+
/* A table or a diagram reaches the edges: under the head it keeps the hairline, a gap above it */
|
|
870
|
+
.tag-card > .tag-head + .tag-part:is([data-type='table'], [data-type='diagram']) { margin-top: var(--tag-y); padding-top: 0; border-top: 1px solid var(--tag-line); }
|
|
871
|
+
.tag-title { flex: 1 1 14em; min-width: 0; font-weight: 600; font-size: calc(14px * var(--tag-s)); line-height: 1.45; color: var(--ta-text); }
|
|
872
|
+
.tag-status { --tag-tone: var(--ta-muted); flex: none; display: inline-flex; align-items: center; gap: 6px; height: calc(22px * var(--tag-s)); padding: 0 9px; border-radius: 999px; font-size: var(--tag-small); font-weight: 600; line-height: 1; white-space: nowrap; color: var(--tag-tone); background: color-mix(in srgb, var(--tag-tone) 12%, transparent); }
|
|
774
873
|
.tag-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
|
|
775
874
|
.tag-status[data-status='done'] { --tag-tone: var(--ta-green); }
|
|
776
|
-
.tag-status[data-status='partial']
|
|
875
|
+
.tag-status[data-status='partial'] { --tag-tone: var(--ta-yellow); }
|
|
876
|
+
/* Needs you: the blue of what waits for the user, as the ? of the list of chats. */
|
|
877
|
+
.tag-status[data-status='blocked'] { --tag-tone: var(--ta-blue); }
|
|
777
878
|
.tag-status[data-status='failed'] { --tag-tone: var(--ta-red); }
|
|
778
|
-
|
|
879
|
+
|
|
880
|
+
/* What a part is about, in small muted type above it */
|
|
881
|
+
.tag-section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 6px; color: var(--ta-muted); font-size: var(--tag-small); line-height: 1.4; }
|
|
882
|
+
.tag-section-head > span { display: inline-flex; align-items: center; gap: 5px; }
|
|
779
883
|
.tag-add { color: var(--ta-green); font-variant-numeric: tabular-nums; }
|
|
780
884
|
.tag-del { color: var(--ta-red); font-variant-numeric: tabular-nums; }
|
|
781
|
-
.tag-delta { margin-left: 6px; font-size:
|
|
782
|
-
[data-tone='good'] > .tag-stat-label > .tag-delta
|
|
783
|
-
[data-tone='bad'] > .tag-stat-label > .tag-delta
|
|
885
|
+
.tag-delta { margin-left: 6px; font-size: var(--tag-small); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ta-muted); }
|
|
886
|
+
.tag-delta[data-tone='good'], [data-tone='good'] > .tag-stat-label > .tag-delta { color: var(--ta-green); }
|
|
887
|
+
.tag-delta[data-tone='bad'], [data-tone='bad'] > .tag-stat-label > .tag-delta { color: var(--ta-red); }
|
|
784
888
|
[data-tone='warn'] > .tag-stat-label > .tag-delta { color: var(--ta-yellow); }
|
|
785
889
|
|
|
786
|
-
/* Key numbers: large, their names under them */
|
|
787
|
-
.tag-stats { --tag-columns: 3; display: grid; grid-template-columns: repeat(var(--tag-columns), minmax(0, 1fr)); gap:
|
|
890
|
+
/* Key numbers: large, their names under them; as many in a row as the card holds well */
|
|
891
|
+
.tag-stats { --tag-columns: 3; display: grid; grid-template-columns: repeat(var(--tag-columns), minmax(0, 1fr)); gap: 8px; }
|
|
788
892
|
.tag-stats[data-count='1'] { --tag-columns: 1; }
|
|
789
893
|
.tag-stats[data-count='2'], .tag-stats[data-count='4'] { --tag-columns: 2; }
|
|
790
|
-
@container (min-width:
|
|
791
|
-
@container (
|
|
792
|
-
.tag-
|
|
793
|
-
|
|
794
|
-
.tag-stat
|
|
795
|
-
.tag-stat
|
|
796
|
-
|
|
797
|
-
.tag-stat-label { margin-top: 2px; color: var(--ta-muted); font-size:
|
|
894
|
+
@container tag-card (min-width: 480px) { .tag-stats[data-count='4'] { --tag-columns: 4; } }
|
|
895
|
+
@container tag-card (min-width: 640px) { .tag-stats[data-count='5'] { --tag-columns: 5; } }
|
|
896
|
+
@container tag-card (max-width: 400px) { .tag-stats[data-count='5'], .tag-stats[data-count='6'] { --tag-columns: 2; } .tag-stats { gap: 6px; } .tag-stat { padding: 8px 10px; } }
|
|
897
|
+
@container tag-card (max-width: 300px) { .tag-stats[data-count='3'] { --tag-columns: 2; } }
|
|
898
|
+
.tag-stat { min-width: 0; padding: 10px 12px; border-radius: 8px; background: var(--ta-raised); }
|
|
899
|
+
.tag-stat-value { font-size: calc(20px * var(--tag-s)); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ta-text); }
|
|
900
|
+
@container tag-card (max-width: 400px) { .tag-stat-value { font-size: calc(18px * var(--tag-s)); } }
|
|
901
|
+
.tag-stat-label { margin-top: 2px; color: var(--ta-muted); font-size: var(--tag-small); line-height: 1.4; }
|
|
902
|
+
.tag-tone-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; vertical-align: 0.1em; background: var(--ta-muted); }
|
|
903
|
+
[data-tone='good'] > .tag-stat-label > .tag-tone-dot { background: var(--ta-green); }
|
|
904
|
+
[data-tone='bad'] > .tag-stat-label > .tag-tone-dot { background: var(--ta-red); }
|
|
905
|
+
[data-tone='warn'] > .tag-stat-label > .tag-tone-dot { background: var(--ta-yellow); }
|
|
798
906
|
|
|
799
|
-
/*
|
|
800
|
-
.tag-change
|
|
801
|
-
.tag-
|
|
802
|
-
|
|
907
|
+
/* Rows with a mark: the mark on the first line of the text, whatever the font size */
|
|
908
|
+
.tag-change, .tag-step, .tag-notes li { padding: 3px 0; }
|
|
909
|
+
.tag-kind, .tag-step-mark, .tag-note-mark { flex: none; box-sizing: border-box; width: var(--tag-mark); height: var(--tag-mark); margin-top: var(--tag-mark-top); }
|
|
910
|
+
|
|
911
|
+
/* Files: a letter of what happened, the name and its folder, the lines, the squares of a forge */
|
|
912
|
+
.tag-change { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 8px; }
|
|
913
|
+
.tag-kind { display: inline-grid; place-items: center; border-radius: 4px; font: 600 calc(10px * var(--tag-s)) / 1 var(--ta-mono, ui-monospace, monospace); color: var(--ta-blue); background: color-mix(in srgb, currentColor 14%, transparent); }
|
|
803
914
|
.tag-kind[data-kind='add'] { color: var(--ta-green); }
|
|
804
915
|
.tag-kind[data-kind='delete'] { color: var(--ta-red); }
|
|
805
|
-
.tag-change-path {
|
|
806
|
-
.tag-change-file { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
|
|
807
|
-
.tag-change-name { flex:
|
|
808
|
-
.tag-change-name .ta-markdown a { color: var(--ta-text); }
|
|
809
|
-
.tag-change-
|
|
916
|
+
.tag-change-path { min-width: 0; }
|
|
917
|
+
.tag-change-file { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; line-height: var(--tag-lh); }
|
|
918
|
+
.tag-change-name { flex: 0 1 auto; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
|
|
919
|
+
.tag-change-name .ta-markdown :is(a, .ta-link-path) { color: var(--ta-text); }
|
|
920
|
+
.tag-change-name :is(a, button) { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
|
|
921
|
+
.tag-change-dir { flex: 1 1 7em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; color: var(--ta-muted); font-size: var(--tag-small); line-height: 1.4; }
|
|
810
922
|
.tag-change-dir bdi { direction: ltr; unicode-bidi: isolate; }
|
|
811
|
-
.tag-change-note { color: var(--ta-muted); font-size:
|
|
812
|
-
.tag-change-count { display: inline-flex; align-items: center;
|
|
923
|
+
.tag-change-note { margin-top: 1px; color: var(--ta-muted); font-size: var(--tag-small); line-height: 1.45; }
|
|
924
|
+
.tag-change-count { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; height: var(--tag-lh); font-size: var(--tag-small); white-space: nowrap; }
|
|
813
925
|
.tag-squares { display: inline-flex; gap: 2px; }
|
|
814
|
-
.tag-squares i { width: 7px; height: 7px; border-radius: 1.5px; background: var(--ta-border); }
|
|
926
|
+
.tag-squares i { width: calc(7px * var(--tag-s)); height: calc(7px * var(--tag-s)); border-radius: 1.5px; background: var(--ta-border); }
|
|
815
927
|
.tag-squares i[data-kind='add'] { background: var(--ta-green); }
|
|
816
928
|
.tag-squares i[data-kind='del'] { background: var(--ta-red); }
|
|
929
|
+
@container tag-card (max-width: 400px) { .tag-squares { display: none; } }
|
|
817
930
|
|
|
818
|
-
/* Steps: marks on a thread */
|
|
819
|
-
.tag-
|
|
820
|
-
.tag-step { position:
|
|
821
|
-
.tag-step
|
|
822
|
-
.tag-step-mark {
|
|
931
|
+
/* Steps: marks on a thread; the thread is green where the steps are done */
|
|
932
|
+
.tag-step { position: relative; display: flex; gap: 10px; }
|
|
933
|
+
.tag-step:not(:last-child)::after { content: ''; position: absolute; left: calc(var(--tag-mark) / 2 - 0.5px); width: 1px; top: calc(3px + var(--tag-mark-top) + var(--tag-mark) + 2px); bottom: calc(2px - 3px - var(--tag-mark-top)); background: var(--ta-border); }
|
|
934
|
+
.tag-step[data-status='done']:not(:last-child)::after { background: color-mix(in srgb, var(--ta-green) 45%, var(--ta-border)); }
|
|
935
|
+
.tag-step-mark { display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--ta-border-field); color: var(--ta-card); }
|
|
936
|
+
.tag-step-mark svg { width: calc(10px * var(--tag-s)); height: calc(10px * var(--tag-s)); stroke-width: 3; }
|
|
823
937
|
.tag-step[data-status='done'] .tag-step-mark { border: 0; background: var(--ta-green); }
|
|
824
938
|
.tag-step[data-status='failed'] .tag-step-mark { border: 0; background: var(--ta-red); }
|
|
825
|
-
.tag-step[data-status='skipped'] .tag-step-mark { color: var(--ta-muted); }
|
|
939
|
+
.tag-step[data-status='skipped'] .tag-step-mark { border-style: dashed; color: var(--ta-muted); }
|
|
826
940
|
.tag-step[data-status='doing'] .tag-step-mark { border-color: var(--ta-blue); border-top-color: transparent; animation: ta-spin 1s linear infinite; }
|
|
941
|
+
.tag-step-text { flex: 1; min-width: 0; }
|
|
942
|
+
.tag-step[data-status='doing'] .tag-step-text { font-weight: 500; }
|
|
827
943
|
.tag-step[data-status='todo'] .tag-step-text, .tag-step[data-status='skipped'] .tag-step-text { color: var(--ta-muted); }
|
|
828
|
-
.tag-step[data-status='skipped'] .tag-step-text { text-decoration: line-through; }
|
|
829
|
-
.tag-step-text { min-width: 0; overflow-wrap: anywhere; }
|
|
944
|
+
.tag-step[data-status='skipped'] .tag-step-text { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 60%, transparent); }
|
|
830
945
|
|
|
831
|
-
/* Before and after: two bars
|
|
832
|
-
.tag-legend { display:
|
|
833
|
-
.tag-
|
|
834
|
-
.tag-
|
|
835
|
-
.tag-measure
|
|
836
|
-
.tag-measure-
|
|
837
|
-
.tag-measure-label { min-width: 0; overflow-wrap: anywhere; }
|
|
838
|
-
.tag-measure-value { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
946
|
+
/* Before and after: a measure, its numbers, two bars */
|
|
947
|
+
.tag-legend i { display: inline-block; width: 10px; height: 6px; border-radius: 3px; }
|
|
948
|
+
.tag-measure + .tag-measure { margin-top: 10px; }
|
|
949
|
+
.tag-measure-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; }
|
|
950
|
+
.tag-measure-label { flex: 1 1 auto; min-width: 0; }
|
|
951
|
+
.tag-measure-value { margin-left: auto; color: var(--ta-muted); font-size: var(--tag-small); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
839
952
|
.tag-measure-value b { color: var(--ta-text); font-weight: 600; }
|
|
840
|
-
.tag-track {
|
|
841
|
-
.tag-track
|
|
842
|
-
|
|
843
|
-
.tag-
|
|
844
|
-
|
|
845
|
-
[data-bar='
|
|
953
|
+
.tag-measure .tag-track { height: 5px; background: none; }
|
|
954
|
+
.tag-measure .tag-track + .tag-track { margin-top: 3px; }
|
|
955
|
+
.tag-measure-head + .tag-track { margin-top: 5px; }
|
|
956
|
+
.tag-track { display: block; height: 6px; border-radius: 3px; background: var(--ta-hover); overflow: hidden; }
|
|
957
|
+
.tag-track i { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--ta-accent); transition: width 0.4s var(--ta-ease, ease); }
|
|
958
|
+
.tag-track i[data-bar='before'], .tag-legend i[data-bar='before'] { background: var(--ta-border-field); }
|
|
959
|
+
.tag-legend i[data-bar='after'], .tag-track i[data-bar='after'][data-tone='good'] { background: var(--ta-green); }
|
|
960
|
+
.tag-track i[data-bar='after'][data-tone='bad'] { background: var(--ta-red); }
|
|
961
|
+
.tag-track i[data-bar='after'][data-tone='neutral'] { background: var(--ta-secondary); }
|
|
846
962
|
|
|
847
|
-
/* Amounts side by side */
|
|
848
|
-
.tag-bars { display: grid; grid-template-columns: minmax(0, max-content) minmax(
|
|
963
|
+
/* Amounts side by side: label, bar, value in a row; when narrow, the bar under its label and value */
|
|
964
|
+
.tag-bars { display: grid; grid-template-columns: minmax(0, max-content) minmax(64px, 1fr) auto; align-items: center; gap: 8px 12px; }
|
|
849
965
|
.tag-bar { display: contents; }
|
|
850
|
-
.tag-bar-label { min-width: 0;
|
|
851
|
-
.tag-bar .tag-track {
|
|
852
|
-
.tag-bar-
|
|
966
|
+
.tag-bar-label { min-width: 0; max-width: 16em; line-height: 1.4; }
|
|
967
|
+
.tag-bar .tag-track { height: 6px; }
|
|
968
|
+
.tag-bar .tag-track i { background: var(--ta-blue); }
|
|
969
|
+
.tag-bar-value { text-align: right; color: var(--ta-muted); font-size: var(--tag-small); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
970
|
+
@container tag-card (max-width: 400px) {
|
|
971
|
+
.tag-bars { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
|
|
972
|
+
.tag-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 12px; }
|
|
973
|
+
.tag-bar-label { max-width: none; grid-area: 1 / 1; }
|
|
974
|
+
.tag-bar-value { grid-area: 1 / 2; }
|
|
975
|
+
.tag-bar .tag-track { grid-area: 2 / 1 / 3 / 3; }
|
|
976
|
+
}
|
|
853
977
|
|
|
854
|
-
/* A path:
|
|
855
|
-
.tag-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px
|
|
856
|
-
.tag-flow-
|
|
857
|
-
.tag-flow-
|
|
858
|
-
.tag-
|
|
859
|
-
.tag-
|
|
978
|
+
/* A path: nodes and arrows; an arrow keeps to the node after it, so that no line ends with one */
|
|
979
|
+
.tag-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
|
|
980
|
+
.tag-flow-step { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
|
|
981
|
+
.tag-flow-node { min-width: 0; padding: 2px 10px; border: 1px solid var(--ta-border); border-radius: 6px; background: var(--ta-raised); line-height: var(--tag-lh); }
|
|
982
|
+
.tag-flow-arrow { flex: none; display: inline-flex; color: var(--ta-muted); }
|
|
983
|
+
.tag-flow-arrow svg { width: calc(13px * var(--tag-s)); height: calc(13px * var(--tag-s)); }
|
|
984
|
+
|
|
985
|
+
/* A table and a diagram reach the edges of the card, their columns lined up with the text above */
|
|
986
|
+
.tag-card > .tag-part[data-type='table'], .tag-card > .tag-part[data-type='diagram'] { padding: 0; }
|
|
860
987
|
.tag-card .tag-table { margin: 0; border: 0; border-radius: 0; }
|
|
861
|
-
.tag-card .tag-table
|
|
862
|
-
.tag-card .tag-table th
|
|
863
|
-
.tag-card .tag-table th:
|
|
988
|
+
.tag-card .tag-table table { font-size: var(--tag-text); }
|
|
989
|
+
.tag-card .tag-table th, .tag-card .tag-table td { padding: 7px 10px; }
|
|
990
|
+
.tag-card .tag-table th:first-child, .tag-card .tag-table td:first-child { padding-left: var(--tag-x); }
|
|
991
|
+
.tag-card .tag-table th:last-child, .tag-card .tag-table td:last-child { padding-right: var(--tag-x); }
|
|
992
|
+
.tag-card .tag-table th { font-size: var(--tag-small); color: var(--ta-secondary); }
|
|
993
|
+
.tag-card .ta-mermaid { margin: 0; border: 0; border-radius: 0; background: transparent; }
|
|
994
|
+
.tag-card .ta-mermaid .ta-code-bar { padding-left: var(--tag-x); padding-right: calc(var(--tag-x) - 4px); }
|
|
995
|
+
.tag-card .ta-markdown:has(> .ta-mermaid) { margin: 0; }
|
|
864
996
|
|
|
865
|
-
/* Choices: a
|
|
997
|
+
/* Choices: a box each, a button that answers; when narrow, the button under its choice */
|
|
866
998
|
.tag-question { margin-bottom: 8px; font-weight: 600; }
|
|
867
999
|
.tag-options { display: flex; flex-direction: column; gap: 8px; }
|
|
868
|
-
.tag-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ta-border); border-radius:
|
|
869
|
-
.tag-option-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap:
|
|
870
|
-
.tag-option[data-recommended] { border-color: color-mix(in srgb, var(--ta-green)
|
|
1000
|
+
.tag-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ta-border); border-radius: 8px; transition: opacity 0.2s, border-color 0.2s, box-shadow 0.2s; }
|
|
1001
|
+
.tag-option-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
1002
|
+
.tag-option[data-recommended] { border-color: color-mix(in srgb, var(--ta-green) 50%, var(--ta-border)); background: color-mix(in srgb, var(--ta-green) 4%, transparent); }
|
|
871
1003
|
.tag-option[data-chosen] { border-color: var(--ta-green); box-shadow: 0 0 0 1px var(--ta-green) inset; }
|
|
872
1004
|
.tag-option[data-other] { opacity: 0.5; }
|
|
873
|
-
|
|
874
|
-
.tag-
|
|
875
|
-
.tag-
|
|
876
|
-
.tag-
|
|
877
|
-
.tag-
|
|
878
|
-
.tag-
|
|
1005
|
+
/* Choices that wait for the user: the card is framed in blue and its question marked with the ? of the list, until they answer. */
|
|
1006
|
+
.tag-card:has(.tag-options-block[data-pending]) { border-color: color-mix(in srgb, var(--ta-blue) 55%, var(--ta-border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ta-blue) 22%, transparent); }
|
|
1007
|
+
.tag-options-block[data-pending] > .tag-question { display: flex; align-items: center; gap: 6px; }
|
|
1008
|
+
.tag-options-block[data-pending] > .tag-question::before { content: '?'; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ta-blue); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
|
|
1009
|
+
.tag-option-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
|
|
1010
|
+
.tag-option-label { font-weight: 600; }
|
|
1011
|
+
.tag-badge { flex: none; padding: 0 6px; border-radius: 999px; font-size: var(--tag-tiny); line-height: calc(18px * var(--tag-s)); font-weight: 600; white-space: nowrap; color: var(--ta-green); background: color-mix(in srgb, var(--ta-green) 13%, transparent); }
|
|
1012
|
+
.tag-option-detail { color: var(--ta-secondary); font-size: var(--tag-small); line-height: 1.45; }
|
|
1013
|
+
.tag-points { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: var(--tag-small); line-height: 1.45; color: var(--ta-secondary); }
|
|
879
1014
|
.tag-points span::before { margin-right: 3px; font-weight: 700; }
|
|
880
1015
|
.tag-points span[data-tone='good']::before { content: '+'; color: var(--ta-green); }
|
|
881
1016
|
.tag-points span[data-tone='bad']::before { content: '−'; color: var(--ta-red); }
|
|
882
1017
|
.tag-choose { flex: none; display: inline-flex; align-items: center; gap: 4px; }
|
|
1018
|
+
@container tag-card (max-width: 400px) {
|
|
1019
|
+
.tag-option { flex-direction: column; align-items: stretch; gap: 10px; }
|
|
1020
|
+
.tag-choose { width: 100%; }
|
|
1021
|
+
}
|
|
883
1022
|
|
|
884
1023
|
/* Risks, notes, what to do */
|
|
885
|
-
.tag-notes {
|
|
886
|
-
.tag-notes li
|
|
887
|
-
.tag-
|
|
888
|
-
.tag-note-mark {
|
|
1024
|
+
.tag-notes li { display: flex; gap: 8px; }
|
|
1025
|
+
.tag-notes li > span:last-child { flex: 1; min-width: 0; }
|
|
1026
|
+
.tag-note-mark { display: inline-grid; place-items: center; color: var(--ta-muted); }
|
|
1027
|
+
.tag-note-mark svg { width: calc(14px * var(--tag-s)); height: calc(14px * var(--tag-s)); }
|
|
889
1028
|
.tag-notes li[data-tone='risk'] .tag-note-mark { color: var(--ta-yellow); }
|
|
890
1029
|
.tag-notes li[data-tone='todo'] .tag-note-mark { color: var(--ta-blue); }
|
|
891
1030
|
|
|
892
1031
|
/* What to ask next: chips that send it */
|
|
893
1032
|
.tag-next { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
894
|
-
.tag-chip { display: inline-flex; align-items: center; gap:
|
|
895
|
-
.tag-chip svg { flex: none; color: var(--ta-muted); }
|
|
896
|
-
.tag-chip:hover:not(:disabled) { background: var(--ta-hover); }
|
|
1033
|
+
.tag-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: calc(28px * var(--tag-s)); padding: 3px 12px 3px 10px; border: 1px solid var(--ta-border); border-radius: 999px; background: transparent; color: var(--ta-text); font-size: var(--tag-small); line-height: 1.4; cursor: pointer; text-align: left; transition: background 120ms, border-color 120ms; }
|
|
1034
|
+
.tag-chip svg { flex: none; width: calc(13px * var(--tag-s)); height: calc(13px * var(--tag-s)); color: var(--ta-muted); }
|
|
897
1035
|
.tag-chip:disabled { opacity: 0.5; cursor: default; }
|
|
898
|
-
.tag-part[data-type='next'] { padding-top:
|
|
1036
|
+
.tag-part[data-type='next'] { padding-top: calc(var(--tag-y) - 2px); padding-bottom: calc(var(--tag-y) - 2px); }
|
|
899
1037
|
|
|
900
1038
|
/* Details, folded */
|
|
901
1039
|
.tag-part[data-type='details'] { padding-top: 8px; padding-bottom: 8px; }
|
|
902
|
-
.tag-details-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--ta-muted); font
|
|
903
|
-
.tag-details-toggle
|
|
904
|
-
.tag-details-
|
|
1040
|
+
.tag-details-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: calc(24px * var(--tag-s)); margin-left: -4px; padding: 0 6px 0 4px; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); font-size: var(--tag-small); cursor: pointer; transition: color 120ms, background 120ms; }
|
|
1041
|
+
.tag-details-toggle svg { width: calc(14px * var(--tag-s)); height: calc(14px * var(--tag-s)); transition: transform 150ms var(--ta-ease, ease); }
|
|
1042
|
+
.tag-details-toggle[aria-expanded='true'] svg { transform: rotate(90deg); }
|
|
1043
|
+
.tag-details-body { margin-top: 4px; padding-bottom: 4px; font-size: var(--tag-text); color: var(--ta-body); animation: ta-in 180ms var(--ta-ease, ease); }
|
|
905
1044
|
.tag-details-body .ta-markdown > :last-child { margin-bottom: 0; }
|
|
906
1045
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1046
|
+
@media (hover: hover) {
|
|
1047
|
+
.tag-chip:hover:not(:disabled) { background: var(--ta-hover); border-color: var(--ta-border-field); }
|
|
1048
|
+
.tag-details-toggle:hover { color: var(--ta-text); background: var(--ta-hover); }
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/* Touch: what is tapped is a finger high */
|
|
1052
|
+
[data-touch] .tag-chip { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
|
|
1053
|
+
[data-touch] .tag-choose { height: 36px; }
|
|
1054
|
+
[data-touch] .tag-details-toggle { min-height: 32px; }
|
|
910
1055
|
`;
|
|
911
1056
|
function injectStyle() {
|
|
912
1057
|
const element = document.createElement("style");
|
|
@@ -925,7 +1070,10 @@ function activate(pi) {
|
|
|
925
1070
|
};
|
|
926
1071
|
}
|
|
927
1072
|
const removeStyle = injectStyle();
|
|
928
|
-
|
|
1073
|
+
const card = glanceCard(pi);
|
|
1074
|
+
for (const language of [LANGUAGE, ...ALIASES]) {
|
|
1075
|
+
pi.registerCodeRenderer(language, card);
|
|
1076
|
+
}
|
|
929
1077
|
return removeStyle;
|
|
930
1078
|
}
|
|
931
1079
|
export {
|