@zh-xx/antu 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/assets/viewer.html +48 -49
  2. package/bin/antu-mcp.mjs +62 -63
  3. package/bin/antu.mjs +54 -55
  4. package/embed/antu-embed.d.ts +11 -0
  5. package/embed/antu-embed.js +28227 -28093
  6. package/examples/agent/fact/1-minimal.en.json +8 -11
  7. package/examples/agent/fact/1-minimal.zh-CN.json +34 -9
  8. package/examples/agent/fact/2-single-actor.en.json +4 -30
  9. package/examples/agent/fact/2-single-actor.zh-CN.json +22 -10
  10. package/examples/agent/fact/{3-groups.en.json → 3-sides.en.json} +9 -9
  11. package/examples/agent/fact/{3-groups.zh-CN.json → 3-sides.zh-CN.json} +9 -9
  12. package/examples/agent/fact/4-one-side-several.en.json +44 -0
  13. package/examples/agent/fact/4-one-side-several.zh-CN.json +44 -0
  14. package/examples/agent/fact/5-duration.en.json +31 -8
  15. package/examples/agent/fact/5-duration.zh-CN.json +31 -8
  16. package/examples/agent/fact/6-sources.en.json +51 -12
  17. package/examples/agent/fact/6-sources.zh-CN.json +51 -12
  18. package/examples/agent/fact/7-undated.en.json +26 -9
  19. package/examples/agent/fact/7-undated.zh-CN.json +26 -9
  20. package/examples/fact/fang-yuan-loan-and-conflict.en.json +7 -66
  21. package/examples/fact/fang-yuan-loan-and-conflict.zh-CN.json +6 -29
  22. package/examples/fact/gym-membership-face-scan.en.json +1 -6
  23. package/examples/fact/gym-membership-face-scan.zh-CN.json +1 -6
  24. package/examples/fact/lin-fang-v-zhao-lei-private-lending.en.json +6 -19
  25. package/examples/fact/lin-fang-v-zhao-lei-private-lending.zh-CN.json +6 -19
  26. package/examples/fact/marketplace-platform-liability.en.json +5 -24
  27. package/examples/fact/marketplace-platform-liability.zh-CN.json +5 -24
  28. package/examples/fact/neighbour-corridor-charging.en.json +3 -25
  29. package/examples/fact/neighbour-corridor-charging.zh-CN.json +3 -25
  30. package/examples/fact/sample-construction-payment.en.json +8 -82
  31. package/examples/fact/sample-construction-payment.zh-CN.json +7 -25
  32. package/examples/fact/sample-four-parties-four-slots.en.json +8 -81
  33. package/examples/fact/sample-four-parties-four-slots.zh-CN.json +5 -22
  34. package/examples/fact/sample-no-groups.en.json +1 -1
  35. package/examples/fact/sample-no-groups.zh-CN.json +1 -1
  36. package/examples/fact/sample-three-slots.en.json +3 -15
  37. package/examples/fact/sample-three-slots.zh-CN.json +3 -15
  38. package/examples/fact/sample-two-actors-one-side.en.json +4 -23
  39. package/examples/fact/sample-two-actors-one-side.zh-CN.json +4 -23
  40. package/examples/fact/sample-two-parties-each-side.en.json +7 -34
  41. package/examples/fact/sample-two-parties-each-side.zh-CN.json +7 -34
  42. package/lib/chunks/report-BTsYMUG2.mjs +1461 -0
  43. package/lib/html.mjs +5 -5
  44. package/lib/validate.d.ts +9 -0
  45. package/lib/validate.mjs +5 -5
  46. package/package.json +1 -1
  47. package/server.json +2 -2
  48. package/spec/agent/fact/guide.md +39 -38
  49. package/spec/agent/relationship/guide.md +26 -7
  50. package/examples/agent/fact/4-views.en.json +0 -44
  51. package/examples/agent/fact/4-views.zh-CN.json +0 -44
  52. package/lib/chunks/report-BV3j2cS_.mjs +0 -1462
@@ -55,6 +55,8 @@ export interface MountOptions {
55
55
  ui?: { header?: boolean; capsule?: boolean; minimap?: boolean; zoom?: boolean }
56
56
  /** Where the reader's choices are kept: 'none' (default) while mounted only, 'local' in the viewer page's localStorage key, or the host's store */
57
57
  prefs?: 'none' | 'local' | AntuPrefsStore
58
+ /** How it opens, ahead of the reader's stored choices (the reader can still change it). An unknown key or a wrong value: `mount` throws. */
59
+ initial?: { headerFolded?: boolean }
58
60
  onEvent?: (event: AntuEvent) => void
59
61
  }
60
62
 
@@ -67,6 +69,12 @@ export interface AntuHandle {
67
69
  setKind(kind: string): boolean
68
70
  setTheme(theme: AntuTheme): boolean
69
71
  setLang(lang: AntuLang): boolean
72
+ /** Pin the card of the item `id`, as a reader's click would (a `select` event follows); `null` unpins. False when no card of it is drawn in this kind. */
73
+ select(id: string | null): boolean
74
+ /** Move the view to the item `id`, keeping the zoom unless it would not show it. False when it is not drawn in this kind. */
75
+ focus(id: string): boolean
76
+ /** Ring these items in the theme's colour until called again; `[]` clears. Ids that name no item are passed over. */
77
+ highlight(ids: string[]): void
70
78
  fitView(): void
71
79
  /** The PNG the page's own export makes (no label card, a white margin), not saved anywhere. Waits until the spec now mounted is drawn; rejects (with `errors`) while it is not valid. */
72
80
  exportPng(options?: { pixelRatio?: number }): Promise<Blob>
@@ -80,5 +88,8 @@ export function mount(element: HTMLElement, spec: AntuSpec, options?: MountOptio
80
88
  /** Check a spec the way the diagram checks it before drawing; each error names its field */
81
89
  export function validate(spec: unknown): { ok: boolean; errors: string[] }
82
90
 
91
+ /** Repair what is inconsistent in the marks of a spec but not in its content (a procedure's main line); the input is not modified, `changes` says what was done */
92
+ export function normalize(spec: unknown): { spec: unknown; changes: string[] }
93
+
83
94
  /** The kinds a type can be drawn in, the first being the one it opens in */
84
95
  export function kindsOf(type: string): string[]