orcasvn-react-diagrams 0.2.4 → 0.2.6

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 (75) hide show
  1. package/CHANGELOG.md +42 -4
  2. package/README.md +15 -32
  3. package/ai/api-contract.json +88 -3
  4. package/ai/manifest.json +1 -1
  5. package/dist/cjs/examples.js +6519 -4423
  6. package/dist/cjs/index.js +1513 -120
  7. package/dist/cjs/types/api/createDiagramEditor.d.ts +4 -1
  8. package/dist/cjs/types/api/types.d.ts +43 -1
  9. package/dist/cjs/types/displaybox/demos/LinkColorPoolDemoTab.d.ts +3 -0
  10. package/dist/cjs/types/displaybox/demos/OffsetAnchorAvoidanceDemoTab.d.ts +3 -0
  11. package/dist/cjs/types/displaybox/demos/SimpleDemo.d.ts +4 -1
  12. package/dist/cjs/types/displaybox/demos/ZoomToFitElementsDemoTab.d.ts +3 -0
  13. package/dist/cjs/types/displaybox/demos/linkColorPoolDemo.d.ts +2 -0
  14. package/dist/cjs/types/displaybox/demos/offsetAnchorAvoidanceDemo.d.ts +4 -0
  15. package/dist/cjs/types/displaybox/demos/textDemo.d.ts +3 -0
  16. package/dist/cjs/types/displaybox/demos/zoomToFitElementsDemo.d.ts +4 -0
  17. package/dist/cjs/types/displaybox/types.d.ts +3 -1
  18. package/dist/cjs/types/displaybox/useDemoEditor.d.ts +4 -2
  19. package/dist/cjs/types/engine/AutoLayoutService.d.ts +59 -2
  20. package/dist/cjs/types/engine/DiagramEngine.d.ts +20 -1
  21. package/dist/cjs/types/engine/LinkRoutingService.d.ts +9 -0
  22. package/dist/cjs/types/models/TextModel.d.ts +1 -0
  23. package/dist/cjs/types/renderer/konva/KonvaInteraction.d.ts +6 -0
  24. package/dist/cjs/types/strategies/ObstacleRouter.d.ts +2 -0
  25. package/dist/cjs/types/strategies/RouterStrategy.d.ts +10 -0
  26. package/dist/esm/examples.js +6519 -4423
  27. package/dist/esm/examples.js.map +1 -1
  28. package/dist/esm/index.js +1513 -120
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/types/api/createDiagramEditor.d.ts +4 -1
  31. package/dist/esm/types/api/types.d.ts +43 -1
  32. package/dist/esm/types/displaybox/demos/LinkColorPoolDemoTab.d.ts +3 -0
  33. package/dist/esm/types/displaybox/demos/OffsetAnchorAvoidanceDemoTab.d.ts +3 -0
  34. package/dist/esm/types/displaybox/demos/SimpleDemo.d.ts +4 -1
  35. package/dist/esm/types/displaybox/demos/ZoomToFitElementsDemoTab.d.ts +3 -0
  36. package/dist/esm/types/displaybox/demos/linkColorPoolDemo.d.ts +2 -0
  37. package/dist/esm/types/displaybox/demos/offsetAnchorAvoidanceDemo.d.ts +4 -0
  38. package/dist/esm/types/displaybox/demos/textDemo.d.ts +3 -0
  39. package/dist/esm/types/displaybox/demos/zoomToFitElementsDemo.d.ts +4 -0
  40. package/dist/esm/types/displaybox/types.d.ts +3 -1
  41. package/dist/esm/types/displaybox/useDemoEditor.d.ts +4 -2
  42. package/dist/esm/types/engine/AutoLayoutService.d.ts +59 -2
  43. package/dist/esm/types/engine/DiagramEngine.d.ts +20 -1
  44. package/dist/esm/types/engine/LinkRoutingService.d.ts +9 -0
  45. package/dist/esm/types/models/TextModel.d.ts +1 -0
  46. package/dist/esm/types/renderer/konva/KonvaInteraction.d.ts +6 -0
  47. package/dist/esm/types/strategies/ObstacleRouter.d.ts +2 -0
  48. package/dist/esm/types/strategies/RouterStrategy.d.ts +10 -0
  49. package/dist/examples.d.ts +56 -1
  50. package/dist/index.d.ts +60 -2
  51. package/docs/API_CONTRACT.md +73 -3
  52. package/docs/CAPABILITIES.md +8 -0
  53. package/docs/COMMANDS_EVENTS.md +8 -0
  54. package/docs/DOCUMENTATION_WORKFLOW.md +4 -1
  55. package/docs/INTEGRATION_PLAYBOOK.md +3 -0
  56. package/docs/STATE_INVARIANTS.md +4 -0
  57. package/package.json +1 -1
  58. package/src/displaybox/demos/AutoLayoutDemoTab.tsx +515 -381
  59. package/src/displaybox/demos/EngineEventsDemoTab.tsx +12 -11
  60. package/src/displaybox/demos/LinkColorPoolDemoTab.tsx +49 -0
  61. package/src/displaybox/demos/ObstacleRoutingDemoTab.tsx +52 -31
  62. package/src/displaybox/demos/OffsetAnchorAvoidanceDemoTab.tsx +30 -0
  63. package/src/displaybox/demos/SimpleDemo.tsx +18 -13
  64. package/src/displaybox/demos/TextLayoutDemoTab.tsx +18 -1
  65. package/src/displaybox/demos/ZoomToFitElementsDemoTab.tsx +29 -0
  66. package/src/displaybox/demos/autoLayoutDemo.ts +62 -26
  67. package/src/displaybox/demos/index.tsx +81 -57
  68. package/src/displaybox/demos/linkColorPoolDemo.ts +122 -0
  69. package/src/displaybox/demos/obstacleRoutingDemo.ts +77 -1
  70. package/src/displaybox/demos/offsetAnchorAvoidanceDemo.ts +211 -0
  71. package/src/displaybox/demos/routingDemo.ts +5 -5
  72. package/src/displaybox/demos/shared.ts +17 -12
  73. package/src/displaybox/demos/textDemo.ts +6 -2
  74. package/src/displaybox/demos/zoomToFitElementsDemo.ts +83 -0
  75. package/src/displaybox/types.ts +10 -8
