@taylorwong/ichartjs 2.0.6 → 2.0.7
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/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/docs/agent/README.md +3 -1
- package/docs/agent/coding-agent-integration.md +1 -1
- package/docs/agent/development/iteration-12.md +101 -0
- package/docs/agent/development/roadmap.md +2 -1
- package/docs/agent/development-guide.md +1 -1
- package/docs/agent/diagram-scenario.md +39 -11
- package/docs/agent/editing-contract.md +5 -0
- package/docs/agent/frontend-integration.md +1 -1
- package/docs/agent/runtime-contract.md +11 -1
- package/docs/agent/theme-guide.md +33 -1
- package/docs/agent/usage-scenarios.md +3 -1
- package/docs/agent/zh-CN/README.md +1 -1
- package/docs/agent/zh-CN/coding-agent-integration.md +1 -1
- package/docs/agent/zh-CN/diagram-scenario.md +32 -3
- package/docs/agent/zh-CN/editing-contract.md +2 -0
- package/docs/agent/zh-CN/frontend-integration.md +1 -1
- package/docs/agent/zh-CN/iteration-12.md +98 -0
- package/docs/agent/zh-CN/runtime-contract.md +3 -1
- package/docs/agent/zh-CN/theme-guide.md +33 -1
- package/docs/agent/zh-CN/usage-scenarios.md +3 -1
- package/docs/manifests/capabilities.json +30 -3
- package/docs/manifests/commands.json +10 -9
- package/docs/manifests/schemas.json +5 -2
- package/package.json +1 -1
- package/skills/ichartjs/SKILL.md +2 -1
- package/src/capabilities.mjs +60 -12
- package/src/charts.mjs +127 -44
- package/src/command.mjs +4 -3
- package/src/diagram-interaction.mjs +55 -11
- package/src/diagram.mjs +149 -36
- package/src/edit-controller.mjs +6 -3
- package/src/edit.mjs +17 -7
- package/src/index.mjs +34 -15
- package/src/layout.mjs +39 -0
- package/src/preferences-ui.mjs +73 -24
- package/src/project.mjs +64 -24
- package/src/renderer.mjs +2 -2
- package/src/scene.mjs +32 -1
- package/src/schema.mjs +7 -2
- package/src/spec.mjs +10 -4
- package/src/theme.mjs +1 -1
- package/types/index.d.ts +22 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.7 - 2026-09-20
|
|
4
|
+
|
|
5
|
+
- Added Architecture and Mindmap chart types with shared diagram contracts, layers, boundaries, parent-child validation, deterministic tree/radial layouts, and Agent-readable schemas and capabilities.
|
|
6
|
+
- Added renderer-parity edge selection and editing, persistent manual waypoints, obstacle-aware routing, and true cubic-Bezier Mindmap edges while keeping navigation and editing disabled by default.
|
|
7
|
+
- Improved chart layout reflow, diagram connection routing, label spacing, legend and branding controls, and compact chart preference behavior.
|
|
8
|
+
- Fixed chart settings placement so scrolling preserves the selected side without viewport snapping and closes the menu directly after its anchor leaves the viewport.
|
|
9
|
+
|
|
3
10
|
## 2.0.6 - 2026-09-18
|
|
4
11
|
|
|
5
12
|
- Added compact per-chart visual settings with explicit default font sizing, capability-aware visibility toggles, bilingual labels, and theme-aware hamburger icon contrast.
|
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ getCapabilities
|
|
|
40
40
|
npm install @taylorwong/ichartjs@^2
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
As a fallback for environments without npm access, install directly from GitHub: `npm install github:wanghetommy/ichartjs#v2.0.
|
|
43
|
+
As a fallback for environments without npm access, install directly from GitHub: `npm install github:wanghetommy/ichartjs#v2.0.7`.
|
|
44
44
|
|
|
45
45
|
### Optional Agent Skill
|
|
46
46
|
|
|
@@ -62,7 +62,7 @@ For a non-interactive global Codex installation:
|
|
|
62
62
|
npx skills add wanghetommy/ichartjs --skill ichartjs --agent codex --global --yes
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
For a release-pinned installation, use `npx skills add https://github.com/wanghetommy/ichartjs/tree/v2.0.
|
|
65
|
+
For a release-pinned installation, use `npx skills add https://github.com/wanghetommy/ichartjs/tree/v2.0.7/skills/ichartjs --agent codex --global --yes`. WorkBuddy users can import the same tagged `skills/ichartjs` URL through the host's Skill interface; do not assume a `--agent workbuddy` adapter unless the installed CLI declares it. Package consumers can still copy `node_modules/@taylorwong/ichartjs/skills/ichartjs` as a manual fallback. After installation, invoke `$ichartjs` when named Skill invocation is supported, or select `ichartjs` in the host UI.
|
|
66
66
|
|
|
67
67
|
### Agent workflow
|
|
68
68
|
|
package/docs/agent/README.md
CHANGED
|
@@ -17,7 +17,7 @@ This is the user-facing Agent entry point for iChart.js 2.0. Read this file firs
|
|
|
17
17
|
- [Visual Style and Themes](theme-guide.md): automatic matching, presets, palettes, switching, and contrast checks.
|
|
18
18
|
- [Data Charting](charting-scenario.md): generic data analysis charts.
|
|
19
19
|
- [Project Management](project-scenario.md): Gantt, Timeline, Milestone, and Burndown.
|
|
20
|
-
- [Interactive Diagrams](diagram-scenario.md): Flow, Swimlane, Groups, Ports, and editing.
|
|
20
|
+
- [Interactive Diagrams](diagram-scenario.md): Flow, Swimlane, Architecture, Mindmap, Groups, Ports, and editing.
|
|
21
21
|
- [Runtime Contract](runtime-contract.md): shared Spec, renderer, interaction, and export rules.
|
|
22
22
|
- [Editing Contract](editing-contract.md): schemas, commands, preview, commit, and undo/redo.
|
|
23
23
|
- Machine-readable capability manifests are in `docs/manifests/` and should be loaded on demand.
|
|
@@ -56,6 +56,8 @@ For a visual overview of all supported chart types, open `playground/project-gal
|
|
|
56
56
|
- Prefer `canvas` when rendering many marks or targeting lower-power devices.
|
|
57
57
|
- Use `gantt`, `timeline`, `milestone`, or `burndown` for project delivery views.
|
|
58
58
|
- Use `flow` or `swimlane` for process, ownership, and responsibility views.
|
|
59
|
+
- Use `architecture` for business, data, and technical system structures with declared layers and boundaries.
|
|
60
|
+
- Use `mindmap` for hierarchical ideas, with stable `parentId` references and tree or radial layout.
|
|
59
61
|
- Do not generate `map` or `3d` Specs unless `getCapabilities()` declares them.
|
|
60
62
|
|
|
61
63
|
## Error handling
|
|
@@ -33,7 +33,7 @@ Install the official Skill with the standard Agent Skills CLI:
|
|
|
33
33
|
npx skills add wanghetommy/ichartjs --skill ichartjs
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
For global non-interactive Codex setup, append `--agent codex --global --yes`. To pin the released workflow, install `https://github.com/wanghetommy/ichartjs/tree/v2.0.
|
|
36
|
+
For global non-interactive Codex setup, append `--agent codex --global --yes`. To pin the released workflow, install `https://github.com/wanghetommy/ichartjs/tree/v2.0.7/skills/ichartjs`. WorkBuddy can import that tagged directory through its Skill interface; only use a host-specific `--agent` value when the installed CLI declares it.
|
|
37
37
|
|
|
38
38
|
Verify discovery with `npx skills add wanghetommy/ichartjs --list`; the result should include `ichartjs`.
|
|
39
39
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Iteration 12 — Structured Diagrams: Architecture and Mindmap
|
|
2
|
+
|
|
3
|
+
Release status: Iteration 12A–12G is included in `v2.0.7`.
|
|
4
|
+
|
|
5
|
+
Iteration 12 extends the existing Flow/Swimlane diagram runtime with two structured-diagram modes. Architecture diagrams and mindmaps share the same JSON-safe nodes, edges, layout, interaction, export, and Agent contracts; they are not separate renderer implementations.
|
|
6
|
+
|
|
7
|
+
## 12A — Shared Structured Diagram Model
|
|
8
|
+
|
|
9
|
+
- Reuse stable node IDs, edges, groups, ports, positions, sizes, routing, selection, keyboard navigation, history, Canvas/SVG rendering, and JSON/SVG/PNG export.
|
|
10
|
+
- Normalize `diagram.mode` as `process`, `architecture`, or `mindmap`.
|
|
11
|
+
- Derive mindmap parent-child edges from `node.parentId` while preserving explicit edges.
|
|
12
|
+
- Validate missing parents, self-parenting, duplicate IDs, layer references, and mindmap cycles.
|
|
13
|
+
- Keep `validateDiagram()` as the Agent-facing validation entry point.
|
|
14
|
+
|
|
15
|
+
## 12B — Architecture Diagram Mode
|
|
16
|
+
|
|
17
|
+
- Add `type: 'architecture'` for business, data, and technical architecture views.
|
|
18
|
+
- Support `layers` for stable vertical or horizontal architectural strata.
|
|
19
|
+
- Support `boundaries` with `nodeIds`, labels, padding, and color for bounded contexts, domains, systems, or platform boundaries.
|
|
20
|
+
- Keep regular edges for dependencies, realizes, persists, publishes, and other declared relationships; the runtime does not infer business semantics.
|
|
21
|
+
- Preserve manual positions when supplied and use deterministic layered placement otherwise.
|
|
22
|
+
|
|
23
|
+
## 12C — Mindmap Mode
|
|
24
|
+
|
|
25
|
+
- Add `type: 'mindmap'` with `parentId` as the compact Agent-friendly hierarchy contract.
|
|
26
|
+
- Support deterministic `tree` and `radial` layouts through the existing diagram layout modes.
|
|
27
|
+
- Render root and branch emphasis without introducing a new renderer or a separate editing model.
|
|
28
|
+
- Keep explicit IDs and parent references so Agents can update one branch without replacing the whole mindmap.
|
|
29
|
+
|
|
30
|
+
## 12D — Agent Contract and Schemas
|
|
31
|
+
|
|
32
|
+
- Expose `architecture` and `mindmap` in `getCapabilities()`, `planChart()`, chart profiles, TypeScript declarations, and manifests.
|
|
33
|
+
- Add `architecture-node`, `architecture-edge`, and `mindmap-node` business schemas.
|
|
34
|
+
- Return assumptions and structured validation diagnostics instead of silently guessing layer, boundary, or parent semantics.
|
|
35
|
+
- Keep architecture and mindmap in the `diagram` family and recommend them only for `architecture`, `hierarchy`, `brainstorm`, and related intents.
|
|
36
|
+
|
|
37
|
+
## 12E — Playground and Documentation
|
|
38
|
+
|
|
39
|
+
- Add Architecture and Mindmap examples to `playground/project-gallery.html`.
|
|
40
|
+
- Document the distinction: architecture is a domain/system structure; a mindmap is a hierarchy of ideas. Both are structured diagrams, but a mindmap is not an architecture diagram by default.
|
|
41
|
+
- Use `npm run playground` and preview `http://localhost:3000/playground/project-gallery.html`, then search `Architecture` or `Mindmap`.
|
|
42
|
+
|
|
43
|
+
## 12F — Renderer-Parity Edge Editing
|
|
44
|
+
|
|
45
|
+
Direct edge editing must remain a renderer-independent Diagram capability. SVG may be used to validate the interaction first, but Canvas and SVG must expose the same public operations, editing semantics, persisted data, keyboard behavior, and final acceptance status. The feature is not complete while either renderer is read-only or has reduced editing behavior.
|
|
46
|
+
|
|
47
|
+
The default runtime state must be static and safe, with no unexpected viewport or structural changes. Zoom, pan, brush selection, node dragging, edge dragging, port connection, and structural commands are disabled by default and must be explicitly enabled by the host. Agent-driven edits continue to use the validated preview/commit contract and do not implicitly enable pointer editing in the UI.
|
|
48
|
+
|
|
49
|
+
### Phase 1 — Edge Hit Testing and Selection
|
|
50
|
+
|
|
51
|
+
- Add geometry-aware edge hit testing with a forgiving interaction tolerance instead of relying on rectangular scene bounds.
|
|
52
|
+
- Make diagram edges selectable in Flow, Swimlane, Architecture, and Mindmap without changing chart-series line behavior.
|
|
53
|
+
- Support selected, hover, focus, delete, Escape, and keyboard traversal states consistently in Canvas and SVG.
|
|
54
|
+
- Keep hit testing in the shared Scene Graph; SVG transparent strokes may optimize DOM interaction but must not become the source of truth.
|
|
55
|
+
- Expose explicit edge-selection and edge-editing support through `getCapabilities()`.
|
|
56
|
+
- Keep navigation and editing disabled in default chart specs; Gallery and read-only embeds must not enable them implicitly.
|
|
57
|
+
|
|
58
|
+
### Phase 2 — Waypoint and Segment Handles
|
|
59
|
+
|
|
60
|
+
- Show bend-point and segment-midpoint handles only after an edge is selected in editing mode.
|
|
61
|
+
- Dragging a bend point updates one waypoint; dragging an orthogonal segment midpoint moves only that horizontal or vertical segment.
|
|
62
|
+
- Use enlarged invisible hit regions and minimum target sizes so thin lines remain usable without visually thickening them.
|
|
63
|
+
- Reuse preview, confirmation, commit, undo, redo, and audit behavior from the shared edit controller.
|
|
64
|
+
- Validate the interaction in SVG first if useful, but do not publish renderer-specific public behavior.
|
|
65
|
+
|
|
66
|
+
### Phase 3 — Persistent Manual Routing
|
|
67
|
+
|
|
68
|
+
- Add JSON-safe `waypoints` to the edge contract and preserve stable edge IDs.
|
|
69
|
+
- Apply the same waypoint model to Canvas rendering, SVG rendering, JSON export, SVG/PNG export, copy/paste, duplicate, and Agent edits.
|
|
70
|
+
- Define routing precedence as explicit waypoints first, automatic obstacle-aware routing otherwise.
|
|
71
|
+
- When connected nodes move, preserve valid manual segments, repair invalid endpoint segments, and fall back to deterministic automatic routing when the manual path becomes unusable.
|
|
72
|
+
- Support Agent updates through validated `updateEdge` operations rather than renderer-specific commands.
|
|
73
|
+
|
|
74
|
+
### 12F Acceptance
|
|
75
|
+
|
|
76
|
+
- Canvas and SVG pass the same edge hit-testing, selection, handle dragging, persistence, undo/redo, keyboard, and export tests.
|
|
77
|
+
- Flow, Swimlane, Architecture, and Mindmap use the same edge-editing contract and interaction implementation.
|
|
78
|
+
- Thin edges remain easy to select without changing their visible stroke width.
|
|
79
|
+
- Manual waypoints survive rerender, renderer switching, serialization, export, and chart recreation.
|
|
80
|
+
- Node movement never leaves an edge passing through a node; invalid manual routes are repaired or deterministically rerouted.
|
|
81
|
+
- Until all parity criteria pass, capabilities report segment dragging as unavailable rather than advertising SVG-only support.
|
|
82
|
+
- Default charts remain static: zoom, pan, brush, node drag, edge drag, port connection, and structural editing only activate through explicit host configuration.
|
|
83
|
+
|
|
84
|
+
## 12G — Mindmap Curved Edges
|
|
85
|
+
|
|
86
|
+
- Mindmap parent-child edges default to `routing: 'curved'`; Flow, Swimlane, and Architecture keep orthogonal defaults.
|
|
87
|
+
- `curved` renders one cubic Bezier segment in both Canvas and SVG instead of a four-point polyline.
|
|
88
|
+
- `diagram.curveTension` and per-edge `curveTension` accept values from `0.2` to `0.8`, with `0.4` as the default.
|
|
89
|
+
- Labels use the Bezier midpoint and arrowheads use the end tangent. Shared Scene Graph hit testing samples the curve so Canvas and SVG selection remain equivalent.
|
|
90
|
+
- Curves that intersect another node fall back deterministically to obstacle-aware orthogonal routing.
|
|
91
|
+
- Explicit `waypoints` retain precedence and render as manual polylines. Bezier control-point editing is intentionally excluded; moving nodes recalculates the curve.
|
|
92
|
+
|
|
93
|
+
## Acceptance
|
|
94
|
+
|
|
95
|
+
- `npm run agent:check` passes with 18 public chart types and 10 business schemas.
|
|
96
|
+
- Architecture validates and renders layers, boundaries, nodes, and dependency edges in both SVG and Canvas.
|
|
97
|
+
- Mindmap validates parent references and cycles, derives stable parent-child edges, and renders tree and radial layouts deterministically.
|
|
98
|
+
- Existing Flow and Swimlane tests and previews remain unchanged and pass.
|
|
99
|
+
- Existing export, accessibility, selection, keyboard, and preference behavior remains available through the shared diagram runtime.
|
|
100
|
+
- Iteration 12F is accepted only when Canvas and SVG expose equivalent edge-editing behavior.
|
|
101
|
+
- Iteration 12G is accepted only when Canvas, browser SVG, and headless SVG all emit true cubic Bezier paths and preserve static-by-default interaction behavior.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# iChart.js 2.0 Roadmap
|
|
2
2
|
|
|
3
|
-
> Roadmap baseline: 2026-09-14. Current release status: `v2.0.
|
|
3
|
+
> Roadmap baseline: 2026-09-14. Current release status: `v2.0.7` includes the completed Iteration 12 structured-diagram work and follow-up chart/menu fixes. Geographic charts and 3D rendering remain out of scope until explicitly reintroduced.
|
|
4
4
|
|
|
5
5
|
## Current Status
|
|
6
6
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- Iteration 9A–9D implemented the lightweight visual style system, adaptive theme planning, runtime switching, renderer integration, and bilingual Agent guidance without adding a chart type; these capabilities remain in the `2.0.x` line.
|
|
15
15
|
- Iteration 10A Export Contract Hardening was implemented and released in `v2.0.5`: export representations and type errors are deterministic, optional Node raster export uses `exportAsync()`, Canvas/SVG paint semantics are aligned, and the playground server has safer port/path handling. No chart behavior or public chart type was added.
|
|
16
16
|
- Iteration 11 visual preference controls are included in the `v2.0.6` release: compact per-chart settings, capability-aware visibility controls, theme-aware icon contrast, explicit font-size defaults, shared page preferences, and Agent-adjustable global settings.
|
|
17
|
+
- Iteration 12A–12G is included in `v2.0.7`: shared structured-diagram contracts, Architecture layers/boundaries, Mindmap parent-child tree/radial layouts with true cubic-Bezier edges, Agent schemas/capabilities, renderer-parity edge hit testing and selection, waypoint/segment handles, persistent manual routing, and Gallery/documentation coverage. Navigation and editing remain disabled by default and require explicit host activation.
|
|
17
18
|
- The original `2.0.0` readiness record is historical and superseded by the published `2.0.x` releases. Current release checks are defined by `docs/agent/development/release-sop.md`.
|
|
18
19
|
|
|
19
20
|
## Iteration 4 — Agent Data Contract and Business Editing
|
|
@@ -8,7 +8,7 @@ Unified workflow for Coding Agents developing iChart.js 2.0.
|
|
|
8
8
|
| --- | --- | --- |
|
|
9
9
|
| Generic metrics and data charts | `charting-scenario.md` | `src/charts.mjs` |
|
|
10
10
|
| Schedules, milestones, and progress | `project-scenario.md` | `src/project.mjs` |
|
|
11
|
-
| Processes, swimlanes, and Diagram editing | `diagram-scenario.md` | `src/diagram.mjs`, `src/diagram-interaction.mjs` |
|
|
11
|
+
| Processes, swimlanes, architecture, mindmaps, and Diagram editing | `diagram-scenario.md` | `src/diagram.mjs`, `src/diagram-interaction.mjs` |
|
|
12
12
|
|
|
13
13
|
## Standard Change Flow
|
|
14
14
|
|
|
@@ -6,22 +6,36 @@ Agent usage and development guide for process modeling, responsibility mapping,
|
|
|
6
6
|
|
|
7
7
|
- `flow`: a process graph made of nodes and edges.
|
|
8
8
|
- `swimlane`: a process graph organized by responsibility lanes.
|
|
9
|
+
- `architecture`: a layered business, data, or technical architecture graph with optional boundaries.
|
|
10
|
+
- `mindmap`: a parent-child hierarchy of ideas rendered as a tree or radial diagram.
|
|
11
|
+
|
|
12
|
+
Architecture and mindmap are both structured diagrams, but they are not interchangeable: architecture describes declared domain or system relationships, while a mindmap describes an idea hierarchy.
|
|
9
13
|
|
|
10
14
|
## Data Model
|
|
11
15
|
|
|
12
16
|
```js
|
|
13
17
|
{
|
|
14
|
-
type: '
|
|
18
|
+
type: 'architecture',
|
|
19
|
+
layers: [{ id: 'business', label: 'Business' }, { id: 'technology', label: 'Technology' }],
|
|
20
|
+
boundaries: [{ id: 'platform', label: 'Platform', nodeIds: ['api'] }],
|
|
15
21
|
nodes: [{
|
|
16
|
-
id: '
|
|
17
|
-
label: 'Review',
|
|
18
|
-
position: { x: 240, y: 100 },
|
|
19
|
-
size: { width: 140, height: 44 },
|
|
20
|
-
ports: [{ id: 'in', side: 'left', offset: 0.5 }],
|
|
21
|
-
groupId: 'delivery'
|
|
22
|
+
id: 'api', label: 'Order API', layerId: 'technology', position: { x: 240, y: 100 }
|
|
22
23
|
}],
|
|
23
|
-
edges: [{ from: '
|
|
24
|
-
|
|
24
|
+
edges: [{ id: 'orders-api', from: 'orders', to: 'api', relation: 'realizes', waypoints: [{ x: 220, y: 80 }, { x: 220, y: 160 }] }]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For a mindmap, prefer the compact parent contract:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
{
|
|
32
|
+
type: 'mindmap',
|
|
33
|
+
nodes: [
|
|
34
|
+
{ id: 'root', label: 'Release plan' },
|
|
35
|
+
{ id: 'scope', label: 'Scope', parentId: 'root' },
|
|
36
|
+
{ id: 'risk', label: 'Risks', parentId: 'root' }
|
|
37
|
+
],
|
|
38
|
+
diagram: { mode: 'mindmap', layout: 'tree', routing: 'curved', curveTension: 0.4 }
|
|
25
39
|
}
|
|
26
40
|
```
|
|
27
41
|
|
|
@@ -31,12 +45,25 @@ Supported:
|
|
|
31
45
|
|
|
32
46
|
- Nodes, edges, lanes, groups, and ports.
|
|
33
47
|
- `manual`, `layered`, `tree`, and `radial` layouts.
|
|
34
|
-
-
|
|
48
|
+
- Architecture layers and boundaries, plus mindmap parent-child derivation.
|
|
49
|
+
- `straight`, `orthogonal`, and true cubic-Bezier `curved` routing, with adjustable `curveTension` and obstacle-aware orthogonal fallback.
|
|
35
50
|
- Node dragging, multi-selection, alignment, and grid snapping.
|
|
36
51
|
- Keyboard movement, copy/paste, duplicate, group collapse/expand, undo/redo, and a shared Canvas/SVG Scene.
|
|
37
52
|
- Port-aware drag-to-connect interaction and typed edge creation.
|
|
53
|
+
- Geometry-aware edge selection, waypoint handles, orthogonal segment handles, persistent manual routing, and edge deletion.
|
|
38
54
|
- Group collapse/expand with collapsed group summary rendering.
|
|
39
55
|
|
|
56
|
+
Navigation and editing are opt-in. The default chart is static: zoom, pan, brush, node drag, edge drag, port connection, and structural editing are disabled until the host enables them.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
interaction: { zoom: true, pan: true, drag: true, edgeDrag: true, portConnect: true },
|
|
60
|
+
editing: { enabled: true, allowDelete: true, allowStructuralChanges: true }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Canvas and SVG use the same Scene Graph hit testing, `waypoints` contract, commands, history, and interaction behavior.
|
|
64
|
+
|
|
65
|
+
Mindmap defaults to curved parent-child edges. Set `diagram.curveTension` from `0.2` to `0.8`, override `routing` or `curveTension` on one explicit edge, or use `waypoints` when a persistent manual polyline is required. Bezier control points are not directly editable.
|
|
66
|
+
|
|
40
67
|
Current limitations:
|
|
41
68
|
|
|
42
69
|
- Groups are flat; nested groups are not supported.
|
|
@@ -50,7 +77,7 @@ Current limitations:
|
|
|
50
77
|
1. Assign stable IDs to nodes and edges.
|
|
51
78
|
2. Use `validateDiagram(spec)` to check endpoints, ports, groups, lanes, and layout options.
|
|
52
79
|
3. Create the chart with `createChart(spec)`.
|
|
53
|
-
4. Use typed commands such as `moveNodes`, `alignNodes`, `snapNodes`, `addEdge`, `toggleGroupCollapse`, `duplicateSelection`, and `pasteSelection` for edits.
|
|
80
|
+
4. Use typed commands such as `moveNodes`, `alignNodes`, `snapNodes`, `addEdge`, `updateEdge`, `removeEdge`, `toggleGroupCollapse`, `duplicateSelection`, and `pasteSelection` for edits.
|
|
54
81
|
5. Follow the preview/confirm/commit flow for all business-data changes.
|
|
55
82
|
|
|
56
83
|
## Implementation Map
|
|
@@ -80,3 +107,4 @@ Current limitations:
|
|
|
80
107
|
- Copy/paste preserves internal edges and produces deterministic new IDs.
|
|
81
108
|
- Group collapse hides member nodes and keeps group-level state visible.
|
|
82
109
|
- Groups, ports, and invalid references produce structured validation results.
|
|
110
|
+
- Canvas and SVG produce equivalent edge selection, handle dragging, persisted waypoints, keyboard behavior, and exports.
|
|
@@ -40,6 +40,8 @@ Core APIs:
|
|
|
40
40
|
- Command validation does not mutate the input command or source data.
|
|
41
41
|
- Host confirmation is required by default; `confirmed: true` is not an authorization system.
|
|
42
42
|
- External persistence, permissions, and authentication belong to the host application.
|
|
43
|
+
- Pointer navigation and editing are disabled by default. `editing.enabled` authorizes edit transactions; `interaction.drag`, `interaction.edgeDrag`, and `interaction.portConnect` separately expose direct-manipulation UI.
|
|
44
|
+
- Diagram edge routes use JSON-safe `waypoints` and update through `updateEdge`; edge deletion uses `removeEdge` and requires structural-edit permission.
|
|
43
45
|
|
|
44
46
|
## Supported Models
|
|
45
47
|
|
|
@@ -50,6 +52,9 @@ Core APIs:
|
|
|
50
52
|
- `flow-node`
|
|
51
53
|
- `flow-edge`
|
|
52
54
|
- `swimlane`
|
|
55
|
+
- `architecture-node`
|
|
56
|
+
- `architecture-edge`
|
|
57
|
+
- `mindmap-node`
|
|
53
58
|
|
|
54
59
|
## History and Revision
|
|
55
60
|
|
|
@@ -10,7 +10,7 @@ This is the production component path. For one-off files or Agent-led repository
|
|
|
10
10
|
npm install @taylorwong/ichartjs@^2
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
For environments without npm registry access, install from GitHub as a fallback: `npm install github:wanghetommy/ichartjs#v2.0.
|
|
13
|
+
For environments without npm registry access, install from GitHub as a fallback: `npm install github:wanghetommy/ichartjs#v2.0.7`.
|
|
14
14
|
|
|
15
15
|
Use the package through a bundler or another environment that resolves npm ESM imports:
|
|
16
16
|
|
|
@@ -10,6 +10,8 @@ getCapabilities → inspectData → planChart → create Spec → validateSpec
|
|
|
10
10
|
|
|
11
11
|
Agents should use `getCapabilities()` first instead of hard-coding undeclared types or operations.
|
|
12
12
|
|
|
13
|
+
For post-creation visual settings, use `getPreferenceCapabilities(chartType, { locale }) → chart.getPreferences() → validatePreferences(patch) → chart.setPreferences(patch, { source: 'agent' }) → chart.getState().preferences`. This keeps Agent changes on the same allowlisted contract as the built-in settings menu.
|
|
14
|
+
|
|
13
15
|
Iteration 8 adds per-chart profiles through `getChartCapability(type)`. Each profile declares required data roles, supported interactions, renderers, feature status, exports, and practical limits. Unsupported behavior must be handled from this profile or from validation diagnostics rather than guessed.
|
|
14
16
|
|
|
15
17
|
`planChart(data, { intent, renderer })` returns a versioned planning result with a primary chart, alternatives, confidence, reasons, required fields, suggested encodings, assumptions, warnings, unsupported requests, safe next actions, and the selected capability profile. Planning never invents business meaning, units, dates, or missing fields.
|
|
@@ -19,7 +21,7 @@ Iteration 8 adds per-chart profiles through `getChartCapability(type)`. Each pro
|
|
|
19
21
|
- Specs must be JSON-serializable.
|
|
20
22
|
- Call `validateSpec()` before rendering.
|
|
21
23
|
- Chart layout and data semantics are renderer-independent.
|
|
22
|
-
- `flow` and `swimlane` use `nodes/edges/lanes`; generic charts use `data.values`.
|
|
24
|
+
- `flow` and `swimlane` use `nodes/edges/lanes`; `architecture` uses `nodes/edges/layers/boundaries`; `mindmap` uses `nodes` with `parentId` and optional `edges`; generic charts use `data.values`.
|
|
23
25
|
|
|
24
26
|
## Renderer
|
|
25
27
|
|
|
@@ -93,10 +95,18 @@ validateSpec(spec)
|
|
|
93
95
|
createChart(spec)
|
|
94
96
|
getCapabilities()
|
|
95
97
|
getChartCapability(type)
|
|
98
|
+
getPreferenceCapabilities(type, options)
|
|
99
|
+
validatePreferences(patch, options)
|
|
96
100
|
chart.describe()
|
|
97
101
|
chart.explain()
|
|
98
102
|
chart.getState()
|
|
103
|
+
chart.getPreferences()
|
|
104
|
+
chart.setPreferences(patch, options)
|
|
105
|
+
chart.resetPreferences(options)
|
|
99
106
|
chart.getSelectedData()
|
|
107
|
+
chart.selectEdges(edgeIds, options)
|
|
108
|
+
chart.getSelectedEdgeIds()
|
|
109
|
+
chart.deleteSelectedEdges(options)
|
|
100
110
|
chart.export(options)
|
|
101
111
|
chart.exportAsync(options)
|
|
102
112
|
chart.toDataURL(type)
|
|
@@ -75,7 +75,11 @@ const chart = createChart({
|
|
|
75
75
|
data: { values: rows },
|
|
76
76
|
preferences: pagePreferences
|
|
77
77
|
});
|
|
78
|
-
mountChartSettings(chart, {
|
|
78
|
+
const settings = mountChartSettings(chart, {
|
|
79
|
+
locale: 'en',
|
|
80
|
+
placement: 'auto',
|
|
81
|
+
preferredPlacements: ['right', 'top', 'bottom']
|
|
82
|
+
});
|
|
79
83
|
|
|
80
84
|
// The same operation can come from an Agent conversation.
|
|
81
85
|
chart.setPreferences({
|
|
@@ -83,8 +87,36 @@ chart.setPreferences({
|
|
|
83
87
|
typography: { scale: 1.15 },
|
|
84
88
|
components: { grid: false }
|
|
85
89
|
}, { source: 'agent' });
|
|
90
|
+
|
|
91
|
+
// Call this when the host permanently removes the chart.
|
|
92
|
+
settings.destroy();
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The quick-settings panel is portaled outside the clipped chart surface. Automatic placement prefers the button's right side, then the top, then the bottom, and finally constrains the panel inside the browser viewport. On scroll it preserves the selected placement and follows the anchor without viewport snapping; it closes directly when the chart or anchor leaves the viewport. Resize and content changes may recompute placement.
|
|
96
|
+
|
|
97
|
+
### Agent Discovery and Validation
|
|
98
|
+
|
|
99
|
+
Agents should discover the allowlisted surface instead of hard-coding menu options. `getPreferenceCapabilities(chartType, { locale })` returns every preference field with its type, default value, options, scopes, chart applicability, and `menu.visible` status. Use the same contract for conversational changes and custom settings pages.
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import { getPreferenceCapabilities, validatePreferences } from '@taylorwong/ichartjs';
|
|
103
|
+
|
|
104
|
+
const capabilities = getPreferenceCapabilities(chart.getSpec().type, { locale: 'en' });
|
|
105
|
+
const menuFields = capabilities.fields.filter(field => field.menu.visible);
|
|
106
|
+
const current = chart.getPreferences();
|
|
107
|
+
const patch = {
|
|
108
|
+
theme: { preset: 'dashboard', palette: 'status' },
|
|
109
|
+
typography: { scale: 1.15 },
|
|
110
|
+
components: { grid: false }
|
|
111
|
+
};
|
|
112
|
+
const checked = validatePreferences(patch, { partial: true });
|
|
113
|
+
if (!checked.valid) throw new Error(JSON.stringify(checked.errors));
|
|
114
|
+
chart.setPreferences(checked.value, { scope: 'chart', source: 'agent' });
|
|
115
|
+
const applied = chart.getState().preferences;
|
|
86
116
|
```
|
|
87
117
|
|
|
118
|
+
The quick menu fields are `theme.mode`, `theme.palette`, `typography.scale`, and capability-supported `components.legend`, `components.labels`, and `components.grid`. The full allowlist additionally includes `theme.preset`, `density`, `branding.enabled`, and `motion`. Unknown locales fall back to English.
|
|
119
|
+
|
|
88
120
|
The optional per-chart menu uses a compact hamburger icon and intentionally exposes only high-frequency controls: theme mode, palette, font scale, and supported legend/label/grid visibility. Capability checks hide controls that do not apply to the current chart. Changes apply immediately and the UI supports `en`, `zh-CN`, and automatic document-language detection.
|
|
89
121
|
|
|
90
122
|
Keep low-frequency and page-wide controls in a dedicated settings surface outside the chart popover. Share one store across the page, and call `store.setGlobal()` or `chart.setPreferences(patch, { scope: 'global' })`. The full surface may expose preset, density, branding, and other allowlisted preferences without overloading every chart. The store uses memory in Node/SSR unless `localStorage` or a host adapter is explicitly selected. Preview the quick menu in `http://localhost:3000/playground/project-gallery.html` and the full page at `http://localhost:3000/playground/preferences-lab.html`.
|
|
@@ -121,7 +121,7 @@ npx skills add wanghetommy/ichartjs --skill ichartjs --agent codex --global --ye
|
|
|
121
121
|
For reproducible installation, pin the released Skill directory:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
npx skills add https://github.com/wanghetommy/ichartjs/tree/v2.0.
|
|
124
|
+
npx skills add https://github.com/wanghetommy/ichartjs/tree/v2.0.7/skills/ichartjs \
|
|
125
125
|
--agent codex --global --yes
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -159,6 +159,8 @@ Use the project and diagram contracts when the data has project semantics rather
|
|
|
159
159
|
- `gantt`, `timeline`, `milestone`, and `burndown` for delivery schedules;
|
|
160
160
|
- project analytics for capacity, velocity, release forecast, risk, and issue aging;
|
|
161
161
|
- `flow` and `swimlane` for process, ownership, responsibility, groups, ports, and controlled editing.
|
|
162
|
+
- `architecture` for business, data, or technical architecture with explicit layers, boundaries, and relationships.
|
|
163
|
+
- `mindmap` for idea hierarchies where `parentId` is the source of truth and a tree or radial layout is preferred.
|
|
162
164
|
|
|
163
165
|
Preserve stable record, node, edge, lane, group, and port IDs. For business edits, return a preview before commit and include the audit result.
|
|
164
166
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- [视觉样式与主题](theme-guide.md)
|
|
12
12
|
- [数据分析图表](charting-scenario.md)
|
|
13
13
|
- [项目管理图表](project-scenario.md)
|
|
14
|
-
- [交互式 Diagram](diagram-scenario.md)
|
|
14
|
+
- [交互式 Diagram](diagram-scenario.md):Flow、Swimlane、Architecture、Mindmap 与编辑。
|
|
15
15
|
- [Runtime 契约](runtime-contract.md)
|
|
16
16
|
- [编辑契约](editing-contract.md)
|
|
17
17
|
- 机器可读能力清单位于 `docs/manifests/`,供 Agent 按需读取。
|
|
@@ -22,7 +22,7 @@ npm Registry 中无作用域的 `ichartjs` 是安全占位包,并非本项目
|
|
|
22
22
|
npx skills add wanghetommy/ichartjs --skill ichartjs
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Codex 全局无交互安装可追加 `--agent codex --global --yes`。需要固定发布版本时,安装 `https://github.com/wanghetommy/ichartjs/tree/v2.0.
|
|
25
|
+
Codex 全局无交互安装可追加 `--agent codex --global --yes`。需要固定发布版本时,安装 `https://github.com/wanghetommy/ichartjs/tree/v2.0.7/skills/ichartjs`。WorkBuddy 可通过自身 Skill 界面导入该带 Tag 的目录;只有当前 CLI 明确声明对应适配器时才使用宿主专用 `--agent` 参数。
|
|
26
26
|
|
|
27
27
|
使用 `npx skills add wanghetommy/ichartjs --list` 验证发现结果,其中应包含 `ichartjs`。
|
|
28
28
|
|
|
@@ -6,10 +6,39 @@
|
|
|
6
6
|
|
|
7
7
|
- `flow`:节点和边组成的流程图。
|
|
8
8
|
- `swimlane`:带责任泳道的流程图。
|
|
9
|
+
- `architecture`:带可选层和边界的业务、数据或技术架构图。
|
|
10
|
+
- `mindmap`:以树形或放射布局呈现想法层级的思维导图。
|
|
11
|
+
|
|
12
|
+
架构图和思维导图都属于结构化图,但不能混用:架构图表达明确的领域或系统关系,思维导图表达想法层级。
|
|
13
|
+
|
|
14
|
+
思维导图建议使用简洁的父子数据:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
{
|
|
18
|
+
type: 'mindmap',
|
|
19
|
+
nodes: [
|
|
20
|
+
{ id: 'root', label: '发布计划' },
|
|
21
|
+
{ id: 'scope', label: '范围', parentId: 'root' },
|
|
22
|
+
{ id: 'risk', label: '风险', parentId: 'root' }
|
|
23
|
+
],
|
|
24
|
+
diagram: { mode: 'mindmap', layout: 'tree', routing: 'curved', curveTension: 0.4 }
|
|
25
|
+
}
|
|
26
|
+
```
|
|
9
27
|
|
|
10
28
|
## 当前能力
|
|
11
29
|
|
|
12
|
-
已支持节点、边、泳道、Group、Port
|
|
30
|
+
已支持节点、边、泳道、Group、Port、四种布局、三种路由、Mindmap 三次贝塞尔曲线、节点拖动、多选、对齐、网格吸附、键盘移动、Copy/Paste、Group 折叠展开、Port 键盘连线、边选择、折点/正交线段手柄、持久化 `waypoints`、边删除和 Undo/Redo。
|
|
31
|
+
|
|
32
|
+
导航和编辑能力默认关闭。普通图表保持静态,缩放、平移、框选、节点拖动、线段拖动、Port 连线和结构编辑必须由宿主显式开启:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
interaction: { zoom: true, pan: true, drag: true, edgeDrag: true, portConnect: true },
|
|
36
|
+
editing: { enabled: true, allowDelete: true, allowStructuralChanges: true }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Canvas 与 SVG 共用 Scene Graph 命中、`waypoints`、命令、历史和交互行为,不提供渲染器专属编辑能力。
|
|
40
|
+
|
|
41
|
+
Mindmap 默认使用曲线父子连线。`diagram.curveTension` 支持 `0.2` 到 `0.8`;显式边可以覆盖 `routing` 或 `curveTension`。存在 `waypoints` 时优先使用人工折线,当前不支持直接拖动贝塞尔控制点。
|
|
13
42
|
|
|
14
43
|
当前限制:
|
|
15
44
|
|
|
@@ -22,7 +51,7 @@
|
|
|
22
51
|
1. 为节点和边分配稳定 ID。
|
|
23
52
|
2. 使用 `validateDiagram(spec)` 检查端点、Port、Group、Lane 和布局。
|
|
24
53
|
3. 使用 `createChart(spec)` 创建图表。
|
|
25
|
-
4. 使用 `moveNodes`、`alignNodes`、`snapNodes` 等命令编辑。
|
|
54
|
+
4. 使用 `moveNodes`、`alignNodes`、`snapNodes`、`updateEdge`、`removeEdge` 等命令编辑。
|
|
26
55
|
5. 编辑遵循 `editing-contract.md` 的 Preview/Confirm/Commit 流程。
|
|
27
56
|
|
|
28
57
|
## 开发位置与验收
|
|
@@ -34,4 +63,4 @@
|
|
|
34
63
|
- 专用 Demo:`playground/diagram-editor.html`
|
|
35
64
|
- 全量 Gallery:`playground/project-gallery.html`
|
|
36
65
|
|
|
37
|
-
节点移动后必须验证边、箭头和标签跟随;同时检查 Canvas 与 SVG
|
|
66
|
+
节点移动后必须验证边、箭头和标签跟随;同时检查 Canvas 与 SVG 的边命中、手柄拖动、waypoint 持久化、键盘和导出一致性。
|
|
@@ -23,5 +23,7 @@ const result = chart.applyEdit(command, { preview, confirmed: true, source: 'age
|
|
|
23
23
|
- 默认需要 Host 确认;确认不等同于授权。
|
|
24
24
|
- 成功提交产生 ChangeSet、审计信息、revision 和 Undo 历史。
|
|
25
25
|
- 外部持久化、权限和认证由 Host 应用负责。
|
|
26
|
+
- 指针导航和编辑默认关闭。`editing.enabled` 授权编辑事务;`interaction.drag`、`interaction.edgeDrag`、`interaction.portConnect` 分别控制直接操作 UI。
|
|
27
|
+
- Diagram 边通过 JSON-safe 的 `waypoints` 持久化;路径更新使用 `updateEdge`,删除使用 `removeEdge`,并要求结构编辑权限。
|
|
26
28
|
|
|
27
29
|
Schema、命令、Preview/Commit、事务和历史的实现分别位于 `src/schema.mjs`、`src/command.mjs`、`src/edit.mjs`、`src/edit-controller.mjs` 和 `src/history.mjs`。
|
|
@@ -6,7 +6,7 @@ iChart.js 应作为普通 JavaScript UI 组件运行在浏览器应用中。数
|
|
|
6
6
|
npm install @taylorwong/ichartjs@^2
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
无法访问 npm Registry 的环境请用 GitHub 源作为后备:`npm install github:wanghetommy/ichartjs#v2.0.
|
|
9
|
+
无法访问 npm Registry 的环境请用 GitHub 源作为后备:`npm install github:wanghetommy/ichartjs#v2.0.7`。
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
import { createChart } from '@taylorwong/ichartjs';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Iteration 12:结构化图——架构图与思维导图
|
|
2
|
+
|
|
3
|
+
Iteration 12 在 Flow/Swimlane 现有 Diagram Runtime 上增加两种结构化图模式。架构图和思维导图共用节点、边、布局、交互、导出和 Agent 契约,不新增第二套渲染器。
|
|
4
|
+
|
|
5
|
+
## 12A:共享结构化图模型
|
|
6
|
+
|
|
7
|
+
- 复用稳定节点 ID、边、Group、Port、位置、尺寸、路由、选择、键盘导航、历史、Canvas/SVG 渲染以及 JSON/SVG/PNG 导出。
|
|
8
|
+
- 将 `diagram.mode` 归一化为 `process`、`architecture` 或 `mindmap`。
|
|
9
|
+
- 思维导图可以从 `node.parentId` 推导父子边,同时保留显式边。
|
|
10
|
+
- 校验缺失父节点、自引用、重复 ID、无效层引用和思维导图循环。
|
|
11
|
+
- Agent 统一使用 `validateDiagram()` 作为校验入口。
|
|
12
|
+
|
|
13
|
+
## 12B:架构图模式
|
|
14
|
+
|
|
15
|
+
- 使用 `type: 'architecture'` 表达业务架构、数据架构和技术架构。
|
|
16
|
+
- 使用 `layers` 表达稳定的架构分层。
|
|
17
|
+
- 使用 `boundaries` 表达领域、系统、平台或上下文边界,并支持 `nodeIds`、标签、边距和颜色。
|
|
18
|
+
- 普通边表达依赖、实现、持久化、发布等关系;Runtime 不擅自推断业务语义。
|
|
19
|
+
- 有明确位置时保留手工布局,否则使用确定性的分层布局。
|
|
20
|
+
|
|
21
|
+
## 12C:思维导图模式
|
|
22
|
+
|
|
23
|
+
- 使用 `type: 'mindmap'` 和 `parentId` 表达简洁的 Agent 友好层级。
|
|
24
|
+
- 支持确定性的 `tree` 和 `radial` 布局。
|
|
25
|
+
- 使用现有 Diagram 模型表达根节点和分支强调,不新增独立编辑模型。
|
|
26
|
+
- 保留稳定 ID 和父引用,Agent 可以只更新一个分支。
|
|
27
|
+
|
|
28
|
+
## 12D:Agent 契约与 Schema
|
|
29
|
+
|
|
30
|
+
- 在 `getCapabilities()`、`planChart()`、图表能力、TypeScript 声明和 manifest 中暴露 `architecture`、`mindmap`。
|
|
31
|
+
- 增加 `architecture-node`、`architecture-edge`、`mindmap-node` Schema。
|
|
32
|
+
- 对层、边界和父节点语义返回 assumptions 与结构化诊断,不静默猜测。
|
|
33
|
+
- 两者都归入 `diagram` 家族,仅在 architecture、hierarchy、brainstorm 等意图下推荐。
|
|
34
|
+
|
|
35
|
+
## 12E:Playground 与文档
|
|
36
|
+
|
|
37
|
+
- 在 `playground/project-gallery.html` 增加 Architecture 和 Mindmap 示例。
|
|
38
|
+
- 要区分:架构图表达领域/系统结构,思维导图表达想法层级;思维导图不默认等同于架构图。
|
|
39
|
+
- 执行 `npm run playground`,打开 `http://localhost:3000/playground/project-gallery.html`,搜索 `Architecture` 或 `Mindmap`。
|
|
40
|
+
|
|
41
|
+
## 12F:Canvas/SVG 一致的线段编辑
|
|
42
|
+
|
|
43
|
+
线段直接编辑必须是与渲染器无关的 Diagram 能力。可以先用 SVG 验证交互体验,但 Canvas 与 SVG 必须提供相同的公共操作、编辑语义、持久化数据、键盘行为和最终验收状态。只要任一渲染器仍为只读或能力缩水,12F 就不算完成。
|
|
44
|
+
|
|
45
|
+
Runtime 默认状态必须静态、安全,不产生意外的视图或结构变化。缩放、平移、框选、节点拖动、线段拖动、端口连线和结构命令默认全部关闭,必须由宿主显式开启。Agent 编辑继续使用经过校验的预览/提交契约,不得隐式开启页面中的指针编辑能力。
|
|
46
|
+
|
|
47
|
+
### 第一阶段:边命中与选择
|
|
48
|
+
|
|
49
|
+
- 增加基于几何距离的边命中算法和宽容的交互容差,不再依赖 Scene Node 的矩形 `bounds`。
|
|
50
|
+
- Flow、Swimlane、Architecture、Mindmap 中的边都可选择,但不影响普通 Line 等数据图表的折线交互。
|
|
51
|
+
- Canvas 与 SVG 一致支持选中、Hover、焦点、删除、Escape 和键盘遍历状态。
|
|
52
|
+
- 命中检测放在共享 Scene Graph 中;SVG 可以使用透明粗描边优化 DOM 交互,但不能以 SVG DOM 作为唯一事实来源。
|
|
53
|
+
- 通过 `getCapabilities()` 明确暴露边选择和边编辑能力。
|
|
54
|
+
- 默认图表 Spec 必须关闭导航与编辑;Gallery 和只读嵌入页面不能隐式开启这些能力。
|
|
55
|
+
|
|
56
|
+
### 第二阶段:折点与线段手柄
|
|
57
|
+
|
|
58
|
+
- 仅在编辑模式选中边后显示折点手柄和线段中点手柄。
|
|
59
|
+
- 拖动折点只更新一个 waypoint;拖动正交线段中点只移动对应的水平或垂直线段。
|
|
60
|
+
- 使用不可见的扩大命中区域和最小触控尺寸,让细线易于操作,同时不改变可见线宽。
|
|
61
|
+
- 复用共享编辑控制器的预览、确认、提交、撤销、重做和审计能力。
|
|
62
|
+
- 可以先在 SVG 中验证交互,但不能发布渲染器特有的公共行为。
|
|
63
|
+
|
|
64
|
+
### 第三阶段:人工路由持久化
|
|
65
|
+
|
|
66
|
+
- 在边契约中增加 JSON-safe 的 `waypoints`,继续使用稳定 edge ID。
|
|
67
|
+
- Canvas、SVG、JSON 导出、SVG/PNG 导出、复制粘贴、复制和 Agent 编辑均使用同一 waypoint 模型。
|
|
68
|
+
- 路由优先级定义为:存在显式 waypoints 时优先使用,否则执行自动避障路由。
|
|
69
|
+
- 节点移动后尽量保留有效人工线段,修复无效的端点线段;人工路径不可用时回退到确定性的自动路由。
|
|
70
|
+
- Agent 通过经过校验的 `updateEdge` 操作更新路径,不增加渲染器专属命令。
|
|
71
|
+
|
|
72
|
+
### 12F 验收
|
|
73
|
+
|
|
74
|
+
- Canvas 与 SVG 通过同一套边命中、选择、手柄拖动、持久化、撤销/重做、键盘和导出测试。
|
|
75
|
+
- Flow、Swimlane、Architecture、Mindmap 共用同一套边编辑契约和交互实现。
|
|
76
|
+
- 细线在不改变可见宽度的情况下仍容易选择。
|
|
77
|
+
- 人工 waypoints 在重绘、切换渲染器、序列化、导出和重新创建图表后保持不变。
|
|
78
|
+
- 节点移动后边不能穿过节点;无效人工路径必须被修复或确定性地重新路由。
|
|
79
|
+
- 在双渲染器一致性全部通过前,Capabilities 应报告线段拖动不可用,而不是只声明 SVG 支持。
|
|
80
|
+
- 默认图表保持静态:缩放、平移、框选、节点拖动、线段拖动、端口连线和结构编辑只有在宿主显式配置后才启用。
|
|
81
|
+
|
|
82
|
+
## 12G:Mindmap 贝塞尔曲线
|
|
83
|
+
|
|
84
|
+
- Mindmap 父子连线默认使用 `routing: 'curved'`;Flow、Swimlane、Architecture 继续默认使用正交路由。
|
|
85
|
+
- `curved` 在 Canvas 与 SVG 中都渲染为一段真实三次贝塞尔曲线,不再是四点折线。
|
|
86
|
+
- `diagram.curveTension` 和单边 `curveTension` 支持 `0.2` 到 `0.8`,默认值为 `0.4`。
|
|
87
|
+
- 标签位于贝塞尔中点,箭头根据终点切线定向;共享 Scene Graph 通过曲线采样保持 Canvas/SVG 命中一致。
|
|
88
|
+
- 曲线穿过其他节点时,确定性回退到具备避障能力的正交路由。
|
|
89
|
+
- 显式 `waypoints` 优先并继续使用人工折线。暂不提供贝塞尔控制点拖动;节点移动后自动重新计算曲线。
|
|
90
|
+
|
|
91
|
+
## 验收
|
|
92
|
+
|
|
93
|
+
- `npm run agent:check` 通过,公开图表类型为 18 个,业务 Schema 为 10 个。
|
|
94
|
+
- Architecture 在 SVG 和 Canvas 下均能显示层、边界、节点和依赖边。
|
|
95
|
+
- Mindmap 能校验父引用与循环,生成稳定父子边,并确定性渲染 tree/radial 布局。
|
|
96
|
+
- 既有 Flow、Swimlane 测试和预览不回归。
|
|
97
|
+
- Iteration 12F 只有在 Canvas 与 SVG 具备一致的线段编辑能力后才通过验收。
|
|
98
|
+
- Iteration 12G 只有在 Canvas、浏览器 SVG 与 Headless SVG 都输出真实三次贝塞尔路径,并保持默认静态交互时才通过验收。
|