orcasvn-react-diagrams 0.2.7 → 0.2.9

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 (37) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +7 -12
  3. package/ai/api-contract.json +16 -0
  4. package/ai/invariants.json +8 -0
  5. package/ai/manifest.json +1 -1
  6. package/dist/cjs/examples.js +604 -39
  7. package/dist/cjs/index.js +227 -28
  8. package/dist/cjs/types/api/types.d.ts +2 -0
  9. package/dist/cjs/types/displaybox/demos/elementVisibilitySelectionDemo.d.ts +4 -0
  10. package/dist/cjs/types/engine/DiagramEngine.d.ts +8 -0
  11. package/dist/cjs/types/models/DiagramModel.d.ts +5 -0
  12. package/dist/cjs/types/models/ElementModel.d.ts +2 -0
  13. package/dist/esm/examples.js +604 -39
  14. package/dist/esm/examples.js.map +1 -1
  15. package/dist/esm/index.js +227 -28
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/api/types.d.ts +2 -0
  18. package/dist/esm/types/displaybox/demos/elementVisibilitySelectionDemo.d.ts +4 -0
  19. package/dist/esm/types/engine/DiagramEngine.d.ts +8 -0
  20. package/dist/esm/types/models/DiagramModel.d.ts +5 -0
  21. package/dist/esm/types/models/ElementModel.d.ts +2 -0
  22. package/dist/examples.d.ts +2 -0
  23. package/dist/index.d.ts +9 -0
  24. package/docs/API_CONTRACT.md +16 -1
  25. package/docs/CAPABILITIES.md +1 -0
  26. package/docs/COMMANDS_EVENTS.md +3 -1
  27. package/docs/DOCUMENTATION_WORKFLOW.md +3 -1
  28. package/docs/INTEGRATION_PLAYBOOK.md +1 -0
  29. package/docs/PORTING_CHECKLIST.md +1 -0
  30. package/docs/STATE_INVARIANTS.md +9 -1
  31. package/package.json +1 -1
  32. package/src/displaybox/demos/AutoLayoutDemoTab.tsx +11 -5
  33. package/src/displaybox/demos/autoLayoutDemo.ts +233 -0
  34. package/src/displaybox/demos/basicDemo.ts +6 -6
  35. package/src/displaybox/demos/elementVisibilitySelectionDemo.ts +128 -0
  36. package/src/displaybox/demos/index.tsx +14 -7
  37. package/src/displaybox/demos/selectionDemo.ts +12 -12
@@ -0,0 +1,128 @@
1
+ import type { DiagramState } from '../../api';
2
+ import type { DemoConfig } from '../types';
3
+ import { baseElementShapes, basePortShapes } from './shared';
4
+
5
+ export const createElementVisibilitySelectionState = (): DiagramState => ({
6
+ elements: [
7
+ {
8
+ id: 'policy-normal',
9
+ position: { x: 120, y: 160 },
10
+ size: { width: 180, height: 120 },
11
+ shapeId: 'default',
12
+ style: { fill: '#dbeafe', stroke: '#1d4ed8', strokeWidth: 2 },
13
+ },
14
+ {
15
+ id: 'policy-unselectable',
16
+ position: { x: 410, y: 160 },
17
+ size: { width: 180, height: 120 },
18
+ shapeId: 'default',
19
+ selectable: false,
20
+ style: { fill: '#e2e8f0', stroke: '#334155', strokeWidth: 2 },
21
+ },
22
+ {
23
+ id: 'policy-hidden',
24
+ position: { x: 700, y: 140 },
25
+ size: { width: 180, height: 120 },
26
+ shapeId: 'default',
27
+ visible: false,
28
+ style: { fill: '#fee2e2', stroke: '#dc2626', strokeWidth: 2 },
29
+ },
30
+ ],
31
+ ports: [
32
+ {
33
+ id: 'policy-normal-port',
34
+ elementId: 'policy-normal',
35
+ position: { x: 180, y: 60 },
36
+ shapeId: 'port-circle',
37
+ },
38
+ {
39
+ id: 'policy-unselectable-port',
40
+ elementId: 'policy-unselectable',
41
+ position: { x: 0, y: 60 },
42
+ shapeId: 'port-circle',
43
+ },
44
+ {
45
+ id: 'policy-hidden-port',
46
+ elementId: 'policy-hidden',
47
+ position: { x: 0, y: 60 },
48
+ shapeId: 'port-circle',
49
+ },
50
+ ],
51
+ links: [
52
+ {
53
+ id: 'policy-visible-link',
54
+ sourcePortId: 'policy-normal-port',
55
+ targetPortId: 'policy-unselectable-port',
56
+ points: [
57
+ { x: 300, y: 220 },
58
+ { x: 410, y: 220 },
59
+ ],
60
+ style: { stroke: '#2563eb', strokeWidth: 3 },
61
+ },
62
+ {
63
+ id: 'policy-hidden-link',
64
+ sourcePortId: 'policy-normal-port',
65
+ targetPortId: 'policy-hidden-port',
66
+ points: [
67
+ { x: 300, y: 220 },
68
+ { x: 700, y: 200 },
69
+ ],
70
+ style: { stroke: '#dc2626', strokeWidth: 3 },
71
+ },
72
+ ],
73
+ texts: [
74
+ {
75
+ id: 'policy-tip',
76
+ content:
77
+ 'Blue node is normal. Slate node is visible but its body ignores click and marquee. Its port stays interactive. Hidden node, its port, and its attached red link stay in state but are suppressed from scene, selection, zoom-to-fit, and fit-to-content export.',
78
+ position: { x: 80, y: 72 },
79
+ size: { width: 760, height: 44 },
80
+ style: { fontSize: 14, fill: '#0f172a' },
81
+ },
82
+ {
83
+ id: 'policy-normal-label',
84
+ content: 'Normal selectable element',
85
+ position: { x: 16, y: 14 },
86
+ ownerId: 'policy-normal',
87
+ },
88
+ {
89
+ id: 'policy-unselectable-label',
90
+ content: 'Visible but body is unselectable',
91
+ position: { x: 16, y: 14 },
92
+ ownerId: 'policy-unselectable',
93
+ },
94
+ {
95
+ id: 'policy-hidden-label',
96
+ content: 'Hidden in state',
97
+ position: { x: 16, y: 14 },
98
+ ownerId: 'policy-hidden',
99
+ },
100
+ ],
101
+ });
102
+
103
+ export const elementVisibilitySelectionDemoConfig: DemoConfig = {
104
+ id: 'element-visibility-selection',
105
+ title: 'Element Visibility + Selectability',
106
+ description:
107
+ 'QA scene for visible-but-unselectable element bodies, hidden-in-state elements, and port/link propagation. Shift + drag marquee to confirm only eligible items are collected.',
108
+ createState: createElementVisibilitySelectionState,
109
+ elementShapes: baseElementShapes,
110
+ portShapes: basePortShapes,
111
+ defaultElementShapeId: 'default',
112
+ defaultPortShapeId: 'port-circle',
113
+ actions: [
114
+ {
115
+ id: 'policy-filtered-selection',
116
+ label: 'Try filtered API selection',
117
+ run: (editor) => {
118
+ editor.setSelection([
119
+ 'policy-normal',
120
+ 'policy-unselectable',
121
+ 'policy-hidden',
122
+ 'policy-unselectable-port',
123
+ 'policy-hidden-link',
124
+ ]);
125
+ },
126
+ },
127
+ ],
128
+ };
@@ -5,7 +5,8 @@ import { linkPortCreationDemoConfig } from './linkPortCreationDemo';
5
5
  import { nestedDemoConfig } from './nestedDemo';
