@joplo-app/core 0.2.18 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/actions.d.ts +6 -0
  2. package/dist/actions.js +34 -0
  3. package/dist/agent-skill.d.ts +9 -15
  4. package/dist/agent-skill.js +41 -44
  5. package/dist/auto-caption.d.ts +3 -0
  6. package/dist/auto-caption.js +33 -0
  7. package/dist/catalog.d.ts +39 -42
  8. package/dist/catalog.js +27 -329
  9. package/dist/compile.d.ts +2 -8
  10. package/dist/compile.js +225 -393
  11. package/dist/content-i18n.js +27 -16
  12. package/dist/feature-diff.d.ts +9 -9
  13. package/dist/feature-diff.js +28 -6
  14. package/dist/focus.d.ts +3 -1
  15. package/dist/focus.js +16 -34
  16. package/dist/guide.d.ts +10 -12
  17. package/dist/guide.js +363 -591
  18. package/dist/index.d.ts +3 -1
  19. package/dist/index.js +3 -1
  20. package/dist/media.d.ts +10 -0
  21. package/dist/media.js +43 -0
  22. package/dist/node.d.ts +1 -2
  23. package/dist/node.js +1 -2
  24. package/dist/outline.js +1 -1
  25. package/dist/pace.d.ts +4 -1
  26. package/dist/pace.js +7 -3
  27. package/dist/player.d.ts +8 -41
  28. package/dist/player.js +83 -147
  29. package/dist/playground.d.ts +38 -0
  30. package/dist/playground.js +111 -0
  31. package/dist/plugin-data.d.ts +11 -0
  32. package/dist/plugin-data.js +96 -0
  33. package/dist/plugins/compiler.d.ts +66 -0
  34. package/dist/plugins/compiler.js +428 -0
  35. package/dist/plugins/data.d.ts +12 -0
  36. package/dist/plugins/data.js +120 -0
  37. package/dist/result.d.ts +1 -1
  38. package/dist/result.js +1 -0
  39. package/dist/runtime.d.ts +22 -0
  40. package/dist/runtime.js +18 -0
  41. package/dist/schema.d.ts +590 -112
  42. package/dist/schema.js +60 -52
  43. package/dist/scope.js +14 -5
  44. package/dist/step-identity.d.ts +1 -1
  45. package/dist/step-identity.js +1 -1
  46. package/dist/themes.d.ts +7 -0
  47. package/dist/themes.js +5 -0
  48. package/dist/traits.d.ts +7 -0
  49. package/dist/traits.js +26 -0
  50. package/dist/validate.js +17 -4
  51. package/package.json +7 -4
  52. package/dist/diagram/elk.d.ts +0 -6
  53. package/dist/diagram/elk.js +0 -56
  54. package/dist/diagram/graph-layout.d.ts +0 -123
  55. package/dist/diagram/graph-layout.js +0 -620
  56. package/dist/diagram/index.d.ts +0 -41
  57. package/dist/diagram/index.js +0 -92
  58. package/dist/diagram/model.d.ts +0 -217
  59. package/dist/diagram/model.js +0 -189
  60. package/dist/diagram/sequence-layout.d.ts +0 -12
  61. package/dist/diagram/sequence-layout.js +0 -185
