orcasvn-react-diagrams 0.2.0 → 0.2.2

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 (133) hide show
  1. package/README.md +22 -1
  2. package/ai/api-contract.json +57 -5
  3. package/ai/invariants.json +5 -3
  4. package/ai/manifest.json +1 -1
  5. package/dist/cjs/examples.js +11775 -0
  6. package/dist/cjs/index.js +3889 -1112
  7. package/dist/cjs/types/api/createDiagramEditor.d.ts +7 -2
  8. package/dist/cjs/types/api/types.d.ts +178 -0
  9. package/dist/cjs/types/displaybox/demos/DeletionEventsDemoTab.d.ts +3 -0
  10. package/dist/cjs/types/displaybox/demos/ShapeHoverControlsDemoTab.d.ts +3 -0
  11. package/dist/cjs/types/displaybox/demos/TextLayoutDemoTab.d.ts +3 -0
  12. package/dist/cjs/types/displaybox/demos/deletionEventsDemo.d.ts +2 -0
  13. package/dist/cjs/types/displaybox/demos/rotatedCreationDemo.d.ts +2 -0
  14. package/dist/cjs/types/displaybox/demos/roundedRectRadiusDemo.d.ts +2 -0
  15. package/dist/cjs/types/displaybox/demos/shapeBorderMovementDemo.d.ts +2 -0
  16. package/dist/cjs/types/displaybox/demos/shapeHoverControlsDemo.d.ts +10 -0
  17. package/dist/cjs/types/displaybox/demos/textDemo.d.ts +4 -0
  18. package/dist/cjs/types/displaybox/useDemoEditor.d.ts +5 -2
  19. package/dist/cjs/types/engine/AutoLayoutService.d.ts +24 -0
  20. package/dist/cjs/types/engine/DiagramEngine.d.ts +32 -14
  21. package/dist/cjs/types/engine/EngineCommands.d.ts +4 -1
  22. package/dist/cjs/types/engine/LinkRoutingService.d.ts +35 -0
  23. package/dist/cjs/types/engine/MutationPipeline.d.ts +23 -0
  24. package/dist/cjs/types/engine/TextLayoutService.d.ts +40 -0
  25. package/dist/cjs/types/examples/index.d.ts +2 -0
  26. package/dist/cjs/types/measure/textStyleDefaults.d.ts +9 -0
  27. package/dist/cjs/types/models/DiagramModel.d.ts +1 -0
  28. package/dist/cjs/types/models/ElementModel.d.ts +1 -0
  29. package/dist/cjs/types/models/PortModel.d.ts +3 -0
  30. package/dist/cjs/types/models/TextModel.d.ts +8 -0
  31. package/dist/cjs/types/renderer/RenderTypes.d.ts +34 -1
  32. package/dist/cjs/types/renderer/konva/KonvaHitTester.d.ts +1 -1
  33. package/dist/cjs/types/renderer/konva/KonvaInteraction.d.ts +53 -3
  34. package/dist/cjs/types/renderer/konva/KonvaNodeFactory.d.ts +18 -1
  35. package/dist/cjs/types/renderer/konva/KonvaRenderer.d.ts +49 -2
  36. package/dist/cjs/types/shapes/BuiltInShapes.d.ts +107 -0
  37. package/dist/cjs/types/shapes/__tests__/BuiltInShapes.test.d.ts +1 -0
  38. package/dist/cjs/types/shapes/index.d.ts +1 -0
  39. package/dist/cjs/types/utils/__tests__/borderGeometry.test.d.ts +1 -0
  40. package/dist/cjs/types/utils/borderGeometry.d.ts +6 -0
  41. package/dist/cjs/types/utils/geometry.d.ts +22 -0
  42. package/dist/esm/examples.js +11767 -0
  43. package/dist/esm/examples.js.map +1 -0
  44. package/dist/esm/index.js +3890 -1113
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/types/api/createDiagramEditor.d.ts +7 -2
  47. package/dist/esm/types/api/types.d.ts +178 -0
  48. package/dist/esm/types/displaybox/demos/DeletionEventsDemoTab.d.ts +3 -0
  49. package/dist/esm/types/displaybox/demos/ShapeHoverControlsDemoTab.d.ts +3 -0
  50. package/dist/esm/types/displaybox/demos/TextLayoutDemoTab.d.ts +3 -0
  51. package/dist/esm/types/displaybox/demos/deletionEventsDemo.d.ts +2 -0
  52. package/dist/esm/types/displaybox/demos/rotatedCreationDemo.d.ts +2 -0
  53. package/dist/esm/types/displaybox/demos/roundedRectRadiusDemo.d.ts +2 -0
  54. package/dist/esm/types/displaybox/demos/shapeBorderMovementDemo.d.ts +2 -0
  55. package/dist/esm/types/displaybox/demos/shapeHoverControlsDemo.d.ts +10 -0
  56. package/dist/esm/types/displaybox/demos/textDemo.d.ts +4 -0
  57. package/dist/esm/types/displaybox/useDemoEditor.d.ts +5 -2
  58. package/dist/esm/types/engine/AutoLayoutService.d.ts +24 -0
  59. package/dist/esm/types/engine/DiagramEngine.d.ts +32 -14
  60. package/dist/esm/types/engine/EngineCommands.d.ts +4 -1
  61. package/dist/esm/types/engine/LinkRoutingService.d.ts +35 -0
  62. package/dist/esm/types/engine/MutationPipeline.d.ts +23 -0
  63. package/dist/esm/types/engine/TextLayoutService.d.ts +40 -0
  64. package/dist/esm/types/examples/index.d.ts +2 -0
  65. package/dist/esm/types/measure/textStyleDefaults.d.ts +9 -0
  66. package/dist/esm/types/models/DiagramModel.d.ts +1 -0
  67. package/dist/esm/types/models/ElementModel.d.ts +1 -0
  68. package/dist/esm/types/models/PortModel.d.ts +3 -0
  69. package/dist/esm/types/models/TextModel.d.ts +8 -0
  70. package/dist/esm/types/renderer/RenderTypes.d.ts +34 -1
  71. package/dist/esm/types/renderer/konva/KonvaHitTester.d.ts +1 -1
  72. package/dist/esm/types/renderer/konva/KonvaInteraction.d.ts +53 -3
  73. package/dist/esm/types/renderer/konva/KonvaNodeFactory.d.ts +18 -1
  74. package/dist/esm/types/renderer/konva/KonvaRenderer.d.ts +49 -2
  75. package/dist/esm/types/shapes/BuiltInShapes.d.ts +107 -0
  76. package/dist/esm/types/shapes/__tests__/BuiltInShapes.test.d.ts +1 -0
  77. package/dist/esm/types/shapes/index.d.ts +1 -0
  78. package/dist/esm/types/utils/__tests__/borderGeometry.test.d.ts +1 -0
  79. package/dist/esm/types/utils/borderGeometry.d.ts +6 -0
  80. package/dist/esm/types/utils/geometry.d.ts +22 -0
  81. package/dist/examples.d.ts +532 -0
  82. package/dist/index.d.ts +233 -2
  83. package/docs/API_CONTRACT.md +59 -3
  84. package/docs/ARCHITECTURE.md +1 -0
  85. package/docs/CAPABILITIES.md +3 -1
  86. package/docs/COMMANDS_EVENTS.md +5 -0
  87. package/docs/DOCUMENTATION_WORKFLOW.md +6 -8
  88. package/docs/INTEGRATION_PLAYBOOK.md +2 -0
  89. package/docs/PORTING_CHECKLIST.md +1 -0
  90. package/docs/STATE_INVARIANTS.md +4 -0
  91. package/package.json +20 -10
  92. package/src/displaybox/demos/AutoLayoutDemoTab.tsx +501 -0
  93. package/src/displaybox/demos/DeletionEventsDemoTab.tsx +147 -0
  94. package/src/displaybox/demos/EngineEventsDemoTab.tsx +151 -0
  95. package/src/displaybox/demos/EventHandlersDemoTab.tsx +110 -0
  96. package/src/displaybox/demos/ExternalDragDropDemoTab.tsx +261 -0
  97. package/src/displaybox/demos/LinkCancelDemoTab.tsx +238 -0
  98. package/src/displaybox/demos/ObstacleRoutingDemoTab.tsx +30 -0
  99. package/src/displaybox/demos/ShapeHoverControlsDemoTab.tsx +558 -0
  100. package/src/displaybox/demos/SimpleDemo.tsx +73 -0
  101. package/src/displaybox/demos/SvgPathDemoTab.tsx +327 -0
  102. package/src/displaybox/demos/TextLayoutDemoTab.tsx +386 -0
  103. package/src/displaybox/demos/autoLayoutDemo.ts +111 -0
  104. package/src/displaybox/demos/basicDemo.ts +131 -0
  105. package/src/displaybox/demos/childConstraintsDemo.ts +65 -0
  106. package/src/displaybox/demos/customDemo.ts +59 -0
  107. package/src/displaybox/demos/deletionEventsDemo.ts +91 -0
  108. package/src/displaybox/demos/engineEventsDemo.ts +64 -0
  109. package/src/displaybox/demos/eventHandlersDemo.ts +41 -0
  110. package/src/displaybox/demos/externalDragDropDemo.ts +28 -0
  111. package/src/displaybox/demos/gridOverlayDemo.ts +50 -0
  112. package/src/displaybox/demos/index.tsx +217 -0
  113. package/src/displaybox/demos/linkBendHandlesDemo.ts +143 -0
  114. package/src/displaybox/demos/linkCancelDemo.ts +56 -0
  115. package/src/displaybox/demos/linkPortCreationDemo.ts +46 -0
  116. package/src/displaybox/demos/multiLevelTreeDemo.ts +120 -0
  117. package/src/displaybox/demos/multipleElementsDemo.ts +62 -0
  118. package/src/displaybox/demos/nestedDemo.ts +78 -0
  119. package/src/displaybox/demos/obstacleRoutingDemo.ts +176 -0
  120. package/src/displaybox/demos/portBorderDemo.ts +98 -0
  121. package/src/displaybox/demos/portConstraintsDemo.ts +175 -0
  122. package/src/displaybox/demos/rotatedCreationDemo.ts +185 -0
  123. package/src/displaybox/demos/roundedRectRadiusDemo.ts +93 -0
  124. package/src/displaybox/demos/routingDemo.ts +57 -0
  125. package/src/displaybox/demos/selectionDemo.ts +49 -0
  126. package/src/displaybox/demos/shapeBorderMovementDemo.ts +126 -0
  127. package/src/displaybox/demos/shapeGalleryDemo.ts +73 -0
  128. package/src/displaybox/demos/shapeHoverControlsDemo.ts +172 -0
  129. package/src/displaybox/demos/shared.ts +161 -0
  130. package/src/displaybox/demos/svgPathDemo.ts +71 -0
  131. package/src/displaybox/demos/textDemo.ts +62 -0
  132. package/src/displaybox/types.ts +66 -0
  133. package/src/examples/index.ts +21 -0