package/CHANGELOG.md CHANGED
@@ -2,11 +2,52 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.2.6] - 2026-05-14
6
+
7
+ ### Added
8
+ - Editor viewport helper `zoomToFitElements(options?)` with `padding`, `minZoom`, and `maxZoom` fit controls.
9
+ - Grid auto-layout opt-in child width topology editing through `layout.gridChildWidthResizeEnabled`.
10
+ - Dedicated `gridLayoutChanged` host event for resize-driven grid row split/redistribution changes.
11
+ - Per-text interaction policy via `TextData.interaction` with `movable` and `editable` controls for built-in text behavior.
12
+
13
+ ### Changed
14
+ - Grid auto-layout now keeps overflow rows on the established fallback model while deriving row occupancy from flat slot templates.
15
+ - Partial grid rows keep proportional occupied width when children are added, and direct child move/resize relayout now preserves parent width unless topology actually changes.
16
+ - Resize-handle interaction now applies bounds changes directly without routing through move semantics.
17
+ - Auto routing now preserves endpoint-host interior avoidance for offset attach anchors by treating projected border-equivalent endpoints like boundary endpoints.
18
+ - Built-in text drag and built-in double-click/tap editing now respect per-text interaction policy while leaving programmatic `moveTextTo(...)` and `updateText(...)` unchanged.
19
+
20
+ ### Fixed
21
+ - Prevented dramatic grid parent width growth when adding children into partially occupied derived rows.
22
+ - Prevented resize gestures that update top-left position from emitting move-specific behavior/events.
23
+
24
+ ### Docs
25
+ - Updated `README.md` release highlights for `v0.2.6`.
26
+ - Updated public API and machine-readable contract docs for `zoomToFitElements`, `ViewportFitOptions`, grid child width resize policy, `gridLayoutChanged`, and per-text interaction policy.
27
+
28
+ ## [0.2.5] - 2026-05-10
29
+
30
+ ### Added
31
+ - Auto-layout `grid` mode with template rows/columns (`gridTemplate`) and weighted track sizing support.
32
+ - Auto-layout parent resize policy (`autoResize`) with `grow` and `grow-shrink` modes.
33
+ - Explicit auto-layout child size aliases (`childMinWidth`, `childMaxWidth`, `childMinHeight`, `childMaxHeight`).
34
+ - Grid auto-layout child resize behavior that locks horizontal child resizing while preserving vertical child resizing and parent resize responsiveness.
35
+ - Direct resize handling for non-manual layout parents that preserves explicit resized parent bounds for the resize cycle before child reflow.
36
+ - Optional redraw-time link route refresh policy (`linkRouteRefreshPolicy`) for two-endpoint-change checks.
37
+ - Cross-parent first common-ancestor corridor preference for auto-routed links across parent branches.
38
+ - Optional random link color assignment policy (`linkColorPoolPolicy`) with built-in default 20-color pool.
39
+
40
+ ### Fixed
41
+ - Stabilized `element-hover` nested hover-control ownership near child boundaries to prevent child/parent control flicker.
42
+
43
+ ### Docs
44
+ - Updated `README.md` release highlights for `v0.2.5`.
45
+ - Updated public API and machine-readable contract docs for new `v0.2.5` config and layout options.
46
+
5
47
  ## [0.2.4] - 2026-05-06
