orcasvn-react-diagrams 0.2.2 → 0.2.3

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 (73) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +11 -3
  3. package/dist/cjs/examples.js +1768 -161
  4. package/dist/cjs/index.js +786 -120
  5. package/dist/cjs/types/api/createDiagramEditor.d.ts +19 -1
  6. package/dist/cjs/types/api/index.d.ts +1 -1
  7. package/dist/cjs/types/api/types.d.ts +32 -0
  8. package/dist/cjs/types/displaybox/DisplayBoxControls.d.ts +5 -1
  9. package/dist/cjs/types/displaybox/demos/AsymmetricPortMultiAnchorDemoTab.d.ts +3 -0
  10. package/dist/cjs/types/displaybox/demos/LayoutLabelReservedSpaceDemoTab.d.ts +3 -0
  11. package/dist/cjs/types/displaybox/demos/VertexControlLinkSessionDemoTab.d.ts +3 -0
  12. package/dist/cjs/types/displaybox/demos/asymmetricPortMultiAnchorDemo.d.ts +31 -0
  13. package/dist/cjs/types/displaybox/demos/layoutLabelReservedSpaceDemo.d.ts +11 -0
  14. package/dist/cjs/types/displaybox/demos/vertexControlLinkSessionDemo.d.ts +12 -0
  15. package/dist/cjs/types/displaybox/useDemoControls.d.ts +4 -0
  16. package/dist/cjs/types/engine/AutoLayoutService.d.ts +2 -0
  17. package/dist/cjs/types/engine/DiagramEngine.d.ts +5 -0
  18. package/dist/cjs/types/engine/LinkRoutingService.d.ts +9 -1
  19. package/dist/cjs/types/models/PortModel.d.ts +5 -0
  20. package/dist/cjs/types/renderer/RenderTypes.d.ts +3 -1
  21. package/dist/cjs/types/renderer/konva/KonvaInteraction.d.ts +14 -0
  22. package/dist/cjs/types/renderer/konva/KonvaNodeFactory.d.ts +1 -0
  23. package/dist/cjs/types/renderer/konva/KonvaRenderer.d.ts +0 -1
  24. package/dist/cjs/types/shapes/BuiltInShapes.d.ts +3 -1
  25. package/dist/cjs/types/utils/__tests__/portGeometry.test.d.ts +1 -0
  26. package/dist/cjs/types/utils/portGeometry.d.ts +44 -0
  27. package/dist/esm/examples.js +1769 -162
  28. package/dist/esm/examples.js.map +1 -1
  29. package/dist/esm/index.js +786 -120
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/types/api/createDiagramEditor.d.ts +19 -1
  32. package/dist/esm/types/api/index.d.ts +1 -1
  33. package/dist/esm/types/api/types.d.ts +32 -0
  34. package/dist/esm/types/displaybox/DisplayBoxControls.d.ts +5 -1
  35. package/dist/esm/types/displaybox/demos/AsymmetricPortMultiAnchorDemoTab.d.ts +3 -0
  36. package/dist/esm/types/displaybox/demos/LayoutLabelReservedSpaceDemoTab.d.ts +3 -0
  37. package/dist/esm/types/displaybox/demos/VertexControlLinkSessionDemoTab.d.ts +3 -0
  38. package/dist/esm/types/displaybox/demos/asymmetricPortMultiAnchorDemo.d.ts +31 -0
  39. package/dist/esm/types/displaybox/demos/layoutLabelReservedSpaceDemo.d.ts +11 -0
  40. package/dist/esm/types/displaybox/demos/vertexControlLinkSessionDemo.d.ts +12 -0
  41. package/dist/esm/types/displaybox/useDemoControls.d.ts +4 -0
  42. package/dist/esm/types/engine/AutoLayoutService.d.ts +2 -0
  43. package/dist/esm/types/engine/DiagramEngine.d.ts +5 -0
  44. package/dist/esm/types/engine/LinkRoutingService.d.ts +9 -1
  45. package/dist/esm/types/models/PortModel.d.ts +5 -0
  46. package/dist/esm/types/renderer/RenderTypes.d.ts +3 -1
  47. package/dist/esm/types/renderer/konva/KonvaInteraction.d.ts +14 -0
  48. package/dist/esm/types/renderer/konva/KonvaNodeFactory.d.ts +1 -0
  49. package/dist/esm/types/renderer/konva/KonvaRenderer.d.ts +0 -1
  50. package/dist/esm/types/shapes/BuiltInShapes.d.ts +3 -1
  51. package/dist/esm/types/utils/__tests__/portGeometry.test.d.ts +1 -0
  52. package/dist/esm/types/utils/portGeometry.d.ts +44 -0
  53. package/dist/examples.d.ts +50 -0
  54. package/dist/index.d.ts +58 -1
  55. package/package.json +11 -10
  56. package/src/displaybox/demos/AsymmetricPortMultiAnchorDemoTab.tsx +269 -0
  57. package/src/displaybox/demos/AutoLayoutDemoTab.tsx +113 -11
  58. package/src/displaybox/demos/DeletionEventsDemoTab.tsx +6 -1
  59. package/src/displaybox/demos/EngineEventsDemoTab.tsx +5 -0
  60. package/src/displaybox/demos/EventHandlersDemoTab.tsx +5 -0
  61. package/src/displaybox/demos/ExternalDragDropDemoTab.tsx +5 -0
  62. package/src/displaybox/demos/LayoutLabelReservedSpaceDemoTab.tsx +291 -0
  63. package/src/displaybox/demos/LinkCancelDemoTab.tsx +5 -0
  64. package/src/displaybox/demos/ShapeHoverControlsDemoTab.tsx +6 -1
  65. package/src/displaybox/demos/SimpleDemo.tsx +5 -0
  66. package/src/displaybox/demos/SvgPathDemoTab.tsx +5 -0
  67. package/src/displaybox/demos/TextLayoutDemoTab.tsx +6 -1
  68. package/src/displaybox/demos/VertexControlLinkSessionDemoTab.tsx +302 -0
  69. package/src/displaybox/demos/asymmetricPortMultiAnchorDemo.ts +357 -0
  70. package/src/displaybox/demos/autoLayoutDemo.ts +23 -5
  71. package/src/displaybox/demos/index.tsx +91 -75
  72. package/src/displaybox/demos/layoutLabelReservedSpaceDemo.ts +121 -0
  73. package/src/displaybox/demos/vertexControlLinkSessionDemo.ts +145 -0