@@ -0,0 +1,59 @@
1
+ import type { DiagramState } from '../../api';
2
+ import { createId } from '../../utils/ids';
3
+ import type { DemoConfig } from '../types';
4
+ import { baseElementShapes, basePortShapes } from './shared';
5
+
6
+ const createCustomShapeState = (): DiagramState => ({
7
+ elements: [
8
+ {
9
+ id: 'custom-1',
10
+ position: { x: 120, y: 160 },
11
+ size: { width: 260, height: 150 },
12
+ shapeId: 'panel',
13
+ },
14
+ ],
15
+ ports: [
16
+ {
17
+ id: 'custom-port',
18
+ elementId: 'custom-1',
19
+ position: { x: 30, y: 30 },
20
+ shapeId: 'port-dark',
21
+ anchorCenter: true,
22
+ },
23
+ ],
24
+ links: [],
25
+ texts: [
26
+ {
27
+ id: 'custom-text',
28
+ content: 'Custom Shapes',
29
+ position: { x: 20, y: -16 },
30
+ ownerId: 'custom-1',
31
+ },
32
+ ],
33
+ });
34
+
35
+ export const customDemoConfig: DemoConfig = ({
36
+ id: 'custom',
37
+ title: 'Custom Shapes',
38
+ description: 'Built-in shapes with custom styling.',
39
+ createState: createCustomShapeState,
40
+ elementShapes: baseElementShapes,
41
+ portShapes: basePortShapes,
42
+ defaultElementShapeId: 'panel',
43
+ defaultPortShapeId: 'port-dark',
44
+ actions: [
45
+ {
46
+ id: 'add-element',
47
+ label: 'Add element',
48
+ run: (editor, _state, demo, helpers) => {
49
+ const offset = helpers.nextOffset();
50
+ editor.addElement({
51
+ id: `panel-${createId()}`,
52
+ position: { x: 160 + offset, y: 140 + offset },
53
+ size: { width: 220, height: 140 },
54
+ shapeId: demo.defaultElementShapeId ?? 'panel',
55
+ });
56
+ },
57
+ },
58
+ ],
59
+ });
@@ -0,0 +1,91 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ const createDeletionEventsState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'delete-source',
9
+ position: { x: 120, y: 170 },
10
+ size: { width: 220, height: 150 },
11
+ shapeId: 'default',
12
+ },
13
+ {
14
+ id: 'delete-target',
15
+ position: { x: 520, y: 210 },
16
+ size: { width: 220, height: 140 },
17
+ shapeId: 'panel',
18
+ },
19
+ ],
20
+ ports: [
21
+ {
22
+ id: 'delete-source-link-port',
23
+ elementId: 'delete-source',
24
+ position: { x: 220, y: 75 },
25
+ shapeId: 'port-circle',
26
+ anchorCenter: true,
27
+ moveMode: 'border',
28
+ },
29
+ {
30
+ id: 'delete-source-free-port',
31
+ elementId: 'delete-source',
32
+ position: { x: 0, y: 75 },
33
+ shapeId: 'port-dark',
34
+ anchorCenter: true,
35
+ moveMode: 'border',
36
+ },
37
+ {
38
+ id: 'delete-target-link-port',
39
+ elementId: 'delete-target',
40
+ position: { x: 0, y: 70 },
41
+ shapeId: 'port-circle',
42
+ anchorCenter: true,
43
+ moveMode: 'border',
44
+ },
45
+ ],
46
+ links: [
47
+ {
48
+ id: 'delete-link',
49
+ sourcePortId: 'delete-source-link-port',
50
+ targetPortId: 'delete-target-link-port',
51
+ points: [],
52
+ },
53
+ ],
54
+ texts: [
55
+ {
56
+ id: 'delete-element-text',
57
+ content: 'Element-owned text',
58
+ position: { x: 12, y: -14 },
59
+ ownerId: 'delete-source',
60
+ },
61
+ {
62
+ id: 'delete-port-text',
63
+ content: 'Port-owned text',
64
+ position: { x: 8, y: -16 },
65
+ ownerId: 'delete-source-free-port',
66
+ },
67
+ {
68
+ id: 'delete-link-text',
69
+ content: 'Link-owned text',
70
+ position: { x: 10, y: -16 },
71
+ ownerId: 'delete-link',
72
+ },
73
+ {
74
+ id: 'delete-free-text',
75
+ content: 'Standalone text (direct text delete)',
76
+ position: { x: 120, y: 120 },
77
+ },
78
+ ],
79
+ });
80
+
81
+ export const deletionEventsDemoConfig: DemoConfig = {
82
+ id: 'deletion-events',
83
+ title: 'Deletion Events',
84
+ description: 'Inspect elementDeleted, portDeleted, linkDeleted, and textDeleted payloads for direct and cascade removals.',
85
+ createState: createDeletionEventsState,
86
+ elementShapes: baseElementShapes,
87
+ portShapes: basePortShapes,
88
+ defaultElementShapeId: 'default',
89
+ defaultPortShapeId: 'port-circle',
90
+ actions: [],
91
+ };
@@ -0,0 +1,64 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ const createEngineEventsState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'engine-events-source',
9
+ position: { x: 140, y: 160 },
10
+ size: { width: 220, height: 140 },
11
+ shapeId: 'default',
12
+ },
13
+ {
14
+ id: 'engine-events-target',
15
+ position: { x: 500, y: 260 },
16
+ size: { width: 240, height: 160 },
17
+ shapeId: 'panel',
18
+ },
19
+ ],
20
+ ports: [
21
+ {
22
+ id: 'engine-events-source-port',
23
+ elementId: 'engine-events-source',
24
+ position: { x: 40, y: 60 },
25
+ shapeId: 'port-circle',
26
+ anchorCenter: true,
27
+ },
28
+ {
29
+ id: 'engine-events-target-port',
30
+ elementId: 'engine-events-target',
31
+ position: { x: 60, y: 50 },
32
+ shapeId: 'port-circle',
33
+ anchorCenter: true,
34
+ },
35
+ ],
36
+ links: [
37
+ {
38
+ id: 'engine-events-link',
39
+ sourcePortId: 'engine-events-source-port',
40
+ targetPortId: 'engine-events-target-port',
41
+ points: [],
42
+ routing: 'auto',
43
+ },
44
+ ],
45
+ texts: [
46
+ {
47
+ id: 'engine-events-tip',
48
+ content: 'Select an engine event and interact to see the payload.',
49
+ position: { x: 140, y: 120 },
50
+ },
51
+ ],
52
+ });
53
+
54
+ export const engineEventsDemoConfig: DemoConfig = ({
55
+ id: 'engine-events',
56
+ title: 'Engine Events',
57
+ description: 'Inspect the latest payload for each engine event.',
58
+ createState: createEngineEventsState,
59
+ elementShapes: baseElementShapes,
60
+ portShapes: basePortShapes,
61
+ defaultElementShapeId: 'default',
62
+ defaultPortShapeId: 'port-circle',
63
+ actions: [],
64
+ });
@@ -0,0 +1,41 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ const createEventHandlersState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'event-element',
9
+ position: { x: 160, y: 160 },
10
+ size: { width: 220, height: 140 },
11
+ shapeId: 'default',
12
+ },
13
+ {
14
+ id: 'event-element-2',
15
+ position: { x: 460, y: 280 },
16
+ size: { width: 220, height: 140 },
17
+ shapeId: 'panel',
18
+ },
19
+ ],
20
+ ports: [],
21
+ links: [],
22
+ texts: [
23
+ {
24
+ id: 'event-tip',
25
+ content: 'Pick an engine event and interact to see the handler run.',
26
+ position: { x: 120, y: 120 },
27
+ },
28
+ ],
29
+ });
30
+
31
+ export const eventHandlersDemoConfig: DemoConfig = ({
32
+ id: 'event-handlers',
33
+ title: 'Event Handlers',
34
+ description: 'Choose an engine event and watch the handler effect.',
35
+ createState: createEventHandlersState,
36
+ elementShapes: baseElementShapes,
37
+ portShapes: basePortShapes,
38
+ defaultElementShapeId: 'default',
39
+ defaultPortShapeId: 'port-circle',
40
+ actions: [],
41
+ });
@@ -0,0 +1,28 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ const createExternalDragDropState = (): DiagramState => ({
6
+ elements: [],
7
+ ports: [],
8
+ links: [],
9
+ texts: [
10
+ {
11
+ id: 'drop-tip',
12
+ content: 'Drag items from the toolbox into the canvas.',
13
+ position: { x: 120, y: 120 },
14
+ },
15
+ ],
16
+ });
17
+
18
+ export const externalDragDropDemoConfig: DemoConfig = ({
19
+ id: 'external-drag-drop',
20
+ title: 'External Drag + Drop',
21
+ description: 'Drag items from the external toolbox into the canvas. Drops use client-to-world conversion.',
22
+ createState: createExternalDragDropState,
23
+ elementShapes: baseElementShapes,
24
+ portShapes: basePortShapes,
25
+ defaultElementShapeId: 'default',
26
+ defaultPortShapeId: 'port-circle',
27
+ actions: [],
28
+ });
@@ -0,0 +1,50 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes, gridStageStyle } from './shared';
4
+
5
+ const createGridOverlayState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'grid-a',
9
+ position: { x: 140, y: 120 },
10
+ size: { width: 200, height: 120 },
11
+ shapeId: 'default',
12
+ },
13
+ {
14
+ id: 'grid-b',
15
+ position: { x: 420, y: 220 },
16
+ size: { width: 220, height: 140 },
17
+ shapeId: 'panel',
18
+ },
19
+ ],
20
+ ports: [
21
+ { id: 'grid-a-port', elementId: 'grid-a', position: { x: 40, y: 40 }, shapeId: 'port-circle', anchorCenter: true },
22
+ { id: 'grid-b-port', elementId: 'grid-b', position: { x: 50, y: 50 }, shapeId: 'port-circle', anchorCenter: true },
23
+ ],
24
+ links: [
25
+ {
26
+ id: 'grid-link',
27
+ sourcePortId: 'grid-a-port',
28
+ targetPortId: 'grid-b-port',
29
+ points: [],
30
+ },
31
+ ],
32
+ texts: [
33
+ { id: 'grid-a-label', content: 'Grid A', position: { x: 12, y: -12 }, ownerId: 'grid-a' },
34
+ { id: 'grid-b-label', content: 'Grid B', position: { x: 12, y: -12 }, ownerId: 'grid-b' },
35
+ ],
36
+ });
37
+
38
+ export const gridOverlayDemoConfig: DemoConfig = ({
39
+ id: 'grid-overlay',
40
+ title: 'Grid Overlay',
41
+ description: 'Grid background with snapping enabled by default.',
42
+ createState: createGridOverlayState,
43
+ elementShapes: baseElementShapes,
44
+ portShapes: basePortShapes,
45
+ defaultElementShapeId: 'default',
46
+ defaultPortShapeId: 'port-circle',
47
+ snapDefault: true,
48
+ stageStyle: gridStageStyle,
49
+ actions: [],
50
+ });
@@ -0,0 +1,217 @@
1
+ import React from 'react';
2
+ import type { DemoConfig, DemoDefinition } from '../types';
3
+ import { basicDemoConfig } from './basicDemo';
4
+ import { linkPortCreationDemoConfig } from './linkPortCreationDemo';
5
+ import { nestedDemoConfig } from './nestedDemo';
6
+ import { customDemoConfig } from './customDemo';
7
+ import { textDemoConfig } from './textDemo';
8
+ import { selectionDemoConfig } from './selectionDemo';
9
+ import { eventHandlersDemoConfig } from './eventHandlersDemo';
10
+ import { engineEventsDemoConfig } from './engineEventsDemo';
11
+ import { linkCancelDemoConfig } from './linkCancelDemo';
12
+ import { autoLayoutDemoConfig } from './autoLayoutDemo';
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';
19
+ import { multipleElementsDemoConfig } from './multipleElementsDemo';
20
+ import { portConstraintsDemoConfig } from './portConstraintsDemo';
21
+ import { portBorderDemoConfig } from './portBorderDemo';
22
+ import { childConstraintsDemoConfig } from './childConstraintsDemo';
23
+ import { gridOverlayDemoConfig } from './gridOverlayDemo';
24
+ import { routingDemoConfig } from './routingDemo';
25
+ import { obstacleRoutingDemoConfig } from './obstacleRoutingDemo';
26
+ import { linkBendHandlesDemoConfig } from './linkBendHandlesDemo';
27
+ import { deletionEventsDemoConfig } from './deletionEventsDemo';
28
+ import { shapeBorderMovementDemoConfig } from './shapeBorderMovementDemo';
29
+ import { shapeHoverControlsDemoConfig } from './shapeHoverControlsDemo';
30
+ import EventHandlersDemo from './EventHandlersDemoTab';
31
+ import EngineEventsDemo from './EngineEventsDemoTab';
32
+ import LinkCancelDemo from './LinkCancelDemoTab';
33
+ 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';
40
+ import ShapeHoverControlsDemo from './ShapeHoverControlsDemoTab';
41
+
42
+ export {
43
+ baseElementShapes,
44
+ basePortShapes,
45
+ customGalleryShapes,
46
+ defaultGhostSize,
47
+ defaultSvgPath,
48
+ defaultSvgPathSize,
49
+ externalToolboxItems,
50
+ } from './shared';
51
+
52
+ const wrapSimpleDemo = (demo: DemoConfig) => () => <SimpleDemo demo={demo} />;
53
+
54
+ export const demoTabs: DemoDefinition[] = [
55
+ {
56
+ id: basicDemoConfig.id,
57
+ title: basicDemoConfig.title,
58
+ description: basicDemoConfig.description,
59
+ Component: wrapSimpleDemo(basicDemoConfig),
60
+ },
61
+ {
62
+ id: linkPortCreationDemoConfig.id,
63
+ title: linkPortCreationDemoConfig.title,
64
+ description: linkPortCreationDemoConfig.description,
65
+ Component: wrapSimpleDemo(linkPortCreationDemoConfig),
66
+ },
67
+ {
68
+ id: nestedDemoConfig.id,
69
+ title: nestedDemoConfig.title,
70
+ description: nestedDemoConfig.description,
71
+ Component: wrapSimpleDemo(nestedDemoConfig),
72
+ },
73
+ {
74
+ id: customDemoConfig.id,
75
+ title: customDemoConfig.title,
76
+ description: customDemoConfig.description,
77
+ Component: wrapSimpleDemo(customDemoConfig),
78
+ },
79
+ {
80
+ id: textDemoConfig.id,
81
+ title: textDemoConfig.title,
82
+ description: textDemoConfig.description,
83
+ Component: TextLayoutDemo,
84
+ },
85
+ {
86
+ id: selectionDemoConfig.id,
87
+ title: selectionDemoConfig.title,
88
+ description: selectionDemoConfig.description,
89
+ Component: wrapSimpleDemo(selectionDemoConfig),
90
+ },
91
+ {
92
+ id: eventHandlersDemoConfig.id,
93
+ title: eventHandlersDemoConfig.title,
94
+ description: eventHandlersDemoConfig.description,
95
+ Component: EventHandlersDemo,
96
+ },
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
+ {
110
+ id: autoLayoutDemoConfig.id,
111
+ title: autoLayoutDemoConfig.title,
112
+ description: autoLayoutDemoConfig.description,
113
+ Component: AutoLayoutDemo,
114
+ },
115
+ {
116
+ id: linkCancelDemoConfig.id,
117
+ title: linkCancelDemoConfig.title,
118
+ description: linkCancelDemoConfig.description,
119
+ Component: LinkCancelDemo,
120
+ },
121
+ {
122
+ id: externalDragDropDemoConfig.id,
123
+ title: externalDragDropDemoConfig.title,
124
+ description: externalDragDropDemoConfig.description,
125
+ Component: ExternalDragDropDemo,
126
+ },
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,
148
+ description: svgPathDemoConfig.description,
149
+ Component: SvgPathDemo,
150
+ },
151
+ {
152
+ id: multiLevelTreeDemoConfig.id,
153
+ title: multiLevelTreeDemoConfig.title,
154
+ description: multiLevelTreeDemoConfig.description,
155
+ Component: wrapSimpleDemo(multiLevelTreeDemoConfig),
156
+ },
157
+ {
158
+ id: multipleElementsDemoConfig.id,
159
+ title: multipleElementsDemoConfig.title,
160
+ description: multipleElementsDemoConfig.description,
161
+ Component: wrapSimpleDemo(multipleElementsDemoConfig),
162
+ },
163
+ {
164
+ id: portConstraintsDemoConfig.id,
165
+ title: portConstraintsDemoConfig.title,
166
+ description: portConstraintsDemoConfig.description,
167
+ Component: wrapSimpleDemo(portConstraintsDemoConfig),
168
+ },
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
+ },
181
+ {
182
+ id: shapeHoverControlsDemoConfig.id,
183
+ title: shapeHoverControlsDemoConfig.title,
184
+ description: shapeHoverControlsDemoConfig.description,
185
+ Component: ShapeHoverControlsDemo,
186
+ },
187
+ {
188
+ id: childConstraintsDemoConfig.id,
189
+ title: childConstraintsDemoConfig.title,
190
+ description: childConstraintsDemoConfig.description,
191
+ Component: wrapSimpleDemo(childConstraintsDemoConfig),
192
+ },
193
+ {
194
+ id: gridOverlayDemoConfig.id,
195
+ title: gridOverlayDemoConfig.title,
196
+ description: gridOverlayDemoConfig.description,
197
+ Component: wrapSimpleDemo(gridOverlayDemoConfig),
198
+ },
199
+ {
200
+ id: routingDemoConfig.id,
201
+ title: routingDemoConfig.title,
202
+ description: routingDemoConfig.description,
203
+ Component: wrapSimpleDemo(routingDemoConfig),
204
+ },
205
+ {
206
+ id: obstacleRoutingDemoConfig.id,
207
+ title: obstacleRoutingDemoConfig.title,
208
+ description: obstacleRoutingDemoConfig.description,
209
+ Component: ObstacleRoutingDemo,
210
+ },
211
+ {
212
+ id: linkBendHandlesDemoConfig.id,
213
+ title: linkBendHandlesDemoConfig.title,
214
+ description: linkBendHandlesDemoConfig.description,
215
+ Component: wrapSimpleDemo(linkBendHandlesDemoConfig),
216
+ },
217
+ ];
@@ -0,0 +1,143 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ const createLinkBendHandlesState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'bend-source',
9
+ position: { x: 120, y: 120 },
10
+ size: { width: 180, height: 100 },
11
+ shapeId: 'default',
12
+ },
13
+ {
14
+ id: 'bend-target',
15
+ position: { x: 420, y: 140 },
16
+ size: { width: 220, height: 120 },
17
+ shapeId: 'panel',
18
+ },
19
+ {
20
+ id: 'corner-upper',
21
+ position: { x: 120, y: 330 },
22
+ size: { width: 200, height: 110 },
23
+ shapeId: 'default',
24
+ },
25
+ {
26
+ id: 'corner-lower',
27
+ position: { x: 360, y: 510 },
28
+ size: { width: 220, height: 120 },
29
+ shapeId: 'panel',
30
+ },
31
+ {
32
+ id: 'stacked-top',
33
+ position: { x: 700, y: 300 },
34
+ size: { width: 180, height: 100 },
35
+ shapeId: 'default',
36
+ },
37
+ {
38
+ id: 'stacked-bottom',
39
+ position: { x: 700, y: 470 },
40
+ size: { width: 180, height: 100 },
41
+ shapeId: 'panel',
42
+ },
43
+ ],
44
+ ports: [
45
+ {
46
+ id: 'bend-source-port',
47
+ elementId: 'bend-source',
48
+ position: { x: 30, y: 50 },
49
+ shapeId: 'port-circle',
50
+ moveMode: 'border',
51
+ anchorCenter: true,
52
+ },
53
+ {
54
+ id: 'bend-target-port',
55
+ elementId: 'bend-target',
56
+ position: { x: 40, y: 40 },
57
+ shapeId: 'port-circle',
58
+ moveMode: 'border',
59
+ anchorCenter: true,
60
+ },
61
+ {
62
+ id: 'corner-source-port',
63
+ elementId: 'corner-upper',
64
+ position: { x: 200, y: 110 },
65
+ shapeId: 'port-circle',
66
+ moveMode: 'border',
67
+ anchorCenter: true,
68
+ },
69
+ {
70
+ id: 'corner-target-port',
71
+ elementId: 'corner-lower',
72
+ position: { x: 0, y: 60 },
73
+ shapeId: 'port-circle',
74
+ moveMode: 'border',
75
+ anchorCenter: true,
76
+ },
77
+ {
78
+ id: 'stacked-source-port',
79
+ elementId: 'stacked-top',
80
+ position: { x: 0, y: 100 },
81
+ shapeId: 'port-dark',
82
+ moveMode: 'border',
83
+ anchorCenter: true,
84
+ },
85
+ {
86
+ id: 'stacked-target-port',
87
+ elementId: 'stacked-bottom',
88
+ position: { x: 180, y: 0 },
89
+ shapeId: 'port-dark',
90
+ moveMode: 'border',
91
+ anchorCenter: true,
92
+ },
93
+ ],
94
+ links: [
95
+ {
96
+ id: 'bend-link',
97
+ sourcePortId: 'bend-source-port',
98
+ targetPortId: 'bend-target-port',
99
+ routing: 'manual',
100
+ points: [
101
+ { x: 150, y: 170 },
102
+ { x: 300, y: 170 },
103
+ { x: 300, y: 280 },
104
+ { x: 460, y: 180 },
105
+ ],
106
+ },
107
+ {
108
+ id: 'corner-auto-link',
109
+ sourcePortId: 'corner-source-port',
110
+ targetPortId: 'corner-target-port',
111
+ routing: 'auto',
112
+ points: [],
113
+ },
114
+ {
115
+ id: 'stacked-auto-link',
116
+ sourcePortId: 'stacked-source-port',
117
+ targetPortId: 'stacked-target-port',
118
+ routing: 'auto',
119
+ points: [],
120
+ },
121
+ ],
122
+ texts: [
123
+ { id: 'bend-source-label', content: 'Manual start', position: { x: 12, y: -12 }, ownerId: 'bend-source' },
124
+ { id: 'bend-target-label', content: 'Manual end', position: { x: 12, y: -12 }, ownerId: 'bend-target' },
125
+ { id: 'corner-upper-label', content: 'Corner source', position: { x: 12, y: -12 }, ownerId: 'corner-upper' },
126
+ { id: 'corner-lower-label', content: 'Left-edge target', position: { x: 12, y: -12 }, ownerId: 'corner-lower' },
127
+ { id: 'stacked-top-label', content: 'Stacked top', position: { x: 12, y: -12 }, ownerId: 'stacked-top' },
128
+ { id: 'stacked-bottom-label', content: 'Stacked bottom', position: { x: 12, y: -12 }, ownerId: 'stacked-bottom' },
129
+ { id: 'bend-tip', content: 'Select the manual link to drag bend handles. Auto links show corner edge-cases.', position: { x: 120, y: 70 } },
130
+ ],
131
+ });
132
+
133
+ export const linkBendHandlesDemoConfig: DemoConfig = ({
134
+ id: 'link-bends',
135
+ title: 'Link Bend Handles',
136
+ description: 'Manual bend editing plus corner and stacked auto-routing edge cases.',
137
+ createState: createLinkBendHandlesState,
138
+ elementShapes: baseElementShapes,
139
+ portShapes: basePortShapes,
140
+ defaultElementShapeId: 'default',
141
+ defaultPortShapeId: 'port-circle',
142
+ actions: [],
143
+ });