@celljs/ta-glance 4.15.2 → 4.16.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 +2 -0
- package/README.md +2 -0
- package/extension/index.mjs +110 -21
- package/package.json +3 -3
- package/web/index.js +330 -34
package/README.en.md
CHANGED
|
@@ -6,6 +6,8 @@ A pi package that comes with Ta (on by default; Settings → Extensions of the w
|
|
|
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
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`).
|
|
8
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.
|
|
9
|
+
- **Charts**: a key number may have a small line of its values over time (`trend`), and a card may have a line chart (`line`, up to 4 series) and the parts of a whole (`share`), drawn in plain SVG, with no library.
|
|
10
|
+
- **Icons**: a key number, a node of a flow, a choice, a note and a thing to ask next may have a lucide icon (`icon`), to tell items apart at a glance; the prompt gives the model 31 common ones and tells it never to write an emoji. An icon the page does not have is not drawn.
|
|
9
11
|
|
|
10
12
|
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`.
|
|
11
13
|
|
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 扩展
|
|
|
6
6
|
- **结果画成卡片**:汇报完成的工作、结果、对比、要你选的方案、多个事实或关系时,Ta 在第一行之后写一个 `ta-glance` 代码块(JSON),Web 把它画成卡片:关键数字、改了的文件(点开)、步骤、前后对比、横条、流程、Mermaid 关系图、表格、可点选的方案、风险与待办、下一步按钮、折叠的细节。卡片随回复流式长出来。
|
|
7
7
|
- **待你决定**:一轮回复以带选项(`options`)或 `status: "blocked"` 的卡片结束时,pi 扩展在会话里记一条 `ta-ask`(`TA_ASK_ENTRY`,模型读不到),对话列表、标签、分身任务和快捷打开就显示这个对话在等你决定,直到你回答(点选或打字都算)。卡片在你回答前用蓝框和问号标出;回答后各设备都显示已选,刷新也保留(`WebCodeRendererProps.answer`)。
|
|
8
8
|
- **别处**:对话列表的预览显示第一行结论;发到微信、企业微信机器人的回复不画卡片,照常是短段落;终端里的 `ta` 回复照旧。外部 Agent(ta-agents)也会拿到这段写法。
|
|
9
|
+
- **图表**:关键数字可以带一条小走势线(`trend`),还有趋势线(`line`,最多 4 条)和占比(`share`),用原生 SVG 画、不加依赖。
|
|
10
|
+
- **图标**:关键数字、流程节点、方案、提示、下一步可以带一个 lucide 图标(`icon`),一眼分清各项说的是什么;提示词给模型 31 个常用图标,并要求不用 emoji。页面没有的图标不画。
|
|
9
11
|
|
|
10
12
|
卡片的格式见 `web-src/glance-protocol.ts`,提示词见 `web-src/glance-prompt.ts`。别的包也能用 `registerCodeRenderer` 为自己的代码块语言画卡片。
|
|
11
13
|
|
package/extension/index.mjs
CHANGED
|
@@ -177,9 +177,44 @@ var GlanceJson;
|
|
|
177
177
|
// web-src/glance-protocol.ts
|
|
178
178
|
var NAME = "@celljs/ta-glance";
|
|
179
179
|
var LANGUAGE = "ta-glance";
|
|
180
|
+
var GLANCE_ICONS = [
|
|
181
|
+
"Zap",
|
|
182
|
+
"Gauge",
|
|
183
|
+
"Timer",
|
|
184
|
+
"Cpu",
|
|
185
|
+
"MemoryStick",
|
|
186
|
+
"HardDrive",
|
|
187
|
+
"TrendingUp",
|
|
188
|
+
"TrendingDown",
|
|
189
|
+
"Code",
|
|
190
|
+
"GitBranch",
|
|
191
|
+
"Bug",
|
|
192
|
+
"FlaskConical",
|
|
193
|
+
"Package",
|
|
194
|
+
"SquareTerminal",
|
|
195
|
+
"Database",
|
|
196
|
+
"Server",
|
|
197
|
+
"Globe",
|
|
198
|
+
"Shield",
|
|
199
|
+
"Lock",
|
|
200
|
+
"KeyRound",
|
|
201
|
+
"Users",
|
|
202
|
+
"MessageCircle",
|
|
203
|
+
"Smartphone",
|
|
204
|
+
"Laptop",
|
|
205
|
+
"Rocket",
|
|
206
|
+
"Wrench",
|
|
207
|
+
"Lightbulb",
|
|
208
|
+
"Coins",
|
|
209
|
+
"Calendar",
|
|
210
|
+
"FileText",
|
|
211
|
+
"Sparkles"
|
|
212
|
+
];
|
|
180
213
|
|
|
181
214
|
// web-src/glance-spec.ts
|
|
182
215
|
var ITEMS = 12;
|
|
216
|
+
var POINTS = 24;
|
|
217
|
+
var SERIES = 4;
|
|
183
218
|
var BLOCKS = 8;
|
|
184
219
|
var TEXT = 400;
|
|
185
220
|
var MARKDOWN = 8000;
|
|
@@ -208,7 +243,7 @@ function oneOf(value, values) {
|
|
|
208
243
|
const lower = typeof value === "string" ? value.trim().toLowerCase() : undefined;
|
|
209
244
|
return values.find((candidate) => candidate === lower);
|
|
210
245
|
}
|
|
211
|
-
function items(value, read) {
|
|
246
|
+
function items(value, read, max = ITEMS) {
|
|
212
247
|
if (!Array.isArray(value)) {
|
|
213
248
|
return [];
|
|
214
249
|
}
|
|
@@ -218,14 +253,41 @@ function items(value, read) {
|
|
|
218
253
|
if (made !== undefined) {
|
|
219
254
|
out.push(made);
|
|
220
255
|
}
|
|
221
|
-
if (out.length ===
|
|
256
|
+
if (out.length === max) {
|
|
222
257
|
break;
|
|
223
258
|
}
|
|
224
259
|
}
|
|
225
260
|
return out;
|
|
226
261
|
}
|
|
262
|
+
function icon(value) {
|
|
263
|
+
if (typeof value !== "string") {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const words = value.trim().replace(/^lucide[:\-_\s]*/i, "").split(/[-_\s.:]+/).filter(Boolean);
|
|
267
|
+
const name = words.map((word) => word[0].toUpperCase() + word.slice(1)).join("");
|
|
268
|
+
return /^[A-Z][A-Za-z0-9]{0,39}$/.test(name) ? name : undefined;
|
|
269
|
+
}
|
|
270
|
+
function withIcon(value) {
|
|
271
|
+
const name = icon(value?.icon);
|
|
272
|
+
return name ? { icon: name } : {};
|
|
273
|
+
}
|
|
227
274
|
function strings(value, max = ITEMS) {
|
|
228
|
-
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text)
|
|
275
|
+
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text), max);
|
|
276
|
+
}
|
|
277
|
+
function numbers(value, max = POINTS) {
|
|
278
|
+
return items(value, number, max);
|
|
279
|
+
}
|
|
280
|
+
function amount(entry) {
|
|
281
|
+
const value = object(entry);
|
|
282
|
+
const label = text(value?.label);
|
|
283
|
+
const shown = number(value?.value);
|
|
284
|
+
return label && shown !== undefined ? { label, value: shown } : undefined;
|
|
285
|
+
}
|
|
286
|
+
function series(entry) {
|
|
287
|
+
const value = object(entry);
|
|
288
|
+
const values = numbers(Array.isArray(entry) ? entry : value?.values ?? value?.data);
|
|
289
|
+
const label = text(value?.label ?? value?.name);
|
|
290
|
+
return values.length ? { values, ...label ? { label } : {} } : undefined;
|
|
229
291
|
}
|
|
230
292
|
function stat(item) {
|
|
231
293
|
const value = object(item);
|
|
@@ -236,11 +298,12 @@ function stat(item) {
|
|
|
236
298
|
}
|
|
237
299
|
const tone = oneOf(value?.tone, TONES);
|
|
238
300
|
const delta = text(value?.delta);
|
|
239
|
-
|
|
301
|
+
const trend = numbers(value?.trend);
|
|
302
|
+
return { label, value: shown, ...tone ? { tone } : {}, ...delta ? { delta } : {}, ...withIcon(value), ...trend.length > 1 ? { trend } : {} };
|
|
240
303
|
}
|
|
241
304
|
function change(item) {
|
|
242
305
|
const value = object(item);
|
|
243
|
-
const path = text(value?.path ?? item);
|
|
306
|
+
const path = text(value?.path ?? value?.file ?? item);
|
|
244
307
|
if (!path) {
|
|
245
308
|
return;
|
|
246
309
|
}
|
|
@@ -273,13 +336,28 @@ function option(item) {
|
|
|
273
336
|
...detail ? { detail } : {},
|
|
274
337
|
pros: strings(value?.pros, 4),
|
|
275
338
|
cons: strings(value?.cons, 4),
|
|
276
|
-
...value?.recommended === true ? { recommended: true } : {}
|
|
339
|
+
...value?.recommended === true ? { recommended: true } : {},
|
|
340
|
+
...withIcon(value)
|
|
277
341
|
};
|
|
278
342
|
}
|
|
279
343
|
function note(item) {
|
|
280
344
|
const value = object(item);
|
|
281
345
|
const shown = text(value?.text ?? item);
|
|
282
|
-
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
346
|
+
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info", ...withIcon(value) } : undefined;
|
|
347
|
+
}
|
|
348
|
+
function listItem(entry) {
|
|
349
|
+
const value = object(entry);
|
|
350
|
+
const shown = text(entry) ?? text(value?.text) ?? text(value?.label);
|
|
351
|
+
return shown ? { text: shown, ...withIcon(value) } : undefined;
|
|
352
|
+
}
|
|
353
|
+
function point(item) {
|
|
354
|
+
const value = object(item);
|
|
355
|
+
const head = text(value?.title ?? value?.label);
|
|
356
|
+
const body = text(value?.detail ?? value?.note ?? value?.text ?? value?.description);
|
|
357
|
+
if (!value || !head) {
|
|
358
|
+
return note(value ? { text: body } : item);
|
|
359
|
+
}
|
|
360
|
+
return { text: body ? `**${head}** ${body}` : head, tone: "info" };
|
|
283
361
|
}
|
|
284
362
|
function isPath(value) {
|
|
285
363
|
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
@@ -296,8 +374,9 @@ function block(item, partial, labels) {
|
|
|
296
374
|
}
|
|
297
375
|
case "changes": {
|
|
298
376
|
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
299
|
-
|
|
300
|
-
|
|
377
|
+
const pathless = (entry) => typeof entry === "string" ? !isPath(entry) : !!object(entry) && !text(object(entry)?.path ?? object(entry)?.file);
|
|
378
|
+
if (raw.length && raw.every(pathless)) {
|
|
379
|
+
const list2 = items(raw, point);
|
|
301
380
|
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
302
381
|
}
|
|
303
382
|
const list = items(value?.items, change);
|
|
@@ -329,16 +408,23 @@ function block(item, partial, labels) {
|
|
|
329
408
|
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
330
409
|
}
|
|
331
410
|
case "bars": {
|
|
332
|
-
const list = items(value?.items,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
});
|
|
411
|
+
const list = items(value?.items, amount);
|
|
412
|
+
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
413
|
+
}
|
|
414
|
+
case "line": {
|
|
415
|
+
const points = items(value?.items, amount, POINTS);
|
|
416
|
+
const lines = points.length ? [{ values: points.map((point2) => point2.value) }] : Array.isArray(value?.series) ? items(value.series, series, SERIES) : [series(value)].filter((line) => !!line);
|
|
417
|
+
const labels2 = points.length ? points.map((point2) => point2.label) : strings(value?.labels, POINTS);
|
|
418
|
+
const better = oneOf(value?.better, ["lower", "higher"]);
|
|
419
|
+
const drawn = lines.filter((line) => partial || line.values.length > 1);
|
|
420
|
+
return drawn.length ? { type, labels: labels2, series: drawn, ...unit ? { unit } : {}, ...better ? { better } : {} } : undefined;
|
|
421
|
+
}
|
|
422
|
+
case "share": {
|
|
423
|
+
const list = items(value?.items, amount, 6).filter((part) => part.value > 0);
|
|
338
424
|
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
339
425
|
}
|
|
340
426
|
case "flow": {
|
|
341
|
-
const list =
|
|
427
|
+
const list = items(value?.items, listItem);
|
|
342
428
|
return list.length ? { type, items: list } : undefined;
|
|
343
429
|
}
|
|
344
430
|
case "diagram": {
|
|
@@ -360,7 +446,7 @@ function block(item, partial, labels) {
|
|
|
360
446
|
return list.length ? { type, items: list } : undefined;
|
|
361
447
|
}
|
|
362
448
|
case "next": {
|
|
363
|
-
const list =
|
|
449
|
+
const list = items(value?.items, listItem).slice(0, 3);
|
|
364
450
|
return list.length ? { type, items: list } : undefined;
|
|
365
451
|
}
|
|
366
452
|
case "details": {
|
|
@@ -492,18 +578,21 @@ How to reply:
|
|
|
492
578
|
The card: {"status": "done" | "partial" | "failed" | "blocked" | "info", "title"?: string, "blocks": [...]}
|
|
493
579
|
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.
|
|
494
580
|
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).
|
|
495
|
-
- {"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.
|
|
496
|
-
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed, a path each (
|
|
581
|
+
- {"type":"stats","items":[{"label":"Tests","value":"128/128","tone":"good"},{"label":"Startup","value":"210 ms","delta":"-34%","tone":"good","trend":[320,290,210]}]}: key numbers, at most 6; tone good | bad | warn; trend, its values over time when known, draws a small line.
|
|
582
|
+
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed, a path each (what changed without a file goes in notes); kind add | edit | delete.
|
|
497
583
|
- {"type":"steps","items":[{"text":"...","status":"done"}]}: progress or a plan; status done | doing | todo | failed | skipped.
|
|
498
584
|
- {"type":"compare","unit":"ms","better":"lower","items":[{"label":"Startup","before":320,"after":210}]}: before and after, numbers only (words go in a table).
|
|
499
585
|
- {"type":"bars","unit":"MB","items":[{"label":"ta","value":66},{"label":"pi","value":129}]}: amounts side by side.
|
|
500
|
-
- {"type":"
|
|
586
|
+
- {"type":"line","unit":"ms","better":"lower","labels":["11-01","11-08","11-15"],"series":[{"label":"Startup","values":[320,260,210]}]}: how values went over time, at most 4 series of 24 points.
|
|
587
|
+
- {"type":"share","unit":"MB","items":[{"label":"pi","value":129},{"label":"ta","value":66}]}: the parts of a whole.
|
|
588
|
+
- {"type":"flow","items":["Request",{"text":"Gateway","icon":"Server"},"Session","Model"]}: a sequence or a path.
|
|
501
589
|
- {"type":"diagram","mermaid":"graph LR; A-->B"}: relations a flow cannot show, under 12 nodes.
|
|
502
590
|
- {"type":"table","columns":["",""],"rows":[["",""]]}: a few rows that compare things on several points.
|
|
503
591
|
- {"type":"options","question":"Which one?","items":[{"label":"A","detail":"one line","pros":["..."],"cons":["..."],"recommended":true}]}: when the user must choose; each is a button that answers with its label.
|
|
504
592
|
- {"type":"notes","items":[{"text":"...","tone":"risk"}]}: risks, caveats, what the user must do; tone risk | info | todo.
|
|
505
593
|
- {"type":"next","items":["Run the e2e tests"]}: at most 3 things the user may well ask next, each a button that sends it.
|
|
506
|
-
- {"type":"details","title":"How","markdown":"..."}: what few will read, folded
|
|
594
|
+
- {"type":"details","title":"How","markdown":"..."}: what few will read, folded.
|
|
595
|
+
An item of stats, flow, options, notes or next may have "icon", where it tells items apart at a glance (an item of flow or next then {"text","icon"}): one of ${GLANCE_ICONS.join(", ")}; else leave it out. Never write an emoji, in a card or out of it.`;
|
|
507
596
|
|
|
508
597
|
// web-src/extension.ts
|
|
509
598
|
function activate(pi) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-glance",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.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.16.0",
|
|
30
|
+
"@celljs/ta-web": "4.16.0",
|
|
31
31
|
"@types/react": "^19.3.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -83,6 +83,8 @@ var GlanceJson;
|
|
|
83
83
|
|
|
84
84
|
// web-src/glance-spec.ts
|
|
85
85
|
var ITEMS = 12;
|
|
86
|
+
var POINTS = 24;
|
|
87
|
+
var SERIES = 4;
|
|
86
88
|
var BLOCKS = 8;
|
|
87
89
|
var TEXT = 400;
|
|
88
90
|
var MARKDOWN = 8000;
|
|
@@ -111,7 +113,7 @@ function oneOf(value, values) {
|
|
|
111
113
|
const lower = typeof value === "string" ? value.trim().toLowerCase() : undefined;
|
|
112
114
|
return values.find((candidate) => candidate === lower);
|
|
113
115
|
}
|
|
114
|
-
function items(value, read) {
|
|
116
|
+
function items(value, read, max = ITEMS) {
|
|
115
117
|
if (!Array.isArray(value)) {
|
|
116
118
|
return [];
|
|
117
119
|
}
|
|
@@ -121,14 +123,41 @@ function items(value, read) {
|
|
|
121
123
|
if (made !== undefined) {
|
|
122
124
|
out.push(made);
|
|
123
125
|
}
|
|
124
|
-
if (out.length ===
|
|
126
|
+
if (out.length === max) {
|
|
125
127
|
break;
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
return out;
|
|
129
131
|
}
|
|
132
|
+
function icon(value) {
|
|
133
|
+
if (typeof value !== "string") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const words = value.trim().replace(/^lucide[:\-_\s]*/i, "").split(/[-_\s.:]+/).filter(Boolean);
|
|
137
|
+
const name = words.map((word) => word[0].toUpperCase() + word.slice(1)).join("");
|
|
138
|
+
return /^[A-Z][A-Za-z0-9]{0,39}$/.test(name) ? name : undefined;
|
|
139
|
+
}
|
|
140
|
+
function withIcon(value) {
|
|
141
|
+
const name = icon(value?.icon);
|
|
142
|
+
return name ? { icon: name } : {};
|
|
143
|
+
}
|
|
130
144
|
function strings(value, max = ITEMS) {
|
|
131
|
-
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text)
|
|
145
|
+
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text), max);
|
|
146
|
+
}
|
|
147
|
+
function numbers(value, max = POINTS) {
|
|
148
|
+
return items(value, number, max);
|
|
149
|
+
}
|
|
150
|
+
function amount(entry) {
|
|
151
|
+
const value = object(entry);
|
|
152
|
+
const label = text(value?.label);
|
|
153
|
+
const shown = number(value?.value);
|
|
154
|
+
return label && shown !== undefined ? { label, value: shown } : undefined;
|
|
155
|
+
}
|
|
156
|
+
function series(entry) {
|
|
157
|
+
const value = object(entry);
|
|
158
|
+
const values = numbers(Array.isArray(entry) ? entry : value?.values ?? value?.data);
|
|
159
|
+
const label = text(value?.label ?? value?.name);
|
|
160
|
+
return values.length ? { values, ...label ? { label } : {} } : undefined;
|
|
132
161
|
}
|
|
133
162
|
function stat(item) {
|
|
134
163
|
const value = object(item);
|
|
@@ -139,11 +168,12 @@ function stat(item) {
|
|
|
139
168
|
}
|
|
140
169
|
const tone = oneOf(value?.tone, TONES);
|
|
141
170
|
const delta = text(value?.delta);
|
|
142
|
-
|
|
171
|
+
const trend = numbers(value?.trend);
|
|
172
|
+
return { label, value: shown, ...tone ? { tone } : {}, ...delta ? { delta } : {}, ...withIcon(value), ...trend.length > 1 ? { trend } : {} };
|
|
143
173
|
}
|
|
144
174
|
function change(item) {
|
|
145
175
|
const value = object(item);
|
|
146
|
-
const path = text(value?.path ?? item);
|
|
176
|
+
const path = text(value?.path ?? value?.file ?? item);
|
|
147
177
|
if (!path) {
|
|
148
178
|
return;
|
|
149
179
|
}
|
|
@@ -176,13 +206,28 @@ function option(item) {
|
|
|
176
206
|
...detail ? { detail } : {},
|
|
177
207
|
pros: strings(value?.pros, 4),
|
|
178
208
|
cons: strings(value?.cons, 4),
|
|
179
|
-
...value?.recommended === true ? { recommended: true } : {}
|
|
209
|
+
...value?.recommended === true ? { recommended: true } : {},
|
|
210
|
+
...withIcon(value)
|
|
180
211
|
};
|
|
181
212
|
}
|
|
182
213
|
function note(item) {
|
|
183
214
|
const value = object(item);
|
|
184
215
|
const shown = text(value?.text ?? item);
|
|
185
|
-
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
216
|
+
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info", ...withIcon(value) } : undefined;
|
|
217
|
+
}
|
|
218
|
+
function listItem(entry) {
|
|
219
|
+
const value = object(entry);
|
|
220
|
+
const shown = text(entry) ?? text(value?.text) ?? text(value?.label);
|
|
221
|
+
return shown ? { text: shown, ...withIcon(value) } : undefined;
|
|
222
|
+
}
|
|
223
|
+
function point(item) {
|
|
224
|
+
const value = object(item);
|
|
225
|
+
const head = text(value?.title ?? value?.label);
|
|
226
|
+
const body = text(value?.detail ?? value?.note ?? value?.text ?? value?.description);
|
|
227
|
+
if (!value || !head) {
|
|
228
|
+
return note(value ? { text: body } : item);
|
|
229
|
+
}
|
|
230
|
+
return { text: body ? `**${head}** ${body}` : head, tone: "info" };
|
|
186
231
|
}
|
|
187
232
|
function isPath(value) {
|
|
188
233
|
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
@@ -199,8 +244,9 @@ function block(item, partial, labels) {
|
|
|
199
244
|
}
|
|
200
245
|
case "changes": {
|
|
201
246
|
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
202
|
-
|
|
203
|
-
|
|
247
|
+
const pathless = (entry) => typeof entry === "string" ? !isPath(entry) : !!object(entry) && !text(object(entry)?.path ?? object(entry)?.file);
|
|
248
|
+
if (raw.length && raw.every(pathless)) {
|
|
249
|
+
const list2 = items(raw, point);
|
|
204
250
|
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
205
251
|
}
|
|
206
252
|
const list = items(value?.items, change);
|
|
@@ -232,16 +278,23 @@ function block(item, partial, labels) {
|
|
|
232
278
|
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
233
279
|
}
|
|
234
280
|
case "bars": {
|
|
235
|
-
const list = items(value?.items,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
281
|
+
const list = items(value?.items, amount);
|
|
282
|
+
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
283
|
+
}
|
|
284
|
+
case "line": {
|
|
285
|
+
const points = items(value?.items, amount, POINTS);
|
|
286
|
+
const lines = points.length ? [{ values: points.map((point2) => point2.value) }] : Array.isArray(value?.series) ? items(value.series, series, SERIES) : [series(value)].filter((line) => !!line);
|
|
287
|
+
const labels2 = points.length ? points.map((point2) => point2.label) : strings(value?.labels, POINTS);
|
|
288
|
+
const better = oneOf(value?.better, ["lower", "higher"]);
|
|
289
|
+
const drawn = lines.filter((line) => partial || line.values.length > 1);
|
|
290
|
+
return drawn.length ? { type, labels: labels2, series: drawn, ...unit ? { unit } : {}, ...better ? { better } : {} } : undefined;
|
|
291
|
+
}
|
|
292
|
+
case "share": {
|
|
293
|
+
const list = items(value?.items, amount, 6).filter((part) => part.value > 0);
|
|
241
294
|
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
242
295
|
}
|
|
243
296
|
case "flow": {
|
|
244
|
-
const list =
|
|
297
|
+
const list = items(value?.items, listItem);
|
|
245
298
|
return list.length ? { type, items: list } : undefined;
|
|
246
299
|
}
|
|
247
300
|
case "diagram": {
|
|
@@ -263,7 +316,7 @@ function block(item, partial, labels) {
|
|
|
263
316
|
return list.length ? { type, items: list } : undefined;
|
|
264
317
|
}
|
|
265
318
|
case "next": {
|
|
266
|
-
const list =
|
|
319
|
+
const list = items(value?.items, listItem).slice(0, 3);
|
|
267
320
|
return list.length ? { type, items: list } : undefined;
|
|
268
321
|
}
|
|
269
322
|
case "details": {
|
|
@@ -312,6 +365,26 @@ function percent(before, after) {
|
|
|
312
365
|
const change2 = Math.round((after - before) / Math.abs(before) * 100);
|
|
313
366
|
return `${change2 > 0 ? "+" : ""}${change2}%`;
|
|
314
367
|
}
|
|
368
|
+
function range(values) {
|
|
369
|
+
const low = Math.min(...values);
|
|
370
|
+
const high = Math.max(...values);
|
|
371
|
+
if (!values.length) {
|
|
372
|
+
return { low: 0, high: 1 };
|
|
373
|
+
}
|
|
374
|
+
if (low === high) {
|
|
375
|
+
return { low: low - 1, high: high + 1 };
|
|
376
|
+
}
|
|
377
|
+
const margin = (high - low) * 0.08;
|
|
378
|
+
return { low: low - margin, high: high + margin };
|
|
379
|
+
}
|
|
380
|
+
function points(values, count, { low, high }, width, height) {
|
|
381
|
+
const step2 = count > 1 ? width / (count - 1) : 0;
|
|
382
|
+
return values.map((value, index) => [count > 1 ? index * step2 : width / 2, height - (value - low) / (high - low) * height]);
|
|
383
|
+
}
|
|
384
|
+
function share(part, total) {
|
|
385
|
+
const value = total > 0 ? part / total * 100 : 0;
|
|
386
|
+
return value > 0 && value < 1 ? "<1%" : `${Math.round(value)}%`;
|
|
387
|
+
}
|
|
315
388
|
|
|
316
389
|
// ../ta-protocol/esm/common/language.js
|
|
317
390
|
var TaLanguageUtil;
|
|
@@ -433,6 +506,8 @@ function bind(react) {
|
|
|
433
506
|
var MARKS = /[*_`[\]$\\]/;
|
|
434
507
|
var SQUARES = 5;
|
|
435
508
|
var LINES = 20;
|
|
509
|
+
var WIDTH = 300;
|
|
510
|
+
var HEIGHT = 100;
|
|
436
511
|
function fileName(path) {
|
|
437
512
|
return path.replace(/\/+$/, "").split("/").pop() || path;
|
|
438
513
|
}
|
|
@@ -455,13 +530,144 @@ function glanceCard(pi) {
|
|
|
455
530
|
text: text2
|
|
456
531
|
})) : text2;
|
|
457
532
|
}
|
|
458
|
-
function Icon({ name, size = 14 }) {
|
|
459
|
-
const Found = icons[name];
|
|
533
|
+
function Icon({ name, fallback, size = 14 }) {
|
|
534
|
+
const Found = name && icons[name] || fallback && icons[fallback];
|
|
460
535
|
return Found ? /* @__PURE__ */ React.createElement(Found, {
|
|
461
536
|
size,
|
|
462
537
|
strokeWidth: 2
|
|
463
538
|
}) : null;
|
|
464
539
|
}
|
|
540
|
+
const has = (name) => !!name && !!icons[name];
|
|
541
|
+
function Polyline({
|
|
542
|
+
values,
|
|
543
|
+
count: count2,
|
|
544
|
+
scale,
|
|
545
|
+
area,
|
|
546
|
+
index
|
|
547
|
+
}) {
|
|
548
|
+
const at = points(values, count2, scale, WIDTH, HEIGHT);
|
|
549
|
+
const line = at.map(([x, y]) => `${x.toFixed(1)},${y.toFixed(1)}`).join(" ");
|
|
550
|
+
const last = at[at.length - 1];
|
|
551
|
+
return /* @__PURE__ */ React.createElement("g", {
|
|
552
|
+
className: "tag-series",
|
|
553
|
+
"data-index": index
|
|
554
|
+
}, area && at.length > 1 && /* @__PURE__ */ React.createElement("polygon", {
|
|
555
|
+
className: "tag-series-area",
|
|
556
|
+
points: `0,${HEIGHT} ${line} ${last[0].toFixed(1)},${HEIGHT}`
|
|
557
|
+
}), /* @__PURE__ */ React.createElement("polyline", {
|
|
558
|
+
points: line,
|
|
559
|
+
fill: "none",
|
|
560
|
+
vectorEffect: "non-scaling-stroke"
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
function Sparkline({ values }) {
|
|
564
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
565
|
+
className: "tag-spark",
|
|
566
|
+
viewBox: `0 0 ${WIDTH} ${HEIGHT}`,
|
|
567
|
+
preserveAspectRatio: "none",
|
|
568
|
+
"aria-hidden": "true"
|
|
569
|
+
}, /* @__PURE__ */ React.createElement(Polyline, {
|
|
570
|
+
values,
|
|
571
|
+
count: values.length,
|
|
572
|
+
scale: range(values),
|
|
573
|
+
area: true,
|
|
574
|
+
index: 0
|
|
575
|
+
}));
|
|
576
|
+
}
|
|
577
|
+
function Line({ block: block2 }) {
|
|
578
|
+
const size = Math.max(block2.labels.length, ...block2.series.map((line) => line.values.length));
|
|
579
|
+
const scale = range(block2.series.flatMap((line) => line.values));
|
|
580
|
+
const unit = block2.unit ? ` ${block2.unit}` : "";
|
|
581
|
+
const marks = [...new Set(size >= 5 ? [0, Math.round((size - 1) / 2), size - 1] : [0, size - 1])].filter((index) => block2.labels[index] !== undefined);
|
|
582
|
+
const where = (index) => size > 1 ? index / (size - 1) * 100 : 50;
|
|
583
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
584
|
+
className: "tag-line"
|
|
585
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
586
|
+
className: "tag-section-head tag-legend"
|
|
587
|
+
}, block2.series.map((line, index) => {
|
|
588
|
+
const first = line.values[0];
|
|
589
|
+
const last = line.values[line.values.length - 1];
|
|
590
|
+
const change2 = line.values.length > 1 ? percent(first, last) : "";
|
|
591
|
+
const better = block2.better === "higher" ? last > first : last < first;
|
|
592
|
+
const tone = !block2.better || last === first ? "neutral" : better ? "good" : "bad";
|
|
593
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
594
|
+
key: index,
|
|
595
|
+
className: "tag-line-key",
|
|
596
|
+
"data-index": index
|
|
597
|
+
}, /* @__PURE__ */ React.createElement("i", null), line.label && /* @__PURE__ */ React.createElement(Text, {
|
|
598
|
+
text: line.label
|
|
599
|
+
}), /* @__PURE__ */ React.createElement("b", null, count(last), unit), change2 && /* @__PURE__ */ React.createElement("span", {
|
|
600
|
+
className: "tag-delta",
|
|
601
|
+
"data-tone": tone
|
|
602
|
+
}, change2));
|
|
603
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
604
|
+
className: "tag-plot"
|
|
605
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
606
|
+
className: "tag-plot-area"
|
|
607
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
608
|
+
viewBox: `0 0 ${WIDTH} ${HEIGHT}`,
|
|
609
|
+
preserveAspectRatio: "none",
|
|
610
|
+
"aria-hidden": "true"
|
|
611
|
+
}, [0, HEIGHT / 2, HEIGHT].map((y) => /* @__PURE__ */ React.createElement("line", {
|
|
612
|
+
key: y,
|
|
613
|
+
className: "tag-grid",
|
|
614
|
+
x1: 0,
|
|
615
|
+
x2: WIDTH,
|
|
616
|
+
y1: y,
|
|
617
|
+
y2: y,
|
|
618
|
+
vectorEffect: "non-scaling-stroke"
|
|
619
|
+
})), block2.series.map((line, index) => /* @__PURE__ */ React.createElement(Polyline, {
|
|
620
|
+
key: index,
|
|
621
|
+
values: line.values,
|
|
622
|
+
count: size,
|
|
623
|
+
scale,
|
|
624
|
+
area: index === 0 && block2.series.length === 1,
|
|
625
|
+
index
|
|
626
|
+
}))), block2.series.map((line, index) => {
|
|
627
|
+
const [x, y] = points(line.values, size, scale, WIDTH, HEIGHT)[line.values.length - 1];
|
|
628
|
+
return /* @__PURE__ */ React.createElement("i", {
|
|
629
|
+
key: index,
|
|
630
|
+
className: "tag-plot-dot",
|
|
631
|
+
"data-index": index,
|
|
632
|
+
style: { left: `${x / WIDTH * 100}%`, top: `${y / HEIGHT * 100}%` }
|
|
633
|
+
});
|
|
634
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
635
|
+
className: "tag-plot-axis",
|
|
636
|
+
"aria-hidden": "true"
|
|
637
|
+
}, /* @__PURE__ */ React.createElement("span", null, count(Math.max(...block2.series.flatMap((line) => line.values)))), /* @__PURE__ */ React.createElement("span", null, count(Math.min(...block2.series.flatMap((line) => line.values))))), marks.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
638
|
+
className: "tag-plot-labels"
|
|
639
|
+
}, marks.map((index) => /* @__PURE__ */ React.createElement("span", {
|
|
640
|
+
key: index,
|
|
641
|
+
"data-at": index === 0 ? "start" : index === size - 1 ? "end" : "middle",
|
|
642
|
+
style: { left: `${where(index)}%` }
|
|
643
|
+
}, block2.labels[index])))));
|
|
644
|
+
}
|
|
645
|
+
function Share({ block: block2 }) {
|
|
646
|
+
const total = block2.items.reduce((sum, item) => sum + item.value, 0);
|
|
647
|
+
const unit = block2.unit ? ` ${block2.unit}` : "";
|
|
648
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
649
|
+
className: "tag-share"
|
|
650
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
651
|
+
className: "tag-share-bar",
|
|
652
|
+
"aria-hidden": "true"
|
|
653
|
+
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement("i", {
|
|
654
|
+
key: index,
|
|
655
|
+
"data-index": index,
|
|
656
|
+
style: { flexGrow: item.value }
|
|
657
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
658
|
+
className: "tag-share-keys"
|
|
659
|
+
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement("div", {
|
|
660
|
+
key: index,
|
|
661
|
+
className: "tag-share-key",
|
|
662
|
+
"data-index": index
|
|
663
|
+
}, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", {
|
|
664
|
+
className: "tag-share-label"
|
|
665
|
+
}, /* @__PURE__ */ React.createElement(Text, {
|
|
666
|
+
text: item.label
|
|
667
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
668
|
+
className: "tag-share-value"
|
|
669
|
+
}, count(item.value), unit), /* @__PURE__ */ React.createElement("b", null, share(item.value, total))))));
|
|
670
|
+
}
|
|
465
671
|
function Stats({ block: block2 }) {
|
|
466
672
|
return /* @__PURE__ */ React.createElement("div", {
|
|
467
673
|
className: "tag-stats",
|
|
@@ -474,9 +680,16 @@ function glanceCard(pi) {
|
|
|
474
680
|
className: "tag-stat-value"
|
|
475
681
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
476
682
|
text: item.value
|
|
477
|
-
})), /* @__PURE__ */ React.createElement(
|
|
683
|
+
})), item.trend && /* @__PURE__ */ React.createElement(Sparkline, {
|
|
684
|
+
values: item.trend
|
|
685
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
478
686
|
className: "tag-stat-label"
|
|
479
|
-
}, item.
|
|
687
|
+
}, has(item.icon) ? /* @__PURE__ */ React.createElement("span", {
|
|
688
|
+
className: "tag-item-icon"
|
|
689
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
690
|
+
name: item.icon,
|
|
691
|
+
size: 12
|
|
692
|
+
})) : item.tone && !item.delta && /* @__PURE__ */ React.createElement("i", {
|
|
480
693
|
className: "tag-tone-dot"
|
|
481
694
|
}), /* @__PURE__ */ React.createElement(Text, {
|
|
482
695
|
text: item.label
|
|
@@ -640,8 +853,13 @@ function glanceCard(pi) {
|
|
|
640
853
|
size: 13
|
|
641
854
|
})), /* @__PURE__ */ React.createElement("span", {
|
|
642
855
|
className: "tag-flow-node"
|
|
643
|
-
}, /* @__PURE__ */ React.createElement(
|
|
644
|
-
|
|
856
|
+
}, has(item.icon) && /* @__PURE__ */ React.createElement("span", {
|
|
857
|
+
className: "tag-item-icon"
|
|
858
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
859
|
+
name: item.icon,
|
|
860
|
+
size: 13
|
|
861
|
+
})), /* @__PURE__ */ React.createElement(Text, {
|
|
862
|
+
text: item.text
|
|
645
863
|
})))));
|
|
646
864
|
}
|
|
647
865
|
function Table({ block: block2 }) {
|
|
@@ -698,7 +916,12 @@ function glanceCard(pi) {
|
|
|
698
916
|
className: "tag-option-main"
|
|
699
917
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
700
918
|
className: "tag-option-head"
|
|
701
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
919
|
+
}, has(item.icon) && /* @__PURE__ */ React.createElement("span", {
|
|
920
|
+
className: "tag-item-icon"
|
|
921
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
922
|
+
name: item.icon,
|
|
923
|
+
size: 14
|
|
924
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
702
925
|
className: "tag-option-label"
|
|
703
926
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
704
927
|
text: item.label
|
|
@@ -710,16 +933,16 @@ function glanceCard(pi) {
|
|
|
710
933
|
text: item.detail
|
|
711
934
|
})), (item.pros.length > 0 || item.cons.length > 0) && /* @__PURE__ */ React.createElement("div", {
|
|
712
935
|
className: "tag-points"
|
|
713
|
-
}, item.pros.map((
|
|
936
|
+
}, item.pros.map((point2, at) => /* @__PURE__ */ React.createElement("span", {
|
|
714
937
|
key: `p${at}`,
|
|
715
938
|
"data-tone": "good"
|
|
716
939
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
717
|
-
text:
|
|
718
|
-
}))), item.cons.map((
|
|
940
|
+
text: point2
|
|
941
|
+
}))), item.cons.map((point2, at) => /* @__PURE__ */ React.createElement("span", {
|
|
719
942
|
key: `c${at}`,
|
|
720
943
|
"data-tone": "bad"
|
|
721
944
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
722
|
-
text:
|
|
945
|
+
text: point2
|
|
723
946
|
}))))), /* @__PURE__ */ React.createElement("button", {
|
|
724
947
|
type: "button",
|
|
725
948
|
className: `ta-button tag-choose${item.recommended && !done ? " ta-primary" : ""}`,
|
|
@@ -741,7 +964,8 @@ function glanceCard(pi) {
|
|
|
741
964
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
742
965
|
className: "tag-note-mark"
|
|
743
966
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
744
|
-
name:
|
|
967
|
+
name: item.icon,
|
|
968
|
+
fallback: NOTE_ICON[item.tone],
|
|
745
969
|
size: 14
|
|
746
970
|
})), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(Text, {
|
|
747
971
|
text: item.text
|
|
@@ -756,11 +980,12 @@ function glanceCard(pi) {
|
|
|
756
980
|
type: "button",
|
|
757
981
|
className: "tag-chip",
|
|
758
982
|
disabled: !closed || !send,
|
|
759
|
-
onClick: () => void send?.(item).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"))
|
|
983
|
+
onClick: () => void send?.(item.text).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"))
|
|
760
984
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
761
|
-
name:
|
|
985
|
+
name: item.icon,
|
|
986
|
+
fallback: "CornerDownRight",
|
|
762
987
|
size: 13
|
|
763
|
-
}), /* @__PURE__ */ React.createElement("span", null, item.replace(/\*\*|`/g, "")))));
|
|
988
|
+
}), /* @__PURE__ */ React.createElement("span", null, item.text.replace(/\*\*|`/g, "")))));
|
|
764
989
|
}
|
|
765
990
|
function Details({ block: block2, words }) {
|
|
766
991
|
const [open, setOpen] = React.useState(false);
|
|
@@ -804,6 +1029,14 @@ function glanceCard(pi) {
|
|
|
804
1029
|
return /* @__PURE__ */ React.createElement(Bars, {
|
|
805
1030
|
block: block2
|
|
806
1031
|
});
|
|
1032
|
+
case "line":
|
|
1033
|
+
return /* @__PURE__ */ React.createElement(Line, {
|
|
1034
|
+
block: block2
|
|
1035
|
+
});
|
|
1036
|
+
case "share":
|
|
1037
|
+
return /* @__PURE__ */ React.createElement(Share, {
|
|
1038
|
+
block: block2
|
|
1039
|
+
});
|
|
807
1040
|
case "flow":
|
|
808
1041
|
return /* @__PURE__ */ React.createElement(Flow, {
|
|
809
1042
|
block: block2
|
|
@@ -982,7 +1215,16 @@ var STYLE = `
|
|
|
982
1215
|
.tag-stat { min-width: 0; padding: 10px 12px; border-radius: 8px; background: var(--ta-raised); }
|
|
983
1216
|
.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); }
|
|
984
1217
|
@container tag-card (max-width: 400px) { .tag-stat-value { font-size: calc(18px * var(--tag-s)); } }
|
|
985
|
-
|
|
1218
|
+
/* Its icon, name and change wrap as wholes, so that a narrow box does not break the name */
|
|
1219
|
+
.tag-stat-label { display: flex; flex-wrap: wrap; align-items: center; margin-top: 2px; color: var(--ta-muted); font-size: var(--tag-small); line-height: 1.4; }
|
|
1220
|
+
/* The icon an item names: before its label, in the color of its tone where it has one */
|
|
1221
|
+
.tag-item-icon { flex: none; display: inline-flex; color: var(--ta-secondary); }
|
|
1222
|
+
.tag-item-icon svg { width: calc(var(--tag-icon, 13px) * var(--tag-s)); height: calc(var(--tag-icon, 13px) * var(--tag-s)); }
|
|
1223
|
+
.tag-stat-label > .tag-item-icon { --tag-icon: 12px; margin-right: 5px; }
|
|
1224
|
+
[data-tone='good'] > .tag-stat-label > .tag-item-icon { color: var(--ta-green); }
|
|
1225
|
+
[data-tone='bad'] > .tag-stat-label > .tag-item-icon { color: var(--ta-red); }
|
|
1226
|
+
[data-tone='warn'] > .tag-stat-label > .tag-item-icon { color: var(--ta-yellow); }
|
|
1227
|
+
.tag-option-head > .tag-item-icon { --tag-icon: 14px; }
|
|
986
1228
|
.tag-tone-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; vertical-align: 0.1em; background: var(--ta-muted); }
|
|
987
1229
|
[data-tone='good'] > .tag-stat-label > .tag-tone-dot { background: var(--ta-green); }
|
|
988
1230
|
[data-tone='bad'] > .tag-stat-label > .tag-tone-dot { background: var(--ta-red); }
|
|
@@ -1059,10 +1301,64 @@ var STYLE = `
|
|
|
1059
1301
|
.tag-bar .tag-track { grid-area: 2 / 1 / 3 / 3; }
|
|
1060
1302
|
}
|
|
1061
1303
|
|
|
1304
|
+
/* Charts: the lines of a chart and the parts of a whole in the color of amounts (blue) first, then amber, grey,
|
|
1305
|
+
faint blue; green and red only for a change that is better or worse. Strokes keep their width as the SVG stretches. */
|
|
1306
|
+
.tag-card { --tag-c0: var(--ta-accent); --tag-c1: var(--ta-yellow); --tag-c2: var(--ta-secondary); --tag-c3: color-mix(in srgb, var(--ta-accent) 45%, transparent); }
|
|
1307
|
+
.tag-series polyline { stroke: var(--tag-c0); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
|
|
1308
|
+
.tag-series[data-index='1'] polyline { stroke: var(--tag-c1); }
|
|
1309
|
+
.tag-series[data-index='2'] polyline { stroke: var(--tag-c2); }
|
|
1310
|
+
.tag-series[data-index='3'] polyline { stroke: var(--tag-c3); }
|
|
1311
|
+
.tag-series-area { fill: color-mix(in srgb, var(--tag-tint, var(--tag-c0)) 12%, transparent); stroke: none; }
|
|
1312
|
+
.tag-grid { stroke: var(--tag-line); stroke-width: 1; }
|
|
1313
|
+
|
|
1314
|
+
/* The small line of a key number, under it, in the color of its tone */
|
|
1315
|
+
.tag-spark { display: block; width: 100%; height: calc(20px * var(--tag-s)); margin: 4px 0 2px; overflow: visible; }
|
|
1316
|
+
.tag-spark polyline { stroke-width: 1.5; }
|
|
1317
|
+
[data-tone='good'] > .tag-spark { --tag-c0: var(--ta-green); }
|
|
1318
|
+
[data-tone='bad'] > .tag-spark { --tag-c0: var(--ta-red); }
|
|
1319
|
+
[data-tone='warn'] > .tag-spark { --tag-c0: var(--ta-yellow); }
|
|
1320
|
+
|
|
1321
|
+
/* A line over time: what each line is now and how it changed above it, its highest and lowest on the right, the first, middle and last labels under it */
|
|
1322
|
+
.tag-line-key { display: inline-flex; align-items: baseline; gap: 5px; }
|
|
1323
|
+
.tag-line-key > i { align-self: center; width: 10px; height: 2px; border-radius: 1px; background: var(--tag-c0); }
|
|
1324
|
+
.tag-line-key[data-index='1'] > i { background: var(--tag-c1); }
|
|
1325
|
+
.tag-line-key[data-index='2'] > i { background: var(--tag-c2); }
|
|
1326
|
+
.tag-line-key[data-index='3'] > i { background: var(--tag-c3); }
|
|
1327
|
+
.tag-line-key > b { color: var(--ta-text); font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
1328
|
+
.tag-line-key > .tag-delta { margin-left: 0; }
|
|
1329
|
+
.tag-plot { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
|
|
1330
|
+
.tag-plot-area { position: relative; height: calc(96px * var(--tag-s)); }
|
|
1331
|
+
.tag-plot-area svg { display: block; width: 100%; height: 100%; overflow: visible; }
|
|
1332
|
+
.tag-plot-dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--tag-c0); box-shadow: 0 0 0 2px var(--ta-card); }
|
|
1333
|
+
.tag-plot-dot[data-index='1'] { background: var(--tag-c1); }
|
|
1334
|
+
.tag-plot-dot[data-index='2'] { background: var(--tag-c2); }
|
|
1335
|
+
.tag-plot-dot[data-index='3'] { background: var(--tag-c3); }
|
|
1336
|
+
.tag-plot-axis { display: flex; flex-direction: column; justify-content: space-between; margin: -0.6em 0; color: var(--ta-muted); font-size: var(--tag-tiny); line-height: 1.2; font-variant-numeric: tabular-nums; text-align: right; }
|
|
1337
|
+
.tag-plot-labels { grid-column: 1; position: relative; height: 1.4em; margin-top: 6px; color: var(--ta-muted); font-size: var(--tag-tiny); line-height: 1.4; }
|
|
1338
|
+
.tag-plot-labels span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
|
|
1339
|
+
.tag-plot-labels span[data-at='start'] { transform: none; }
|
|
1340
|
+
.tag-plot-labels span[data-at='end'] { transform: translateX(-100%); }
|
|
1341
|
+
|
|
1342
|
+
/* Parts of a whole: one bar cut in parts, a key of each under it with its amount and share */
|
|
1343
|
+
.tag-share-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
|
|
1344
|
+
.tag-share-bar i { flex: 1 1 0; min-width: 3px; background: var(--tag-part); transition: flex-grow 0.4s var(--ta-ease, ease); }
|
|
1345
|
+
.tag-share [data-index='0'] { --tag-part: var(--ta-accent); }
|
|
1346
|
+
.tag-share [data-index='1'] { --tag-part: color-mix(in srgb, var(--ta-accent) 66%, transparent); }
|
|
1347
|
+
.tag-share [data-index='2'] { --tag-part: color-mix(in srgb, var(--ta-accent) 44%, transparent); }
|
|
1348
|
+
.tag-share [data-index='3'] { --tag-part: color-mix(in srgb, var(--ta-accent) 28%, transparent); }
|
|
1349
|
+
.tag-share [data-index='4'] { --tag-part: color-mix(in srgb, var(--ta-accent) 17%, transparent); }
|
|
1350
|
+
.tag-share [data-index='5'] { --tag-part: var(--ta-border-field); }
|
|
1351
|
+
.tag-share-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--tag-s)), 1fr)); gap: 4px 16px; margin-top: 8px; }
|
|
1352
|
+
.tag-share-key { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--tag-small); line-height: 1.5; }
|
|
1353
|
+
.tag-share-key > i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--tag-part); }
|
|
1354
|
+
.tag-share-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1355
|
+
.tag-share-value { color: var(--ta-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
1356
|
+
.tag-share-key > b { min-width: 2.6em; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
|
|
1357
|
+
|
|
1062
1358
|
/* A path: nodes and arrows; an arrow keeps to the node after it, so that no line ends with one */
|
|
1063
1359
|
.tag-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
|
|
1064
1360
|
.tag-flow-step { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
|
|
1065
|
-
.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); }
|
|
1361
|
+
.tag-flow-node { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 2px 10px; border: 1px solid var(--ta-border); border-radius: 6px; background: var(--ta-raised); line-height: var(--tag-lh); }
|
|
1066
1362
|
.tag-flow-arrow { flex: none; display: inline-flex; color: var(--ta-muted); }
|
|
1067
1363
|
.tag-flow-arrow svg { width: calc(13px * var(--tag-s)); height: calc(13px * var(--tag-s)); }
|
|
1068
1364
|
|