@@ -74,18 +74,36 @@ const createAutoLayoutState = (): DiagramState => ({
74
74
  ports: [],
75
75
  links: [],
76
76
  texts: [
77
- { id: 'label-layout-row', content: 'Row parent', position: { x: 8, y: -18 }, ownerId: 'layout-row' },
77
+ {
78
+ id: 'label-layout-row',
79
+ content: 'Row parent label lane',
80
+ position: { x: 8, y: 6 },
81
+ ownerId: 'layout-row',
82
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
83
+ },
78
84
  { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
79
85
  { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
80
86
  { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
81
87
  { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
82
88
 
83
- { id: 'label-layout-column', content: 'Column parent', position: { x: 8, y: -18 }, ownerId: 'layout-column' },
89
+ {
90
+ id: 'label-layout-column',
91
+ content: 'Column parent label lane',
92
+ position: { x: 8, y: 6 },
93
+ ownerId: 'layout-column',
94
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
95
+ },
84
96
  { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
85
97
  { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
86
98
  { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
87
99
 
88
- { id: 'label-layout-nested', content: 'Row + nested column', position: { x: 6, y: -18 }, ownerId: 'layout-nested' },
100
+ {
101
+ id: 'label-layout-nested',
102
+ content: 'Row + nested column lane',
103
+ position: { x: 6, y: 6 },
104
+ ownerId: 'layout-nested',
105
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
106
+ },
89
107
  { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
90
108
  { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
91
109
  { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
@@ -100,8 +118,8 @@ const createAutoLayoutState = (): DiagramState => ({
100
118
 
101
119
  export const autoLayoutDemoConfig: DemoConfig = ({
102
120
  id: 'auto-layout',
103
- title: 'Element Auto-Layout',
104
- description: 'Arrange children with padding/alignment plus fit options (main-axis distribute, cross-axis stretch).',
121
+ title: 'Element Auto-Layout + Label Lane',
122
+ description: 'Consolidated auto-layout verification with baseline/nested containers, fit options, and label reserved-space modes.',
105
123
  createState: createAutoLayoutState,
106
124
  elementShapes: baseElementShapes,
107
125
  portShapes: basePortShapes,
@@ -8,36 +8,40 @@ import { textDemoConfig } from './textDemo';
8
8
  import { selectionDemoConfig } from './selectionDemo';
9
9
  import { eventHandlersDemoConfig } from './eventHandlersDemo';
10
10
  import { engineEventsDemoConfig } from './engineEventsDemo';
11
- import { linkCancelDemoConfig } from './linkCancelDemo';
12
- import { autoLayoutDemoConfig } from './autoLayoutDemo';
11
+ import { linkCancelDemoConfig } from './linkCancelDemo';
12
+ import { autoLayoutDemoConfig } from './autoLayoutDemo';
13
13
  import { externalDragDropDemoConfig } from './externalDragDropDemo';
14
- import { shapeGalleryDemoConfig } from './shapeGalleryDemo';
15
- import { svgPathDemoConfig } from './svgPathDemo';
16
- import { roundedRectRadiusDemoConfig } from './roundedRectRadiusDemo';
17
- import { rotatedCreationDemoConfig } from './rotatedCreationDemo';
18
- import { multiLevelTreeDemoConfig } from './multiLevelTreeDemo';
14
+ import { shapeGalleryDemoConfig } from './shapeGalleryDemo';
15
+ import { svgPathDemoConfig } from './svgPathDemo';
16
+ import { roundedRectRadiusDemoConfig } from './roundedRectRadiusDemo';
17
+ import { rotatedCreationDemoConfig } from './rotatedCreationDemo';
18
+ import { multiLevelTreeDemoConfig } from './multiLevelTreeDemo';
19
19
  import { multipleElementsDemoConfig } from './multipleElementsDemo';
20
+ import { asymmetricPortMultiAnchorDemoConfig } from './asymmetricPortMultiAnchorDemo';
20
21
  import { portConstraintsDemoConfig } from './portConstraintsDemo';
21
22
  import { portBorderDemoConfig } from './portBorderDemo';
22
23
  import { childConstraintsDemoConfig } from './childConstraintsDemo';
23
24
  import { gridOverlayDemoConfig } from './gridOverlayDemo';
24
25
  import { routingDemoConfig } from './routingDemo';
25
- import { obstacleRoutingDemoConfig } from './obstacleRoutingDemo';
26
- import { linkBendHandlesDemoConfig } from './linkBendHandlesDemo';
27
- import { deletionEventsDemoConfig } from './deletionEventsDemo';
26
+ import { obstacleRoutingDemoConfig } from './obstacleRoutingDemo';
27
+ import { linkBendHandlesDemoConfig } from './linkBendHandlesDemo';
28
+ import { deletionEventsDemoConfig } from './deletionEventsDemo';
28
29
  import { shapeBorderMovementDemoConfig } from './shapeBorderMovementDemo';
29
30
  import { shapeHoverControlsDemoConfig } from './shapeHoverControlsDemo';
30
- import EventHandlersDemo from './EventHandlersDemoTab';
31
- import EngineEventsDemo from './EngineEventsDemoTab';
31
+ import { vertexControlLinkSessionDemoConfig } from './vertexControlLinkSessionDemo';
32
+ import EventHandlersDemo from './EventHandlersDemoTab';
33
+ import EngineEventsDemo from './EngineEventsDemoTab';
32
34
  import LinkCancelDemo from './LinkCancelDemoTab';
33
35
  import AutoLayoutDemo from './AutoLayoutDemoTab';
34
- import ExternalDragDropDemo from './ExternalDragDropDemoTab';
35
- import SvgPathDemo from './SvgPathDemoTab';
36
- import TextLayoutDemo from './TextLayoutDemoTab';
37
- import SimpleDemo from './SimpleDemo';
38
- import ObstacleRoutingDemo from './ObstacleRoutingDemoTab';
39
- import DeletionEventsDemo from './DeletionEventsDemoTab';
36
+ import ExternalDragDropDemo from './ExternalDragDropDemoTab';
37
+ import SvgPathDemo from './SvgPathDemoTab';
38
+ import TextLayoutDemo from './TextLayoutDemoTab';
39
+ import SimpleDemo from './SimpleDemo';
40
+ import ObstacleRoutingDemo from './ObstacleRoutingDemoTab';
41
+ import DeletionEventsDemo from './DeletionEventsDemoTab';
40
42
  import ShapeHoverControlsDemo from './ShapeHoverControlsDemoTab';
43
+ import AsymmetricPortMultiAnchorDemo from './AsymmetricPortMultiAnchorDemoTab';
44
+ import VertexControlLinkSessionDemo from './VertexControlLinkSessionDemoTab';
41
45
 
42
46
  export {
43
47
  baseElementShapes,
@@ -76,12 +80,12 @@ export const demoTabs: DemoDefinition[] = [
76
80
  description: customDemoConfig.description,
77
81
  Component: wrapSimpleDemo(customDemoConfig),
78
82
  },
79
- {
80
- id: textDemoConfig.id,
81
- title: textDemoConfig.title,
82
- description: textDemoConfig.description,
83
- Component: TextLayoutDemo,
84
- },
83
+ {
84
+ id: textDemoConfig.id,
85
+ title: textDemoConfig.title,
86
+ description: textDemoConfig.description,
87
+ Component: TextLayoutDemo,
88
+ },
85
89
  {
86
90
  id: selectionDemoConfig.id,
87
91
  title: selectionDemoConfig.title,
@@ -94,24 +98,24 @@ export const demoTabs: DemoDefinition[] = [
94
98
  description: eventHandlersDemoConfig.description,
95
99
  Component: EventHandlersDemo,
96
100
  },
97
- {
98
- id: engineEventsDemoConfig.id,
99
- title: engineEventsDemoConfig.title,
100
- description: engineEventsDemoConfig.description,
101
- Component: EngineEventsDemo,
102
- },
103
- {
104
- id: deletionEventsDemoConfig.id,
105
- title: deletionEventsDemoConfig.title,
106
- description: deletionEventsDemoConfig.description,
107
- Component: DeletionEventsDemo,
108
- },
109
101
  {
110
- id: autoLayoutDemoConfig.id,
111
- title: autoLayoutDemoConfig.title,
112
- description: autoLayoutDemoConfig.description,
113
- Component: AutoLayoutDemo,
102
+ id: engineEventsDemoConfig.id,
103
+ title: engineEventsDemoConfig.title,
104
+ description: engineEventsDemoConfig.description,
105
+ Component: EngineEventsDemo,
114
106
  },
107
+ {
108
+ id: deletionEventsDemoConfig.id,
109
+ title: deletionEventsDemoConfig.title,
110
+ description: deletionEventsDemoConfig.description,
111
+ Component: DeletionEventsDemo,
112
+ },
113
+ {
114
+ id: autoLayoutDemoConfig.id,
115
+ title: autoLayoutDemoConfig.title,
116
+ description: autoLayoutDemoConfig.description,
117
+ Component: AutoLayoutDemo,
118
+ },
115
119
  {
116
120
  id: linkCancelDemoConfig.id,
117
121
  title: linkCancelDemoConfig.title,
@@ -124,30 +128,36 @@ export const demoTabs: DemoDefinition[] = [
124
128
  description: externalDragDropDemoConfig.description,
125
129
  Component: ExternalDragDropDemo,
126
130
  },
127
- {
128
- id: shapeGalleryDemoConfig.id,
129
- title: shapeGalleryDemoConfig.title,
130
- description: shapeGalleryDemoConfig.description,
131
- Component: wrapSimpleDemo(shapeGalleryDemoConfig),
132
- },
133
- {
134
- id: roundedRectRadiusDemoConfig.id,
135
- title: roundedRectRadiusDemoConfig.title,
136
- description: roundedRectRadiusDemoConfig.description,
137
- Component: wrapSimpleDemo(roundedRectRadiusDemoConfig),
138
- },
139
- {
140
- id: rotatedCreationDemoConfig.id,
141
- title: rotatedCreationDemoConfig.title,
142
- description: rotatedCreationDemoConfig.description,
143
- Component: wrapSimpleDemo(rotatedCreationDemoConfig),
144
- },
145
- {
146
- id: svgPathDemoConfig.id,
147
- title: svgPathDemoConfig.title,
131
+ {
132
+ id: shapeGalleryDemoConfig.id,
133
+ title: shapeGalleryDemoConfig.title,
134
+ description: shapeGalleryDemoConfig.description,
135
+ Component: wrapSimpleDemo(shapeGalleryDemoConfig),
136
+ },
137
+ {
138
+ id: roundedRectRadiusDemoConfig.id,
139
+ title: roundedRectRadiusDemoConfig.title,
140
+ description: roundedRectRadiusDemoConfig.description,
141
+ Component: wrapSimpleDemo(roundedRectRadiusDemoConfig),
142
+ },
143
+ {
144
+ id: rotatedCreationDemoConfig.id,
145
+ title: rotatedCreationDemoConfig.title,
146
+ description: rotatedCreationDemoConfig.description,
147
+ Component: wrapSimpleDemo(rotatedCreationDemoConfig),
148
+ },
149
+ {
150
+ id: svgPathDemoConfig.id,
151
+ title: svgPathDemoConfig.title,
148
152
  description: svgPathDemoConfig.description,
149
153
  Component: SvgPathDemo,
150
154
  },
155
+ {
156
+ id: asymmetricPortMultiAnchorDemoConfig.id,
157
+ title: asymmetricPortMultiAnchorDemoConfig.title,
158
+ description: asymmetricPortMultiAnchorDemoConfig.description,
159
+ Component: AsymmetricPortMultiAnchorDemo,
160
+ },
151
161
  {
152
162
  id: multiLevelTreeDemoConfig.id,
153
163
  title: multiLevelTreeDemoConfig.title,
@@ -166,18 +176,18 @@ export const demoTabs: DemoDefinition[] = [
166
176
  description: portConstraintsDemoConfig.description,
167
177
  Component: wrapSimpleDemo(portConstraintsDemoConfig),
168
178
  },
169
- {
170
- id: portBorderDemoConfig.id,
171
- title: portBorderDemoConfig.title,
172
- description: portBorderDemoConfig.description,
173
- Component: wrapSimpleDemo(portBorderDemoConfig),
174
- },
175
- {
176
- id: shapeBorderMovementDemoConfig.id,
177
- title: shapeBorderMovementDemoConfig.title,
178
- description: shapeBorderMovementDemoConfig.description,
179
- Component: wrapSimpleDemo(shapeBorderMovementDemoConfig),
180
- },
179
+ {
180
+ id: portBorderDemoConfig.id,
181
+ title: portBorderDemoConfig.title,
182
+ description: portBorderDemoConfig.description,
183
+ Component: wrapSimpleDemo(portBorderDemoConfig),
184
+ },
185
+ {
186
+ id: shapeBorderMovementDemoConfig.id,
187
+ title: shapeBorderMovementDemoConfig.title,
188
+ description: shapeBorderMovementDemoConfig.description,
189
+ Component: wrapSimpleDemo(shapeBorderMovementDemoConfig),
190
+ },
181
191
  {
182
192
  id: shapeHoverControlsDemoConfig.id,
183
193
  title: shapeHoverControlsDemoConfig.title,
@@ -185,8 +195,14 @@ export const demoTabs: DemoDefinition[] = [
185
195
  Component: ShapeHoverControlsDemo,
186
196
  },
187
197
  {
188
- id: childConstraintsDemoConfig.id,
189
- title: childConstraintsDemoConfig.title,
198
+ id: vertexControlLinkSessionDemoConfig.id,
199
+ title: vertexControlLinkSessionDemoConfig.title,
200
+ description: vertexControlLinkSessionDemoConfig.description,
201
+ Component: VertexControlLinkSessionDemo,
202
+ },
203
+ {
204
+ id: childConstraintsDemoConfig.id,
205
+ title: childConstraintsDemoConfig.title,
190
206
  description: childConstraintsDemoConfig.description,
191
207
  Component: wrapSimpleDemo(childConstraintsDemoConfig),
192
208
  },
@@ -0,0 +1,121 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ export const layoutReservedDemoIds = {
6
+ parent: 'layout-lane-parent',
7
+ childA: 'layout-lane-child-a',
8
+ childB: 'layout-lane-child-b',
9
+ nestedParent: 'layout-lane-nested-parent',
10
+ nestedChildA: 'layout-lane-nested-child-a',
11
+ nestedChildB: 'layout-lane-nested-child-b',
12
+ parentLabel: 'layout-lane-parent-label',
13
+ } as const;
14
+
15
+ const createLayoutReservedState = (): DiagramState => ({
16
+ elements: [
17
+ {
18
+ id: layoutReservedDemoIds.parent,
19
+ position: { x: 70, y: 90 },
20
+ size: { width: 520, height: 260 },
21
+ shapeId: 'panel',
22
+ layout: {
23
+ mode: 'horizontal',
24
+ padding: 12,
25
+ gap: 10,
26
+ align: 'start',
27
+ childFitMainAxis: 'none',
28
+ childFitCrossAxis: 'none',
29
+ labelReservedSpace: { mode: 'none' },
30
+ },
31
+ },
32
+ {
33
+ id: layoutReservedDemoIds.childA,
34
+ parentId: layoutReservedDemoIds.parent,
35
+ position: { x: 0, y: 0 },
36
+ size: { width: 110, height: 70 },
37
+ shapeId: 'default',
38
+ },
39
+ {
40
+ id: layoutReservedDemoIds.childB,
41
+ parentId: layoutReservedDemoIds.parent,
42
+ position: { x: 0, y: 0 },
43
+ size: { width: 130, height: 60 },
44
+ shapeId: 'default',
45
+ },
46
+ {
47
+ id: layoutReservedDemoIds.nestedParent,
48
+ parentId: layoutReservedDemoIds.parent,
49
+ position: { x: 0, y: 0 },
50
+ size: { width: 190, height: 140 },
51
+ shapeId: 'default',
52
+ layout: {
53
+ mode: 'vertical',
54
+ padding: 8,
55
+ gap: 8,
56
+ align: 'start',
57
+ labelReservedSpace: { mode: 'fixed', size: 20 },
58
+ },
59
+ },
60
+ {
61
+ id: layoutReservedDemoIds.nestedChildA,
62
+ parentId: layoutReservedDemoIds.nestedParent,
63
+ position: { x: 0, y: 0 },
64
+ size: { width: 120, height: 26 },
65
+ shapeId: 'default',
66
+ },
67
+ {
68
+ id: layoutReservedDemoIds.nestedChildB,
69
+ parentId: layoutReservedDemoIds.nestedParent,
70
+ position: { x: 0, y: 0 },
71
+ size: { width: 150, height: 30 },
72
+ shapeId: 'default',
73
+ },
74
+ ],
75
+ ports: [],
76
+ links: [],
77
+ texts: [
78
+ {
79
+ id: layoutReservedDemoIds.parentLabel,
80
+ ownerId: layoutReservedDemoIds.parent,
81
+ content: 'Parent label lane demo',
82
+ position: { x: 10, y: 6 },
83
+ style: { fontSize: 13, fontFamily: 'sans-serif' },
84
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
85
+ },
86
+ {
87
+ id: 'layout-lane-child-a-label',
88
+ ownerId: layoutReservedDemoIds.childA,
89
+ content: 'child-a',
90
+ position: { x: 8, y: -14 },
91
+ style: { fontSize: 12, fontFamily: 'sans-serif' },
92
+ },
93
+ {
94
+ id: 'layout-lane-child-b-label',
95
+ ownerId: layoutReservedDemoIds.childB,
96
+ content: 'child-b',
97
+ position: { x: 8, y: -14 },
98
+ style: { fontSize: 12, fontFamily: 'sans-serif' },
99
+ },
100
+ {
101
+ id: 'layout-lane-nested-parent-label',
102
+ ownerId: layoutReservedDemoIds.nestedParent,
103
+ content: 'nested layout parent',
104
+ position: { x: 8, y: -14 },
105
+ style: { fontSize: 12, fontFamily: 'sans-serif' },
106
+ },
107
+ ],
108
+ });
109
+
110
+ export const layoutLabelReservedSpaceDemoConfig: DemoConfig = {
111
+ id: 'layout-label-reserved-space',
112
+ title: 'Layout Label Reserved Space',
113
+ description:
114
+ 'Reserve top label lane for child layouts (none/fixed/flexible) and verify distribute/stretch plus nested layout behavior within adjusted child bounds.',
115
+ createState: createLayoutReservedState,
116
+ elementShapes: baseElementShapes,
117
+ portShapes: basePortShapes,
118
+ defaultElementShapeId: 'default',
119
+ defaultPortShapeId: 'port-circle',
120
+ actions: [],
121
+ };
@@ -0,0 +1,145 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ export const vertexSessionDemoIds = {
6
+ source: 'vertex-session-source',
7
+ portTarget: 'vertex-session-port-target',
8
+ elementTarget: 'vertex-session-element-target',
9
+ nativeSource: 'vertex-session-native-source',
10
+ nativeTarget: 'vertex-session-native-target',
11
+ existingTargetPort: 'vertex-session-existing-target-port',
12
+ nativeSourcePort: 'vertex-session-native-source-port',
13
+ nativeTargetPort: 'vertex-session-native-target-port',
14
+ } as const;
15
+
16
+ const elementShapes = [
17
+ ...baseElementShapes,
18
+ {
19
+ id: 'vertex-session-diamond',
20
+ kind: 'diamond' as const,
21
+ style: {
22
+ fill: '#f5edff',
23
+ stroke: '#6a3da3',
24
+ strokeWidth: 2,
25
+ },
26
+ },
27
+ {
28
+ id: 'vertex-session-target',
29
+ kind: 'rect' as const,
30
+ style: {
31
+ cornerRadius: 10,
32
+ fill: '#edf7ff',
33
+ stroke: '#2f6d97',
34
+ strokeWidth: 2,
35
+ },
36
+ },
37
+ ];
38
+
39
+ const createVertexSessionState = (): DiagramState => ({
40
+ elements: [
41
+ {
42
+ id: vertexSessionDemoIds.source,
43
+ position: { x: 80, y: 120 },
44
+ size: { width: 170, height: 130 },
45
+ shapeId: 'vertex-session-diamond',
46
+ },
47
+ {
48
+ id: vertexSessionDemoIds.portTarget,
49
+ position: { x: 420, y: 110 },
50
+ size: { width: 210, height: 140 },
51
+ shapeId: 'vertex-session-target',
52
+ },
53
+ {
54
+ id: vertexSessionDemoIds.elementTarget,
55
+ position: { x: 720, y: 120 },
56
+ size: { width: 220, height: 160 },
57
+ shapeId: 'vertex-session-target',
58
+ },
59
+ {
60
+ id: vertexSessionDemoIds.nativeSource,
61
+ position: { x: 200, y: 360 },
62
+ size: { width: 180, height: 120 },
63
+ shapeId: 'default',
64
+ },
65
+ {
66
+ id: vertexSessionDemoIds.nativeTarget,
67
+ position: { x: 560, y: 360 },
68
+ size: { width: 180, height: 120 },
69
+ shapeId: 'default',
70
+ },
71
+ ],
72
+ ports: [
73
+ {
74
+ id: vertexSessionDemoIds.existingTargetPort,
75
+ elementId: vertexSessionDemoIds.portTarget,
76
+ position: { x: 0, y: 70 },
77
+ shapeId: 'port-circle',
78
+ moveMode: 'border',
79
+ anchorCenter: true,
80
+ orientToHostBorder: true,
81
+ },
82
+ {
83
+ id: vertexSessionDemoIds.nativeSourcePort,
84
+ elementId: vertexSessionDemoIds.nativeSource,
85
+ position: { x: 180, y: 60 },
86
+ shapeId: 'port-circle',
87
+ moveMode: 'border',
88
+ anchorCenter: true,
89
+ orientToHostBorder: true,
90
+ },
91
+ {
92
+ id: vertexSessionDemoIds.nativeTargetPort,
93
+ elementId: vertexSessionDemoIds.nativeTarget,
94
+ position: { x: 0, y: 60 },
95
+ shapeId: 'port-circle',
96
+ moveMode: 'border',
97
+ anchorCenter: true,
98
+ orientToHostBorder: true,
99
+ },
100
+ ],
101
+ links: [],
102
+ texts: [
103
+ {
104
+ id: 'vertex-session-source-label',
105
+ ownerId: vertexSessionDemoIds.source,
106
+ content: 'Drag the vertex control to start programmatic link session',
107
+ position: { x: 8, y: -18 },
108
+ style: { fontSize: 13, fontFamily: 'sans-serif' },
109
+ },
110
+ {
111
+ id: 'vertex-session-target-port-label',
112
+ ownerId: vertexSessionDemoIds.portTarget,
113
+ content: 'Scenario 1 target: existing port',
114
+ position: { x: 8, y: -16 },
115
+ style: { fontSize: 13, fontFamily: 'sans-serif' },
116
+ },
117
+ {
118
+ id: 'vertex-session-target-element-label',
119
+ ownerId: vertexSessionDemoIds.elementTarget,
120
+ content: 'Scenario 2 target: element body (auto create destination port)',
121
+ position: { x: 8, y: -16 },
122
+ style: { fontSize: 13, fontFamily: 'sans-serif' },
123
+ },
124
+ {
125
+ id: 'vertex-session-native-label',
126
+ ownerId: vertexSessionDemoIds.nativeSource,
127
+ content: 'Scenario 5 baseline: native port drag still works',
128
+ position: { x: 8, y: -16 },
129
+ style: { fontSize: 12, fontFamily: 'sans-serif' },
130
+ },
131
+ ],
132
+ });
133
+
134
+ export const vertexControlLinkSessionDemoConfig: DemoConfig = {
135
+ id: 'vertex-control-link-session',
136
+ title: 'Vertex Control Link Session',
137
+ description:
138
+ 'Programmatic link lifecycle driven by vertex-control drag: start, preview update, complete-to-port, complete-to-element, and cancel paths with event log verification.',
139
+ createState: createVertexSessionState,
140
+ elementShapes,
141
+ portShapes: basePortShapes,
142
+ defaultElementShapeId: 'default',
143
+ defaultPortShapeId: 'port-circle',
144
+ actions: [],
145
+ };