orcasvn-react-diagrams 0.2.11 → 0.2.12

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +11 -7
  3. package/ai/api-contract.json +43 -1
  4. package/ai/manifest.json +1 -1
  5. package/dist/cjs/examples.js +492 -286
  6. package/dist/cjs/index.js +180 -61
  7. package/dist/cjs/types/api/createDiagramEditor.d.ts +2 -1
  8. package/dist/cjs/types/api/types.d.ts +14 -0
  9. package/dist/cjs/types/displaybox/demos/LinkPortCreationDemoTab.d.ts +3 -0
  10. package/dist/cjs/types/displaybox/demos/linkLabelsDemo.d.ts +4 -0
  11. package/dist/cjs/types/displaybox/types.d.ts +3 -0
  12. package/dist/cjs/types/displaybox/useDemoEditor.d.ts +3 -2
  13. package/dist/cjs/types/engine/DiagramEngine.d.ts +2 -1
  14. package/dist/cjs/types/engine/TextLayoutService.d.ts +1 -0
  15. package/dist/cjs/types/examples/index.d.ts +1 -1
  16. package/dist/cjs/types/renderer/konva/KonvaInteraction.d.ts +10 -1
  17. package/dist/esm/examples.js +492 -286
  18. package/dist/esm/examples.js.map +1 -1
  19. package/dist/esm/index.js +180 -61
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/types/api/createDiagramEditor.d.ts +2 -1
  22. package/dist/esm/types/api/types.d.ts +14 -0
  23. package/dist/esm/types/displaybox/demos/LinkPortCreationDemoTab.d.ts +3 -0
  24. package/dist/esm/types/displaybox/demos/linkLabelsDemo.d.ts +4 -0
  25. package/dist/esm/types/displaybox/types.d.ts +3 -0
  26. package/dist/esm/types/displaybox/useDemoEditor.d.ts +3 -2
  27. package/dist/esm/types/engine/DiagramEngine.d.ts +2 -1
  28. package/dist/esm/types/engine/TextLayoutService.d.ts +1 -0
  29. package/dist/esm/types/examples/index.d.ts +1 -1
  30. package/dist/esm/types/renderer/konva/KonvaInteraction.d.ts +10 -1
  31. package/dist/examples.d.ts +4 -1
  32. package/dist/index.d.ts +16 -1
  33. package/docs/API_CONTRACT.md +40 -0
  34. package/docs/CAPABILITIES.md +2 -0
  35. package/docs/COMMANDS_EVENTS.md +1 -0
  36. package/docs/DOCUMENTATION_WORKFLOW.md +3 -1
  37. package/docs/INTEGRATION_PLAYBOOK.md +4 -0
  38. package/docs/STATE_INVARIANTS.md +3 -0
  39. package/package.json +1 -1
  40. package/src/displaybox/demos/LinkPortCreationDemoTab.tsx +98 -0
  41. package/src/displaybox/demos/index.tsx +122 -221
  42. package/src/displaybox/demos/linkLabelsDemo.ts +164 -0
  43. package/src/displaybox/demos/linkPortCreationDemo.ts +7 -7
  44. package/src/displaybox/types.ts +21 -11
  45. package/src/examples/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.2.12] - 2026-06-26
6
+
7
+ ### Added
8
+ - Optional `onCreateLinkTargetPort(context)` editor config callback for customizing the auto-created destination port when a link completes onto an element body.
9
+ - Supported link labels through ordinary link-owned `TextData` (`ownerId = link.id`) without introducing a separate `LinkData.label` field.
10
+
11
+ ### Changed
12
+ - Link-to-element placeholder preview, pointer-drop commit, and programmatic `completeLinkToElement(...)` now share the same target-port draft resolution and normalization flow before `elementLinkConnecting` runs.
13
+ - Link-owned text now behaves as an explicit public label contract: midpoint-relative positioning is preserved across drag, reroute, export-fit bounds, and link-removal cascade deletion.
14
+
15
+ ### Docs
16
+ - Updated release highlights, API/integration docs, state invariants, and machine-readable contract metadata for `v0.2.12`.
17
+
5
18
  ## [0.2.11] - 2026-06-20
6
19
 
7
20
  ### Added
package/README.md CHANGED
@@ -30,13 +30,17 @@ editor.addElement({
30
30
  });