6
6
  import { customDemoConfig } from './customDemo';
7
7
  import { textDemoConfig } from './textDemo';
8
- import { selectionDemoConfig } from './selectionDemo';
8
+ import { selectionDemoConfig } from './selectionDemo';
9
+ import { elementVisibilitySelectionDemoConfig } from './elementVisibilitySelectionDemo';
9
10
  import { eventHandlersDemoConfig } from './eventHandlersDemo';
10
11
  import { engineEventsDemoConfig } from './engineEventsDemo';
11
12
  import { linkCancelDemoConfig } from './linkCancelDemo';
@@ -94,12 +95,18 @@ export const demoTabs: DemoDefinition[] = [
94
95
  description: textDemoConfig.description,
95
96
  Component: TextLayoutDemo,
96
97
  },
97
- {
98
- id: selectionDemoConfig.id,
99
- title: selectionDemoConfig.title,
100
- description: selectionDemoConfig.description,
101
- Component: wrapSimpleDemo(selectionDemoConfig),
102
- },
98
+ {
99
+ id: selectionDemoConfig.id,
100
+ title: selectionDemoConfig.title,
101
+ description: selectionDemoConfig.description,
102
+ Component: wrapSimpleDemo(selectionDemoConfig),
103
+ },
104
+ {
105
+ id: elementVisibilitySelectionDemoConfig.id,
106
+ title: elementVisibilitySelectionDemoConfig.title,
107
+ description: elementVisibilitySelectionDemoConfig.description,
108
+ Component: wrapSimpleDemo(elementVisibilitySelectionDemoConfig),
109
+ },
103
110
  {
104
111
  id: eventHandlersDemoConfig.id,
105
112
  title: eventHandlersDemoConfig.title,
@@ -20,20 +20,20 @@ const createSelectionState = (): DiagramState => ({
20
20
  ports: [],
21
21
  links: [],
22
22
  texts: [
23
- {
24
- id: 'select-tip',
25
- content: 'Click to select, drag to move, Delete/Backspace to remove.',
26
- position: { x: 80, y: 80 },
27
- },
28
- ],
29
- });
23
+ {
24
+ id: 'select-tip',
25
+ content: 'Click to select, drag to move, drag empty paper to pan, Shift + drag to marquee-select.',
26
+ position: { x: 80, y: 80 },
27
+ },
28
+ ],
29
+ });
30
30
 
31
31
  export const selectionDemoConfig: DemoConfig = ({
32
- id: 'selection',
33
- title: 'Selection + Interaction',
34
- description: 'Click to select, drag to move, marquee-select on empty space, delete to remove.',
35
- createState: createSelectionState,
36
- elementShapes: baseElementShapes,
32
+ id: 'selection',
33
+ title: 'Selection + Interaction',
34
+ description: 'Click to select, drag to move, drag empty paper to pan, Shift + drag to marquee-select, delete to remove.',
35
+ createState: createSelectionState,
36
+ elementShapes: baseElementShapes,
37
37
  portShapes: basePortShapes,
38
38
  defaultElementShapeId: 'default',
39
39
  defaultPortShapeId: 'port-circle',