@@ -0,0 +1,6 @@
1
+ import type { PluginActionSpec } from '@joplo-app/kit/plugin';
2
+ import type { Action, Project } from './schema.js';
3
+ export declare function pluginActionSpec(project: Pick<Project, 'plugins'>, name: string): PluginActionSpec | undefined;
4
+ export declare function validActionData(spec: PluginActionSpec, data: Record<string, unknown>): boolean;
5
+ /** Gesture matching is declarative, including plugin payloads. No plugin callbacks in playback. */
6
+ export declare function actionMatches(expected: Action, observed: Action, spec?: PluginActionSpec): boolean;
@@ -0,0 +1,34 @@
1
+ export function pluginActionSpec(project, name) {
2
+ const [plugin, key] = name.split(':');
3
+ return plugin && key ? project.plugins?.[plugin]?.actions?.[key] : undefined;
4
+ }
5
+ export function validActionData(spec, data) {
6
+ return Object.keys(data).length === Object.keys(spec.fields).length && Object.entries(spec.fields).every(([key, field]) => {
7
+ const value = data[key];
8
+ return typeof value === field.type && (typeof value !== 'number' || Number.isFinite(value) && (field.min === undefined || value >= field.min) && (field.max === undefined || value <= field.max));
9
+ });
10
+ }
11
+ const sameDestination = (a, b) => typeof a === 'string' || typeof b === 'string' ? a === b : Math.hypot(a.x - b.x, a.y - b.y) <= 16;
12
+ /** Gesture matching is declarative, including plugin payloads. No plugin callbacks in playback. */
13
+ export function actionMatches(expected, observed, spec) {
14
+ if (expected.type !== observed.type)
15
+ return false;
16
+ if ('target' in expected && (!('target' in observed) || expected.target !== observed.target))
17
+ return false;
18
+ switch (expected.type) {
19
+ case 'click':
20
+ case 'back': return true;
21
+ case 'type':
22
+ case 'select':
23
+ case 'toggle': return 'value' in observed && expected.value === observed.value;
24
+ case 'press': return observed.type === 'press' && expected.keys === observed.keys;
25
+ case 'drag':
26
+ case 'scroll': return 'to' in observed && sameDestination(expected.to, observed.to);
27
+ case 'hover': return observed.type === 'hover' && observed.ms >= expected.ms;
28
+ case 'plugin': return observed.type === 'plugin' && expected.name === observed.name && !!spec && validActionData(spec, observed.data) && Object.entries(spec.fields).every(([key, field]) => {
29
+ const a = expected.data[key], b = observed.data[key];
30
+ return typeof a === 'number' && typeof b === 'number' ? Math.abs(a - b) <= (field.tolerance ?? 0) : a === b;
31
+ });
32
+ default: return false; // System events and cards cannot be triggered by audience input.
33
+ }
34
+ }
@@ -9,31 +9,22 @@
9
9
  /** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
10
10
  export declare const SKILL_TOPICS: readonly [{
11
11
  readonly name: "authoring";
12
- readonly description: "Mental model, first steps, page / option / flow syntax, when conditions, a form example";
12
+ readonly description: "Engine model, page / option / flow, explicit plugins, named local reactions, composable effects, state and conditions";
13
13
  }, {
14
14
  readonly name: "story";
15
15
  readonly description: "Plan a demo before coding; PM lens from a need to roles, goal, cases, and scenarios; openings, endings, captions; explainers and news-style demos";
16
- }, {
17
- readonly name: "content";
18
- readonly description: "Explainers, tutorials, and news-explainer videos: package and plan, hook, one world with Canvas, camera(), motion morphs, chapters with flow({ from }), narration, sources, review";
19
16
  }, {
20
17
  readonly name: "demo";
21
- readonly description: "Layers, shots, captions, full-height layout, custom motion and data graphics, deep links, and screenshots";
18
+ readonly description: "Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots";
22
19
  }, {
23
20
  readonly name: "focus";
24
21
  readonly description: "Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact";
25
- }, {
26
- readonly name: "diagram";
27
- readonly description: "Architecture, sequence and state diagrams: domain groups, automatic layout, traces, shot framing";
28
- }, {
29
- readonly name: "components";
30
- readonly description: "Component catalog, supported HTML tags, line breaks, props, and real images";
31
22
  }, {
32
23
  readonly name: "cases";
33
24
  readonly description: "Case dimensions: ask the user before starting";
34
25
  }, {
35
26
  readonly name: "check";
36
- readonly description: "Read diagnostics, UNBOUND_INTERACTIVE, and fix the indicated file and line";
27
+ readonly description: "Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line";
37
28
  }, {
38
29
  readonly name: "selection";
39
30
  readonly description: "Edit only the element selected by the user in the board";
@@ -46,13 +37,16 @@ export declare const SKILL_TOPICS: readonly [{
46
37
  }, {
47
38
  readonly name: "publish";
48
39
  readonly description: "pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)";
40
+ }, {
41
+ readonly name: "plugins";
42
+ readonly description: "Data-only action contracts, native local behavior, engine-clock presenters; Universal properties, plugin themes, state writes and director targets; Binary assets, explicit paid resource generation, persistent artifacts, media tracks and offline publishing; API v2 immutable hooks, scoped/localized snapshots, shared React and production-package checks";
49
43
  }];
50
44
  /** 心智模型:所有入口最先读到的几句话。 */
51
- export declare const MENTAL_MODEL: readonly ["Joplo turns a feature idea into a clickable, replayable demo. It is a player for pre-declared scenarios, not a free-form app prototype, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.", "Structure: a project has features; a feature has options (alternative designs, A/B) and cases (edge cases to cover); an option plays scenarios; a scenario is a list of steps.", "A step is one user action (.click / .type / .select / .press) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.", "Viewers advance by clicking the highlighted element (other clicks only show a hint). Inputs show the sample value the step types; viewers cannot type their own, but the board's native feedback panel accepts real reviewer text.", "Options and cases are compared in the local board; only the picked option is published."];
45
+ export declare const MENTAL_MODEL: readonly ["Joplo turns a feature idea into a clickable, replayable demo. It is a player for pre-declared scenarios, not a free-form app prototype with persistent data or real backend logic, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.", "Structure: a project has features; a feature has options (alternative designs, A/B) and cases (edge cases to cover); an option plays scenarios; a scenario is a list of steps.", "A step is one user action (.click / .type / .select / .press / .drag / .hover / .scroll / .act) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.", "During playback, the first picture-changing stage input pauses and applies that same input. Hover does not pause; blank clicks only pause without an exploration notice. Matching the next action advances the script and stays stopped; another reachable scenario asks to switch (default before the action; actionEntry: 'after' consumes it on confirmation); native controls and declared free reactions change only a local playground. Play, jump, scenario change and reset discard exploration. Screenshots, video and deep links always use scripted state.", "Options and cases are compared in the local board; only the picked option is published."];
52
46
  /** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
53
- export declare const START_ORDER: readonly ["Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and components as needed.", "Plan before coding (npx joplo skill story): audience, one to three points, one line per scenario (Given → When → Then, how it opens and ends; a case's expected is its Then); show the plan to the user. A demo is a story, not a feature tour.", "With minimal code, write one happy path and one error-and-recovery scenario.", "Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.", "Extend to every option and every case agreed with the user; run check until 0 errors.", "Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill."];
47
+ export declare const START_ORDER: readonly ["Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and installed plugin skills as needed.", "Plan before coding (npx joplo skill story): audience, one to three points, one line per scenario (Given → When → Then, how it opens and ends; a case's expected is its Then); show the plan to the user. A demo is a story, not a feature tour.", "With minimal code, write one happy path and one error-and-recovery scenario.", "Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.", "Extend to every option and every case agreed with the user; run check until 0 errors.", "Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill."];
54
48
  /** 最常见的坑:一句话 + 详细主题。 */