6
48
 
7
49
  ### Added
8
50
  - Directional parent-child attach mode support for hierarchy-aware linking flows.
9
- - Port position-limit normalization coverage in DisplayBox demos for add/load/move entry points.
10
51
 
11
52
  ### Changed
12
53
  - Unified child-port movement restrictions across all engine entry points (move, add, load, link-session creation, resize reprojection).
@@ -30,7 +71,6 @@ All notable changes to this project are documented in this file.
30
71
 
31
72
  ### Changed
32
73
  - Asymmetric SVG-path multi-anchor transform/orientation behavior for deterministic border-side placement.
33
- - DisplayBox demo coverage consolidated for auto-layout and vertex-control scenarios.
34
74
  - Vertex-control session logs in demo flows improved for collapse/scroll stability.
35
75
 
36
76
  ### Fixed
@@ -50,7 +90,6 @@ All notable changes to this project are documented in this file.
50
90
  - Discrete port anchor constraints with anchor-based movement support.
51
91
  - Shape hover controls for edge and vertex targets with configurable trigger modes.
52
92
  - Ellipse midpoint control enumeration support.
53
- - DisplayBox demos for discrete anchors, hover controls, and ellipse midpoints.
54
93
 
55
94
  ### Changed
56
95
  - Refactored built-in shape behavior to class-based implementations.
@@ -66,4 +105,3 @@ All notable changes to this project are documented in this file.
66
105
  - Improved shape-aware endpoint edge detection for link routing.
67
106
 
68
107
  ### Docs
69
- - Refreshed DisplayBox verification coverage for shape class and rotation behavior.
package/README.md CHANGED
@@ -30,38 +30,21 @@ editor.addElement({
30
30
  });