31
31
  ```
32
32
 
33
- ## Release Highlights (v0.2.11)
34
-
35
- - Includes all completed `v0.2.1` through `v0.2.10` work, plus `v0.2.11` updates.
36
- - `v0.2.11` link color pool load-time fill:
37
- - `linkColorPoolPolicy.assignOnLoadWhenMissingStroke = true` backfills loaded links whose `style.stroke` is missing, `null`, or blank after trimming
38
- - explicit non-empty loaded `style.stroke` values are preserved exactly as loaded
39
- - the fill uses normalized custom `colors` when provided, otherwise the built-in 20-color pool
33
+ ## Release Highlights (v0.2.12)
34
+
35
+ - Includes all completed `v0.2.1` through `v0.2.11` work, plus `v0.2.12` updates.
36
+ - `v0.2.12` link labels via owned text:
37
+ - create a link label with `addText({ ..., ownerId: linkId })`
38
+ - link-owned text is stored midpoint-relative, so labels stay attached when the link reroutes or endpoints move
39
+ - no separate `LinkData.label` or `LinkData.labels` field is required
40
+ - `v0.2.12` link-created target port customization:
41
+ - `createDiagramEditor({ onCreateLinkTargetPort })` lets hosts shape auto-created destination ports for link-to-element completion
42
+ - the callback runs for both pointer drag and programmatic `completeLinkToElement(...)`, in `preview` and `commit` phases
43
+ - `elementLinkConnecting` remains the cancellation surface; the callback customizes the target-port draft only
40
44
 
41
45
  ## API Docs
42
46
 
@@ -28,6 +28,7 @@
28
28
  "elementShapeHoverControls": "ElementShapeHoverControls",
29
29
  "onElementShapeHoverControlInteraction": "(event: ElementShapeHoverControlInteractionEvent) => void",
30
30
  "onElementShapeHoverControlActivated": "(event: ElementShapeHoverControlActivationEvent) => void",
31
+ "onCreateLinkTargetPort": "(context: LinkTargetPortCreationContext) => Partial<LinkTargetPortDraft> | void",
31
32
  "onChange": "(event: EngineChangeEvent) => void",
32
33
  "onSelection": "(event: EngineSelectionEvent) => void",
33
34
  "linkRouteRefreshPolicy": "LinkRouteRefreshPolicy",
@@ -138,6 +139,11 @@
138
139
  "defaults": {
139
140
  "routing": "auto",
140
141
  "textIds": []
142
+ },
143
+ "ownershipSemantics": {
144
+ "linkLabels": "Represent link labels as TextData with ownerId = link.id",
145
+ "linkTextIds": "LinkData.textIds is the owner-side index only",
146
+ "dedicatedLabelField": "No LinkData.label or LinkData.labels field"
141
147
  }
142
148
  },
143
149
  "textData": {
@@ -158,6 +164,12 @@
158
164
  ],
159
165
  "defaults": {
160
166
  "ownerId": null
167
+ },
168
+ "ownershipSemantics": {
169
+ "elementOwnedPosition": "owner-relative local position",
170
+ "portOwnedPosition": "owner-relative local position",
171
+ "linkOwnedPosition": "local offset from the owning link midpoint",
172
+ "missingOwner": "falls back to standalone world-position text"
161
173
  }
162
174
  },
163
175
  "elementLayoutDefaults": {
@@ -202,7 +214,8 @@
202
214
  "overflow": "'clip' | 'ellipsis-end' | 'ellipsis-middle' | 'ellipsis-start'",
203
215
  "padding": "number",
204
216
  "maxLines": "number",
205
- "fixedSize": "Size"
217
+ "fixedSize": "Size",
218
+ "linkOwnedDefault": "link-owned text does not implicitly default to owner-width or owner-box bounds"
206
219
  },
207
220
  "textInteractionPolicy": {
208
221
  "movable": "boolean",
@@ -262,6 +275,35 @@
262
275
  "assignOnLoadWhenMissingStroke": "boolean",
263
276
  "defaultPoolSize": 20
264
277
  },
278
+ "linkTargetPortCreation": {
279
+ "phase": "'preview' | 'commit'",
280
+ "draft": "Omit<PortData, 'id' | 'elementId'>",
281
+ "context": {
282
+ "phase": "LinkTargetPortCreationPhase",
283
+ "pointer": "Point",
284
+ "sourcePortId": "string",
285
+ "sourceElementId": "string",
286
+ "targetElementId": "string",
287
+ "sourcePort": "PortData",
288
+ "targetElement": "ElementData",
289
+ "defaultPort": "LinkTargetPortDraft"
290
+ },
291
+ "result": "Partial<LinkTargetPortDraft> | void",
292
+ "behavior": [
293
+ "runs only for link-to-element completion, not port-to-port linking or direct addPortToElement",
294
+ "preview and commit both invoke the callback before final target-port normalization against the target element",
295
+ "elementLinkConnecting remains the only cancellation surface"
296
+ ]
297
+ },
298
+ "linkLabelOwnership": {
299
+ "creation": "Create a link label with addText({ ownerId: linkId, ... })",
300
+ "storage": "Persist TextData.position as midpoint-relative local offset for link-owned text",
301
+ "rerouteBehavior": "Keep the stored local offset and recompute world position from the latest link midpoint",
302
+ "events": [
303
+ "textUpdated",
304
+ "textDeleted"
305
+ ]
306
+ },
265
307
  "viewportFitOptions": {
266
308
  "padding": "number",
267
309
  "minZoom": "number",
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-06-20"
33
+ "updatedAt": "2026-06-26"
34
34
  }