@joplo-app/core 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-skill.d.ts +1 -1
- package/dist/agent-skill.js +3 -2
- package/dist/catalog.d.ts +21 -5
- package/dist/catalog.js +149 -21
- package/dist/compile.d.ts +9 -1
- package/dist/compile.js +336 -60
- package/dist/diagram/elk.d.ts +6 -0
- package/dist/diagram/elk.js +56 -0
- package/dist/diagram/graph-layout.d.ts +123 -0
- package/dist/diagram/graph-layout.js +620 -0
- package/dist/diagram/index.d.ts +41 -0
- package/dist/diagram/index.js +92 -0
- package/dist/diagram/model.d.ts +217 -0
- package/dist/diagram/model.js +189 -0
- package/dist/diagram/sequence-layout.d.ts +12 -0
- package/dist/diagram/sequence-layout.js +185 -0
- package/dist/focus-check.d.ts +9 -0
- package/dist/focus-check.js +95 -0
- package/dist/focus.d.ts +50 -0
- package/dist/focus.js +274 -0
- package/dist/guide.d.ts +14 -0
- package/dist/guide.js +284 -26
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +2 -0
- package/dist/outline.d.ts +58 -0
- package/dist/outline.js +72 -0
- package/dist/pace.d.ts +33 -0
- package/dist/pace.js +61 -0
- package/dist/player.d.ts +1 -0
- package/dist/player.js +16 -6
- package/dist/schema.d.ts +103 -0
- package/dist/schema.js +55 -0
- package/dist/validate.js +44 -4
- package/package.json +3 -2
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 时序图布局(D69,纯函数、确定):参与者按源码顺序排成列,消息按源码顺序一行一条,片段(alt / opt / loop…)是包住
|
|
3
|
+
* 若干行的框,参与者分组是包住若干列的业务域框。不需要通用图布局算法,编译期直接算好写进 IR。
|
|
4
|
+
*
|
|
5
|
+
* - 列间距:先按相邻头部宽度加最小间隙,再保证每条消息的标签放得下(跨多列的消息把不够的宽度平均分给它跨过的间隙);
|
|
6
|
+
* 自调用(from === to)的回环和标签放在生命线右侧,下一列让出位置。
|
|
7
|
+
* - 行:消息行高固定(标签在线上方),自调用多一点;片段开始处多一行放片段标签,结束处留一点底。
|
|
8
|
+
*/
|
|
9
|
+
import { GROUP_HEAD, GROUP_PAD, EDGE_FONT, groupTitleWidth, textWidth } from "./model.js";
|
|
10
|
+
const M = 12;
|
|
11
|
+
const GAP = 48;
|
|
12
|
+
const ROW = 44;
|
|
13
|
+
const SELF_ROW = 58;
|
|
14
|
+
const SELF_W = 36;
|
|
15
|
+
const BLOCK_HEAD = 30;
|
|
16
|
+
const BLOCK_TAIL = 12;
|
|
17
|
+
const BLOCK_PAD = 18;
|
|
18
|
+
/** 序号徽章占的宽度(numbered 时标签前面画一个圆形序号)。 */
|
|
19
|
+
export const SEQ_BADGE = 20;
|
|
20
|
+
export function layoutSequence(s) {
|
|
21
|
+
const empty = { kind: 'sequence', width: 0, height: 0, actors: {}, lifelines: {}, messages: {}, groups: {}, titles: {}, blocks: {}, blockTitles: {} };
|
|
22
|
+
if (!s.actors.length)
|
|
23
|
+
return empty;
|
|
24
|
+
const idx = new Map(s.actors.map((a, i) => [a.id, i]));
|
|
25
|
+
const n = s.actors.length;
|
|
26
|
+
const labelW = (label) => (label ? textWidth(label, EDGE_FONT) + 12 : 0) + (s.numbered ? SEQ_BADGE : 0);
|
|
27
|
+
// ---------- 列 ----------
|
|
28
|
+
// gap[i] = 第 i 列与第 i+1 列中心的距离
|
|
29
|
+
const gap = [];
|
|
30
|
+
for (let i = 0; i < n - 1; i++)
|
|
31
|
+
gap.push(s.actors[i].w / 2 + s.actors[i + 1].w / 2 + GAP);
|
|
32
|
+
// 同一分组的参与者之间、分组边界也要留出分组的内边距
|
|
33
|
+
for (let i = 0; i < n - 1; i++)
|
|
34
|
+
if (s.actors[i].group !== s.actors[i + 1].group)
|
|
35
|
+
gap[i] = gap[i] + 2 * GROUP_PAD;
|
|
36
|
+
const valid = s.messages.filter((m) => idx.has(m.from) && idx.has(m.to));
|
|
37
|
+
// 自调用:回环 + 标签放在右侧
|
|
38
|
+
for (const m of valid) {
|
|
39
|
+
if (m.from !== m.to)
|
|
40
|
+
continue;
|
|
41
|
+
const i = idx.get(m.from);
|
|
42
|
+
const need = SELF_W + 8 + labelW(m.label) + 16 + (i < n - 1 ? s.actors[i + 1].w / 2 : 0);
|
|
43
|
+
if (i < n - 1)
|
|
44
|
+
gap[i] = Math.max(gap[i], need);
|
|
45
|
+
}
|
|
46
|
+
// 普通消息:标签放得下(按跨度从小到大处理,结果确定)
|
|
47
|
+
const spans = valid.filter((m) => m.from !== m.to).map((m) => ({ a: Math.min(idx.get(m.from), idx.get(m.to)), b: Math.max(idx.get(m.from), idx.get(m.to)), w: labelW(m.label) + 28 }));
|
|
48
|
+
spans.sort((x, y) => x.b - x.a - (y.b - y.a) || x.a - y.a);
|
|
49
|
+
for (const sp of spans) {
|
|
50
|
+
let have = 0;
|
|
51
|
+
for (let i = sp.a; i < sp.b; i++)
|
|
52
|
+
have += gap[i];
|
|
53
|
+
if (have >= sp.w)
|
|
54
|
+
continue;
|
|
55
|
+
const add = (sp.w - have) / (sp.b - sp.a);
|
|
56
|
+
for (let i = sp.a; i < sp.b; i++)
|
|
57
|
+
gap[i] = gap[i] + add;
|
|
58
|
+
}
|
|
59
|
+
const hasGroups = s.actors.some((a) => a.group);
|
|
60
|
+
const left = M + (hasGroups ? GROUP_PAD : 0);
|
|
61
|
+
const cx = [left + s.actors[0].w / 2];
|
|
62
|
+
for (let i = 1; i < n; i++)
|
|
63
|
+
cx.push(cx[i - 1] + gap[i - 1]);
|
|
64
|
+
// ---------- 头部 ----------
|
|
65
|
+
const top = M + (hasGroups ? GROUP_HEAD + 4 : 0);
|
|
66
|
+
const headH = Math.max(...s.actors.map((a) => a.h));
|
|
67
|
+
const actors = {};
|
|
68
|
+
s.actors.forEach((a, i) => {
|
|
69
|
+
actors[a.id] = { x: cx[i] - a.w / 2, y: top + (headH - a.h), w: a.w, h: a.h };
|
|
70
|
+
});
|
|
71
|
+
// ---------- 行 ----------
|
|
72
|
+
const blockOf = new Map(s.blocks.map((b) => [b.id, b]));
|
|
73
|
+
const depthOf = (id) => {
|
|
74
|
+
let d = 0;
|
|
75
|
+
for (let b = blockOf.get(id); b?.parent; b = blockOf.get(b.parent))
|
|
76
|
+
d++;
|
|
77
|
+
return d;
|
|
78
|
+
};
|
|
79
|
+
let y = top + headH + 26;
|
|
80
|
+
const messages = {};
|
|
81
|
+
const blockY = new Map();
|
|
82
|
+
let open = [];
|
|
83
|
+
let k = 0;
|
|
84
|
+
for (const m of s.messages) {
|
|
85
|
+
// 离开的片段:收尾
|
|
86
|
+
const keep = open.filter((b, i) => m.blocks[i] === b);
|
|
87
|
+
for (const b of open.slice(keep.length).reverse()) {
|
|
88
|
+
y += BLOCK_TAIL;
|
|
89
|
+
blockY.get(b).y1 = y;
|
|
90
|
+
}
|
|
91
|
+
// 进入的片段:留出标签行
|
|
92
|
+
for (const b of m.blocks.slice(keep.length)) {
|
|
93
|
+
blockY.set(b, { y0: y, y1: y });
|
|
94
|
+
y += BLOCK_HEAD;
|
|
95
|
+
}
|
|
96
|
+
open = [...m.blocks];
|
|
97
|
+
if (!idx.has(m.from) || !idx.has(m.to))
|
|
98
|
+
continue; // 编译期已报 UNKNOWN_DIAGRAM_NODE
|
|
99
|
+
k++;
|
|
100
|
+
const lw = labelW(m.label);
|
|
101
|
+
if (m.from === m.to) {
|
|
102
|
+
const x = cx[idx.get(m.from)];
|
|
103
|
+
const ly = y + 18;
|
|
104
|
+
const points = [{ x, y: ly }, { x: x + SELF_W, y: ly }, { x: x + SELF_W, y: ly + 20 }, { x, y: ly + 20 }];
|
|
105
|
+
messages[m.id] = { points, label: lw ? { x: x + SELF_W + 8, y: ly + 1, w: lw, h: 18 } : null, n: k, self: true };
|
|
106
|
+
y += SELF_ROW;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const x1 = cx[idx.get(m.from)];
|
|
110
|
+
const x2 = cx[idx.get(m.to)];
|
|
111
|
+
const ly = y + 28;
|
|
112
|
+
messages[m.id] = { points: [{ x: x1, y: ly }, { x: x2, y: ly }], label: lw ? { x: (x1 + x2) / 2 - lw / 2, y: ly - 24, w: lw, h: 18 } : null, n: k, self: false };
|
|
113
|
+
y += ROW;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const b of open.reverse()) {
|
|
117
|
+
y += BLOCK_TAIL;
|
|
118
|
+
blockY.get(b).y1 = y;
|
|
119
|
+
}
|
|
120
|
+
// 没有消息的片段(只有标题)
|
|
121
|
+
for (const b of s.blocks)
|
|
122
|
+
if (!blockY.has(b.id))
|
|
123
|
+
blockY.set(b.id, { y0: y, y1: (y += BLOCK_HEAD + BLOCK_TAIL) });
|
|
124
|
+
const bottom = y + 18;
|
|
125
|
+
// ---------- 片段框 ----------
|
|
126
|
+
const blocks = {};
|
|
127
|
+
const blockTitles = {};
|
|
128
|
+
const involved = (bid) => {
|
|
129
|
+
const cols = new Set();
|
|
130
|
+
for (const m of s.messages)
|
|
131
|
+
if (m.blocks.includes(bid) && idx.has(m.from) && idx.has(m.to))
|
|
132
|
+
[idx.get(m.from), idx.get(m.to)].forEach((c) => cols.add(c));
|
|
133
|
+
return [...cols];
|
|
134
|
+
};
|
|
135
|
+
for (const b of s.blocks) {
|
|
136
|
+
const cols = involved(b.id);
|
|
137
|
+
const d = depthOf(b.id);
|
|
138
|
+
const inset = (BLOCK_PAD * 2) / 3;
|
|
139
|
+
const c0 = cols.length ? Math.min(...cols) : 0;
|
|
140
|
+
const c1 = cols.length ? Math.max(...cols) : n - 1;
|
|
141
|
+
// 包含自调用时右侧多留出回环与标签
|
|
142
|
+
const selfExtra = Math.max(0, ...s.messages.filter((m) => m.blocks.includes(b.id) && m.from === m.to && idx.get(m.from) === c1).map((m) => SELF_W + 8 + labelW(m.label)));
|
|
143
|
+
const x0 = cx[c0] - Math.max(BLOCK_PAD + 40, s.actors[c0].w / 2 - 6) + d * inset;
|
|
144
|
+
const x1 = cx[c1] + Math.max(BLOCK_PAD + 40, s.actors[c1].w / 2 - 6, selfExtra + 10) - d * inset;
|
|
145
|
+
const yy = blockY.get(b.id);
|
|
146
|
+
blocks[b.id] = { x: x0, y: yy.y0 + 2, w: x1 - x0, h: yy.y1 - yy.y0 - 2 };
|
|
147
|
+
const title = `${b.kind}${b.label ? ` ${b.label}` : ''}`;
|
|
148
|
+
blockTitles[b.id] = { x: x0, y: yy.y0 + 2, w: Math.min(x1 - x0, textWidth(title, EDGE_FONT) + 18), h: 20 };
|
|
149
|
+
}
|
|
150
|
+
// ---------- 生命线与分组 ----------
|
|
151
|
+
const lifelines = {};
|
|
152
|
+
for (const a of s.actors)
|
|
153
|
+
lifelines[a.id] = { x: cx[idx.get(a.id)], y1: actors[a.id].y + actors[a.id].h, y2: bottom };
|
|
154
|
+
const groups = {};
|
|
155
|
+
const titles = {};
|
|
156
|
+
for (const g of s.groups) {
|
|
157
|
+
const members = s.actors.filter((a) => a.group === g.id);
|
|
158
|
+
if (!members.length)
|
|
159
|
+
continue;
|
|
160
|
+
const x0 = Math.min(...members.map((a) => actors[a.id].x)) - GROUP_PAD;
|
|
161
|
+
const x1 = Math.max(...members.map((a) => actors[a.id].x + actors[a.id].w)) + GROUP_PAD;
|
|
162
|
+
groups[g.id] = { x: x0, y: M, w: x1 - x0, h: bottom + 6 - M };
|
|
163
|
+
titles[g.id] = { x: x0 + 6, y: M + 4, w: Math.min(x1 - x0 - 12, groupTitleWidth(g.label, !!g.icon)), h: GROUP_HEAD - 6 };
|
|
164
|
+
}
|
|
165
|
+
// ---------- 整体尺寸 ----------
|
|
166
|
+
const boxes = [...Object.values(actors), ...Object.values(groups), ...Object.values(blocks), ...Object.values(messages).flatMap((m) => (m.label ? [m.label] : []))];
|
|
167
|
+
const maxX = Math.max(...boxes.map((b) => b.x + b.w), ...Object.values(messages).flatMap((m) => m.points.map((p) => p.x)));
|
|
168
|
+
const minX = Math.min(...boxes.map((b) => b.x));
|
|
169
|
+
const dx = minX < M ? M - minX : 0;
|
|
170
|
+
const r2 = (v) => Math.round(v * 2) / 2;
|
|
171
|
+
const mv = (b) => ({ x: r2(b.x + dx), y: r2(b.y), w: r2(b.w), h: r2(b.h) });
|
|
172
|
+
const mvAll = (o) => Object.fromEntries(Object.entries(o).map(([k2, b]) => [k2, mv(b)]));
|
|
173
|
+
return {
|
|
174
|
+
kind: 'sequence',
|
|
175
|
+
width: Math.ceil(maxX + dx + M),
|
|
176
|
+
height: Math.ceil(bottom + 6 + M),
|
|
177
|
+
actors: mvAll(actors),
|
|
178
|
+
lifelines: Object.fromEntries(Object.entries(lifelines).map(([k2, l]) => [k2, { x: r2(l.x + dx), y1: r2(l.y1), y2: r2(l.y2) }])),
|
|
179
|
+
messages: Object.fromEntries(Object.entries(messages).map(([k2, m]) => [k2, { ...m, points: m.points.map((p) => ({ x: r2(p.x + dx), y: r2(p.y) })), label: m.label ? mv(m.label) : null }])),
|
|
180
|
+
groups: mvAll(groups),
|
|
181
|
+
titles: mvAll(titles),
|
|
182
|
+
blocks: mvAll(blocks),
|
|
183
|
+
blockTitles: mvAll(blockTitles),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Diagnostic } from './result.js';
|
|
2
|
+
import type { Project, Scenario } from './schema.js';
|
|
3
|
+
export declare const FOCUS_IDLE_RUN = 3;
|
|
4
|
+
type Emit = (severity: Diagnostic['severity'], code: string, message: string, at: string | undefined, ref?: Diagnostic['ref']) => void;
|
|
5
|
+
/** 结构类提示:只看 IR,不回放。 */
|
|
6
|
+
export declare function focusStructureDiagnostics(p: Project, scenarios: Scenario[], emit: Emit): void;
|
|
7
|
+
/** 回放类提示:需要每一步的状态(只对回放成功的场景调用)。 */
|
|
8
|
+
export declare function focusReplayDiagnostics(p: Project, sc: Scenario, emit: Emit): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 焦点相关的 check 提示(D70),少而准:
|
|
3
|
+
* - FOCUS_OFF_LAYER(warning):提示 / 气泡 / 标注的目标不在这一步导演所在的层,观众看不到(之前静默不画);
|
|
4
|
+
* - FOCUS_CONFLICT(warning):这一步自己写了 shot,提示的目标却在 shot 之外:镜头对准一处、提示指向另一处;
|
|
5
|
+
* - CALLOUT_TOO_LONG(warning):气泡与字幕同一口径(CAPTION_MAX);
|
|
6
|
+
* - FOCUS_IDLE(info,需要回放):连续 FOCUS_IDLE_RUN 个系统步骤画面上什么都没变,观众只能读字幕。
|
|
7
|
+
* 焦点目标不存在(FOCUS_UNKNOWN)、参数不合法由编译器报 error。
|
|
8
|
+
*/
|
|
9
|
+
import { CAPTION_MAX, DIRECTOR_LAYER, PAGE_LAYER, captionLength } from "./catalog.js";
|
|
10
|
+
import { focusTimeline, inShotFrame } from "./focus.js";
|
|
11
|
+
import { cameraAt, findNode, layersOf } from "./player.js";
|
|
12
|
+
export const FOCUS_IDLE_RUN = 3;
|
|
13
|
+
/** 结构类提示:只看 IR,不回放。 */
|
|
14
|
+
export function focusStructureDiagnostics(p, scenarios, emit) {
|
|
15
|
+
for (const sc of scenarios) {
|
|
16
|
+
const layers = layersOf(p, sc.id);
|
|
17
|
+
const sceneOfLayer = (lk) => p.scenes[layers.find((l) => l.id === lk)?.sceneId ?? ''];
|
|
18
|
+
sc.steps.forEach((st, i) => {
|
|
19
|
+
const at = st.source ?? sc.source;
|
|
20
|
+
const ref = { kind: 'step', id: st.id, optionId: sc.optionId, stepId: st.id };
|
|
21
|
+
for (const c of st.callouts ?? []) {
|
|
22
|
+
const n = captionLength(c.text);
|
|
23
|
+
if (n > CAPTION_MAX)
|
|
24
|
+
emit('warning', 'CALLOUT_TOO_LONG', `callout("${c.target}") text is ${n} units (recommended maximum: ${CAPTION_MAX}, same as captions): "${c.text}". Say one reason in a few words; put the rest in explain()`, at, ref);
|
|
25
|
+
}
|
|
26
|
+
const named = [
|
|
27
|
+
...(st.cues ?? []).flatMap((c) => c.targets.map((id) => ({ id, fn: c.kind === 'number' ? 'numbered' : c.kind }))),
|
|
28
|
+
...(st.callouts ?? []).map((c) => ({ id: c.target, fn: 'callout' })),
|
|
29
|
+
...(st.marks ?? []).map((m) => ({ id: m.target, fn: 'mark' })),
|
|
30
|
+
];
|
|
31
|
+
if (!named.length)
|
|
32
|
+
return;
|
|
33
|
+
const layer = layers.length ? cameraAt(p, sc.id, i + 1).directorLayer : PAGE_LAYER;
|
|
34
|
+
const scene = layers.length ? sceneOfLayer(layer) : undefined;
|
|
35
|
+
// 有层级:目标要在导演层里,否则这一步看不到它
|
|
36
|
+
if (scene) {
|
|
37
|
+
for (const { id, fn } of named) {
|
|
38
|
+
if (findNode(scene, id))
|
|
39
|
+
continue;
|
|
40
|
+
const elsewhere = layers.filter((l) => { const s = p.scenes[l.sceneId]; return !!s && !!findNode(s, id); }).map((l) => l.id);
|
|
41
|
+
emit('warning', 'FOCUS_OFF_LAYER', `${fn}("${id}") is in layer ${elsewhere.join(', ') || '?'}, but after this step the director is on layer ${layer}, so viewers will not see it. Add shot('${id}') to switch there, or point at an element in ${layer}`, at, ref);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// 这一步写了 shot:提示的目标要在镜头里(镜头目标、它的子元素,或 D69 取景一定带上的父分组 / 两端参与者,见 inShotFrame)
|
|
45
|
+
const shots = (st.shots ?? []).filter((s) => (s.layer === layer || s.layer === DIRECTOR_LAYER) && s.targets.length);
|
|
46
|
+
const frameScene = scene ?? (layers.length ? undefined : sceneAtStep(p, sc, i));
|
|
47
|
+
if (!shots.length || !frameScene)
|
|
48
|
+
return;
|
|
49
|
+
const frame = shots.flatMap((s) => s.targets);
|
|
50
|
+
for (const { id, fn } of named) {
|
|
51
|
+
if (fn === 'mark' || !findNode(frameScene, id))
|
|
52
|
+
continue;
|
|
53
|
+
const inside = inShotFrame(frameScene.root, id, frame);
|
|
54
|
+
if (!inside)
|
|
55
|
+
emit('warning', 'FOCUS_CONFLICT', `This step frames ${frame.map((x) => `"${x}"`).join(', ')} with shot, but ${fn}("${id}") points outside that frame; it may be off-screen or dimmed. Point both at the same thing, add "${id}" to the shot, or split this into two steps`, at, ref);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** 回放类提示:需要每一步的状态(只对回放成功的场景调用)。 */
|
|
61
|
+
export function focusReplayDiagnostics(p, sc, emit) {
|
|
62
|
+
const tl = focusTimeline(p, sc.id);
|
|
63
|
+
let run = [];
|
|
64
|
+
const flush = () => {
|
|
65
|
+
if (run.length >= FOCUS_IDLE_RUN) {
|
|
66
|
+
const first = sc.steps[run[0]];
|
|
67
|
+
emit('info', 'FOCUS_IDLE', `${run.length} system steps in a row (${run.map((i) => i + 1).join(', ')}) change nothing on stage, so viewers only read captions. Merge them into one step, or show what happens: shot / highlight / callout the element, or set() state that the stage displays`, first.source ?? sc.source, { kind: 'step', id: first.id, optionId: sc.optionId, stepId: first.id });
|
|
68
|
+
}
|
|
69
|
+
run = [];
|
|
70
|
+
};
|
|
71
|
+
sc.steps.forEach((st, i) => {
|
|
72
|
+
const f = tl[i + 1];
|
|
73
|
+
if (st.kind === 'system' && f && f.subject === 'caption')
|
|
74
|
+
run.push(i);
|
|
75
|
+
else
|
|
76
|
+
flush();
|
|
77
|
+
});
|
|
78
|
+
flush();
|
|
79
|
+
}
|
|
80
|
+
/** 没有层级的方案:第 i 步执行之后的路径画面(按 navigate / back 推算,与回放相同的页面栈)。 */
|
|
81
|
+
function sceneAtStep(p, sc, i) {
|
|
82
|
+
let sceneId = sc.initial.sceneId;
|
|
83
|
+
const stack = [];
|
|
84
|
+
for (let k = 0; k <= i; k++) {
|
|
85
|
+
const st = sc.steps[k];
|
|
86
|
+
if (st.action.type === 'back')
|
|
87
|
+
sceneId = stack.pop() ?? sceneId;
|
|
88
|
+
for (const e of st.effects)
|
|
89
|
+
if (e.type === 'navigate') {
|
|
90
|
+
stack.push(sceneId);
|
|
91
|
+
sceneId = e.sceneId;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return p.scenes[sceneId];
|
|
95
|
+
}
|
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type PlayState } from './player.js';
|
|
2
|
+
import type { Callout, Project, Scene, SceneNode, Step } from './schema.js';
|
|
3
|
+
export declare const HOLD_MIN_SECONDS = 0.5;
|
|
4
|
+
export declare const HOLD_MAX_SECONDS = 30;
|
|
5
|
+
/** 默认揭晓最多提示几处;更多时不提示。 */
|
|
6
|
+
export declare const REVEAL_MAX = 3;
|
|
7
|
+
export type FocusSubject = 'cover' | 'card' | 'scene' | 'elements' | 'toast' | 'caption';
|
|
8
|
+
export type FocusState = {
|
|
9
|
+
/** 观众此刻该看的东西。 */
|
|
10
|
+
subject: FocusSubject;
|
|
11
|
+
/** explicit = 作者写的;auto = 默认规则推导;none = 没有焦点(只有字幕)。 */
|
|
12
|
+
source: 'explicit' | 'auto' | 'none';
|
|
13
|
+
/** 焦点元素(subject = elements 时;按作者顺序,默认推导时操作目标在前)。 */
|
|
14
|
+
targets: string[];
|
|
15
|
+
/** 这一步之后导演所在的层(没有层级时是 @page)。 */
|
|
16
|
+
layer: string;
|
|
17
|
+
/** 作者写的提示(只作用于这一步)。 */
|
|
18
|
+
spotlight: string[];
|
|
19
|
+
highlight: string[];
|
|
20
|
+
numbered: string[];
|
|
21
|
+
callouts: Callout[];
|
|
22
|
+
/** 默认的结果揭晓:要轻轻提示一次的元素(autoFocus 关闭、作者写了焦点、变化太多时为空)。 */
|
|
23
|
+
reveal: string[];
|
|
24
|
+
/** 自动播放时至少停留的毫秒数(hold,未按速度缩放);0 = 只按阅读节奏。 */
|
|
25
|
+
holdMs: number;
|
|
26
|
+
};
|
|
27
|
+
type Vis = Pick<PlayState, 'ui' | 'data' | 'inputs'>;
|
|
28
|
+
/**
|
|
29
|
+
* 画面里此刻可见的元素 id(与 isNodeVisible 同一套规则:when、浮层 opened、断点、AppShell 收起),一次自上而下算完。
|
|
30
|
+
*/
|
|
31
|
+
export declare function visibleIds(scene: Scene, state: Vis, width?: number): Set<string>;
|
|
32
|
+
/** 整个场景每个位置(0..步数)的焦点;按项目对象缓存(热更新换了项目对象就重新算)。 */
|
|
33
|
+
export declare function focusTimeline(project: Project, scenarioId: string): FocusState[];
|
|
34
|
+
/**
|
|
35
|
+
* 焦点提示的目标是否“在镜头里”(集成 0.2.8:D69 取景 × D70 焦点的组合规则)。编译器决定要不要给提示补整层镜头、
|
|
36
|
+
* check 的 FOCUS_CONFLICT 都用它。在镜头里 =
|
|
37
|
+
* - 镜头目标本身,或它的子元素;
|
|
38
|
+
* - 镜头目标是图表元素时,它的最内层父分组:D69 的取景一定带上这个分组(至少标题),分组框与标题也不随焦点外调暗;
|
|
39
|
+
* - 镜头目标是时序图的消息时,它两端的参与者:取景带上它们的头部。
|
|
40
|
+
* 同一分组里的兄弟节点不算(取景可能只带分组标题,而且焦点外的兄弟元素会被调暗)。
|
|
41
|
+
*/
|
|
42
|
+
export declare function inShotFrame(root: SceneNode, id: string, frameTargets: readonly string[]): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 第 position 步之后的焦点(0 = 封面;越界夹到 0..步数)。纯函数:只由 IR 与位置决定,跳转、前后翻、回放结果相同。
|
|
45
|
+
* 返回新对象,调用方可以随意修改。
|
|
46
|
+
*/
|
|
47
|
+
export declare function focusAt(project: Project, scenarioId: string | null | undefined, position: number): FocusState;
|
|
48
|
+
/** 自动播放时这一步至少停留多久(毫秒,已按速度缩放;0 = 没写 hold)。 */
|
|
49
|
+
export declare function holdMsOf(step: Pick<Step, 'hold'> | undefined, speed?: number): number;
|
|
50
|
+
export {};
|
package/dist/focus.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 叙事焦点(D70):每一步观众该看哪里(焦点对象),以及用什么形式呈现。纯函数,与 cameraAt / diagramStateAt 同级:
|
|
3
|
+
* 看板、发布站(含嵌入、评审)、renderStep 截图、视频录制、check 都读这一份。
|
|
4
|
+
*
|
|
5
|
+
* 焦点对象(subject)按优先级:
|
|
6
|
+
* cover 第 0 步:场景封面;
|
|
7
|
+
* card 过渡卡就是焦点本身;
|
|
8
|
+
* 作者写的:shot / trace / spotlight / highlight / numbered / callout / mark 的目标(source = explicit);
|
|
9
|
+
* 默认推导(source = auto):
|
|
10
|
+
* scene 换页、导演换层:整个新画面就是焦点(先看全局);
|
|
11
|
+
* elements 用户操作 = 被操作的元素(呈现就是鼠标与点击波纹);系统步骤 = 本步新出现或变化的元素;
|
|
12
|
+
* toast 画面里没变,只弹了 Toast;
|
|
13
|
+
* caption 画面上没有新东西,只看字幕(source = none)。
|
|
14
|
+
*
|
|
15
|
+
* 呈现:作者写的提示原样给出;默认只有“结果揭晓”(reveal):本步新出现或变化、观众容易错过的元素轻轻脉冲一次,
|
|
16
|
+
* 不移动镜头、不压暗、不拦截点击。克制规则:弹窗 / 抽屉自带遮罩不提示;DataCard / StateFlow 自己会突出变化;
|
|
17
|
+
* 一次变化超过 REVEAL_MAX 处不提示(整块都变了,让观众自己看);作者写了任何焦点时不加默认提示;换页、换层不提示;
|
|
18
|
+
* 同一个元素连续变化、或往同一个容器里连续追加(终端、聊天记录一行行出现)时,只在第一次提示。
|
|
19
|
+
* config({ autoFocus: false }) 关掉默认呈现(reveal 恒为空);焦点对象仍照常推导,check 用它判断“长时间没有焦点”。
|
|
20
|
+
*/
|
|
21
|
+
import { DIRECTOR_LAYER, GATED_CONTAINERS, PAGE_LAYER, childWidth } from "./catalog.js";
|
|
22
|
+
import { diagramsIn } from "./diagram/index.js";
|
|
23
|
+
import { appShellLayout, applyStep, cameraAt, initialState, isNodeDisabled, isSelfVisible, layersOf, resolveProps, sceneWidth } from "./player.js";
|
|
24
|
+
export const HOLD_MIN_SECONDS = 0.5;
|
|
25
|
+
export const HOLD_MAX_SECONDS = 30;
|
|
26
|
+
/** 默认揭晓最多提示几处;更多时不提示。 */
|
|
27
|
+
export const REVEAL_MAX = 3;
|
|
28
|
+
/** 自带遮罩、出现时本身就是焦点的浮层:默认揭晓不再画提示。 */
|
|
29
|
+
const SELF_EVIDENT = GATED_CONTAINERS;
|
|
30
|
+
/** 自己会突出本步变化的组件(D56)。 */
|
|
31
|
+
const SELF_CHANGING = new Set(['DataCard', 'StateFlow']);
|
|
32
|
+
/**
|
|
33
|
+
* 关系类图表(D69)也自己呈现变化:新元素淡入、连线沿路径画出、trace / value 点亮。默认的结果揭晓不再叠一圈
|
|
34
|
+
* (连线的外接矩形是一大块,状态机 value 变化会框住整张图),集成 0.2.8 的组合规则。
|
|
35
|
+
*/
|
|
36
|
+
const DIAGRAM_FAMILY = /^(Diagram|StateMachine|Sequence)(\.|$)/;
|
|
37
|
+
const EMPTY = (layer, subject = 'caption') => ({ subject, source: 'none', targets: [], layer, spotlight: [], highlight: [], numbered: [], callouts: [], reveal: [], holdMs: 0 });
|
|
38
|
+
/**
|
|
39
|
+
* 画面里此刻可见的元素 id(与 isNodeVisible 同一套规则:when、浮层 opened、断点、AppShell 收起),一次自上而下算完。
|
|
40
|
+
*/
|
|
41
|
+
export function visibleIds(scene, state, width = sceneWidth(scene)) {
|
|
42
|
+
const out = new Set();
|
|
43
|
+
const ps = state;
|
|
44
|
+
const rec = (n, w, shell) => {
|
|
45
|
+
if (!isSelfVisible(n, ps, w))
|
|
46
|
+
return;
|
|
47
|
+
const sh = n.type === 'AppShell' ? { node: n, width: w } : shell;
|
|
48
|
+
if (sh && (n.type === 'AppShell.Navbar' || n.type === 'AppShell.Aside')) {
|
|
49
|
+
const l = appShellLayout(sh.node.props, state, sh.width);
|
|
50
|
+
if ((n.type === 'AppShell.Navbar' ? l.navbar : l.aside)?.collapsed)
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
out.add(n.id);
|
|
54
|
+
const cw = childWidth(n.type, w);
|
|
55
|
+
for (const c of n.children ?? [])
|
|
56
|
+
rec(c, cw, sh);
|
|
57
|
+
};
|
|
58
|
+
rec(scene.root, width, null);
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
function changedElements(scene, before, after) {
|
|
62
|
+
const vb = visibleIds(scene, before);
|
|
63
|
+
const va = visibleIds(scene, after);
|
|
64
|
+
const hits = [];
|
|
65
|
+
const parents = new Map();
|
|
66
|
+
const add = (n, appended) => { if (n && !hits.some((h) => h.id === n.id))
|
|
67
|
+
hits.push({ id: n.id, type: n.type, parent: parents.get(n.id) ?? null, appended: appended && n.type !== '#text' }); };
|
|
68
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
69
|
+
const rec = (n, parent) => {
|
|
70
|
+
parents.set(n.id, parent?.id ?? null);
|
|
71
|
+
if (!va.has(n.id))
|
|
72
|
+
return;
|
|
73
|
+
const owner = n.type === '#text' ? parent : n;
|
|
74
|
+
if (!vb.has(n.id)) {
|
|
75
|
+
add(owner, owner === n);
|
|
76
|
+
return;
|
|
77
|
+
} // 整棵新出现:只记最外层
|
|
78
|
+
if (!same(resolveProps(n, before), resolveProps(n, after)) || isNodeDisabled(n, before) !== isNodeDisabled(n, after))
|
|
79
|
+
add(owner, false);
|
|
80
|
+
for (const c of n.children ?? [])
|
|
81
|
+
rec(c, n.type === '#text' ? parent : n);
|
|
82
|
+
};
|
|
83
|
+
rec(scene.root, null);
|
|
84
|
+
// 只留最外层:祖先已经在列表里的去掉
|
|
85
|
+
const inside = (id, anc) => { const a = findIn(scene.root, anc); return !!a && a.id !== id && !!findIn(a, id); };
|
|
86
|
+
return hits.filter((h) => !hits.some((o) => o.id !== h.id && inside(h.id, o.id)));
|
|
87
|
+
}
|
|
88
|
+
function findIn(node, id) {
|
|
89
|
+
if (node.id === id)
|
|
90
|
+
return node;
|
|
91
|
+
for (const c of node.children ?? []) {
|
|
92
|
+
const f = findIn(c, id);
|
|
93
|
+
if (f)
|
|
94
|
+
return f;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
/** 作者写在这一步上的焦点目标(按出现顺序去重):镜头(这一步导演层的)、调用链、提示、气泡、标注。 */
|
|
99
|
+
function explicitTargets(step, layer) {
|
|
100
|
+
const out = [];
|
|
101
|
+
const add = (id) => { if (!out.includes(id))
|
|
102
|
+
out.push(id); };
|
|
103
|
+
let wholeLayer = false;
|
|
104
|
+
for (const s of step.shots ?? []) {
|
|
105
|
+
if (s.layer !== layer && s.layer !== DIRECTOR_LAYER)
|
|
106
|
+
continue;
|
|
107
|
+
if (!s.targets.length)
|
|
108
|
+
wholeLayer = true;
|
|
109
|
+
s.targets.forEach(add);
|
|
110
|
+
}
|
|
111
|
+
// trace 的焦点对象与镜头目标相同(D69 的 Trace.targets:时序图是消息那一行;旧 IR 没有时按 nodes)
|
|
112
|
+
for (const t of step.traces ?? [])
|
|
113
|
+
if (t.mode !== 'skip')
|
|
114
|
+
(t.targets ?? t.nodes).forEach(add);
|
|
115
|
+
for (const c of step.cues ?? [])
|
|
116
|
+
c.targets.forEach(add);
|
|
117
|
+
for (const c of step.callouts ?? [])
|
|
118
|
+
add(c.target);
|
|
119
|
+
for (const m of step.marks ?? [])
|
|
120
|
+
add(m.target);
|
|
121
|
+
return { targets: out, wholeLayer };
|
|
122
|
+
}
|
|
123
|
+
/** 这一层(或路径页面)在第 position 步之后显示的画面。 */
|
|
124
|
+
function shownScene(project, scenarioId, position, state) {
|
|
125
|
+
const layers = layersOf(project, scenarioId);
|
|
126
|
+
if (!layers.length)
|
|
127
|
+
return { layer: PAGE_LAYER, scene: state ? project.scenes[state.sceneId] : undefined };
|
|
128
|
+
const layer = cameraAt(project, scenarioId, position).directorLayer;
|
|
129
|
+
return { layer, scene: project.scenes[(layers.find((l) => l.id === layer) ?? layers[0]).sceneId] };
|
|
130
|
+
}
|
|
131
|
+
const timelines = new WeakMap();
|
|
132
|
+
/** 整个场景每个位置(0..步数)的焦点;按项目对象缓存(热更新换了项目对象就重新算)。 */
|
|
133
|
+
export function focusTimeline(project, scenarioId) {
|
|
134
|
+
let byScenario = timelines.get(project);
|
|
135
|
+
if (!byScenario)
|
|
136
|
+
timelines.set(project, (byScenario = new Map()));
|
|
137
|
+
const hit = byScenario.get(scenarioId);
|
|
138
|
+
if (hit)
|
|
139
|
+
return hit;
|
|
140
|
+
const sc = project.scenarios[scenarioId];
|
|
141
|
+
const out = [];
|
|
142
|
+
if (!sc) {
|
|
143
|
+
byScenario.set(scenarioId, out);
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
const auto = project.autoFocus !== false;
|
|
147
|
+
// 逐步回放(与 stateAt 同一个 applyStep);回放失败之后的位置没有状态,只给作者写的焦点
|
|
148
|
+
const states = [];
|
|
149
|
+
let s = null;
|
|
150
|
+
try {
|
|
151
|
+
s = initialState(project, scenarioId);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
s = null;
|
|
155
|
+
}
|
|
156
|
+
states.push(s);
|
|
157
|
+
for (let i = 0; i < sc.steps.length; i++) {
|
|
158
|
+
if (s) {
|
|
159
|
+
try {
|
|
160
|
+
s = applyStep(project, sc, s);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
s = null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
states.push(s);
|
|
167
|
+
}
|
|
168
|
+
out.push(EMPTY(shownScene(project, scenarioId, 0, states[0] ?? null).layer, 'cover'));
|
|
169
|
+
/** 上一步变化过的元素与它们所在的容器(连续性:同一处连续变化只在第一次提示)。 */
|
|
170
|
+
let prevChanged = new Set();
|
|
171
|
+
for (let k = 1; k <= sc.steps.length; k++) {
|
|
172
|
+
const lastChanged = prevChanged;
|
|
173
|
+
prevChanged = new Set();
|
|
174
|
+
const step = sc.steps[k - 1];
|
|
175
|
+
const before = states[k - 1] ?? null;
|
|
176
|
+
const after = states[k] ?? null;
|
|
177
|
+
const { layer, scene } = shownScene(project, scenarioId, k, after);
|
|
178
|
+
const f = EMPTY(layer);
|
|
179
|
+
f.holdMs = step.hold ?? 0;
|
|
180
|
+
for (const c of step.cues ?? []) {
|
|
181
|
+
const list = c.kind === 'spotlight' ? f.spotlight : c.kind === 'highlight' ? f.highlight : f.numbered;
|
|
182
|
+
for (const id of c.targets)
|
|
183
|
+
if (!list.includes(id))
|
|
184
|
+
list.push(id);
|
|
185
|
+
}
|
|
186
|
+
f.callouts = (step.callouts ?? []).map((c) => ({ ...c }));
|
|
187
|
+
out.push(f);
|
|
188
|
+
if (step.kind === 'card') {
|
|
189
|
+
f.subject = 'card';
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const ex = explicitTargets(step, layer);
|
|
193
|
+
if (ex.targets.length || ex.wholeLayer) {
|
|
194
|
+
Object.assign(f, { subject: ex.targets.length ? 'elements' : 'scene', source: 'explicit', targets: ex.targets });
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const actionTarget = 'target' in step.action ? step.action.target : null;
|
|
198
|
+
if (!before || !after) {
|
|
199
|
+
if (actionTarget)
|
|
200
|
+
Object.assign(f, { subject: 'elements', source: 'auto', targets: [actionTarget] });
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
// 换页、导演换层:整个新画面就是焦点(用户操作仍然看被操作的元素)
|
|
204
|
+
const prevLayer = shownScene(project, scenarioId, k - 1, before).layer;
|
|
205
|
+
const newView = layersOf(project, scenarioId).length ? prevLayer !== layer : before.sceneId !== after.sceneId;
|
|
206
|
+
if (newView) {
|
|
207
|
+
Object.assign(f, actionTarget && step.kind === 'user' ? { subject: 'elements', source: 'auto', targets: [actionTarget] } : { subject: 'scene', source: 'auto' });
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
// 本步新出现或变化的元素;用户自己操作的元素(及其内部)不算,鼠标已经在那里
|
|
211
|
+
const target = actionTarget && scene ? findIn(scene.root, actionTarget) : null;
|
|
212
|
+
const hits = scene ? changedElements(scene, before, after).filter((h) => !(target && findIn(target, h.id))) : [];
|
|
213
|
+
for (const h of hits) {
|
|
214
|
+
prevChanged.add(h.id);
|
|
215
|
+
if (h.appended && h.parent)
|
|
216
|
+
prevChanged.add(`^${h.parent}`);
|
|
217
|
+
}
|
|
218
|
+
const targets = [...(actionTarget ? [actionTarget] : []), ...hits.map((h) => h.id)];
|
|
219
|
+
if (targets.length)
|
|
220
|
+
Object.assign(f, { subject: 'elements', source: 'auto', targets });
|
|
221
|
+
else if (after.toasts.length)
|
|
222
|
+
Object.assign(f, { subject: 'toast', source: 'auto' });
|
|
223
|
+
// 连续性:同一个元素上一步刚变过;或者往上一步刚追加过的同一个容器里再追加(终端、聊天记录一行行出现)。
|
|
224
|
+
// 观众已经在看那里,不再重复提示
|
|
225
|
+
const repeated = (h) => lastChanged.has(h.id) || (h.appended && !!h.parent && lastChanged.has(`^${h.parent}`));
|
|
226
|
+
const shown = hits.filter((h) => !SELF_EVIDENT.has(h.type) && !SELF_CHANGING.has(h.type) && !DIAGRAM_FAMILY.test(h.type) && !repeated(h));
|
|
227
|
+
if (auto && shown.length <= REVEAL_MAX)
|
|
228
|
+
f.reveal = shown.map((h) => h.id);
|
|
229
|
+
}
|
|
230
|
+
byScenario.set(scenarioId, out);
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 焦点提示的目标是否“在镜头里”(集成 0.2.8:D69 取景 × D70 焦点的组合规则)。编译器决定要不要给提示补整层镜头、
|
|
235
|
+
* check 的 FOCUS_CONFLICT 都用它。在镜头里 =
|
|
236
|
+
* - 镜头目标本身,或它的子元素;
|
|
237
|
+
* - 镜头目标是图表元素时,它的最内层父分组:D69 的取景一定带上这个分组(至少标题),分组框与标题也不随焦点外调暗;
|
|
238
|
+
* - 镜头目标是时序图的消息时,它两端的参与者:取景带上它们的头部。
|
|
239
|
+
* 同一分组里的兄弟节点不算(取景可能只带分组标题,而且焦点外的兄弟元素会被调暗)。
|
|
240
|
+
*/
|
|
241
|
+
export function inShotFrame(root, id, frameTargets) {
|
|
242
|
+
if (frameTargets.includes(id))
|
|
243
|
+
return true;
|
|
244
|
+
for (const f of frameTargets) {
|
|
245
|
+
const n = findIn(root, f);
|
|
246
|
+
if (n && findIn(n, id))
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
const diagrams = diagramsIn(root);
|
|
250
|
+
for (const f of frameTargets)
|
|
251
|
+
for (const d of diagrams) {
|
|
252
|
+
if (d.groupsOf.get(f)?.[0] === id)
|
|
253
|
+
return true;
|
|
254
|
+
if (d.type === 'Sequence' && d.edges.some((e) => e.id === f && (e.from === id || e.to === id)))
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 第 position 步之后的焦点(0 = 封面;越界夹到 0..步数)。纯函数:只由 IR 与位置决定,跳转、前后翻、回放结果相同。
|
|
261
|
+
* 返回新对象,调用方可以随意修改。
|
|
262
|
+
*/
|
|
263
|
+
export function focusAt(project, scenarioId, position) {
|
|
264
|
+
const tl = scenarioId ? focusTimeline(project, scenarioId) : [];
|
|
265
|
+
if (!tl.length)
|
|
266
|
+
return EMPTY(PAGE_LAYER);
|
|
267
|
+
const k = Math.max(0, Math.min(tl.length - 1, Number.isFinite(position) ? Math.trunc(position) : 0));
|
|
268
|
+
return structuredClone(tl[k]);
|
|
269
|
+
}
|
|
270
|
+
/** 自动播放时这一步至少停留多久(毫秒,已按速度缩放;0 = 没写 hold)。 */
|
|
271
|
+
export function holdMsOf(step, speed = 1) {
|
|
272
|
+
const ms = step?.hold ?? 0;
|
|
273
|
+
return ms > 0 ? Math.round(ms / (speed > 0 ? speed : 1)) : 0;
|
|
274
|
+
}
|
package/dist/guide.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export declare const SKILL_TOPICS: readonly [{
|
|
2
2
|
readonly name: "authoring";
|
|
3
3
|
readonly description: "Mental model, first steps, page / option / flow syntax, when conditions, a form example";
|
|
4
|
+
}, {
|
|
5
|
+
readonly name: "story";
|
|
6
|
+
readonly description: "Plan a demo before coding; PM lens from a need to roles, goal, cases, and scenarios; openings, endings, captions";
|
|
4
7
|
}, {
|
|
5
8
|
readonly name: "demo";
|
|
6
9
|
readonly description: "Layers, shots, captions, full-height layout, deep links, and screenshots";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "focus";
|
|
12
|
+
readonly description: "Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "diagram";
|
|
15
|
+
readonly description: "Architecture, sequence and state diagrams: domain groups, automatic layout, traces, shot framing";
|
|
7
16
|
}, {
|
|
8
17
|
readonly name: "components";
|
|
9
18
|
readonly description: "Component catalog, supported HTML tags, line breaks, and props";
|
|
@@ -28,3 +37,8 @@ export declare function nearestSkillTopic(input: string): SkillTopic;
|
|
|
28
37
|
export declare function skillTopic(topic: string, docs?: Readonly<Record<string, string>> | null): string;
|
|
29
38
|
/** 兼容旧入口:与 joplo skill authoring 输出完全相同。 */
|
|
30
39
|
export declare function guide(): string;
|
|
40
|
+
/**
|
|
41
|
+
* `npx joplo components <名字…>`(D68):所列组件(含它的子组件,例如 Menu → Menu.Item)的属性提示、行为分组和示例。
|
|
42
|
+
* 名字不区分大小写;不认识的名字报 USAGE 并给出最接近的名字。
|
|
43
|
+
*/
|
|
44
|
+
export declare function componentDetails(names: readonly string[]): string;
|