31
31
  ```
32
32
 
33
- ## Release Highlights (v0.2.4)
34
-
35
- - Includes all completed `v0.2.1`, `v0.2.2`, and `v0.2.3` work, plus `v0.2.4` updates.
36
- - `v0.2.4` port-constraint and movement consistency updates:
37
- - unified child-port restriction enforcement across move/add/load/link-session/resize entry points
38
- - deterministic border-host constraint resolution when `positionLimits` are also active
39
- - default invalid child-port positions now normalize consistently in add and load flows
40
- - `v0.2.4` routing and hierarchy updates:
41
- - directional parent-child attach mode support
42
- - sibling external and parent-child stub routing rule refinements
43
- - manual link points now translate with subtree moves
44
- - `v0.2.4` demo coverage updates:
45
- - expanded port-position limits scenarios including border + limits and default-position normalization
46
- - refreshed parent/child internal-external anchor coverage
47
- - corrected nested multi-anchor routing demonstration stability
48
- - Shape system upgrade:
49
- - class-based built-in shape behaviors
50
- - runtime removal of `boundaryKind` branching
51
- - additive rotation (`baseRotation` + instance rotation style)
52
- - Port movement enhancements:
53
- - shape-aware border projection
54
- - optional anchor-constrained movement (`portMovement.moveMode = 'anchors'`)
55
- - orientation support with host-border normals and resize reprojection
56
- - Shape hover controls:
57
- - generic control definitions with `targetKind` (`edge`, `vertex`, `midpoint`, `ellipse-midpoint`)
58
- - trigger modes (`element-hover`, `target-hover`)
59
- - interaction callbacks for click and drag lifecycle
60
- - Text layout improvements:
61
- - owner/fixed bounds modes, wrap and overflow controls, and layout padding
62
- - `textUpdated` lifecycle event with rendered display content
63
- - Additional lifecycle events:
64
- - `portDeleted`, `linkDeleted`, `textDeleted`
33
+ ## Release Highlights (v0.2.6)
34
+
35
+ - Includes all completed `v0.2.1` through `v0.2.5` work, plus `v0.2.6` updates.
36
+ - `v0.2.6` viewport update:
37
+ - new `editor.zoomToFitElements(options?)` helper for centered fit-to-elements navigation
38
+ - additive `ViewportFitOptions` with `padding`, `minZoom`, and `maxZoom`
39
+ - `v0.2.6` grid auto-layout updates:
40
+ - opt-in grid child width topology editing via `layout.gridChildWidthResizeEnabled`
41
+ - dedicated `gridLayoutChanged` event for resize-driven row split/redistribution
42
+ - proportional partial-row parent sizing on child add, with stable parent width on child move/resize relayout
43
+ - `v0.2.6` routing update:
44
+ - offset external/internal attach anchors now preserve endpoint-host interior avoidance through projected boundary metadata
45
+ - `v0.2.6` interaction update:
46
+ - resize handle drags no longer route through move semantics before resize is applied
47
+ - per-text interaction policy can suppress built-in drag and/or built-in editing with `TextData.interaction`
65
48
 
66
49
  ## API Docs
67
50
 
@@ -29,7 +29,9 @@
29
29
  "onElementShapeHoverControlInteraction": "(event: ElementShapeHoverControlInteractionEvent) => void",
30
30
  "onElementShapeHoverControlActivated": "(event: ElementShapeHoverControlActivationEvent) => void",
31
31
  "onChange": "(event: EngineChangeEvent) => void",
32
- "onSelection": "(event: EngineSelectionEvent) => void"
32
+ "onSelection": "(event: EngineSelectionEvent) => void",
33
+ "linkRouteRefreshPolicy": "LinkRouteRefreshPolicy",
34
+ "linkColorPoolPolicy": "LinkColorPoolPolicy"
33
35
  },
34
36
  "defaults": {
35
37
  "width": 900,
@@ -46,7 +48,9 @@
46
48
  "router": "RouterStrategy",
47
49
  "snapper": "SnapStrategy",
48
50
  "shapeRegistry": "ShapeRegistry",
49
- "textMeasurer": "TextMeasurer"
51
+ "textMeasurer": "TextMeasurer",
52
+ "linkRouteRefreshPolicy": "LinkRouteRefreshPolicy",
53
+ "linkColorPoolPolicy": "LinkColorPoolPolicy"
50
54
  },
51
55
  "defaults": {
52
56
  "scheduler": "RenderScheduler",
@@ -103,6 +107,11 @@
103
107
  "moveMode",
104
108
  "anchorCenter",
105
109
  "orientToHostBorder",
110
+ "placementPoint",
111
+ "linkAttachPoint",
112
+ "externalLinkAttachPoint",
113
+ "internalLinkAttachPoint",
114
+ "rotationPivot",
106
115
  "currentAnchorId"
107
116
  ],
108
117
  "defaults": {
@@ -139,6 +148,7 @@
139
148
  "style",
140
149
  "ownerId",
141
150
  "layout",
151
+ "interaction",
142
152
  "displayContent",
143
153
  "displayOffset",
144
154
  "displayClipSize"
@@ -151,12 +161,33 @@
151
161
  "padding": 12,
152
162
  "gap": 12,
153
163
  "align": "center"
164
+ },
165
+ "elementLayout": {
166
+ "mode": "'manual' | 'horizontal' | 'vertical' | 'grid'",
167
+ "optional": [
168
+ "padding",
169
+ "gap",
170
+ "align",
171
+ "autoResize",
172
+ "gridTemplate",
173
+ "gridChildWidthResizeEnabled",
174
+ "childFitMainAxis",
175
+ "childFitCrossAxis",
176
+ "childMinWidth",
177
+ "childMaxWidth",
178
+ "childMinHeight",
179
+ "childMaxHeight",
180
+ "childFitMinSize",
181
+ "childFitMaxSize",
182
+ "labelReservedSpace"
183
+ ]
154
184
  }
155
185
  },
156
186
  "additionalContracts": {
157
187
  "portMovementPolicy": {
158
188
  "moveMode": "'free' | 'inside' | 'border' | 'anchors'",
159
- "anchorConstraint": "PortAnchorConstraint"
189
+ "anchorConstraint": "PortAnchorConstraint",
190
+ "positionLimits": "PortPositionLimits"
160
191
  },
161
192
  "portAnchorConstraint": {
162
193
  "preset": "'vertices' | 'cardinal'",
@@ -170,6 +201,14 @@
170
201
  "maxLines": "number",
171
202
  "fixedSize": "Size"
172
203
  },
204
+ "textInteractionPolicy": {
205
+ "movable": "boolean",
206
+ "editable": "boolean",
207
+ "defaults": {
208
+ "movable": true,
209
+ "editable": true
210
+ }
211
+ },
173
212
  "shapeHoverControls": {
174
213
  "targetKinds": [
175
214
  "vertex",
@@ -187,6 +226,44 @@
187
226
  "drag-move",
188
227
  "drag-end"
189
228
  ]
229
+ },
230
+ "linkRouteRefreshPolicy": {
231
+ "mode": "'mutation-only' | 'redraw-two-endpoint-change'",
232
+ "includeManual": "boolean"
233
+ },
234
+ "linkColorPoolPolicy": {
235
+ "enabled": "boolean",
236
+ "colors": "string[]",
237
+ "defaultPoolSize": 20
238
+ },
239
+ "viewportFitOptions": {
240
+ "padding": "number",
241
+ "minZoom": "number",
242
+ "maxZoom": "number",
243
+ "defaults": {
244
+ "padding": 24,
245
+ "minZoom": 0.2,
246
+ "maxZoom": 3
247
+ }
248
+ },
249
+ "gridLayoutChangedEvent": {
250
+ "parentId": "string",
251
+ "triggerChildId": "string",
252
+ "reason": "'child-resize-split' | 'child-resize-redistribute'",
253
+ "beforeRows": "{ childIds: string[] }[]",
254
+ "afterRows": "{ childIds: string[] }[]",
255
+ "beforeGridTemplate": "number[]",
256
+ "afterGridTemplate": "number[]"
257
+ },
258
+ "diagramImageExportOptions": {
259
+ "mimeType": "string",
260
+ "quality": "number",
261
+ "pixelRatio": "number",
262
+ "x": "number",
263
+ "y": "number",
264
+ "width": "number",
265
+ "height": "number",
266
+ "fitToContent": "boolean | { padding?: number }"
190
267
  }
191
268
  },
192
269
  "handleMethods": {
@@ -223,6 +300,13 @@
223
300
  "render"
224
301
  ],
225
302
  "editorOnly": [
303
+ "startLinkFromPort",
304
+ "updateLinkPreview",
305
+ "completeLinkToPort",
306
+ "completeLinkToElement",
307
+ "cancelLink",
308
+ "zoomToFitElements",
309
+ "exportImage",
226
310
  "resize",
227
311
  "setElementShapeHoverControls",
228
312
  "destroy"
@@ -243,6 +327,7 @@
243
327
  "elementDragged": "ElementDropEvent",
244
328
  "elementMoved": "ElementMovedEvent",
245
329
  "elementResized": "ElementResizedEvent",
330
+ "gridLayoutChanged": "GridLayoutChangedEvent",
246
331
  "elementDeleted": "ElementDeletedEvent",
247
332
  "portDeleted": "PortDeletedEvent",
248
333
  "linkDeleted": "LinkDeletedEvent",
package/ai/manifest.json CHANGED
@@ -30,5 +30,5 @@
30
30
  "analysis/White paper/Overview.md",
31
31
  "analysis/White paper/Requirements-Functional.md"
32
32
  ],
33
- "updatedAt": "2026-04-25"
33
+ "updatedAt": "2026-05-14"
34
34
  }