orcasvn-react-diagrams 0.2.10 → 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 (49) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +11 -8
  3. package/ai/api-contract.json +44 -1
  4. package/ai/manifest.json +1 -1
  5. package/dist/cjs/examples.js +621 -349
  6. package/dist/cjs/index.js +222 -74
  7. package/dist/cjs/types/api/createDiagramEditor.d.ts +2 -1
  8. package/dist/cjs/types/api/types.d.ts +15 -0
  9. package/dist/cjs/types/displaybox/demos/LinkPortCreationDemoTab.d.ts +3 -0
  10. package/dist/cjs/types/displaybox/demos/linkColorPoolDemo.d.ts +2 -0
  11. package/dist/cjs/types/displaybox/demos/linkLabelsDemo.d.ts +4 -0
  12. package/dist/cjs/types/displaybox/types.d.ts +3 -0
  13. package/dist/cjs/types/displaybox/useDemoEditor.d.ts +3 -2
  14. package/dist/cjs/types/engine/DiagramEngine.d.ts +5 -1
  15. package/dist/cjs/types/engine/TextLayoutService.d.ts +1 -0
  16. package/dist/cjs/types/examples/index.d.ts +1 -1
  17. package/dist/cjs/types/renderer/konva/KonvaInteraction.d.ts +10 -1
  18. package/dist/esm/examples.js +621 -349
  19. package/dist/esm/examples.js.map +1 -1
  20. package/dist/esm/index.js +222 -74
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/types/api/createDiagramEditor.d.ts +2 -1
  23. package/dist/esm/types/api/types.d.ts +15 -0
  24. package/dist/esm/types/displaybox/demos/LinkPortCreationDemoTab.d.ts +3 -0
  25. package/dist/esm/types/displaybox/demos/linkColorPoolDemo.d.ts +2 -0
  26. package/dist/esm/types/displaybox/demos/linkLabelsDemo.d.ts +4 -0
  27. package/dist/esm/types/displaybox/types.d.ts +3 -0
  28. package/dist/esm/types/displaybox/useDemoEditor.d.ts +3 -2
  29. package/dist/esm/types/engine/DiagramEngine.d.ts +5 -1
  30. package/dist/esm/types/engine/TextLayoutService.d.ts +1 -0
  31. package/dist/esm/types/examples/index.d.ts +1 -1
  32. package/dist/esm/types/renderer/konva/KonvaInteraction.d.ts +10 -1
  33. package/dist/examples.d.ts +5 -1
  34. package/dist/index.d.ts +17 -1
  35. package/docs/API_CONTRACT.md +44 -1
  36. package/docs/CAPABILITIES.md +3 -1
  37. package/docs/COMMANDS_EVENTS.md +1 -0
  38. package/docs/DOCUMENTATION_WORKFLOW.md +5 -1
  39. package/docs/INTEGRATION_PLAYBOOK.md +5 -0
  40. package/docs/STATE_INVARIANTS.md +3 -0
  41. package/package.json +1 -1
  42. package/src/displaybox/demos/LinkColorPoolDemoTab.tsx +10 -5
  43. package/src/displaybox/demos/LinkPortCreationDemoTab.tsx +98 -0
  44. package/src/displaybox/demos/index.tsx +122 -221
  45. package/src/displaybox/demos/linkColorPoolDemo.ts +84 -49
  46. package/src/displaybox/demos/linkLabelsDemo.ts +164 -0
  47. package/src/displaybox/demos/linkPortCreationDemo.ts +7 -7
  48. package/src/displaybox/types.ts +21 -11
  49. package/src/examples/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
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
+
18
+ ## [0.2.11] - 2026-06-20
19
+
20
+ ### Added
21
+ - `LinkColorPoolPolicy.assignOnLoadWhenMissingStroke` for opt-in load-time random `style.stroke` assignment on links that load without a usable stroke value.
22
+
23
+ ### Changed
24
+ - Load-time link color fill now preserves explicit loaded `style.stroke` values, treats missing/`null`/blank strokes as fill candidates, and uses the active custom-or-default color pool only when the policy is enabled.
25
+
26
+ ### Docs
27
+ - Updated release highlights, public API/docs contract text, integration guidance, and machine-readable contract metadata for `v0.2.11`.
28
+
5
29
  ## [0.2.10] - 2026-05-27
6
30
 
7
31
  ### Changed
package/README.md CHANGED
@@ -30,14 +30,17 @@ editor.addElement({
30
30
  });
31
31
  ```
32
32
 
33
- ## Release Highlights (v0.2.10)
34
-
35
- - Includes all completed `v0.2.1` through `v0.2.9` work, plus `v0.2.10` updates.
36
- - `v0.2.10` element visibility/selectability policy:
37
- - `ElementData.visible = false` keeps the element in state while removing its own body from built-in render, hit testing, selection, and fit/export bounds
38
- - visible descendant elements under a hidden parent remain rendered and interactive if their own `visible` flag stays enabled
39
- - direct-owned parent ports/texts still follow the hidden parent, and links remain visible when their endpoint ports are visible
40
- - `ElementData.selectable = false` keeps the element visible while preventing built-in element-body click/marquee/programmatic selection from retaining that element id
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
41
44
 
42
45
  ## API Docs
43
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",
@@ -259,8 +272,38 @@
259
272
  "linkColorPoolPolicy": {
260
273
  "enabled": "boolean",
261
274
  "colors": "string[]",
275
+ "assignOnLoadWhenMissingStroke": "boolean",
262
276
  "defaultPoolSize": 20
263
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
+ },
264
307
  "viewportFitOptions": {
265
308
  "padding": "number",
266
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-05-27"
33
+ "updatedAt": "2026-06-26"
34
34
  }