55
- export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Only catalog components and the listed HTML tags exist; <br/> is UNKNOWN_COMPONENT, so write 'Line 1\\nLine 2' inside <Text>", "components"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["Explainers that read as slides: one board per chapter, title cards, bullet cards, panels fading in and out. Build one <Canvas> world instead, keep objects with motion keys so they morph between steps, and move camera() between them", "content"], readonly ["Moving the view with shot() in an explainer draws a pulsing focus ring and caps UI zoom at 1.25×; inside a <Canvas> use camera('id', …), which frames by content and does not draw a ring", "content"], readonly ["Chapters that should continue the last frame: write flow({ from: 'previousKey' }) instead of copying state by hand; scenarios with only system steps stay on the first layer unless a camera(), shot, or cue moves the director (or flow({ layer }))", "content"], readonly ["The share preview is the first scenario's first frame: design it as a thumbnail (a screen poster in the Canvas that the first step fades out), not an empty screen", "content"], readonly ["outline and the cover estimate narration at about 4.5 CJK characters per second; a chapter whose narrate() lines total more than about 400 characters runs past 90 s", "content"], readonly ["Label illustrative numbers on screen and keep them apart from sourced facts; bars start at zero and lengths stay proportional", "content"], readonly ["HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it", "check"], readonly ["Judge a scenario from its storyboard, not from check alone: npx joplo render --scenario-id <id> --sheet --out board.png shows every step with its caption and narration in one image", "content"]];
49
+ export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it", "check"], readonly ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over", "demo"], readonly ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"], readonly ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"], readonly ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"], readonly ["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"], readonly ["For audience exploration, use native UI controls or option.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"], readonly ["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"]];
56
50
  export type AgentSkill = {
57
51
  name: string;
58
52
  description: string;
@@ -8,31 +8,29 @@
8
8
  */
9
9
  /** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
10
10
  export const SKILL_TOPICS = [
11
- { name: 'authoring', description: 'Mental model, first steps, page / option / flow syntax, when conditions, a form example' },
11
+ { name: 'authoring', description: 'Engine model, page / option / flow, explicit plugins, named local reactions, composable effects, state and conditions' },
12
12
  { name: 'story', description: 'Plan a demo before coding; PM lens from a need to roles, goal, cases, and scenarios; openings, endings, captions; explainers and news-style demos' },
13
- { name: 'content', description: 'Explainers, tutorials, and news-explainer videos: package and plan, hook, one world with Canvas, camera(), motion morphs, chapters with flow({ from }), narration, sources, review' },
14
- { name: 'demo', description: 'Layers, shots, captions, full-height layout, custom motion and data graphics, deep links, and screenshots' },
13
+ { name: 'demo', description: 'Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots' },
15
14
  { name: 'focus', description: 'Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact' },
16
- { name: 'diagram', description: 'Architecture, sequence and state diagrams: domain groups, automatic layout, traces, shot framing' },
17
- { name: 'components', description: 'Component catalog, supported HTML tags, line breaks, props, and real images' },
18
15
  { name: 'cases', description: 'Case dimensions: ask the user before starting' },
19
- { name: 'check', description: 'Read diagnostics, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
16
+ { name: 'check', description: 'Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
20
17
  { name: 'selection', description: 'Edit only the element selected by the user in the board' },
21
18
  { name: 'review', description: 'Local live feedback, Share polling, prompt acknowledgement, session/version isolation, and recovery' },
22
19
  { name: 'diff', description: 'Compare public feature builds, stable step identity, uncertain matches, isolated PR CI publication' },
23
20
  { name: 'publish', description: 'pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)' },
21
+ { name: 'plugins', description: 'Data-only action contracts, native local behavior, engine-clock presenters; Universal properties, plugin themes, state writes and director targets; Binary assets, explicit paid resource generation, persistent artifacts, media tracks and offline publishing; API v2 immutable hooks, scoped/localized snapshots, shared React and production-package checks' },
24
22
  ];
25
23
  /** 心智模型:所有入口最先读到的几句话。 */
26
24
  export const MENTAL_MODEL = [
27
- 'Joplo turns a feature idea into a clickable, replayable demo. It is a player for pre-declared scenarios, not a free-form app prototype, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.',
25
+ 'Joplo turns a feature idea into a clickable, replayable demo. It is a player for pre-declared scenarios, not a free-form app prototype with persistent data or real backend logic, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.',
28
26
  'Structure: a project has features; a feature has options (alternative designs, A/B) and cases (edge cases to cover); an option plays scenarios; a scenario is a list of steps.',
29
- 'A step is one user action (.click / .type / .select / .press) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.',
30
- 'Viewers advance by clicking the highlighted element (other clicks only show a hint). Inputs show the sample value the step types; viewers cannot type their own, but the board\'s native feedback panel accepts real reviewer text.',
27
+ 'A step is one user action (.click / .type / .select / .press / .drag / .hover / .scroll / .act) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.',
28
+ 'During playback, the first picture-changing stage input pauses and applies that same input. Hover does not pause; blank clicks only pause without an exploration notice. Matching the next action advances the script and stays stopped; another reachable scenario asks to switch (default before the action; actionEntry: \'after\' consumes it on confirmation); native controls and declared free reactions change only a local playground. Play, jump, scenario change and reset discard exploration. Screenshots, video and deep links always use scripted state.',
31
29
  'Options and cases are compared in the local board; only the picked option is published.',
32
30
  ];
33
31
  /** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
34
32
  export const START_ORDER = [
35
- 'Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and components as needed.',
33
+ 'Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and installed plugin skills as needed.',
36
34
  'Plan before coding (npx joplo skill story): audience, one to three points, one line per scenario (Given → When → Then, how it opens and ends; a case\'s expected is its Then); show the plan to the user. A demo is a story, not a feature tour.',
37
35
  'With minimal code, write one happy path and one error-and-recovery scenario.',
38
36
  'Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.',
@@ -41,32 +39,31 @@ export const START_ORDER = [
41
39
  ];
42
40
  /** 最常见的坑:一句话 + 详细主题。 */
43
41
  export const PITFALLS = [
44
- ['Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback', 'review'],
45
- ['when takes a condition, not a boolean: when={eq($.ui.mode, \'code\')}, never when={mode === \'code\'}; for values known while writing use {flag && <X/>}', 'authoring'],
46
- ['Only catalog components and the listed HTML tags exist; <br/> is UNKNOWN_COMPONENT, so write \'Line 1\\nLine 2\' inside <Text>', 'components'],
47
- ['Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE', 'check'],
48
- ['No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)', 'authoring'],
49
- ['Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer', 'demo'],
50
- ['Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots', 'demo'],
51
- ['Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user', 'cases'],
52
- ['CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation', 'publish'],
53
- ['Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url', 'publish'],
54
- ['Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow', 'publish'],
55
- ['Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information', 'publish'],
56
- ['Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection', 'publish'],
57
- ['Never share or deploy without the user\'s go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself', 'publish'],
58
- ['Joplo Cloud narration spends the user\'s characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them', 'publish'],
59
- ['AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json', 'publish'],
60
- ['Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead', 'publish'],
61
- ['Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: \'Joplo Cloud\' when config owns the selection)', 'publish'],
62
- ['Explainers that read as slides: one board per chapter, title cards, bullet cards, panels fading in and out. Build one <Canvas> world instead, keep objects with motion keys so they morph between steps, and move camera() between them', 'content'],
63
- ['Moving the view with shot() in an explainer draws a pulsing focus ring and caps UI zoom at 1.25×; inside a <Canvas> use camera(\'id\', …), which frames by content and does not draw a ring', 'content'],
64
- ['Chapters that should continue the last frame: write flow({ from: \'previousKey\' }) instead of copying state by hand; scenarios with only system steps stay on the first layer unless a camera(), shot, or cue moves the director (or flow({ layer }))', 'content'],
65
- ['The share preview is the first scenario\'s first frame: design it as a thumbnail (a screen poster in the Canvas that the first step fades out), not an empty screen', 'content'],
66
- ['outline and the cover estimate narration at about 4.5 CJK characters per second; a chapter whose narrate() lines total more than about 400 characters runs past 90 s', 'content'],
67
- ['Label illustrative numbers on screen and keep them apart from sourced facts; bars start at zero and lengths stay proportional', 'content'],
68
- ['HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it', 'check'],
69
- ['Judge a scenario from its storyboard, not from check alone: npx joplo render --scenario-id <id> --sheet --out board.png shows every step with its caption and narration in one image', 'content'],
42
+ ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"],
43
+ ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"],
44
+ ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"],
45
+ ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"],
46
+ ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"],
47
+ ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"],
48
+ ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"],
49
+ ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"],
50
+ ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"],
51
+ ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"],
52
+ ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information", "publish"],
53
+ ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"],
54
+ ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"],
55
+ ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"],
56
+ ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"],
57
+ ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"],
58
+ ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"],
59
+ ["HAPPY_PATH_ONLY is expected for explainers whose chapters are all main-flow; do not invent failure scenarios to silence it", "check"],
60
+ ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over", "demo"],
61
+ ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"],
62
+ ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"],
63
+ ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"],
64
+ ["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"],
65
+ ["For audience exploration, use native UI controls or option.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"],
66
+ ["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"],
70
67
  ];
71
68
  /** 中文触发词:技能 description 里的匹配文本,不是 CLI 界面文案(english-output 测试的白名单)。 */
72
69
  const ZH_JOPLO = '功能原型、可交互演示、方案对比、给产品 / 设计 / 评审看的演示、讲解视频、科普、教程、资讯解读';
@@ -83,13 +80,13 @@ function joploBody() {
83
80
  '## When to use',
84
81
  '- The user wants to think a feature through before building it: a prototype, a clickable demo, A/B options, edge cases, or a walkthrough for product, design, or review.',
85
82
  '- The user wants to compare how a feature changed between two versions or in a PR (see npx joplo skill diff).',
86
- '- The user wants an explainer, tutorial, science piece, or news explainer that plays like a video (narration, chapters, animated graphics): read npx joplo skill content first.',
83
+ '- The user wants an explainer, tutorial, science piece, or news explainer that plays like a video (narration, chapters, animated graphics): read .claude/skills/joplo-plugins/SKILL.md and the relevant installed plugin skill first.',
87
84
  '',
88
85
  '## When not to use',
89
86
  '- Production UI code or real backends: Joplo demos are scripted; nothing runs real logic.',
90
- '- Demos where viewers must type their own free input.',
87
+ '- Apps that must persist audience edits or execute real backend logic. Local typing and controls are supported only as disposable exploration.',
91
88
  '- Slide decks, pitch decks, or text-and-bullet presentations with no product behavior or animated explanation to show: use a slides tool instead.',
92
- '- Editing real video footage, music videos, or soundtracks: Joplo has no video clips, music, or sound effects.',
89
+ '- Editing real video footage: media plugins add background sound, but Joplo is not a footage editor.',
93
90
  '',
94
91
  '## Quick start',
95
92
  '```sh',
@@ -108,9 +105,9 @@ function joploBody() {
108
105
  '## Show the product, not slides',
109
106
  'Every step is an action on the product and a visible change it causes. If a step could be a bullet on a slide, rebuild it as interface, state, or a trace.',
110
107
  '- Feature: not a card listing "enter email / teammate gets a link / joins today"; instead Ana types the email, clicks Send, the row appears as Pending, then Leo\'s layer opens the mail and lands in the space.',
111
- '- Backend or architecture: not a card "App → API → Queue → Worker"; instead a Diagram where trace() lights each hop as the request moves and trace.fail() shows where it breaks, beside the UI whose status changes with it.',
108
+ '- Backend or architecture: not a card "App → API → Queue → Worker"; instead an installed plugin view where each request hop and failure changes on screen, beside the UI whose status changes with it.',
112
109
  '- Comparison: not a pros-and-cons table; instead options A and B each playing the same scenario, compared in the board.',
113
- '- State or lifecycle: not a paragraph explaining statuses; instead a StateMachine whose current state moves as the user acts.',
110
+ '- State or lifecycle: not a paragraph explaining statuses; instead a lifecycle view whose current state moves as the user acts.',
114
111
  '- Cards only open, close, jump in time, or switch roles; text that explains belongs in captions and explain(). Worked example: npx joplo skill story.',
115
112
  '',
116
113
  '## Review live with the user',
@@ -119,7 +116,7 @@ function joploBody() {
119
116
  '1. Start npx joplo feedback watch <dir> --local --follow --json in its own long-running shell (joplo dev prints this exact command; the board\'s feedback panel can copy it too). One follower covers every option of the project and attaches by itself to the new round each source edit opens.',
120
117
  '2. Then give the user the board URL that dev printed (do not assume port 4790) and point them to the native feedback icon. If they want to drive the UI themselves, only give the link.',
121
118
  '3. While they test, read the follower\'s output with short waits (about 1–5 seconds). Each stdout line is one JSON event (feedback, approved, closed) carrying eventId, optionId, sessionId and context (route, scenario, step, source); deduplicate by eventId. A background shell alone does not wake an idle agent: stay in a receive loop, and do not claim you are still listening after ending your response unless the host can resume you.',
122
- ' - If you will end your response while the user tests, and your host wakes you when a background command finishes (Claude Code does): run the follower in the background with --once added. It exits 0 on the first feedback or approval, which wakes you. Handle the events, then start it again with --since <createdAt of the last event> (the exit message prints this exact command) so nothing is replayed or lost. Without such a host, tell the user to message you after they confirm.',
119
+ ' - If you will end your response while the user tests, and your host wakes you when a background command finishes (a host configured to resume on process exit does): run the follower in the background with --once added. It exits 0 on the first feedback or approval, which wakes you. Handle the events, then start it again with --since <createdAt of the last event> (the exit message prints this exact command) so nothing is replayed or lost. Without such a host, tell the user to message you after they confirm.',
123
120
  '4. On feedback, acknowledge the actual text and its page/step right away, in the reviewer\'s language, then keep listening. Change the demo only when the user asked for changes; after edits, run npx joplo check. closed (source_changed) is then expected and the follower moves to the new round.',
124
121
  '5. approved confirms that option version only: it is not proof the feedback was implemented and not permission to publish. The follower ends with exit 1 only when the board stops (restart dev, then the follower) or 130 on Ctrl+C.',
125
122
  'Exact-session watching, Share polling, and applying pick / rule / question decisions: joplo-feedback skill and npx joplo skill review.',
@@ -134,8 +131,8 @@ function joploBody() {
134
131
  ...PITFALLS.map(([text, topic]) => `- ${text}. See npx joplo skill ${topic}.`),
135
132
  '',
136
133
  '## Reference',
137
- 'npx joplo skill <topic> prints guidance matching the installed version; npx joplo skill lists them with line counts.',
138
- ...SKILL_TOPICS.map(t => `- ${t.name}: ${t.description}`),
134
+ 'npx joplo skill <topic> prints guidance matching the installed version; npx joplo skill lists engine and enabled plugin topics. Installed engine references are linked below; plugin guides are indexed in ../joplo-plugins/SKILL.md.',
135
+ ...SKILL_TOPICS.map(t => `- [${t.name}](./topics/${t.name}.md): ${t.description}`),
139
136
  'npx joplo components <Name> shows a component\'s props and an example. Pin these skills to a release: npx skills add https://github.com/Joplo-app/Joplo/tree/v<version> (Joplo-app/Joplo@v<version> does not work).',
140
137
  ].join('\n');
141
138
  }
@@ -2,6 +2,9 @@
2
2
  import { type ContentLocale } from './content-i18n.js';
3
3
  import type { Step } from './schema.js';
4
4
  type AutoCaptionMessages = {
5
+ autoDrag: (label: string, value: string) => string;
6
+ autoHover: (label: string) => string;
7
+ autoScroll: (label: string, value: string) => string;
5
8
  autoClick: (label: string) => string;
6
9
  autoType: (label: string, text: string) => string;
7
10
  autoSelect: (label: string, text: string) => string;
@@ -2,6 +2,9 @@
2
2
  import { isContentLocale } from "./content-i18n.js";
3
3
  const messages = {
4
4
  'en': {
5
+ autoDrag: (label, value) => `Drag \u201c${label}\u201d to ${value}`,
6
+ autoHover: (label) => `Hover over \u201c${label}\u201d`,
7
+ autoScroll: (label, value) => `Scroll \u201c${label}\u201d to ${value}`,
5
8
  autoClick: (label) => `Click “${label}”`,
6
9
  autoType: (label, text) => `Type “${text}” in “${label}”`,
7
10
  autoSelect: (label, text) => `Select “${text}” in “${label}”`,
@@ -13,6 +16,9 @@ const messages = {
13
16
  autoPress: (keys) => keys.trim() ? `Press ${keys}` : 'Press a key',
14
17
  },
15
18
  'zh-CN': {
19
+ autoDrag: (label, value) => `\u62d6\u52a8\u300c${label}\u300d\u5230 ${value}`,
20
+ autoHover: (label) => `\u60ac\u505c\u5728\u300c${label}\u300d`,
21
+ autoScroll: (label, value) => `\u6eda\u52a8\u300c${label}\u300d\u5230 ${value}`,
16
22
  autoClick: (label) => `\u70b9\u51fb\u300c${label}\u300d`,
17
23
  autoType: (label, text) => `\u5728\u300c${label}\u300d\u4e2d\u8f93\u5165“${text}”`,
18
24
  autoSelect: (label, text) => `\u5728\u300c${label}\u300d\u4e2d\u9009\u62e9“${text}”`,
@@ -24,6 +30,9 @@ const messages = {
24
30
  autoPress: (keys) => keys.trim() ? `\u6309\u4e0b ${keys}` : '\u6309\u4e0b\u6309\u952e',
25
31
  },
26
32
  'zh-TW': {
33
+ autoDrag: (label, value) => `\u62d6\u66f3\u300c${label}\u300d\u5230 ${value}`,
34
+ autoHover: (label) => `\u505c\u7559\u5728\u300c${label}\u300d\u4e0a`,
35
+ autoScroll: (label, value) => `\u6372\u52d5\u300c${label}\u300d\u5230 ${value}`,
27
36
  autoClick: (label) => `\u9ede\u9078\u300c${label}\u300d`,
28
37
  autoType: (label, text) => `\u5728\u300c${label}\u300d\u8f38\u5165\u300c${text}\u300d`,
29
38
  autoSelect: (label, text) => `\u5728\u300c${label}\u300d\u9078\u64c7\u300c${text}\u300d`,
@@ -35,6 +44,9 @@ const messages = {
35
44
  autoPress: (keys) => keys.trim() ? `\u6309\u4e0b ${keys}` : "\u6309\u4e0b\u6309\u9375",
36
45
  },
37
46
  'ja': {
47
+ autoDrag: (label, value) => `\u300c${label}\u300d\u3092 ${value} \u306b\u30c9\u30e9\u30c3\u30b0`,
48
+ autoHover: (label) => `\u300c${label}\u300d\u306b\u30dd\u30a4\u30f3\u30bf\u30fc\u3092\u5408\u308f\u305b\u308b`,
49
+ autoScroll: (label, value) => `\u300c${label}\u300d\u3092 ${value} \u307e\u3067\u30b9\u30af\u30ed\u30fc\u30eb`,
38
50
  autoClick: (label) => `\u300c${label}\u300d\u3092\u30af\u30ea\u30c3\u30af`,
39
51
  autoType: (label, text) => `\u300c${label}\u300d\u306b\u300c${text}\u300d\u3092\u5165\u529b`,
40
52
  autoSelect: (label, text) => `\u300c${label}\u300d\u3067\u300c${text}\u300d\u3092\u9078\u629e`,
@@ -46,6 +58,9 @@ const messages = {
46
58
  autoPress: (keys) => keys.trim() ? `${keys} \u3092\u62bc\u3059` : "\u30ad\u30fc\u3092\u62bc\u3059",
47
59
  },
48
60
  'ko': {
61
+ autoDrag: (label, value) => `\u201c${label}\u201d\uc744(\ub97c) ${value}(\uc73c)\ub85c \ub4dc\ub798\uadf8`,
62
+ autoHover: (label) => `\u201c${label}\u201d \uc704\uc5d0 \ud3ec\uc778\ud130 \ub193\uae30`,
63
+ autoScroll: (label, value) => `\u201c${label}\u201d\uc744(\ub97c) ${value}\uae4c\uc9c0 \uc2a4\ud06c\ub864`,
49
64
  autoClick: (label) => `“${label}” \ud074\ub9ad`,
50
65
  autoType: (label, text) => `“${label}”\uc5d0 “${text}” \uc785\ub825`,
51
66
  autoSelect: (label, text) => `“${label}”\uc5d0\uc11c “${text}” \uc120\ud0dd`,
@@ -57,6 +72,9 @@ const messages = {
57
72
  autoPress: (keys) => keys.trim() ? `${keys} \ub204\ub974\uae30` : "\ud0a4 \ub204\ub974\uae30",
58
73
  },
59
74
  'es': {
75
+ autoDrag: (label, value) => `Arrastra \u00ab${label}\u00bb a ${value}`,
76
+ autoHover: (label) => `Mant\u00e9n el puntero sobre \u00ab${label}\u00bb`,
77
+ autoScroll: (label, value) => `Desplaza \u00ab${label}\u00bb hasta ${value}`,
60
78
  autoClick: (label) => `Haz clic en «${label}»`,
61
79
  autoType: (label, text) => `Escribe «${text}» en «${label}»`,
62
80
  autoSelect: (label, text) => `Elige «${text}» en «${label}»`,
@@ -68,6 +86,9 @@ const messages = {
68
86
  autoPress: (keys) => keys.trim() ? `Pulsa ${keys}` : "Pulsa una tecla",
69
87
  },
70
88
  'fr': {
89
+ autoDrag: (label, value) => `Glisser \u00ab ${label} \u00bb vers ${value}`,
90
+ autoHover: (label) => `Survoler \u00ab ${label} \u00bb`,
91
+ autoScroll: (label, value) => `Faire d\u00e9filer \u00ab ${label} \u00bb jusqu\u2019\u00e0 ${value}`,
71
92
  autoClick: (label) => `Cliquer sur « ${label} »`,
72
93
  autoType: (label, text) => `Saisir « ${text} » dans « ${label} »`,
73
94
  autoSelect: (label, text) => `Choisir « ${text} » dans « ${label} »`,
@@ -79,6 +100,9 @@ const messages = {
79
100
  autoPress: (keys) => keys.trim() ? `Appuyer sur ${keys}` : "Appuyer sur une touche",
80
101
  },
81
102
  'de': {
103
+ autoDrag: (label, value) => `\u201e${label}\u201c nach ${value} ziehen`,
104
+ autoHover: (label) => `Zeiger auf \u201e${label}\u201c halten`,
105
+ autoScroll: (label, value) => `\u201e${label}\u201c bis ${value} scrollen`,
82
106
  autoClick: (label) => `„${label}“ anklicken`,
83
107
  autoType: (label, text) => `„${text}“ in „${label}“ eingeben`,
84
108
  autoSelect: (label, text) => `„${text}“ in „${label}“ wählen`,
@@ -90,6 +114,9 @@ const messages = {
90
114
  autoPress: (keys) => keys.trim() ? `${keys} drücken` : "Taste drücken",
91
115
  },
92
116
  'pt-BR': {
117
+ autoDrag: (label, value) => `Arraste \u201c${label}\u201d para ${value}`,
118
+ autoHover: (label) => `Mantenha o cursor sobre \u201c${label}\u201d`,
119
+ autoScroll: (label, value) => `Role \u201c${label}\u201d at\u00e9 ${value}`,
93
120
  autoClick: (label) => `Clique em “${label}”`,
94
121
  autoType: (label, text) => `Digite “${text}” em “${label}”`,
95
122
  autoSelect: (label, text) => `Selecione “${text}” em “${label}”`,
@@ -101,6 +128,9 @@ const messages = {
101
128
  autoPress: (keys) => keys.trim() ? `Pressione ${keys}` : "Pressione uma tecla",
102
129
  },
103
130
  'ru': {
131
+ autoDrag: (label, value) => `\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u044c \u00ab${label}\u00bb \u043a ${value}`,
132
+ autoHover: (label) => `\u041d\u0430\u0432\u0435\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u00ab${label}\u00bb`,
133
+ autoScroll: (label, value) => `\u041f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u00ab${label}\u00bb \u0434\u043e ${value}`,
104
134
  autoClick: (label) => `Нажать «${label}»`,
105
135
  autoType: (label, text) => `Ввести «${text}» в «${label}»`,
106
136
  autoSelect: (label, text) => `Выбрать «${text}» в «${label}»`,
@@ -120,6 +150,9 @@ export function automaticCaption(auto, locale) {
120
150
  return null;
121
151
  const t = autoCaptionMessages(locale);
122
152
  switch (auto.kind) {
153
+ case 'drag': return t.autoDrag(auto.label, auto.value ?? '');
154
+ case 'hover': return t.autoHover(auto.label);
155
+ case 'scroll': return t.autoScroll(auto.label, auto.value ?? '');
123
156
  case 'click': return t.autoClick(auto.label);
124
157
  case 'type': return t.autoType(auto.label, auto.value ?? '');
125
158
  case 'select': return t.autoSelect(auto.label, auto.value ?? '');
package/dist/catalog.d.ts CHANGED
@@ -1,35 +1,39 @@
1
- /**
2
- * 组件目录 v3(D35):名称与属性对齐 Mantine(数据表对齐 mantine-datatable),另加少量 AI 交互组件、
3
- * HTML 兜底标签和 Joplo 专用组件。复合组件用点语法:`<AppShell.Header>` 编译出的节点 type 就是 'AppShell.Header'。
4
- *
5
- * 目录是唯一来源:@joplo-app/kit/ui 的导出、渲染器(@joplo-app/web)的实现、COMPONENT_DOCS 都必须与 COMPONENT_TYPES 一致
6
- * (packages/core/test/catalog.test.ts 与渲染器的类型检查保证)。目录之外的名称在编译时报错,不会被静默渲染。
7
- * 只换词汇,不换渲染:运行时不引入 Mantine,仍由 Joplo 渲染成低保真风格。
8
- */
9
- export declare const HTML_TAGS: readonly string[];
10
- export declare const COMPONENT_TYPES: readonly ["AppShell", "AppShell.Header", "AppShell.Navbar", "AppShell.Main", "AppShell.Aside", "AppShell.Footer", "Container", "Stack", "Group", "Flex", "Grid", "Grid.Col", "SimpleGrid", "Center", "Box", "Space", "Paper", "Card", "Card.Section", "Divider", "ScrollArea", "Title", "Text", "Code", "Kbd", "Blockquote", "List", "List.Item", "Badge", "Avatar", "Image", "ThemeIcon", "Indicator", "Timeline", "Timeline.Item", "Table", "Table.Thead", "Table.Tbody", "Table.Tr", "Table.Th", "Table.Td", "DataTable", "Accordion", "Accordion.Item", "Accordion.Panel", "Radio", "Tabs.List", "Tabs.Panel", "Breadcrumbs", "Stepper", "Stepper.Step", "Alert", "Loader", "Progress", "RingProgress", "Skeleton", "Notification", "Modal", "Drawer", "ChatMessage", "ToolCall", "Thinking", "Artifact", "Email", "DataCard", "StateFlow", "Terminal", "Terminal.Command", "Terminal.Output", "Phone", "Canvas", "Diagram", "Diagram.Group", "Diagram.Node", "Diagram.Edge", "StateMachine", "StateMachine.Group", "StateMachine.State", "StateMachine.Transition", "Sequence", "Sequence.Group", "Sequence.Actor", "Sequence.Message", "Sequence.Block", "Avatar.Group", "Radio.Card", "EmptyState", "ListRow", "Stat", "KeyValue", "BarChart", "LineChart", "Menu", "Menu.Target", "Menu.Dropdown", "Menu.Label", "Menu.Divider", "div", "span", "p", "h1", "h2", "h3", "h4", "main", "section", "header", "footer", "nav", "aside", "ul", "ol", "li", "strong", "em", "small", "code", "Placeholder", "Custom", "#text", "Button", "ActionIcon", "CloseButton", "Anchor", "a", "NavLink", "Burger", "TextInput", "PasswordInput", "NumberInput", "Textarea", "Select", "MultiSelect", "Checkbox", "Radio.Group", "Switch", "SegmentedControl", "FileInput", "Tabs", "Tabs.Tab", "Accordion.Control", "Pagination", "PromptInput", "Terminal.Input", "Artifact.Ref", "Menu.Item", "TabBar"];
1
+ import type { PluginDataSpec, ElementTraits } from '@joplo-app/kit/plugin';
2
+ export declare const COMPONENT_TYPES: readonly ["Custom", "#text", "#fragment"];
11
3
  export type ComponentType = (typeof COMPONENT_TYPES)[number];
12
- export declare const INTERACTIVE_TYPES: ReadonlySet<string>;
13
- /** 可接收输入值;type/select/toggle 动作写入 state.inputs[nodeId]。 */
14
- export declare const VALUE_TYPES: ReadonlySet<string>;
15
- /**
16
- * 只有 opened(兼容旧写法 open)为真时自身和子节点才可见的浮层。
17
- * Menu.Dropdown(D68):作者把 opened 写在 Menu 上(与 Mantine 一致),编译器把它抄到菜单里的 Menu.Dropdown 上。
18
- */
19
- export declare const GATED_CONTAINERS: ReadonlySet<string>;
20
- /** Joplo 在 Mantine 属性之外追加的属性,编译器会从 props 中取出,放到节点字段上。 */
21
- export declare const JOPLO_PROPS: readonly ["id", "when", "disabledReason", "unmodeled", "note", "redact", "motion", "motionDelay", "motionMs", "screen"];
22
- /**
23
- * 每个组件一行常用属性提示(`joplo skill components` 由此生成)。所有组件另外都接受:
24
- * 样式属性 m/mt/mb/ml/mr/mx/my、p/pt/pb/pl/pr/px/py、w/h/miw/maw/mih/mah、c/bg/fz/fw/ta/ff/lh/opacity,
25
- * 响应式写成 { base, xs, sm, md, lg, xl };visibleFrom / hiddenFrom;以及 Joplo 属性 id/when/disabled/disabledReason/unmodeled/note。
26
- */
27
- export declare const COMPONENT_DOCS: Record<ComponentType, string>;
28
- /**
29
- * 示例(D68,`npx joplo components <名字>` 输出):每个都能直接放进页面或层级里用;交互状态写成 $.ui / $.data 绑定,由步骤 set()。
30
- * 只给最容易写错、或需要和步骤配合的组件;其余组件看 COMPONENT_DOCS 的一行提示就够。
31
- */
32
- export declare const COMPONENT_EXAMPLES: Partial<Record<ComponentType, string>>;
4
+ export type ComponentInfo = {
5
+ interactive?: boolean;
6
+ parent?: string;
7
+ needsId?: boolean;
8
+ selfEvident?: boolean;
9
+ traits?: ElementTraits;
10
+ };
11
+ export declare const JOPLO_PROPS: readonly ["id", "when", "disabledReason", "unmodeled", "note", "redact"];
12
+ /** 插件组件的类型名:`<插件 id>:<组件名>`(例如 scene3d:Target)。目录组件的名字里没有冒号。 */
13
+ export declare const PLUGIN_TYPE: RegExp;
14
+ export type PluginComponentType = `${string}:${string}`;
15
+ export declare const isPluginType: (type: string) => type is PluginComponentType;
16
+ /** 插件 id 与组件名:scene3d:Scene.Part → { plugin: 'scene3d', name: 'Scene.Part' }。 */
17
+ export declare const splitPluginType: (type: string) => {
18
+ plugin: string;
19
+ name: string;
20
+ } | null;
21
+ /** IR 里记录的插件信息(编译自插件清单;发布站保留,不含运行时路径)。 */
22
+ export type PluginInfo = {
23
+ actions?: Record<string, import('@joplo-app/kit/plugin').PluginActionSpec>;
24
+ themes?: Record<string, string>;
25
+ properties?: Record<string, import('@joplo-app/kit/plugin').PluginPropertySpec>;
26
+ data?: PluginDataSpec;
27
+ id: string;
28
+ title: string;
29
+ version?: string;
30
+ components: Record<string, ComponentInfo>;
31
+ };
32
+ export type PluginTable = Readonly<Record<string, PluginInfo>> | undefined;
33
+ /** 插件组件的声明;不是插件类型或插件没启用时为 null。 */
34
+ export declare function pluginSpec(plugins: PluginTable, type: string): ComponentInfo | null;
35
+ /** 可操作的类型:声明了 interactive 的插件组件。 */
36
+ export declare function isInteractiveType(type: string, plugins?: PluginTable): boolean;
33
37
  /** Mantine 默认断点:36/48/62/75/88em,按 16px 换算。 */
34
38
  export declare const BREAKPOINTS: {
35
39
  readonly xs: 576;
@@ -93,17 +97,10 @@ export declare const SCENARIO_MS_MAX = 90000;
93
97
  export declare const PAGE_LAYER = "@page";
94
98
  /** shot()(不带 id)在有层级的方案里:作用于“当时导演所在的层”,让它回到整体。 */
95
99
  export declare const DIRECTOR_LAYER = "@director";
96
- /** Diagram 节点与连线的 state(D41);节点 kind 等见 diagram/model.ts。 */
97
- export declare const DIAGRAM_STATES: readonly ["idle", "active", "ok", "error", "dim"];
98
- /** 横放的 Phone(landscape)内容区尺寸:844 × 390 的屏幕扣掉安全区(左侧刘海、底部横条)。 */
99
- export declare const PHONE_LANDSCAPE: {
100
- readonly width: 772;
101
- readonly height: 358;
102
- };
103
- /** 子节点排版用的宽度:Phone 内部按手机宽度(横放按横屏宽度;响应式取值、visibleFrom / hiddenFrom、AppShell 收起都按它算),其余节点沿用外部宽度。 */
104
- export declare function childWidth(type: string, width: number, props?: {
105
- landscape?: unknown;
106
- }): number;
100
+ /** Child viewport width is declared by the plugin, never inferred from a type name. */
101
+ export declare function childWidth(node: {
102
+ traits?: ElementTraits;
103
+ }, width: number, props?: Record<string, unknown>): number;
107
104
  /** 是否为响应式对象 `{ base, sm, md }`:普通对象,至少一个键,且全部键都是断点名。 */
108
105
  export declare function isResponsive(v: unknown): v is Partial<Record<(typeof BP_KEYS)[number], unknown>>;
109
106
  /** 按舞台宽度取响应式属性的值:取不超过宽度的最大断点;都不满足时取 base;非响应式值原样返回。 */