@joplo-app/core 0.2.6 → 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 +2 -2
- package/dist/agent-skill.js +6 -4
- package/dist/catalog.d.ts +21 -5
- package/dist/catalog.js +149 -21
- package/dist/compile.d.ts +9 -1
- package/dist/compile.js +361 -64
- 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 +305 -37
- 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 +3 -0
- package/dist/player.js +22 -7
- package/dist/result.d.ts +1 -1
- package/dist/result.js +2 -0
- package/dist/schema.d.ts +103 -0
- package/dist/schema.js +55 -0
- package/dist/validate.js +45 -5
- package/package.json +3 -2
package/dist/guide.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { MENTAL_MODEL, START_ORDER } from "./agent-skill.js";
|
|
2
|
-
import { COMPONENT_TYPES, GATED_CONTAINERS, HTML_TAGS, INTERACTIVE_TYPES, JOPLO_PROPS, VALUE_TYPES } from "./catalog.js";
|
|
2
|
+
import { COMPONENT_DOCS, COMPONENT_EXAMPLES, COMPONENT_TYPES, GATED_CONTAINERS, HTML_TAGS, INTERACTIVE_TYPES, JOPLO_PROPS, VALUE_TYPES } from "./catalog.js";
|
|
3
3
|
import { JoploError } from "./result.js";
|
|
4
4
|
import { LAYER_ICONS } from "./schema.js";
|
|
5
|
+
import { DIAGRAM_GROUP_ICONS, DIAGRAM_NODE_KINDS, DIAGRAM_TONES, SEQUENCE_BLOCK_KINDS } from "./diagram/model.js";
|
|
5
6
|
export const SKILL_TOPICS = [
|
|
6
7
|
{ name: 'authoring', description: 'Mental model, first steps, page / option / flow syntax, when conditions, a form example' },
|
|
8
|
+
{ name: 'story', description: 'Plan a demo before coding; PM lens from a need to roles, goal, cases, and scenarios; openings, endings, captions' },
|
|
7
9
|
{ name: 'demo', description: 'Layers, shots, captions, full-height layout, deep links, and screenshots' },
|
|
10
|
+
{ name: 'focus', description: 'Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact' },
|
|
11
|
+
{ name: 'diagram', description: 'Architecture, sequence and state diagrams: domain groups, automatic layout, traces, shot framing' },
|
|
8
12
|
{ name: 'components', description: 'Component catalog, supported HTML tags, line breaks, and props' },
|
|
9
13
|
{ name: 'cases', description: 'Case dimensions: ask the user before starting' },
|
|
10
14
|
{ name: 'check', description: 'Read diagnostics, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
|
|
@@ -12,10 +16,13 @@ export const SKILL_TOPICS = [
|
|
|
12
16
|
{ name: 'publish', description: 'pick, build, share, review version, feedback write-back, deployment' },
|
|
13
17
|
];
|
|
14
18
|
const related = {
|
|
15
|
-
authoring: ['demo', 'components', 'cases', 'check', 'selection', 'publish'],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
authoring: ['story', 'demo', 'focus', 'diagram', 'components', 'cases', 'check', 'selection', 'publish'],
|
|
20
|
+
story: ['authoring', 'cases', 'demo', 'focus', 'check'],
|
|
21
|
+
demo: ['story', 'focus', 'authoring', 'diagram', 'components', 'check', 'publish'],
|
|
22
|
+
focus: ['demo', 'diagram', 'check', 'authoring'],
|
|
23
|
+
diagram: ['demo', 'focus', 'components', 'check'],
|
|
24
|
+
components: ['authoring', 'demo', 'focus', 'diagram', 'check'],
|
|
25
|
+
cases: ['story', 'authoring', 'check'],
|
|
19
26
|
check: ['authoring', 'selection'],
|
|
20
27
|
selection: ['check', 'authoring'],
|
|
21
28
|
publish: ['demo', 'authoring', 'check'],
|
|
@@ -30,7 +37,7 @@ export function skillIndex(version, docs) {
|
|
|
30
37
|
'Start here:',
|
|
31
38
|
...START_ORDER.map((s, i) => ` ${i + 1}. ${s}`),
|
|
32
39
|
'',
|
|
33
|
-
'Topics (suggested order: authoring, cases, components, demo, check; selection and publish when needed):',
|
|
40
|
+
'Topics (suggested order: authoring, story, cases, components, demo, focus, check; diagram for backend / architecture / logic; selection and publish when needed):',
|
|
34
41
|
...SKILL_TOPICS.map(t => ` ${t.name.padEnd(11)} ${t.description} ${skillTopic(t.name, docs).trimEnd().split('\n').length} lines`),
|
|
35
42
|
'Usage: npx joplo skill <topic> Install for agents: npx joplo skill install',
|
|
36
43
|
'',
|
|
@@ -50,8 +57,44 @@ export function skillTopic(topic, docs) {
|
|
|
50
57
|
}
|
|
51
58
|
/** 兼容旧入口:与 joplo skill authoring 输出完全相同。 */
|
|
52
59
|
export function guide() { return skillTopic('authoring'); }
|
|
60
|
+
/** HTML 兜底标签不单独列在目录里(它们在 “HTML tags” 一行里,且一律建议改用组件)。 */
|
|
61
|
+
const HTML_SET = new Set(HTML_TAGS);
|
|
62
|
+
/**
|
|
63
|
+
* `npx joplo components <名字…>`(D68):所列组件(含它的子组件,例如 Menu → Menu.Item)的属性提示、行为分组和示例。
|
|
64
|
+
* 名字不区分大小写;不认识的名字报 USAGE 并给出最接近的名字。
|
|
65
|
+
*/
|
|
66
|
+
export function componentDetails(names) {
|
|
67
|
+
const all = COMPONENT_TYPES.filter((n) => !n.startsWith('#'));
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const raw of names) {
|
|
70
|
+
const hit = all.find((n) => n.toLowerCase() === String(raw).toLowerCase());
|
|
71
|
+
if (!hit) {
|
|
72
|
+
const near = [...all].sort((a, b) => distance(String(raw).toLowerCase(), a.toLowerCase()) - distance(String(raw).toLowerCase(), b.toLowerCase()))[0];
|
|
73
|
+
throw new JoploError('USAGE', `Unknown component "${raw}". Did you mean ${near}?\nRun npx joplo components to list all components.`);
|
|
74
|
+
}
|
|
75
|
+
const family = [hit, ...all.filter((n) => n.startsWith(`${hit}.`))];
|
|
76
|
+
out.push(`# ${hit}`);
|
|
77
|
+
for (const n of family) {
|
|
78
|
+
const groups = [INTERACTIVE_TYPES.has(n) ? 'interactive: requires id and a step, disabled + disabledReason, or unmodeled' : '', VALUE_TYPES.has(n) ? 'value: type / select / toggle write to it' : '', GATED_CONTAINERS.has(n) ? 'shown only while opened' : ''].filter(Boolean);
|
|
79
|
+
out.push(`- ${n}: ${COMPONENT_DOCS[n].replace(/\s+/g, ' ').trim()}${groups.length ? ` [${groups.join('; ')}]` : ''}`);
|
|
80
|
+
}
|
|
81
|
+
const ex = COMPONENT_EXAMPLES[hit];
|
|
82
|
+
if (ex)
|
|
83
|
+
out.push('', '```tsx', ex, '```');
|
|
84
|
+
out.push('');
|
|
85
|
+
}
|
|
86
|
+
out.push('Import components from @joplo-app/kit/ui; bindings and conditions: npx joplo skill authoring.');
|
|
87
|
+
return `${out.join('\n')}\n`;
|
|
88
|
+
}
|
|
89
|
+
/** 图表家族(D69)在 components 里各占一行(根组件 + 子组件名),细节在 npx joplo skill diagram。 */
|
|
90
|
+
const DIAGRAM_FAMILY = /^(Diagram|StateMachine|Sequence)\./;
|
|
53
91
|
function componentTopic(docs = {}) {
|
|
54
|
-
const names = COMPONENT_TYPES.filter(name => !name.startsWith('#'));
|
|
92
|
+
const names = COMPONENT_TYPES.filter(name => !name.startsWith('#') && !HTML_SET.has(name) && !DIAGRAM_FAMILY.test(name));
|
|
93
|
+
const family = (root) => [root, ...COMPONENT_TYPES.filter(n => n.startsWith(`${root}.`))].join(', ');
|
|
94
|
+
const line = (name) => {
|
|
95
|
+
const label = name === 'Diagram' || name === 'StateMachine' || name === 'Sequence' ? family(name) : name;
|
|
96
|
+
return `- ${label}${Object.hasOwn(docs, name) && docs[name]?.trim() ? `: ${docs[name].replace(/\s+/g, ' ').trim()}` : ''}`;
|
|
97
|
+
};
|
|
55
98
|
const listed = (set) => names.filter(name => set.has(name)).join(', ');
|
|
56
99
|
return [
|
|
57
100
|
'# Joplo components: components',
|
|
@@ -66,7 +109,14 @@ function componentTopic(docs = {}) {
|
|
|
66
109
|
'- Every component accepts style={{ … }} and the Mantine style props (m, p, w, h, c, bg, fz, fw, ta…); className is not needed.',
|
|
67
110
|
'',
|
|
68
111
|
'## Component catalog',
|
|
69
|
-
|
|
112
|
+
'Props and an example for any component: npx joplo components <Name> (for example npx joplo components Menu DataTable).',
|
|
113
|
+
...names.map(line),
|
|
114
|
+
'',
|
|
115
|
+
'## Common product screens (D68)',
|
|
116
|
+
'- Empty list, 404, expired link, no access, or a result page: EmptyState with action Buttons in children. Confirm a destructive action: Modal with opened={$.ui.confirm} and two Buttons.',
|
|
117
|
+
'- Rows with avatar, text, and actions: ListRow (tappable rows: NavLink). Row actions: Menu with opened={$.ui.menu} on an ActionIcon target. Status cells, sorting, selection, loading: DataTable columns badge / avatar, sortStatus, selectedRecords, fetching.',
|
|
118
|
+
'- Dashboards: Stat, KeyValue, BarChart / LineChart (data can bind $.data.x; set a new array to animate). Mobile: TabBar at the bottom of a full-height Stack. Undo bar or banner: Notification position="bottom" with when.',
|
|
119
|
+
'- Point viewers at any component without zooming: spotlight / highlight / numbered / callout / hold in a step (functions from @joplo-app/kit, not components): npx joplo skill focus. Architecture, sequence, and state diagrams: npx joplo skill diagram.',
|
|
70
120
|
'',
|
|
71
121
|
'## Behavior groups (from the catalog)',
|
|
72
122
|
`- Interactive; require id and declared behavior: ${listed(INTERACTIVE_TYPES)}.`,
|
|
@@ -74,13 +124,62 @@ function componentTopic(docs = {}) {
|
|
|
74
124
|
`- Containers whose expanded state controls child visibility: ${listed(GATED_CONTAINERS)}.`,
|
|
75
125
|
'',
|
|
76
126
|
`Joplo props: ${JOPLO_PROPS.join(', ')}; disabled is the component disable prop.`,
|
|
77
|
-
'when controls visibility; disabledReason explains disabling; unmodeled marks behavior not modeled by this prototype; note is an authoring note.',
|
|
127
|
+
'when controls visibility; disabledReason explains disabling; unmodeled marks behavior not modeled by this prototype; note is an authoring note; redact blurs secrets or private data (true or a condition; see focus).',
|
|
78
128
|
'Interactive elements need a flow step, disabled={true} with a disabledReason, or explicit unmodeled (see check: UNBOUND_INTERACTIVE).',
|
|
79
129
|
'Value components are read-only on stage: they show inputs[id] written by .type/.select/.toggle steps, or a bound value prop. Viewers cannot type their own text.',
|
|
80
130
|
'See authoring for bindings, conditions, and steps; check for component error fixes.',
|
|
81
131
|
].join('\n');
|
|
82
132
|
}
|
|
83
133
|
const CONTENT = {
|
|
134
|
+
story: `# Joplo storytelling and planning: story
|
|
135
|
+
|
|
136
|
+
A demo is a short story a viewer follows without you: who wants what, what gets in the way, what the product does, and the visible result.
|
|
137
|
+
It is not a feature tour. Plan it in a few lines before writing TSX, show the plan to the user, then build. Sources: docs/research/storytelling-and-demos.md.
|
|
138
|
+
|
|
139
|
+
## 1. Plan the demo first (write it in your reply; ask only questions that change it, each with a default)
|
|
140
|
+
- Audience: who watches (product review, design review, a customer, engineers) and what they must decide afterward.
|
|
141
|
+
- One to three points: what viewers must believe after watching. Each point becomes a scenario or an A/B comparison, never a single step.
|
|
142
|
+
- Scene list, one line per scenario: Given (who, where, starting state) → When (the user's actions) → Then (the visible result), plus how it opens and how it ends.
|
|
143
|
+
- Length: a scenario is usually 5–12 steps, about 20–60 s at 1×. check flags one over 90 s; npx joplo outline prints every estimate.
|
|
144
|
+
- Unsure how to frame it? Offer two or three one-line framings and let the user pick.
|
|
145
|
+
|
|
146
|
+
## 2. PM lens: from a need to roles, goal, cases, and scenarios
|
|
147
|
+
Joplo already has the parts of a user story; fill them in that spirit.
|
|
148
|
+
- roles: who it is for, specific ('Space admin', 'Invited teammate'), not 'User'. Use role('Name', { desc }) keys when layers or cards belong to a person; plain names are fine otherwise.
|
|
149
|
+
- goal (the I want + so that): one sentence, who can do what and why, independent of the solution so options A/B are two answers to it.
|
|
150
|
+
Good: 'Space admins invite teammates by email so the team can start working the same day'. Bad: 'Invite button', 'A better invite experience'.
|
|
151
|
+
- cases are the acceptance criteria: the title is the Given (the situation), expected is the Then (what the viewer must see), priority is how much it matters.
|
|
152
|
+
Write expected for every high-priority case; it is the line reviewers check the demo against. npx joplo outline lists cases without one.
|
|
153
|
+
- rules are the business constraints a Then depends on ('Only admins can invite'); link them to cases and elements, and to steps with uses().
|
|
154
|
+
- One scenario = one When and one Then. The steps are the When; the last steps show the Then (a visible state plus done('…')). Several Whens: split the scenario.
|
|
155
|
+
- Splitting, in this order: one thin end-to-end happy path (entry → result) first; then one scenario per business-rule variant, data variant, role, and failure.
|
|
156
|
+
Do not split by step (fill in / review / publish): every scenario goes from its entry to a result. More than 5–6 high-priority cases, or two roles with different goals: split the feature.
|
|
157
|
+
- Edge cases: walk the eight dimensions (npx joplo skill cases), and ask what if the user does steps out of order, skips an optional step, or comes back later. Each adopted answer is a case with its own expected and a scenario.
|
|
158
|
+
- INVEST check per scenario: Independent (its own start state), Valuable (ends on a visible result), Small (fits the length above), Testable (expected says exactly what appears).
|
|
159
|
+
- Direction still open? Build only the main scenario of options A and B first; add every case after the user picks.
|
|
160
|
+
|
|
161
|
+
## 3. Openings, middles, endings
|
|
162
|
+
- Opening: the first step or an opening .card('…', { sub }) says who is trying to do what and why, in one sentence. No logo, no 'So you open the app'.
|
|
163
|
+
- Middle: each step proves one thing with a visible action and a visible change; the cause must be visible (a click, an incoming message, a time-jump card).
|
|
164
|
+
A screen that changes with no trigger reads as a screensaver. Mock results come from steps: set(), toast(), go().
|
|
165
|
+
- Ending: pick one strategy, either stop on the result (done('…') with the result on screen) or a closing .card with points: at most 3–4 short points.
|
|
166
|
+
- Transitions: keep something on screen across a change (the same list, the same person); cards only for time jumps, role switches, opening, and ending.
|
|
167
|
+
- Where the viewer looks each moment (one focus per step, spotlight, highlight, callout, numbered, hold): npx joplo skill focus; layers and shots: npx joplo skill demo.
|
|
168
|
+
|
|
169
|
+
## 4. Captions and explain
|
|
170
|
+
- One idea per caption, about 24 units (CJK 1, other characters 0.5). Subject + verb, active voice, the visible action first: 'Ana sends the invite', 'The link expires after 7 days'.
|
|
171
|
+
- explain (about 48 units) says why it matters or what it means; never repeat the caption.
|
|
172
|
+
- System steps are narration of what happened ('The server rejects the address'), not labels ('System event').
|
|
173
|
+
- Same name for the same person or thing throughout; button and field names exactly as on screen; no internal ids or API names unless the audience is engineers.
|
|
174
|
+
- No filler ('Now let us…', 'a whole new experience'): every sentence does a job. Do not invent numbers or facts; record guesses as ai_assumption rules.
|
|
175
|
+
- Cover text: flow({ description }) is the cover sentence, 30 units at most (DESCRIPTION_TOO_LONG). The cover falls back to the feature goal.
|
|
176
|
+
- Rhythm: every short step waits 3 s, so a run of trivial steps feels like a metronome. Merge trivial steps (type, then click) and give key results an explain.
|
|
177
|
+
|
|
178
|
+
## 5. Before handing over
|
|
179
|
+
- npx joplo outline: per feature, who it is for, the goal, each case with its expected result and coverage per option, and each scenario's steps, duration, opening and ending.
|
|
180
|
+
- npx joplo check: CAPTION_TOO_LONG, EXPLAIN_TOO_LONG, DESCRIPTION_TOO_LONG, CARD_TEXT_TOO_LONG, SCENARIO_TOO_LONG, HAPPY_PATH_ONLY, CASE_NOT_COVERED (names the expected result).
|
|
181
|
+
- Read only the captions from start to end: do they tell the story? Then look only at key frames (npx joplo render --step-id …): does the screen show it without captions?
|
|
182
|
+
- Tell the user which cases have no expected result yet and which options do not cover a high-priority case.`,
|
|
84
183
|
authoring: `# Joplo authoring: authoring
|
|
85
184
|
|
|
86
185
|
## Mental model (read first)
|
|
@@ -109,12 +208,14 @@ Read only the topics needed, usually one or two at a time. See components for co
|
|
|
109
208
|
- page({ title, layout?: string|false, viewport?: 'desktop'|'mobile' }, tree). See demo for devices and stages.
|
|
110
209
|
- feature({ name, goal, cases, order?, roles?, constraints?, rules?, questions?, pick? }).
|
|
111
210
|
- Do not number feature names by hand; use finite numeric order. The compiler writes featureIds into IR (including publish): ascending order first, then natural folder-name order for ties or omitted values. All views read that list.
|
|
112
|
-
- option({ name, idea, on?, routes?, state?, rules?, questions?, coverage?, scenarios }).
|
|
211
|
+
- option({ name, idea, focus?, tradeoffs?, on?, routes?, layers?, state?, rules?, questions?, coverage?, scenarios }).
|
|
212
|
+
- focus: one sentence naming the design decision this option changes; tradeoffs: ['Faster to scan', 'Needs a second click'], shown in the option's hover card in the board. Both stay out of published and review builds.
|
|
113
213
|
- on: { '/members': { actions: <Button id="invite">Invite</Button> } }: add elements to a slot on an existing route.
|
|
114
214
|
- routes: { '/members/new': page({ title: 'New member' }, <Stack>…</Stack>) }: add a route for this option.
|
|
115
215
|
- state: { ui: { ready: false }, data: {}, inputs: {} }: initial option state.
|
|
116
216
|
- scenarios: { happy: flow('Success', { cases: ['happy'], start: '/members' }).click('invite', done('Completed')) }.
|
|
117
|
-
- flow
|
|
217
|
+
- flow(name, { cases?, start?, state?, description?, expected?, mock?, outcome? }): state overrides the option's initial state; description and expected describe the scenario.
|
|
218
|
+
- outcome: 'success' | 'failure' | 'denied' | 'other' is the board's result badge ("Mock failure"). Without it, the badge follows done's second argument, else success. mock: 'Mock: link expired' replaces the badge text.
|
|
118
219
|
- See cases for case and coverage declarations; publish for pick and publishing.
|
|
119
220
|
|
|
120
221
|
## flow: Put behavior in steps
|
|
@@ -125,8 +226,8 @@ Read only the topics needed, usually one or two at a time. See components for co
|
|
|
125
226
|
- set($.ui.ready, true): replace state; push($.data.rows, row): append an array item.
|
|
126
227
|
- toast('Message') / toast.success/error/info('Message'): a message for the current step.
|
|
127
228
|
- go('/members'): change route within the current option; back returns to the previous route.
|
|
128
|
-
- done('Result', 'success'|'failure'|'cancelled'): end the scenario; default is success.
|
|
129
|
-
- uses('rule_key', ...):
|
|
229
|
+
- done('Result', 'success'|'failure'|'cancelled'): end the scenario; default is success. It also sets the result badge (cancelled shows as other) unless flow({ outcome }) is written; if both are written they must agree, otherwise check warns OUTCOME_MISMATCH.
|
|
230
|
+
- uses('rule_key', ...): an effect that links rules from this option or feature, passed like set(): .click('send', uses('admin_only'), done('Sent')). It is not a flow method; .uses(...) is not a function.
|
|
130
231
|
|
|
131
232
|
## Bindings and conditions
|
|
132
233
|
- $.ui.x / $.data.x / $.inputs.x bind whole values; arbitrary expressions are not evaluated. $.inputs.<id> is the value typed into element <id>.
|
|
@@ -140,6 +241,7 @@ Read only the topics needed, usually one or two at a time. See components for co
|
|
|
140
241
|
- Value known while writing (a prop of your own component, a loop variable, an option-specific flag): render conditionally in your code instead, {mode === 'code' && <CodeForm/>}. false, null, and undefined children are dropped.
|
|
141
242
|
- Value that changes during the demo: keep it in option state and change it with set() in a step.
|
|
142
243
|
- disabled accepts true/false or a condition: disabled={$.ui.sending} disabledReason="Sending…".
|
|
244
|
+
- disabledReason is a string or a whole-value binding like disabled: disabledReason={$.ui.sendHint} shows the current state value. Anything else (a number, a condition, an expression) is INVALID_DISABLED_REASON.
|
|
143
245
|
|
|
144
246
|
## Layout and responsiveness (Mantine names and props; no className)
|
|
145
247
|
- Use Stack / Group / SimpleGrid / Grid props: <Group justify="space-between">, <SimpleGrid cols={{ base: 1, md: 3 }}>.
|
|
@@ -189,35 +291,34 @@ See check for diagnostic fixes and selection for editing only the selected locat
|
|
|
189
291
|
|
|
190
292
|
Tell one thing per step: separate viewpoints with independent layers, zoom into details with shots, and describe what happened with short captions.
|
|
191
293
|
See authoring for directories, state, and flow syntax. Import layer, shot, trace, explain from @joplo-app/kit.
|
|
294
|
+
What viewers look at in each step, and the lighter forms (spotlight, highlight, callout, numbered, hold, redact): npx joplo skill focus.
|
|
192
295
|
|
|
193
296
|
## Layers are independent pages
|
|
194
297
|
- Declare layers in an option: layers: { client: layer('Client view', <ClientView/>), backend: layer('Backend flow', <Diagram>…</Diagram>) }.
|
|
195
298
|
- layer(title, <tree/>) owns a JSX tree, renders independently, and fills the stage; it is not a crop of one large page.
|
|
196
299
|
- Layers share ui / data / inputs. Switching layers does not change the step. Declaring layers makes the demo show these independent pages.
|
|
300
|
+
- routes / on and layers work together, but once an option declares layers the stage shows only its layers: route pages are not drawn during the demo. Routes still give flow start, go(), and back() their state, and step targets are found in the layers first (then the route page).
|
|
301
|
+
- To show a route page as well, render the same component in a layer: layers: { app: layer('App', <MembersPage/>), backend: layer('Backend', <Arch/>) }.
|
|
197
302
|
- No automatic overview layer. Declare overview: layer('Overview', <Overview/>) when needed.
|
|
198
303
|
- Put long notes in a separate explanation layer, such as why: layer('Design rationale', <Why/>), then switch to it with a shot.
|
|
199
304
|
|
|
200
305
|
## Shots and the director
|
|
201
|
-
- Write shot(...ids) in a step. Targets can be components, cards, buttons, or Diagram nodes, groups, and edges.
|
|
306
|
+
- Write shot(...ids) in a step. Targets can be components, cards, buttons, or Diagram nodes, groups, and edges. Framing keeps context: see "Frame with shot" in diagram.
|
|
202
307
|
- Each id resolves in the layer containing it. The same id can affect multiple layers; the first shot determines the director layer.
|
|
203
308
|
- Example: .click('app_send', shot('msg_user'), shot('app', 'biz')) follows the client view first, then sets a backend shot.
|
|
204
309
|
- shot() restores the whole director layer. Without a shot, keep the previous one; a plain click can follow the layer containing the button.
|
|
205
|
-
- During playback, the director switches layers, zooms, and highlights.
|
|
310
|
+
- During playback, the director switches layers, zooms, and highlights. Clicking a layer tab, or opening a deep link with l=, pins that layer: Follow director turns off and later steps stay on the pinned layer, even when their shot or action is on another layer (the shot still happens there, you just do not see it). Turn Follow director back on (the switch next to the layer tabs) or drop l= from the URL to follow again; you can also replay only one layer.
|
|
206
311
|
- Viewers can zoom with wheel/pinch, drag to pan, and fit the stage to see the whole view. The next director shot takes over again.
|
|
207
312
|
|
|
208
|
-
##
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
- Use trace('a','b','c') for the a→b→c trace. Do not manually write node/edge state props or use set() to simulate calls; use trace().
|
|
212
|
-
-
|
|
213
|
-
- trace.skip('a','b') marks elements not called this time as dim. They need not be connected; it does not move the shot.
|
|
214
|
-
- trace accepts node or edge ids. Each segment needs a matching edge; reverse traversal is allowed. For multiple edges in the same direction, use the edge id.
|
|
215
|
-
- trace also supplies shot targets and can merge with shot in the same step. Focusing two or more nodes in one Diagram automatically creates a compact subgraph.
|
|
216
|
-
- Reveal segments with when={$.ui.show_billing}; set($.ui.show_billing, true) in a step only controls visibility, not trace call state.
|
|
313
|
+
## Diagrams and traces
|
|
314
|
+
- Backend / architecture / logic: Diagram (relationships, grouped by business domain), Sequence (one call chain in time order), StateMachine (a lifecycle). Read npx joplo skill diagram.
|
|
315
|
+
- Layout is automatic and computed at compile time; nodes never move between steps, also when parts appear with when.
|
|
316
|
+
- Use trace('a','b','c') for the a→b→c call; trace.fail marks failure, trace.skip dims what was not called. Do not manually write node/edge state props or use set() to simulate calls; use trace().
|
|
317
|
+
- shot of a Diagram node keeps its parent group (at least the group title) in frame; shot of a UI card keeps its framed container and zooms at most 1.25×. See diagram.
|
|
217
318
|
|
|
218
319
|
## Captions and fitting one screen
|
|
219
320
|
- Keep captions within about 24 units and explain('Additional note') within about 48. CJK characters count as 1 each; all others count as 0.5; whitespace is ignored. check warns when exceeded.
|
|
220
|
-
- Captions and explain notes appear below the stage, never over it. Tell one thing per step; move long content to an explanation layer.
|
|
321
|
+
- Captions and explain notes appear below the stage, never over it. Tell one thing per step; move long content to an explanation layer. How to write them, and how to plan openings and endings: story.
|
|
221
322
|
- Autoplay reading time: CJK 8 chars/s (125ms each), Latin 15 non-whitespace chars/s; clamp to 3–7 seconds before 0.5× / 1× / 1.5× scaling. Streams, shots and edge waits can exceed 7 seconds. Shots use 700ms ease-out without overshoot.
|
|
222
323
|
- Do not make viewers scroll through a long page. Fit one screen and zoom into details with shots.
|
|
223
324
|
- Each page has one device, desktop by default. page({ viewport: 'mobile' }, tree) uses a Phone frame at a fixed width of 390.
|
|
@@ -239,14 +340,16 @@ See authoring for directories, state, and flow syntax. Import layer, shot, trace
|
|
|
239
340
|
## Deep links and screenshots
|
|
240
341
|
- Board: http://127.0.0.1:<port>/#/<project>/f/<feature>?o=<option>&c=<case>&s=<scenario>&step=<n>&l=<layer>&speed=<0.5|1.5>. Copy the project part from the board URL.
|
|
241
342
|
- Published site: <site>/#/f/<feature>?s=<scenario>&step=<n>&l=<layer>. Embeds use ?embed=1&scenario=<scenario>&autoplay=1 (see publish).
|
|
242
|
-
- Ids are qualified: option invite.a-modal, case invite.no_permission, scenario invite.a-modal.happy. step=n is the state after n steps (0 = initial). l is the layer key from layers: { … }; it turns Follow director off.
|
|
343
|
+
- Ids are qualified: option invite.a-modal, case invite.no_permission, scenario invite.a-modal.happy. step=n is the state after n steps (0 = initial). l is the layer key from layers: { … }; it pins that layer and turns Follow director off, so later steps do not switch layers. Omit l to follow the director.
|
|
243
344
|
- Other parameters (layer=, option=, scenario= in the hash) are ignored; the board logs a console warning naming them.
|
|
244
|
-
- Screenshot one step: npx joplo render --scenario-id invite.a-modal.happy --step-id 'invite.a-modal.happy#2' --out shot.png. It waits for fonts, layout, and the camera
|
|
345
|
+
- Screenshot one step: npx joplo render --scenario-id invite.a-modal.happy --step-id 'invite.a-modal.happy#2' --out shot.png. It waits for fonts, layout, and the camera.
|
|
346
|
+
- render needs the Joplo export component (Playwright + Chromium, about 100 MB, installed once under ~/.joplo, never into the project). Without it render exits 4 with EXPORT_COMPONENT_MISSING and downloads nothing. It is a large download, so confirm with the user, then run npx joplo setup export (npx joplo setup export --status checks without installing). Writing demos, dev, check, build, and share do not need it.
|
|
245
347
|
- In a browser, open the deep link, wait for [data-jcamera][data-camera-settled="1"] plus two animation frames, then capture. During autoplay or typing animations the DOM can be ahead of the pixels; pause first.
|
|
246
348
|
|
|
247
349
|
## Transition cards, roles, and Agent output (D56)
|
|
248
350
|
- .card('Title', { sub?, points?, role? }, ...effects): one large sentence filling the stage, as a step. Use for openings, endings, time jumps, and role switches.
|
|
249
351
|
- Open with why this matters; end with points listing what was confirmed. For time jumps, use .card('3 days later', set($.data.invite, 'expired')).
|
|
352
|
+
- While a card covers the stage, the stage behind it is inert: nothing on it is clickable. Viewers continue with Next (or the → key), or by autoplay; a card step has no target to click.
|
|
250
353
|
- Roles: declare roles: { ajie: role('Ajie', { desc: 'Invited friend' }) } in the feature; use layer('Ajie mobile', <AjieView/>, { role: 'ajie' }) for the layer.
|
|
251
354
|
- A layer with a role shows a name badge at the bottom left and an avatar in its tab. After .card('Now Ajie', { role: 'ajie' }), the director switches to Ajie's layer.
|
|
252
355
|
- Show one person at a time. For side-by-side views, draw two sections in the same layer.
|
|
@@ -287,7 +390,7 @@ See authoring for directories, state, and flow syntax. Import layer, shot, trace
|
|
|
287
390
|
}
|
|
288
391
|
|
|
289
392
|
## Full example: examples/agent-arch
|
|
290
|
-
See layersFor/Diagram in shared/arch.tsx and flow in features/agent/options/a-hybrid.tsx.
|
|
393
|
+
See layersFor/Diagram (domain groups, Sequence, StateMachine) in shared/arch.tsx and flow in features/agent/options/a-hybrid.tsx.
|
|
291
394
|
This excerpt shows the main plan steps, omitting business rule links. start in the same file already handles user input and sending:
|
|
292
395
|
\`\`\`tsx
|
|
293
396
|
const plan = (f: ReturnType<typeof start>) =>
|
|
@@ -298,6 +401,153 @@ const plan = (f: ReturnType<typeof start>) =>
|
|
|
298
401
|
.system('Brain reasoning', 'Brain calls Bedrock to plan the next step', trace('brain', 'llm'));
|
|
299
402
|
\`\`\`
|
|
300
403
|
The example also covers insufficient quota, dangerous tool confirmation, client disconnection, and billing retries. Choose scenarios for the requirements; include more than the main flow.`,
|
|
404
|
+
diagram: `# Joplo diagrams: diagram
|
|
405
|
+
|
|
406
|
+
Three diagram components explain backend, architecture, and logic. Import them from @joplo-app/kit/ui:
|
|
407
|
+
- Diagram: what talks to what, grouped by business domain (gateway, runtime, storage…). Default for architecture.
|
|
408
|
+
- Sequence: one request moving between services in time order. Use it to walk through a call chain.
|
|
409
|
+
- StateMachine: states and transitions of one entity (order, task, run). Use it for lifecycles.
|
|
410
|
+
Choose by the question: "what is where" → Diagram; "what happens in what order" → Sequence; "what states can it be in" → StateMachine.
|
|
411
|
+
|
|
412
|
+
## Diagram: group by business domain
|
|
413
|
+
\`\`\`tsx
|
|
414
|
+
<Diagram id="arch" direction="right" h={520}>
|
|
415
|
+
<Diagram.Group id="g_gw" label="Gateway" icon="gateway" tone="blue">
|
|
416
|
+
<Diagram.Node id="api" label="API" kind="service" description="auth · rate limit" />
|
|
417
|
+
</Diagram.Group>
|
|
418
|
+
<Diagram.Group id="g_run" label="Runtime" icon="service" tone="purple">
|
|
419
|
+
<Diagram.Node id="kernel" label="Kernel" description="model + tool loop" />
|
|
420
|
+
<Diagram.Node id="tools" label="Tools" kind="tool" />
|
|
421
|
+
</Diagram.Group>
|
|
422
|
+
<Diagram.Group id="g_data" label="Storage" icon="database">
|
|
423
|
+
<Diagram.Node id="pg" label="PostgreSQL" kind="database" />
|
|
424
|
+
</Diagram.Group>
|
|
425
|
+
<Diagram.Edge from="api" to="kernel" label="run" />
|
|
426
|
+
<Diagram.Edge from="kernel" to="tools" label="call" />
|
|
427
|
+
<Diagram.Edge from="kernel" to="g_data" label="commit" async />
|
|
428
|
+
</Diagram>
|
|
429
|
+
\`\`\`
|
|
430
|
+
- Every node belongs to a domain group; 2–6 groups, ~3–15 nodes per diagram. One group around everything says nothing (check reports DIAGRAM_UNGROUPED).
|
|
431
|
+
- Group props: label, icon (${DIAGRAM_GROUP_ICONS.join(', ')}), tone (${DIAGRAM_TONES.join(', ')}), group (parent id). Groups nest.
|
|
432
|
+
- Put a node in a group by nesting, or flat with group="g_run" (not both). Edges may connect to a group: to="g_data".
|
|
433
|
+
- Node kind: ${DIAGRAM_NODE_KINDS.join(', ')}. description says the responsibility in a few words; edge label says what flows.
|
|
434
|
+
- Bigger systems: split into layers (overview → one layer per domain) instead of one huge diagram.
|
|
435
|
+
|
|
436
|
+
## Layout is automatic (compile time)
|
|
437
|
+
- Joplo lays the diagram out when compiling (ELK layered: layers, few crossings, orthogonal edges, groups laid out together). Never write coordinates.
|
|
438
|
+
- Leave out direction: Joplo tries top → bottom and left → right and keeps the one that fills the stage with the largest text (domain groups end up side by side). direction="right" / "down" forces one; aspect={1.6} sets the wanted width / height; h="100%" fills a layer.
|
|
439
|
+
- Source order is the order within a layer: write nodes, groups, and edges in reading order. Write the request edge before its reply (api → kernel before kernel → api): the later one is drawn as a return edge.
|
|
440
|
+
- Mark secondary flows async (usage events, audit logs): they may stop pushing their target a layer down, so domains sit side by side instead of in a tall column.
|
|
441
|
+
- pin="start" / pin="end" puts a node or group in the first / last layer of its group. The layout covers every element, including ones hidden with when: nodes never move between steps.
|
|
442
|
+
- In each step only the traced call is bold, colored, with a moving dot and its label outlined; other edges turn thin and light. One call per step reads best.
|
|
443
|
+
|
|
444
|
+
## Traces: light up a call
|
|
445
|
+
- trace('api', 'kernel', 'pg') lights api → kernel → pg this step; earlier traces turn ok. trace.fail('kernel', 'pg') marks failure; trace.skip('tools') dims what was not called.
|
|
446
|
+
- Ids are nodes, groups, or edge ids. Each segment needs an edge (either direction). For several edges between the same pair, trace the edge id.
|
|
447
|
+
- Groups the call passes through are highlighted too, so viewers see which domains a request touches.
|
|
448
|
+
- Do not write state props or set() to fake calls; trace does it.
|
|
449
|
+
|
|
450
|
+
## Sequence: one call chain in time order
|
|
451
|
+
\`\`\`tsx
|
|
452
|
+
<Sequence id="login">
|
|
453
|
+
<Sequence.Group label="Client"><Sequence.Actor id="web" label="Web" kind="client" /></Sequence.Group>
|
|
454
|
+
<Sequence.Actor id="api" label="API" />
|
|
455
|
+
<Sequence.Actor id="db" label="DB" kind="database" />
|
|
456
|
+
<Sequence.Message id="m_req" from="web" to="api" label="POST /login" />
|
|
457
|
+
<Sequence.Message id="m_q" from="api" to="db" label="find user" />
|
|
458
|
+
<Sequence.Block kind="alt" label="wrong password">
|
|
459
|
+
<Sequence.Message id="m_401" from="api" to="web" label="401" reply />
|
|
460
|
+
</Sequence.Block>
|
|
461
|
+
<Sequence.Message id="m_ok" from="api" to="web" label="200 + session" reply />
|
|
462
|
+
</Sequence>
|
|
463
|
+
\`\`\`
|
|
464
|
+
- Participants are columns in source order; messages are rows in source order, numbered (numbered={false} to hide numbers).
|
|
465
|
+
- reply = dashed return; async = open arrow; from === to is a self call. Block kind: ${SEQUENCE_BLOCK_KINDS.join(', ')}.
|
|
466
|
+
- Give messages ids and trace them per step: trace('m_req'), then trace('m_q'). Earlier rows turn ok; the camera frames the row with both participants.
|
|
467
|
+
|
|
468
|
+
## StateMachine: a lifecycle
|
|
469
|
+
\`\`\`tsx
|
|
470
|
+
<StateMachine id="order_sm" value={$.data.order.status}>
|
|
471
|
+
<StateMachine.State id="created" label="Created" initial />
|
|
472
|
+
<StateMachine.State id="paid" label="Paid" />
|
|
473
|
+
<StateMachine.State id="closed" label="Closed" final />
|
|
474
|
+
<StateMachine.Transition from="created" to="paid" label="pay" />
|
|
475
|
+
<StateMachine.Transition from="created" to="closed" label="timeout 30 min" />
|
|
476
|
+
</StateMachine>
|
|
477
|
+
\`\`\`
|
|
478
|
+
- value binds the current state (highlighted). When a step changes it (set($.data.order.status, 'paid')), the matching transition lights up by itself.
|
|
479
|
+
- trace('created', 'paid') also works. initial adds a start dot; final draws a double border; StateMachine.Group boxes substates.
|
|
480
|
+
|
|
481
|
+
## Frame with shot (what the camera keeps)
|
|
482
|
+
- shot('kernel') frames the node with its parent group; when the whole group would make text too small, it keeps at least the group title. Viewers always see which domain they are in.
|
|
483
|
+
- A trace with several nodes frames all of them and their group titles. shot('g_run') frames a whole domain; shot() returns to the whole layer.
|
|
484
|
+
- UI cards and panels zoom at most 1.25× and keep their framed container (Card, Paper, Modal, Table, AppShell side…) in view, so neighbours stay visible.
|
|
485
|
+
- Want more context? shot the container or group. Want the reader to compare two places? shot both ids in one step.
|
|
486
|
+
- Do not use zoom to read tiny text: if a diagram needs heavy zoom, split it into layers.
|
|
487
|
+
- Point at a part without zooming: spotlight / highlight / callout (see focus). A callout on the framed node's group or a message's participant stays in the shot.
|
|
488
|
+
|
|
489
|
+
## Other diagram types
|
|
490
|
+
- C4 context / container: use Diagram with kind="user" for people, Diagram.Group icon="box" for each system boundary, kind="external" for outside systems.
|
|
491
|
+
- Data models: show records with DataCard and Table in their own layer (see demo); an ER diagram component is not available yet.
|
|
492
|
+
|
|
493
|
+
Diagnostics for diagrams are listed in check (UNKNOWN_DIAGRAM_NODE, UNKNOWN_DIAGRAM_GROUP, TRACE_UNKNOWN…). See examples/agent-arch.`,
|
|
494
|
+
focus: `# Joplo focus: focus
|
|
495
|
+
|
|
496
|
+
A demo is a story told over time. In every step the viewer should know where to look and why.
|
|
497
|
+
Decide each step's focus before writing it: one subject, one form. The caption says what happened, the focus shows where, a callout (optional) says why.
|
|
498
|
+
Import spotlight, highlight, numbered, callout, hold from @joplo-app/kit; shot, trace, mark are in demo.
|
|
499
|
+
|
|
500
|
+
## Defaults: what you get without writing anything
|
|
501
|
+
- Step 0 is the scenario cover; a .card() step is its own focus.
|
|
502
|
+
- User actions: the cursor moves to the element and clicks; the camera brings it into frame if needed. Do not add shot() just to show what is clicked.
|
|
503
|
+
- trace() frames the call path in a Diagram.
|
|
504
|
+
- Result reveal: after a step, an element that newly appears or changes (an alert, a badge, a new message, a menu) pulses once and fades. It never moves the camera.
|
|
505
|
+
Skipped on purpose: modals and drawers (their backdrop already says it), DataCard / StateFlow (they show their own change), more than 3 changes at once, a new page or layer, the same element changing again or another line appended to the same log, and any step where you wrote a focus yourself.
|
|
506
|
+
- When the director enters another layer that has a shot, the stage starts on the whole layer, then pushes in (context first, then detail).
|
|
507
|
+
- config({ autoFocus: false }) turns off the reveal pulse and the layer-entry push-in. Your shots and cues still play.
|
|
508
|
+
|
|
509
|
+
## Choose the form by intent
|
|
510
|
+
- Look closer at a small or dense area: shot('id', …). The camera zooms; the rest fades. What the frame keeps (a node's group title, a card's container): diagram.
|
|
511
|
+
- One block on a busy screen, keep the layout visible: spotlight('id'). No zoom; everything else is washed out.
|
|
512
|
+
- "Notice this changed / this matters": highlight('id'). No zoom; a ring that pulses once.
|
|
513
|
+
- One short reason next to an element: callout('id', 'Share after generation', { side? }). A note with a leader line; side is top / right / bottom / left, or omitted to pick the free side.
|
|
514
|
+
- What a screen is made of, or an order of parts: numbered('input', 'preview', 'send'). Badges 1, 2, 3 (keep it to 5 or fewer).
|
|
515
|
+
- Give viewers time to look (a chart, a comparison, a long result): hold(5). Autoplay stays at least 5 seconds (0.5–30, scaled by speed).
|
|
516
|
+
- Secrets and private data: <Code redact>sk-live-…</Code>, or redact={not($.ui.revealed)} to unblur after a step. Blurred, layout unchanged, on every step.
|
|
517
|
+
- Hand-drawn circle / underline / box / arrow: mark('id', { kind }) (see demo).
|
|
518
|
+
|
|
519
|
+
All cues apply to this step only, render in the stage theme, and never block clicks; spotlight keeps the next click target lit.
|
|
520
|
+
Cues do not zoom. If a cue's target is outside the current shot, the camera first returns to the whole layer.
|
|
521
|
+
In diagrams the frame always keeps the target's group (title at least) and a message's two participants: a cue on them stays in the shot; spotlight keeps the group title lit. Diagrams show their own changes (fade-in, traces), so the reveal pulse skips them.
|
|
522
|
+
With layers, a cue switches the director to its target's layer when the step has no shot.
|
|
523
|
+
|
|
524
|
+
## Pacing rules
|
|
525
|
+
1. One subject per step. If the caption needs "and", split the step.
|
|
526
|
+
2. Context first: when a new screen appears, show the whole of it (or number its parts) before zooming into a corner.
|
|
527
|
+
3. Same subject, same frame: when several steps talk about the same block, keep one shot; do not re-aim the camera every step.
|
|
528
|
+
4. Zoom only when the detail is too small to read. Otherwise spotlight or highlight.
|
|
529
|
+
5. One primary form per step (shot or spotlight), plus at most one callout or one numbered set.
|
|
530
|
+
6. A callout explains why, in a few words. Never repeat the caption in it.
|
|
531
|
+
7. If three steps in a row change nothing on stage, merge them or show something.
|
|
532
|
+
|
|
533
|
+
## Anti-patterns → fixes
|
|
534
|
+
- shot() on every click → remove it; the cursor and the result reveal already guide the eye.
|
|
535
|
+
- shot('a') with spotlight('b') elsewhere → FOCUS_CONFLICT; aim both at the same thing or split the step.
|
|
536
|
+
- A callout / mark / highlight on another layer → FOCUS_OFF_LAYER; add shot('<id>') to switch there.
|
|
537
|
+
- Several system steps with only captions → FOCUS_IDLE; set() visible state, or merge.
|
|
538
|
+
- A paragraph in a callout → CALLOUT_TOO_LONG; keep it to about 24 units like captions, put the rest in explain().
|
|
539
|
+
- Rings everywhere: if everything is highlighted, nothing is.
|
|
540
|
+
|
|
541
|
+
## Example
|
|
542
|
+
\`\`\`tsx
|
|
543
|
+
flow('Plan a weekend trip', { start: '/' })
|
|
544
|
+
.card('Weekend camping', { sub: 'Xiaoyu asks the assistant to plan it' })
|
|
545
|
+
.system('Meet the assistant', 'Chat on the left, plan on the right', numbered('chat_col', 'plan_col'), hold(4))
|
|
546
|
+
.type('prompt', 'Camping this Saturday for two', 'Xiaoyu describes the trip')
|
|
547
|
+
.system('Reply', 'Conclusion first: Baihe campsite', stream($.ui.reply, '…'), spotlight('msg_reply'), callout('msg_reply', 'Answer first, details in the plan'))
|
|
548
|
+
.system('Plan ready', 'Budget done, the plan is ready', set($.ui.planStatus, 'ready'), shot('plan', 'share'), callout('share', 'Share after generation'))
|
|
549
|
+
\`\`\`
|
|
550
|
+
Full example: examples/camping.`,
|
|
301
551
|
cases: `# Joplo case checklist: cases
|
|
302
552
|
|
|
303
553
|
Before starting, read user requirements and project material. Use these dimensions to find gaps; ask only key questions that change the design.
|
|
@@ -354,7 +604,7 @@ Pick relevant cases to ask the user before starting. Do not include every preset
|
|
|
354
604
|
|
|
355
605
|
## Turn answers into cases and scenarios
|
|
356
606
|
- feature.cases: { happy: 'Complete successfully', denied: { title: 'No permission', dimension: 'permission', priority: 'high', expected: 'Explain why' } }.
|
|
357
|
-
- dimension uses the keys above; priority is high/medium/low; expected
|
|
607
|
+
- dimension uses the keys above; priority is high/medium/low; expected is the visible result the scenario must end on (the Then of an acceptance criterion; the title is the Given). Write it for every high-priority case; see story for the PM method.
|
|
358
608
|
- Each option uses flow(..., { cases: ['happy'] }) to reference the shared cases for comparison.
|
|
359
609
|
- A case with a scenario is automatically \`expressed\`; one with neither a scenario nor a declaration is \`missing\`.
|
|
360
610
|
- After adding a case, run check: reconsider it in every option.
|
|
@@ -399,22 +649,39 @@ Example: features/invite/options/a.tsx:12:5 warning UNBOUND_INTERACTIVE Inter
|
|
|
399
649
|
- DUPLICATE_ELEMENT: Duplicate element ids within a stage. Change only conflicting ids and update references.
|
|
400
650
|
- CAPTION_TOO_LONG: Shorten the caption to about 24 units: CJK characters count as 1 each, all others as 0.5; whitespace is ignored. One thing per step; move long content to an explanation layer. See demo.
|
|
401
651
|
- EXPLAIN_TOO_LONG: Shorten the explain note to about 48 units, using the same CJK 1 / other 0.5 calculation. Put detailed rationale in a separate explanation layer. See demo.
|
|
652
|
+
- DESCRIPTION_TOO_LONG: flow({ description }) is the scenario cover sentence; keep it within 30 units, one sentence saying what this scenario shows. See story.
|
|
653
|
+
- CARD_TEXT_TOO_LONG (info): a transition card's sub is over 48 units, a point over 24, or more than 4 points. Keep one sentence and a few short points; move details into steps.
|
|
654
|
+
- SCENARIO_TOO_LONG (info): the scenario plays over 90 s at 1×. One scenario tells one thing: split it (happy path, then each recovery) or branch with fork(). npx joplo outline shows the pacing.
|
|
655
|
+
- HAPPY_PATH_ONLY (info): every case is a main-flow case and every scenario succeeds. Ask about input, permission, async, and lifecycle cases (see cases), then add an error-and-recovery scenario. Do not invent behavior.
|
|
402
656
|
- ROLE_UNKNOWN: A layer or card role is not in feature.roles. Declare roles as { key: role('Name') }; see demo.
|
|
403
657
|
- ICON_UNKNOWN: A layer icon is not a preset. Use one of ${LAYER_ICONS.join(', ')}; see demo.
|
|
404
658
|
- FORK_UNKNOWN: fork must target another scenario key in the same option; it cannot reference itself.
|
|
405
|
-
- MARK_UNKNOWN: The mark target is absent from this step's route stage and
|
|
659
|
+
- MARK_UNKNOWN: The mark target is absent from this step's route stage (after go() and back() in earlier steps) or, with layers, from every layer. Check the element id; currently hidden targets are valid references.
|
|
406
660
|
- SHOT_UNKNOWN: The shot target is absent from this step's stage and all layers. Check its id and layer; see demo.
|
|
661
|
+
- FOCUS_UNKNOWN / CALLOUT_EMPTY / CALLOUT_SIDE_INVALID / HOLD_INVALID: spotlight, highlight, numbered, callout need existing element ids (in a layer, or on this step's route stage); callout needs one short sentence and side top/right/bottom/left; hold takes 0.5–30 seconds. See focus.
|
|
662
|
+
- FOCUS_OFF_LAYER (warning): a spotlight / highlight / numbered / callout / mark target is not in the layer the director shows after this step, so nobody sees it. Add shot('<id>') to switch there, or point at an element in the shown layer. See focus.
|
|
663
|
+
- FOCUS_CONFLICT (warning): the step's shot frames one thing while a cue points outside it. Point both at the same thing, add the id to the shot, or split the step.
|
|
664
|
+
- CALLOUT_TOO_LONG (warning): callout text over about 24 units (same count as captions). Say the reason in a few words; move the rest to explain().
|
|
665
|
+
- FOCUS_IDLE (info): three or more system steps in a row change nothing on stage. Merge them, or show what happens (set() visible state, highlight, callout, shot).
|
|
666
|
+
- INVALID_REDACT / AUTOFOCUS_INVALID: redact takes true/false or a condition (redact={not($.ui.revealed)}); config({ autoFocus }) takes true or false.
|
|
407
667
|
- LAYER_UNKNOWN: Invalid layer key or missing content. Use letters/digits/underscores/hyphens, do not start with @, and provide nonempty JSX.
|
|
408
|
-
- TRACE_UNKNOWN: Empty trace, unknown id,
|
|
409
|
-
- TRACE_AMBIGUOUS: Multiple candidate edges between nodes. Use the specific edge id in trace.
|
|
668
|
+
- TRACE_UNKNOWN: Empty trace, unknown id, ids from different diagrams, or a disconnected path. Use connected ids in one Diagram / StateMachine / Sequence.
|
|
669
|
+
- TRACE_AMBIGUOUS: Multiple candidate edges or messages between two nodes. Use the specific edge / message id in trace.
|
|
410
670
|
- THEME_UNKNOWN: config({ theme }) names neither a built-in nor themes/<name>.css. Use a built-in or add that CSS file; see Write a theme in demo.
|
|
411
|
-
- UNKNOWN_DIAGRAM_NODE:
|
|
671
|
+
- UNKNOWN_DIAGRAM_NODE: An edge, transition, or message endpoint is not a node / group / state / participant id in the same diagram. Correct the endpoint ids.
|
|
672
|
+
- UNKNOWN_DIAGRAM_GROUP / DIAGRAM_GROUP_CONFLICT / DIAGRAM_GROUP_CYCLE: group="…" names a missing group, disagrees with the group the element is nested in, or makes groups contain each other. Use nesting or group=, not both. See diagram.
|
|
673
|
+
- DIAGRAM_EDGE_INTO_OWN_GROUP: An edge connects an element to a group that contains it. Connect to an element inside, or to another group.
|
|
674
|
+
- INVALID_DIAGRAM_PROP / INVALID_DIAGRAM_CHILD: tone, pin, kind, or block kind is not a preset, or a child is in the wrong container (messages in Sequence.Group, actors in Sequence.Block). See diagram.
|
|
675
|
+
- DIAGRAM_UNGROUPED (info): Many nodes and no domain groups. Group them with <Diagram.Group label icon> so viewers see what belongs where.
|
|
676
|
+
- DIAGRAM_LAYOUT_FAILED (warning): The automatic layout failed and the diagram shows a simple grid. Check its edges and groups; report it if they look right.
|
|
412
677
|
- ELEMENT_PROP: A component prop contains JSX. Use strings for icons, such as leftSection="+", and children for content.
|
|
413
678
|
- ASSUMPTION_CONFIRMED: Keep AI assumptions \`pending\`. After user confirmation, record the actual origin; do not change only status.
|
|
414
679
|
- UNBOUND_INTERACTIVE: see the section below.
|
|
415
680
|
- INVALID_CONDITION: when got a plain boolean, number, or string (when={!x}, when={mode === 'code'}). Use a condition such as when={eq($.ui.mode, 'code')}, or render conditionally in your code: {flag && <X/>}. See authoring.
|
|
416
|
-
- DISABLED_WITHOUT_REASON: Add disabledReason explaining why the element cannot be used.
|
|
417
|
-
-
|
|
681
|
+
- DISABLED_WITHOUT_REASON: Add disabledReason explaining why the element cannot be used: a string, disabledReason="Only admins can invite", or a binding, disabledReason={$.ui.sendHint}.
|
|
682
|
+
- INVALID_DISABLED_REASON: disabledReason got a number, condition, or other value. Use a string or a whole-value binding; for text that changes, set() it into state and bind it.
|
|
683
|
+
- OUTCOME_MISMATCH: flow({ outcome }) and done(…, outcome) disagree; the badge uses flow's. Make them agree (cancelled corresponds to other).
|
|
684
|
+
- CASE_NOT_COVERED: Add a scenario or declare coverage truthfully. Ask about missing behavior first. The message names high priority and the case's expected result, which is what the new scenario must end on.
|
|
418
685
|
- EXPRESSED_WITHOUT_SCENARIO / COVERAGE_WITHOUT_REASON: Add a scenario or a reason for \`not_applicable\`/\`excluded\`.
|
|
419
686
|
- RULE_ELEMENT_NOT_FOUND: Check rule.elements against element ids in the related option stages.
|
|
420
687
|
- PENDING_AI_ASSUMPTION: Ask the user to confirm; keep \`pending\` until then.
|
|
@@ -472,7 +739,8 @@ Compare cases and options in the board, then decide which option to publish for
|
|
|
472
739
|
- Layer switching, Follow director, replaying one layer, shot focus, and captions all work on the published site. See demo for syntax.
|
|
473
740
|
- Fullscreen works on the published site: F enters/toggles, Space plays/pauses, ←/→ steps back/forward, Esc exits.
|
|
474
741
|
- Fullscreen keeps only the stage and captions. Playback controls float below and hide automatically.
|
|
475
|
-
- Both local and published views can export images. Video export is local only
|
|
742
|
+
- Both local and published views can export images. Video export is local only.
|
|
743
|
+
- Local image and video export use the Joplo export component (Playwright + Chromium, kept under ~/.joplo, not in the project). If it is missing, the board's Export menu offers Install export component (about 100 MB) and continues the export after installing; in a terminal, run npx joplo setup export.
|
|
476
744
|
|
|
477
745
|
## Deploy
|
|
478
746
|
Use your own Wrangler environment and account in the project directory:
|
|
@@ -490,7 +758,7 @@ Deploy only dist output, not author source files. MCP, comments, and collaborati
|
|
|
490
758
|
- Free links expire after 1 hour; read data.expiresAt for the exact time. Pro permanent links have expiresAt: null.
|
|
491
759
|
- Successful share JSON includes data.embed: { iframe, markdown, badge, preview }. To add the demo to a README, write data.embed.markdown as is; do not build badge links yourself. For a free link, tell the user the badge shows "expired" after data.expiresAt.
|
|
492
760
|
- data.embed.iframe embeds a player for blogs and docs: it shows a cover first; append &scenario=<scenario id> to pick the start or &autoplay=1 to skip the cover.
|
|
493
|
-
- share also uploads a 1200x630 preview image of the default scenario when
|
|
761
|
+
- share also uploads a 1200x630 preview image of the default scenario when the export component is installed (npx joplo setup export, or Playwright already in the project); without it, share still succeeds, prints one "Skipped the preview image" line, and never downloads anything.
|
|
494
762
|
- Pro share updates the same-server link in .joplo/cloud.json; --new creates another link and --title sets its title.
|
|
495
763
|
- The review version is a separate share (review: { shareId, url } in .joplo/cloud.json); it never replaces the main link. If the cloud rejects the review manifest, plain share retries once without it and still publishes.
|
|
496
764
|
- npx joplo whoami --format json shows the account, plan, and limits; npx joplo logout signs out.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './catalog.js';
|
|
|
2
2
|
export * from './schema.js';
|
|
3
3
|
export * from './result.js';
|
|
4
4
|
export * from './player.js';
|
|
5
|
+
export * from './focus.js';
|
|
6
|
+
export { FOCUS_IDLE_RUN } from './focus-check.js';
|
|
5
7
|
export * from './compile.js';
|
|
6
8
|
export type { Selection } from './selection.js';
|
|
7
9
|
export * from './validate.js';
|
|
@@ -11,3 +13,6 @@ export * from './embed.js';
|
|
|
11
13
|
export * from './features.js';
|
|
12
14
|
export * from './review.js';
|
|
13
15
|
export * from './agent-skill.js';
|
|
16
|
+
export * from './pace.js';
|
|
17
|
+
export * from './outline.js';
|
|
18
|
+
export * from './diagram/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ export * from "./catalog.js";
|
|
|
2
2
|
export * from "./schema.js";
|
|
3
3
|
export * from "./result.js";
|
|
4
4
|
export * from "./player.js";
|
|
5
|
+
export * from "./focus.js";
|
|
6
|
+
export { FOCUS_IDLE_RUN } from "./focus-check.js";
|
|
5
7
|
export * from "./compile.js";
|
|
6
8
|
// validate.ts 仍是 IR v1 版本,待 T-cli 迁移到 IR v2 后再导出。
|
|
7
9
|
export * from "./validate.js";
|
|
@@ -11,3 +13,6 @@ export * from "./embed.js";
|
|
|
11
13
|
export * from "./features.js";
|
|
12
14
|
export * from "./review.js";
|
|
13
15
|
export * from "./agent-skill.js";
|
|
16
|
+
export * from "./pace.js";
|
|
17
|
+
export * from "./outline.js";
|
|
18
|
+
export * from "./diagram/index.js";
|
package/dist/node.d.ts
CHANGED
package/dist/node.js
CHANGED